summaryrefslogtreecommitdiff
path: root/zebra/kernel_netlink.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-05-24 09:03:11 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-05-24 09:14:43 -0400
commit026a316f2cd5756b7740bec4696e320387f6e49c (patch)
tree3962525cdd14ebbe4a2e4c6f1a830aa58ce407cf /zebra/kernel_netlink.c
parent2414abd3b0adbb48855135b14e5cdbf21b3cc308 (diff)
zebra: Fix RULE notification netlink messages
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>
Diffstat (limited to 'zebra/kernel_netlink.c')
-rw-r--r--zebra/kernel_netlink.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c
index 3c482c9bac..bf83e18a57 100644
--- a/zebra/kernel_netlink.c
+++ b/zebra/kernel_netlink.c
@@ -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);