UNIX / Linux keyboard.

How to Compile Wireshark on OpenBSD

OpenBSD notebook at the National Archives in Washington DC

Wireshark, formerly known as Ethereal, is a great tool for network troubleshooting or any other task involving network packet capture and analysis. But you have to build it yourself on OpenBSD, and the compilation will fail.

The OpenBSD community hasn't built Wireshark packages for a while, since Wireshark has a bad security track record. It has to run with root privileges to do most of what people find useful, and its packet dissectors (the modules analyzing the large set of supported protocols) are very complicated and prone to bugs. A privileged process running untrusted code leads to big security problems!

On top of this, the Wireshark community hasn't seemed to worry about making Wireshark build cleanly from source on OpenBSD.

Here is the trick for compiling Wireshark on OpenBSD, based on what I found at http://www.linbsd.org/ethereal_on_openbsd38.html The following worked with Ethereal under earlier versions of OpenBSD, and it works with Wireshark.


Step 1:

Install these additional packages on OpenBSD:

autoconf
automake
gcc-4*
glib2
gmake
gtk+2
libtool
m4
metaauto
python 

Step 2:

See what versions of autoconf and automake you have:

% pkg_info autoconf | head -1
% pkg_info automake | head -1
% ls /usr/local/bin/auto* 

Step 3:

You will probably have to do the software build as root because of the memory requirements. Become root with:

% su - 

Step 4:

Set two environment variables, changing the numbers as appropriate. If you see, for example, autoconf-2.59p1, then you should probably specify simply 2.59. Similarly, if you see automake-1.9.6p8, then you should probably specify simply 1.9. The ls command above is probably the most useful test.

Step 5:

At this point we find that the INSTALL, README, and other files don't tell the whole story for OpenBSD. First, we have to generate the Makefiles:

# ./autogen.sh 

If that command fails with a complaint about missing Python, even though you have already installed it, then you need to do something like the following as root:

# pushd /usr/local/bin
# ln -s python2.7 python
# popd 

If it fails with an error about a missing open directory /usr/share/aclocal then:

# pushd /usr/share
# ln -s /usr/local/share/aclocal
# popd 

Step 6:

Do the configuration:

# ./configure 

Step 7:

If you previously installed an earlier version, uninstall it and (most importantly) its old libraries. Otherwise, the following build will fail. Notice that you must use the GNU version of make:

# gmake uninstall 

Step 8:

Now build the software. Note that you may have to run the following as root because of the amount of memory resources required by the library building. Note also that you have to use the GNU version of make:

# gmake 

Step 9:

After quite a while, that should succeed. On my system this takes about 3.5 to 4 times as long as it takes to build the OpenBSD kernel. If it succeeds, you're ready to install, again being careful to use the gmake program:

# gmake install 

Step 10:

If it did not succeed, carefully read the output.

Step 11:

When you try to run Wireshark, as soon as you try to start a capture it may fail with these two symptoms:

This problem is caused by Wireshark using so many shared libraries stored under /usr/local/lib and data files stored under /usr/local/share/wireshark, especially if you built it with RADIUS support. The fix is to run Wireshark in an environment where more open files are allowed. For root, the command ulimit -a shows that the Bash shell can have only 128 simultaneous open file descriptors for that shell and its child processes. So, start Wireshark like this:

% su root -c 'ulimit -n 512 ; wireshark &' 

Or, more extremely:

% su root -c 'ulimit -n unlimited ; wireshark &' 

For more details see man bash and read the ulimit section.

As for useful capture filters, see the page at the Wireshark Wiki. I always forget where the "not" goes — it's:
  port not 53
and not:
  not port 53
Things get further complicated when combining expressions:

port not 53 and not arp 

Expressions can be carefully combined in multiple ways. These two are equivalent:

host www.example.com and not (port 80 or port 25)
host www.example.com and not port 80 and not port 25 

Here's my favorite complicated filter expression — just capture HTTP GET requests. This looks for the ASCII for "GET " — 0x47, 0x45; 0x54, 0x20, immediately after the TCP header:

port 80 and tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420 

See the tcpdump manual page for comprehensive details.


Other OpenBSD Compilation Projects

Other Linux, Unix and Open Source Topics

Click here to inquire about advertising on this or any page on this site.
Home Linux/Unix Networking Cybersecurity Travel Technical Radio Site Map Contact
Use /bin/vi! Manipulate images with ImageMagick! Hosted on OpenBSD
Hosted on Apache This site is viewable with any browser Valid HTML 5!  Validate it here. Valid CSS!  Validate it here.
© Bob Cromwell Jun 2013. Created with /bin/vi and ImageMagick, hosted on OpenBSD with Apache.    Root password available here, privacy policy here.