I have made occasional contributions to the Wireshark project for over five years now. I started with small documentation updates, and later I have added two new protocol dissectors (Zabbix and Z21) as well as improved some other dissectors. It can be several months between contributions though, so this post is my own memo about the tooling I use.
I used to use my old Windows 10 laptop for this, but since the machine is not Windows 11 compatible (says Microsoft), I installed Debian Linux 13 (Trixie) for my Wireshark development a short while ago.
Here are my own notes about the development setup, but also remember to read the Wireshark Developers’ Guide if starting your own contributions to the Wireshark project.
Git branch in the bash prompt:
- In
.bashrc
, add “\[\033[33m]$(__git_ps1 " (%s)")
” just after the “\w
” in PS1. The__git_ps1
function has been included by/etc/bash_completion.d/git-prompt
(provided bygit
package).
The usual global git configurations:
git config --global alias.lg "log --oneline --all --graph --decorate"
git config --global alias.s "status -s"
Setting up the local repository:
- Fork the Wireshark repository in GitLab
- Create a new SSH key and add it to the forked repository in GitLab (Settings – Repository – Deploy keys)
- Use
.ssh/id_ed25519
or SSH agent to get seamless experience
- Use
- Clone the fork to the home directory:
git clone git@gitlab.com:yourusername/wireshark.git
cd wireshark
- Add upstream:
git remote add upstream https://gitlab.com/wireshark/wireshark.git
git config user.name xxx
git config user.email yyy
git config push.autoSetupRemote true
git config alias.updatemaster '!git pull --rebase upstream master && git fetch upstream --tags'
git updatemaster
cd .git/hooks
ln -s ../../tools/pre-commit
cd -
Setting up the build environment:
sudo tools/debian-setup.sh --install-optional --install-test-deps
mkdir ~/wsbuild
cd ~/wsbuild
- Optional:
export WIRESHARK_VERSION_EXTRA=-MLe
cmake -G Ninja -D ENABLE_CCACHE=ON -D CMAKE_INSTALL_PREFIX=.. ../wireshark
- See also: https://www.wireshark.org/docs/wsdg_html_chunked/ChapterSetup.html
ninja
- Maybe also:
ninja install
run/wireshark
Contributing changes:
git checkout -b <branch name>
- Make your changes
git add <the files>
git commit -m "Proto: xxx"
- Repeat more commits if needed
- Squash the commits (if multiple):
git rebase -i master
git checkout master
git updatemaster
git checkout -
git rebase master
git push