[kdbus] Update kdbus interface header (commit: b620b72c9127) 14/10/16
[platform/upstream/glib.git] / gio / gnetworkmonitornetlink.c
index 670969d..21a7ad5 100644 (file)
@@ -378,6 +378,19 @@ read_netlink_messages (GSocket      *socket,
 
           if (dest || gateway || oif)
             {
+              /* Unless we're processing the results of a dump, ignore
+               * IPv6 link-local multicast routes, which are added and
+               * removed all the time for some reason.
+               */
+#define UNALIGNED_IN6_IS_ADDR_MC_LINKLOCAL(a)           \
+              ((a[0] == 0xff) && ((a[1] & 0xf) == 0x2))
+
+              if (!nl->priv->dump_networks &&
+                  rtmsg->rtm_family == AF_INET6 &&
+                  rtmsg->rtm_dst_len != 0 &&
+                  UNALIGNED_IN6_IS_ADDR_MC_LINKLOCAL (dest))
+                continue;
+
               if (msg->nlmsg_type == RTM_NEWROUTE)
                 add_network (nl, rtmsg->rtm_family, rtmsg->rtm_dst_len, dest);
               else