Ettercap / ettercap

Ettercap Project
http://www.ettercap-project.org
GNU General Public License v2.0
2.28k stars 488 forks source link

Fix BSD build issues #1209

Closed koeppea closed 1 year ago

koeppea commented 1 year ago

The latest merges introduced some issues and warnings on BSD based systems including MacOSX. This PR fixes the various issues and has been tested on MacOSX, FreeBSD and OpenBSD and on Linux of course.

A little bit tricky was the ordering of the header files, which was triggered externally due to an update on FreeBSD OS side, where they have included queue.h implicitly through net/bpf.h which blocked our customized ec_queue.h being included correctly. However re-ordering this had the consequence on MacOSX that pcap.h was included too early for net/bpf.h for the MacOSX version. So this is the reason to include net/bpf.h for the one BSD OS before and for the other after our set of general custom includes.

Further the removal of the differentiation of OS'es in ec_sslwrap.c do not really make sense to me, even though they've been motivated as a fix for #1176, however since there is now no more differentiation, there should also be no issue with memory leak on Windows anymore. Effectively the pre-processor implementation introduced a syntax error on non-Linux or non-MacOSX platforms, namely Windows and BSD.

On the sslstrip.c side, I just extended the supported OS with all BSD based OS'es, however I'm still not 100% confident if this is the right approach. If on Windows platform the OS driven limitations make such features effectively unavailable, it would be more consequent to make them really unavailable by excluding them with CMake. But this is something beyond the scope of this pull-request.