diff options
Diffstat (limited to 'zebra/rt_netlink.c')
| -rw-r--r-- | zebra/rt_netlink.c | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 70bd8a784c..b600a7db50 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -435,7 +435,7 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id, if (rtm->rtm_src_len != 0) { char buf[PREFIX_STRLEN]; flog_warn( - ZEBRA_ERR_UNSUPPORTED_V4_SRCDEST, + EC_ZEBRA_UNSUPPORTED_V4_SRCDEST, "unsupported IPv4 sourcedest route (dest %s vrf %u)", prefix2str(&p, buf, sizeof(buf)), vrf_id); return 0; @@ -605,7 +605,7 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id, nh_vrf_id = ifp->vrf_id; else { flog_warn( - ZEBRA_ERR_UNKNOWN_INTERFACE, + EC_ZEBRA_UNKNOWN_INTERFACE, "%s: Unknown interface %u specified, defaulting to VRF_DEFAULT", __PRETTY_FUNCTION__, index); @@ -828,15 +828,18 @@ int netlink_route_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) if (!(h->nlmsg_type == RTM_NEWROUTE || h->nlmsg_type == RTM_DELROUTE)) { /* If this is not route add/delete message print warning. */ - zlog_debug("Kernel message: %d NS %u\n", h->nlmsg_type, ns_id); + zlog_debug("Kernel message: %s NS %u\n", + nl_msg_type_to_str(h->nlmsg_type), ns_id); return 0; } - if (!(rtm->rtm_family == AF_INET || rtm->rtm_family == AF_INET6)) { + if (!(rtm->rtm_family == AF_INET || + rtm->rtm_family == AF_INET6 || + rtm->rtm_family == RTNL_FAMILY_IPMR )) { flog_warn( - ZEBRA_ERR_UNKNOWN_FAMILY, - "Invalid address family: %u received from kernel route change: %u", - rtm->rtm_family, h->nlmsg_type); + EC_ZEBRA_UNKNOWN_FAMILY, + "Invalid address family: %u received from kernel route change: %s", + rtm->rtm_family, nl_msg_type_to_str(h->nlmsg_type)); return 0; } @@ -1764,6 +1767,7 @@ skip: int kernel_get_ipmr_sg_stats(struct zebra_vrf *zvrf, void *in) { + uint32_t actual_table; int suc = 0; struct mcast_route_data *mr = (struct mcast_route_data *)in; struct { @@ -1789,7 +1793,23 @@ int kernel_get_ipmr_sg_stats(struct zebra_vrf *zvrf, void *in) addattr_l(&req.n, sizeof(req), RTA_OIF, &mroute->ifindex, 4); addattr_l(&req.n, sizeof(req), RTA_SRC, &mroute->sg.src.s_addr, 4); addattr_l(&req.n, sizeof(req), RTA_DST, &mroute->sg.grp.s_addr, 4); - addattr_l(&req.n, sizeof(req), RTA_TABLE, &zvrf->table_id, 4); + /* + * What? + * + * So during the namespace cleanup we started storing + * the zvrf table_id for the default table as RT_TABLE_MAIN + * which is what the normal routing table for ip routing is. + * This change caused this to break our lookups of sg data + * because prior to this change the zvrf->table_id was 0 + * and when the pim multicast kernel code saw a 0, + * it was auto-translated to RT_TABLE_DEFAULT. But since + * we are now passing in RT_TABLE_MAIN there is no auto-translation + * and the kernel goes screw you and the delicious cookies you + * are trying to give me. So now we have this little hack. + */ + actual_table = (zvrf->table_id == RT_TABLE_MAIN) ? RT_TABLE_DEFAULT : + zvrf->table_id; + addattr_l(&req.n, sizeof(req), RTA_TABLE, &actual_table, 4); suc = netlink_talk(netlink_route_change_read_multicast, &req.n, &zns->netlink_cmd, zns, 0); @@ -2486,9 +2506,9 @@ int netlink_neigh_change(struct nlmsghdr *h, ns_id_t ns_id) return netlink_ipneigh_change(h, len, ns_id); else { flog_warn( - ZEBRA_ERR_UNKNOWN_FAMILY, - "Invalid address family: %u received from kernel neighbor change: %u", - ndm->ndm_family, h->nlmsg_type); + EC_ZEBRA_UNKNOWN_FAMILY, + "Invalid address family: %u received from kernel neighbor change: %s", + ndm->ndm_family, nl_msg_type_to_str(h->nlmsg_type)); return 0; } |
