#include <avahi-common/llist.h>
#include <avahi-common/malloc.h>
+#ifndef IFLA_RTA
+#include <linux/if_addr.h>
+#define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg))))
+#endif
+
+#ifndef IFA_RTA
+#include <linux/if_addr.h>
+#define IFA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg))))
+#endif
+
#include "iface.h"
static int fd = -1;
if ((ifi->ifi_flags & IFF_LOOPBACK) ||
(ifi->ifi_flags & IFF_NOARP) ||
- !(ifi->ifi_flags & IFF_UP) ||
ifi->ifi_type != ARPHRD_ETHER) {
daemon_log(LOG_ERR, "Interface not suitable.");
return -1;
int l;
uint32_t address = 0;
Address *i;
- char buf[32];
ifa = NLMSG_DATA(n);
a = RTA_NEXT(a, l);
}
- daemon_log(LOG_INFO, "%s", inet_ntop(AF_INET, &address, buf, sizeof(buf)));
-
if (!address || is_ll_address(address))
return 0;
return -1;
}
- if (p->nlmsg_type == NLMSG_DONE && wait_for_done && p->nlmsg_seq == seq)
+ if (p->nlmsg_type == NLMSG_DONE && wait_for_done && p->nlmsg_seq == seq && (pid_t) p->nlmsg_pid == getpid())
return 0;
if (p->nlmsg_type == NLMSG_ERROR) {
}
}
- if ((pid_t) p->nlmsg_pid != getpid())
- continue;
-
if (process_nlmsg(p) < 0)
return -1;
}
if (process_response(0, 0) < 0)
return -1;
- if (b && !!addresses)
+ if (b && !addresses)
*event = EVENT_ROUTABLE_ADDR_UNCONFIGURED;
else if (!b && addresses)
*event = EVENT_ROUTABLE_ADDR_CONFIGURED;