Skip to content

Commit

Permalink
Revert to LIBNET_LINK where LIBNET_NONE is not available
Browse files Browse the repository at this point in the history
Old versions of libnet do not support LIBNET_NONE; on those, use
LIBNET_LINK, which has the unfortunate side-effect of needlessly opening
a raw socket, which requires root privileges.  Also, the type of link
layer encapsulation generated by this libnet instance will depend on the
active network interface chosen by libnet for the raw socket, which may
result in uncommon link encapsulations being used for the PCAP files
written.

Issue:		droe#232
  • Loading branch information
droe committed Oct 10, 2018
1 parent 518aa6b commit e6f2a87
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions log.c
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,18 @@ log_content_pcap_preinit(const char *pcapfile)
{
char errbuf[LIBNET_ERRBUF_SIZE];

#ifdef LIBNET_NONE
content_pcap_libnet = libnet_init(LIBNET_NONE, NULL, errbuf);
#else /* !LIBNET_NONE */
/* Old versions of libnet do not support LIBNET_NONE; on those, we use
* LIBNET_LINK, which has the unfortunate side-effect of needlessly
* opening a raw socket, which requires root privileges. Also, the
* type of link layer encapsulation generated by this libnet instance
* will depend on the active network interface chosen by libnet for the
* raw socket, which may result in uncommon link encapsulations being
* used for the PCAP files written. */
content_pcap_libnet = libnet_init(LIBNET_LINK, NULL, errbuf);
#endif /* !LIBNET_NONE */
if (content_pcap_libnet == NULL) {
log_err_printf("Failed to init pcap libnet: %s\n", errbuf);
return -1;
Expand Down

0 comments on commit e6f2a87

Please sign in to comment.