Skip to content

Commit

Permalink
Haiku: Report IEEE 802.11 as PCAP_IF_WIRELESS. [skip ci]
Browse files Browse the repository at this point in the history
Before:
> ./tcpdump -D
1./dev/net/ipro1000/1 [Up, Connected]
2./dev/net/ipro1000/0 [Up, Connected]
3.loop [Up, Loopback]
4./dev/net/realtekwifi/0 [Up, Disconnected]

After:
> ./tcpdump -D
1./dev/net/realtekwifi/0 [Up, Wireless, Not associated]
2./dev/net/ipro1000/1 [Up, Connected]
3./dev/net/ipro1000/0 [Up, Connected]
4.loop [Up, Loopback]
  • Loading branch information
infrastation committed Mar 1, 2024
1 parent d139b30 commit d35fa21
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ DayOfTheWeek, Month DD, YYYY / The Tcpdump Group
Fix a few device activation bugs.
Count and timestamp packets better.
Add kernel filtering, fix userland filtering.
Haiku:
Report IEEE 802.11 as PCAP_IF_WIRELESS.

DayOfTheWeek, Month DD, YYYY / The Tcpdump Group
Summary for 1.10.5 libpcap release (so far!)
Expand Down
7 changes: 7 additions & 0 deletions pcap-haiku.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_types.h>
#include <net/if_media.h>

#include <errno.h>
#include <stdio.h>
Expand Down Expand Up @@ -479,6 +480,12 @@ get_if_flags(const char *name, bpf_u_int32 *flags, char *errbuf)
*flags |= (ifreq.ifr_flags & IFF_LINK) ?
PCAP_IF_CONNECTION_STATUS_CONNECTED :
PCAP_IF_CONNECTION_STATUS_DISCONNECTED;
if (ioctl_ifreq(fd, SIOCGIFMEDIA, "SIOCGIFMEDIA", &ifreq, errbuf) < 0) {
close(fd);
return PCAP_ERROR;
}
if (IFM_TYPE(ifreq.ifr_media) == IFM_IEEE80211)
*flags |= PCAP_IF_WIRELESS;
close(fd);

return (0);
Expand Down

0 comments on commit d35fa21

Please sign in to comment.