diff options
Diffstat (limited to 'zebra/rt_netlink.c')
| -rw-r--r-- | zebra/rt_netlink.c | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 2b758c58d8..3053c56d1e 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -72,8 +72,8 @@ static vlanid_t filter_vlan = 0; struct gw_family_t { - u_int16_t filler; - u_int16_t family; + uint16_t filler; + uint16_t family; union g_addr gate; }; @@ -194,7 +194,7 @@ static inline int proto2zebra(int proto, int family) /* Pending: create an efficient table_id (in a tree/hash) based lookup) */ -static vrf_id_t vrf_lookup_by_table(u_int32_t table_id, ns_id_t ns_id) +static vrf_id_t vrf_lookup_by_table(uint32_t table_id, ns_id_t ns_id) { struct vrf *vrf; struct zebra_vrf *zvrf; @@ -226,7 +226,7 @@ static int netlink_route_change_read_unicast(struct sockaddr_nl *snl, int len; struct rtmsg *rtm; struct rtattr *tb[RTA_MAX + 1]; - u_char flags = 0; + uint8_t flags = 0; struct prefix p; struct prefix_ipv6 src_p = {}; vrf_id_t vrf_id; @@ -237,7 +237,7 @@ static int netlink_route_change_read_unicast(struct sockaddr_nl *snl, int index = 0; int table; int metric = 0; - u_int32_t mtu = 0; + uint32_t mtu = 0; uint8_t distance = 0; route_tag_t tag = 0; @@ -344,7 +344,7 @@ static int netlink_route_change_read_unicast(struct sockaddr_nl *snl, RTA_PAYLOAD(tb[RTA_METRICS])); if (mxrta[RTAX_MTU]) - mtu = *(u_int32_t *)RTA_DATA(mxrta[RTAX_MTU]); + mtu = *(uint32_t *)RTA_DATA(mxrta[RTAX_MTU]); } if (rtm->rtm_family == AF_INET) { @@ -772,8 +772,8 @@ int netlink_route_read(struct zebra_ns *zns) return 0; } -static void _netlink_route_nl_add_gateway_info(u_char route_family, - u_char gw_family, +static void _netlink_route_nl_add_gateway_info(uint8_t route_family, + uint8_t gw_family, struct nlmsghdr *nlmsg, size_t req_size, int bytelen, struct nexthop *nexthop) @@ -798,8 +798,8 @@ static void _netlink_route_nl_add_gateway_info(u_char route_family, } } -static void _netlink_route_rta_add_gateway_info(u_char route_family, - u_char gw_family, +static void _netlink_route_rta_add_gateway_info(uint8_t route_family, + uint8_t gw_family, struct rtattr *rta, struct rtnexthop *rtnh, size_t req_size, int bytelen, @@ -896,10 +896,10 @@ static void _netlink_route_build_singlepath(const char *routedesc, int bytelen, num_labels * sizeof(mpls_lse_t)); else { struct rtattr *nest; - u_int16_t encap = LWTUNNEL_ENCAP_MPLS; + uint16_t encap = LWTUNNEL_ENCAP_MPLS; addattr_l(nlmsg, req_size, RTA_ENCAP_TYPE, &encap, - sizeof(u_int16_t)); + sizeof(uint16_t)); nest = addattr_nest(nlmsg, req_size, RTA_ENCAP); addattr_l(nlmsg, req_size, MPLS_IPTUNNEL_DST, &out_lse, num_labels * sizeof(mpls_lse_t)); @@ -927,9 +927,9 @@ static void _netlink_route_build_singlepath(const char *routedesc, int bytelen, if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug( " 5549: _netlink_route_build_singlepath() (%s): " - "nexthop via %s %s if %u", + "nexthop via %s %s if %u(%u)", routedesc, ipv4_ll_buf, label_buf, - nexthop->ifindex); + nexthop->ifindex, nexthop->vrf_id); return; } @@ -953,9 +953,9 @@ static void _netlink_route_build_singlepath(const char *routedesc, int bytelen, if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug( "netlink_route_multipath() (%s): " - "nexthop via %s %s if %u", + "nexthop via %s %s if %u(%u)", routedesc, inet_ntoa(nexthop->gate.ipv4), - label_buf, nexthop->ifindex); + label_buf, nexthop->ifindex, nexthop->vrf_id); } if (nexthop->type == NEXTHOP_TYPE_IPV6 @@ -976,9 +976,9 @@ static void _netlink_route_build_singlepath(const char *routedesc, int bytelen, if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug( "netlink_route_multipath() (%s): " - "nexthop via %s %s if %u", + "nexthop via %s %s if %u(%u)", routedesc, inet6_ntoa(nexthop->gate.ipv6), - label_buf, nexthop->ifindex); + label_buf, nexthop->ifindex, nexthop->vrf_id); } /* @@ -1003,8 +1003,8 @@ static void _netlink_route_build_singlepath(const char *routedesc, int bytelen, if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug( "netlink_route_multipath() (%s): " - "nexthop via if %u", - routedesc, nexthop->ifindex); + "nexthop via if %u(%u)", + routedesc, nexthop->ifindex, nexthop->vrf_id); } if (nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX) { @@ -1020,8 +1020,8 @@ static void _netlink_route_build_singlepath(const char *routedesc, int bytelen, if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug( "netlink_route_multipath() (%s): " - "nexthop via if %u", - routedesc, nexthop->ifindex); + "nexthop via if %u(%u)", + routedesc, nexthop->ifindex, nexthop->vrf_id); } } @@ -1108,11 +1108,11 @@ static void _netlink_route_build_multipath(const char *routedesc, int bytelen, RTA_LENGTH(num_labels * sizeof(mpls_lse_t)); } else { struct rtattr *nest; - u_int16_t encap = LWTUNNEL_ENCAP_MPLS; + uint16_t encap = LWTUNNEL_ENCAP_MPLS; int len = rta->rta_len; rta_addattr_l(rta, NL_PKT_BUF_SIZE, RTA_ENCAP_TYPE, - &encap, sizeof(u_int16_t)); + &encap, sizeof(uint16_t)); nest = rta_nest(rta, NL_PKT_BUF_SIZE, RTA_ENCAP); rta_addattr_l(rta, NL_PKT_BUF_SIZE, MPLS_IPTUNNEL_DST, &out_lse, @@ -1224,7 +1224,7 @@ static inline void _netlink_mpls_build_singlepath(const char *routedesc, size_t req_size, int cmd) { int bytelen; - u_char family; + uint8_t family; family = NHLFE_FAMILY(nhlfe); bytelen = (family == AF_INET ? 4 : 16); @@ -1239,7 +1239,7 @@ _netlink_mpls_build_multipath(const char *routedesc, zebra_nhlfe_t *nhlfe, struct rtmsg *rtmsg, union g_addr **src) { int bytelen; - u_char family; + uint8_t family; family = NHLFE_FAMILY(nhlfe); bytelen = (family == AF_INET ? 4 : 16); @@ -1260,19 +1260,20 @@ _netlink_mpls_build_multipath(const char *routedesc, zebra_nhlfe_t *nhlfe, */ static void _netlink_route_debug(int cmd, struct prefix *p, struct nexthop *nexthop, const char *routedesc, - int family, struct zebra_vrf *zvrf) + int family, struct zebra_vrf *zvrf, + uint32_t tableid) { if (IS_ZEBRA_DEBUG_KERNEL) { char buf[PREFIX_STRLEN]; zlog_debug( - "netlink_route_multipath() (%s): %s %s vrf %u type %s", + "netlink_route_multipath() (%s): %s %s vrf %u(%u) type %s", routedesc, nl_msg_type_to_str(cmd), - prefix2str(p, buf, sizeof(buf)), zvrf_id(zvrf), + prefix2str(p, buf, sizeof(buf)), zvrf_id(zvrf), tableid, (nexthop) ? nexthop_type_to_str(nexthop->type) : "UNK"); } } -static void _netlink_mpls_debug(int cmd, u_int32_t label, const char *routedesc) +static void _netlink_mpls_debug(int cmd, uint32_t label, const char *routedesc) { if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug("netlink_mpls_multipath() (%s): %s %u/20", routedesc, @@ -1385,7 +1386,7 @@ static int netlink_route_multipath(int cmd, struct prefix *p, if (re->mtu || re->nexthop_mtu) { char buf[NL_PKT_BUF_SIZE]; struct rtattr *rta = (void *)buf; - u_int32_t mtu = re->mtu; + uint32_t mtu = re->mtu; if (!mtu || (re->nexthop_mtu && re->nexthop_mtu < mtu)) mtu = re->nexthop_mtu; rta->rta_type = RTA_METRICS; @@ -1486,7 +1487,7 @@ static int netlink_route_multipath(int cmd, struct prefix *p, : "single-path"; _netlink_route_debug(cmd, p, nexthop, routedesc, - family, zvrf); + family, zvrf, re->table); _netlink_route_build_singlepath( routedesc, bytelen, nexthop, &req.n, &req.r, sizeof req, cmd); @@ -1570,7 +1571,7 @@ static int netlink_route_multipath(int cmd, struct prefix *p, nexthop_num++; _netlink_route_debug(cmd, p, nexthop, routedesc, - family, zvrf); + family, zvrf, re->table); _netlink_route_build_multipath( routedesc, bytelen, nexthop, rta, rtnh, &req.r, &src1); @@ -1724,7 +1725,7 @@ static int netlink_vxlan_flood_list_update(struct interface *ifp, struct ndmsg ndm; char buf[256]; } req; - u_char dst_mac[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; + uint8_t dst_mac[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id); zns = zvrf->zns; @@ -1797,7 +1798,7 @@ static int netlink_macfdb_change(struct sockaddr_nl *snl, struct nlmsghdr *h, char buf[ETHER_ADDR_STRLEN]; char vid_buf[20]; char dst_buf[30]; - u_char sticky = 0; + uint8_t sticky = 0; ndm = NLMSG_DATA(h); @@ -1854,7 +1855,7 @@ static int netlink_macfdb_change(struct sockaddr_nl *snl, struct nlmsghdr *h, if ((NDA_VLAN <= NDA_MAX) && tb[NDA_VLAN]) { vid_present = 1; - vid = *(u_int16_t *)RTA_DATA(tb[NDA_VLAN]); + vid = *(uint16_t *)RTA_DATA(tb[NDA_VLAN]); sprintf(vid_buf, " VLAN %u", vid); } @@ -2017,7 +2018,7 @@ int netlink_macfdb_read_for_bridge(struct zebra_ns *zns, struct interface *ifp, static int netlink_macfdb_update(struct interface *ifp, vlanid_t vid, struct ethaddr *mac, struct in_addr vtep_ip, - int local, int cmd, u_char sticky) + int local, int cmd, uint8_t sticky) { struct zebra_ns *zns; struct { @@ -2107,7 +2108,7 @@ static int netlink_ipneigh_change(struct sockaddr_nl *snl, struct nlmsghdr *h, char buf[ETHER_ADDR_STRLEN]; char buf2[INET6_ADDRSTRLEN]; int mac_present = 0; - u_char ext_learned; + uint8_t ext_learned; ndm = NLMSG_DATA(h); @@ -2329,7 +2330,7 @@ int netlink_neigh_change(struct sockaddr_nl *snl, struct nlmsghdr *h, } static int netlink_neigh_update2(struct interface *ifp, struct ipaddr *ip, - struct ethaddr *mac, u_int32_t flags, int cmd) + struct ethaddr *mac, uint32_t flags, int cmd) { struct { struct nlmsghdr n; @@ -2377,7 +2378,7 @@ static int netlink_neigh_update2(struct interface *ifp, struct ipaddr *ip, } int kernel_add_mac(struct interface *ifp, vlanid_t vid, struct ethaddr *mac, - struct in_addr vtep_ip, u_char sticky) + struct in_addr vtep_ip, uint8_t sticky) { return netlink_macfdb_update(ifp, vid, mac, vtep_ip, 0, RTM_NEWNEIGH, sticky); |
