*/
#include <stdio.h>
-#include <strings.h>
+#include <string.h>
#include <errno.h>
-#include <net/if.h>
-
#include <netlink/msg.h>
#include <netlink/attr.h>
#include <netlink/route/link.h>
+#ifndef IFF_UP
+/*
+ * Apparently, some versions of libnl drag in headers that define IFF_UP
+ * and others don't. Include <net/if.h> iff IFF_UP isn't already defined,
+ * so that if <linux/if.h> has been included by some or all of the
+ * netlink headers, we don't include <net/if.h> and get a bunch of
+ * complaints about various structures being redefined.
+ */
+#include <net/if.h>
+#endif
+
/* libnl 1.x compatibility code */
#ifdef HAVE_LIBNL1
#define nl_sock nl_handle
struct rtnl_link *link_obj;
int flags, up;
char *ifname;
- iface_mon_cb cb = arg;
+ iface_mon_cb cb = (iface_mon_cb)arg;
filter = rtnl_link_alloc();
if (!filter) {
ssize_t received;
struct kern_event_msg *kem;
struct net_event_data *evd;
- int evd_len;
+ size_t evd_len;
char ifr_name[IFNAMSIZ];
received = recv(s, msg, sizeof msg, 0);