]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: Fix RULE notification netlink messages
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 24 May 2018 13:03:11 +0000 (09:03 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 24 May 2018 13:14:43 +0000 (09:14 -0400)
Fix the code so that we would actually start receiving
RULE netlink notifications.

The Kernel expects the long long to be a bit field
value, while the newer netlink message types are
an enum.  So we need to convert the message type
number to a bit position and set that value.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/kernel_netlink.c

index 3c482c9bac159240d9469725f762fa5f9cf4e2d0..bf83e18a57fe8f9819a9e2f9a3004d8b7803d075 100644 (file)
@@ -836,11 +836,24 @@ void kernel_init(struct zebra_ns *zns)
 {
        unsigned long groups;
 
-       /* Initialize netlink sockets */
-       groups = RTMGRP_LINK | RTMGRP_IPV4_ROUTE | RTMGRP_IPV4_IFADDR
-                | RTMGRP_IPV6_ROUTE | RTMGRP_IPV6_IFADDR | RTMGRP_IPV4_MROUTE
-                | RTMGRP_NEIGH
-                | RTNLGRP_IPV4_RULE | RTNLGRP_IPV6_RULE;
+       /*
+        * Initialize netlink sockets
+        *
+        * If RTMGRP_XXX exists use that, but at some point
+        * I think the kernel developers realized that
+        * keeping track of all the different values would
+        * lead to confusion, so we need to convert the
+        * RTNLGRP_XXX to a bit position for ourself
+        */
+       groups = RTMGRP_LINK                   |
+               RTMGRP_IPV4_ROUTE              |
+               RTMGRP_IPV4_IFADDR             |
+               RTMGRP_IPV6_ROUTE              |
+               RTMGRP_IPV6_IFADDR             |
+               RTMGRP_IPV4_MROUTE             |
+               RTMGRP_NEIGH                   |
+               (1 << (RTNLGRP_IPV4_RULE - 1)) |
+               (1 << (RTNLGRP_IPV6_RULE - 1));
 
        snprintf(zns->netlink.name, sizeof(zns->netlink.name),
                 "netlink-listen (NS %u)", zns->ns_id);