Skip to content

Commit

Permalink
Define _GNU_SOURCE to work around pcap/musl bug
Browse files Browse the repository at this point in the history
musl libc seems to not define things like `u_short` unless
`_GNU_SOURCE` or `_BSD_SOURCE` is defined. And pcap header files
assume those typedefs exist.

This should probably be fixed by pcap, but this commit is a
workaround.

Fixes #55
  • Loading branch information
ThomasHabets committed Feb 27, 2024
1 parent 99b5445 commit 69fbb78
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/arping.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#define _GNU_SOURCE
#if HAVE_CONFIG_H
#include "config.h"
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/arping_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include"config.h"
#define _GNU_SOURCE
#include"config.h"
#include<assert.h>
#include<errno.h>
#include<fcntl.h>
Expand Down
1 change: 1 addition & 0 deletions src/findif_getifaddrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/**
* Most modern systems should have getifaddrs().
*/
#define _GNU_SOURCE
#if HAVE_CONFIG_H
#include "config.h"
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/fuzz_pingip.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#define _GNU_SOURCE

#include<arpa/inet.h>
#include<errno.h>
#include<inttypes.h>
Expand Down
2 changes: 2 additions & 0 deletions src/fuzz_pingmac.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#define _GNU_SOURCE

#include<errno.h>
#include<string.h>
#include<stdio.h>
Expand Down
2 changes: 2 additions & 0 deletions src/mock_libpcap.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#define _GNU_SOURCE

#include<pcap.h>

#define UNUSED(x) (void)(x)
Expand Down
1 change: 1 addition & 0 deletions src/unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#define _GNU_SOURCE
#if HAVE_CONFIG_H
#include "config.h"
#endif
Expand Down

0 comments on commit 69fbb78

Please sign in to comment.