aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2013-05-15 21:47:57 +0200
committerGravatar Christian Hesse <mail@eworm.de>2013-05-15 21:47:57 +0200
commit6214212e06a03d94891561fd4e9af83b6ecafcff (patch)
treecc0bb39fbf7c7836adac8398807e3b6bb4d732d7
parent5f5e8ff6f6eda4c4394a60c981a3e1097ad2fbe9 (diff)
downloadnetlink-notify-6214212e06a03d94891561fd4e9af83b6ecafcff.tar.gz
netlink-notify-6214212e06a03d94891561fd4e9af83b6ecafcff.tar.zst
add option for IPv6
define IPV6=1 to use this
-rw-r--r--netlink-notify.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/netlink-notify.c b/netlink-notify.c
index a9d1438..ad8c60e 100644
--- a/netlink-notify.c
+++ b/netlink-notify.c
@@ -30,6 +30,9 @@
#ifndef DEBUG
#define DEBUG 0
#endif
+#ifndef IPV6
+#define IPV6 0
+#endif
#define ICON_NETWORK_CONNECTED "netlink-notify-connected"
#define ICON_NETWORK_DISCONNECTED "netlink-notify-disconnected"
@@ -179,7 +182,11 @@ static int msg_handler (struct sockaddr_nl *nl, struct nlmsghdr *msg) {
rtl = IFA_PAYLOAD (msg);
while (rtl && RTA_OK (rth, rtl)) {
- if (rth->rta_type == IFA_LOCAL)
+ if (rth->rta_type == IFA_LOCAL /* IPv4 */
+#if IPV6
+ || rth->rta_type == IFA_ADDRESS /* IPv6 */
+#endif
+ )
notifystr = newstr_addr(TEXT_NEWADDR, name, ifi->ifi_flags,
ifa->ifa_family, RTA_DATA (rth), ifa->ifa_prefixlen);
rth = RTA_NEXT (rth, rtl);