diff options
Diffstat (limited to 'zebra/rt_netlink.c')
| -rw-r--r-- | zebra/rt_netlink.c | 49 |
1 files changed, 4 insertions, 45 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 5d1ef26487..4913aa878f 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -92,47 +92,6 @@ struct gw_family_t union g_addr gate; }; -static inline int is_selfroute(int proto) -{ - if ((proto == RTPROT_BGP) || (proto == RTPROT_OSPF) || - (proto == RTPROT_STATIC) || (proto == RTPROT_ZEBRA) || - (proto == RTPROT_ISIS) || (proto == RTPROT_RIPNG)) { - return 1; - } - - return 0; -} - -static inline int get_rt_proto(int proto) -{ - switch (proto) { - case ZEBRA_ROUTE_BGP: - proto = RTPROT_BGP; - break; - case ZEBRA_ROUTE_OSPF: - case ZEBRA_ROUTE_OSPF6: - proto = RTPROT_OSPF; - break; - case ZEBRA_ROUTE_STATIC: - proto = RTPROT_STATIC; - break; - case ZEBRA_ROUTE_ISIS: - proto = RTPROT_ISIS; - break; - case ZEBRA_ROUTE_RIP: - proto = RTPROT_RIP; - break; - case ZEBRA_ROUTE_RIPNG: - proto = RTPROT_RIPNG; - break; - default: - proto = RTPROT_ZEBRA; - break; - } - - return proto; -} - /* Pending: create an efficient table_id (in a tree/hash) based lookup) */ @@ -222,7 +181,7 @@ netlink_routing_table (struct sockaddr_nl *snl, struct nlmsghdr *h, } /* Route which inserted by Zebra. */ - if (is_selfroute(rtm->rtm_protocol)) + if (rtm->rtm_protocol == RTPROT_ZEBRA) flags |= ZEBRA_FLAG_SELFROUTE; index = 0; @@ -408,9 +367,9 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h, if (rtm->rtm_protocol == RTPROT_KERNEL) return 0; - if (is_selfroute(rtm->rtm_protocol) && h->nlmsg_type == RTM_NEWROUTE) + if (rtm->rtm_protocol == RTPROT_ZEBRA && h->nlmsg_type == RTM_NEWROUTE) return 0; - if (is_selfroute(rtm->rtm_protocol)) + if (rtm->rtm_protocol == RTPROT_ZEBRA) SET_FLAG(zebra_flags, ZEBRA_FLAG_SELFROUTE); if (rtm->rtm_src_len != 0) @@ -1194,7 +1153,7 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib, req.n.nlmsg_type = cmd; req.r.rtm_family = family; req.r.rtm_dst_len = p->prefixlen; - req.r.rtm_protocol = get_rt_proto(rib->type); + req.r.rtm_protocol = RTPROT_ZEBRA; req.r.rtm_scope = RT_SCOPE_UNIVERSE; if ((rib->flags & ZEBRA_FLAG_BLACKHOLE) || (rib->flags & ZEBRA_FLAG_REJECT)) |
