summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2006-06-30 19:06:18 +0000
committersam <sam@FreeBSD.org>2006-06-30 19:06:18 +0000
commit76a217bd1e55194c1c020183321755ece9f2e993 (patch)
treecc954ba224a2c2d2c4cfb7d3af721f2374ea4057 /tools
parent97363ee503b1750c53fe0437081b373d4d79adcb (diff)
downloadFreeBSD-src-76a217bd1e55194c1c020183321755ece9f2e993.zip
FreeBSD-src-76a217bd1e55194c1c020183321755ece9f2e993.tar.gz
o fix join/rejoin format
o add netbsd portability glue MFC after: 2 weeks
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/net80211/wlanwatch/wlanwatch.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/tools/tools/net80211/wlanwatch/wlanwatch.c b/tools/tools/net80211/wlanwatch/wlanwatch.c
index c169f99..1501d21 100644
--- a/tools/tools/net80211/wlanwatch/wlanwatch.c
+++ b/tools/tools/net80211/wlanwatch/wlanwatch.c
@@ -53,7 +53,13 @@
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <netatalk/at.h>
+#ifdef __NetBSD__
+#include <net80211/ieee80211_netbsd.h>
+#elif __FreeBSD__
#include <net80211/ieee80211_freebsd.h>
+#else
+#error "No support for your operating system!"
+#endif
#include <arpa/inet.h>
#include <netdb.h>
@@ -235,6 +241,19 @@ routename(sa)
return (line);
}
+#ifndef SA_SIZE
+/*
+ * This macro returns the size of a struct sockaddr when passed
+ * through a routing socket. Basically we round up sa_len to
+ * a multiple of sizeof(long), with a minimum of sizeof(long).
+ * The check for a NULL pointer is just a convenience, probably never used.
+ * The case sa_len == 0 should only apply to empty structures.
+ */
+#define SA_SIZE(sa) \
+ ( (!(sa) || ((struct sockaddr *)(sa))->sa_len == 0) ? \
+ sizeof(long) : \
+ 1 + ( (((struct sockaddr *)(sa))->sa_len - 1) | (sizeof(long) - 1) ) )
+#endif
static void
pmsg_addrs(char *cp, int addrs)
@@ -339,8 +358,9 @@ print_rtmsg(struct rt_msghdr *rtm, int msglen)
case RTM_IEEE80211_JOIN:
case RTM_IEEE80211_REJOIN:
printf("%s station %sjoin",
- ifan->ifan_what == RTM_IEEE80211_REJOIN ? "re" : "",
- ether_sprintf(V(ieee80211_join_event)->iev_addr));
+ ether_sprintf(V(ieee80211_join_event)->iev_addr),
+ ifan->ifan_what == RTM_IEEE80211_REJOIN ? "re" : ""
+ );
break;
case RTM_IEEE80211_LEAVE:
printf("%s station leave",
OpenPOWER on IntegriCloud