diff options
Diffstat (limited to 'zebra')
-rw-r--r-- | zebra/connected.c | 22 | ||||
-rw-r--r-- | zebra/if_ioctl.c | 2 | ||||
-rw-r--r-- | zebra/if_netlink.c | 13 | ||||
-rw-r--r-- | zebra/interface.c | 38 | ||||
-rw-r--r-- | zebra/ioctl.c | 14 | ||||
-rw-r--r-- | zebra/redistribute.c | 32 | ||||
-rw-r--r-- | zebra/router-id.c | 6 | ||||
-rw-r--r-- | zebra/rt_netlink.c | 27 | ||||
-rw-r--r-- | zebra/rtadv.c | 87 | ||||
-rw-r--r-- | zebra/zapi_msg.c | 19 | ||||
-rw-r--r-- | zebra/zebra_dplane.c | 26 | ||||
-rw-r--r-- | zebra/zebra_evpn.c | 8 | ||||
-rw-r--r-- | zebra/zebra_evpn_mac.c | 4 | ||||
-rw-r--r-- | zebra/zebra_evpn_neigh.c | 8 | ||||
-rw-r--r-- | zebra/zebra_evpn_vxlan.h | 2 | ||||
-rw-r--r-- | zebra/zebra_l2.c | 6 | ||||
-rw-r--r-- | zebra/zebra_ptm.c | 2 | ||||
-rw-r--r-- | zebra/zebra_vxlan.c | 26 |
18 files changed, 152 insertions, 190 deletions
diff --git a/zebra/connected.c b/zebra/connected.c index 80b6bf832..b261ddb79 100644 --- a/zebra/connected.c +++ b/zebra/connected.c @@ -201,7 +201,7 @@ void connected_up(struct interface *ifp, struct connected *ifc) struct nexthop nh = { .type = NEXTHOP_TYPE_IFINDEX, .ifindex = ifp->ifindex, - .vrf_id = ifp->vrf_id, + .vrf_id = ifp->vrf->vrf_id, }; struct zebra_vrf *zvrf; uint32_t metric; @@ -210,12 +210,12 @@ void connected_up(struct interface *ifp, struct connected *ifc) struct listnode *cnode; struct connected *c; - zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id); + zvrf = ifp->vrf->info; if (!zvrf) { flog_err( EC_ZEBRA_VRF_NOT_FOUND, - "%s: Received Up for interface but no associated zvrf: %d", - __func__, ifp->vrf_id); + "%s: Received Up for interface but no associated zvrf: %s(%d)", + __func__, ifp->vrf->name, ifp->vrf->vrf_id); return; } if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL)) @@ -381,19 +381,19 @@ void connected_down(struct interface *ifp, struct connected *ifc) struct nexthop nh = { .type = NEXTHOP_TYPE_IFINDEX, .ifindex = ifp->ifindex, - .vrf_id = ifp->vrf_id, + .vrf_id = ifp->vrf->vrf_id, }; struct zebra_vrf *zvrf; uint32_t count = 0; struct listnode *cnode; struct connected *c; - zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id); + zvrf = ifp->vrf->info; if (!zvrf) { flog_err( EC_ZEBRA_VRF_NOT_FOUND, - "%s: Received Down for interface but no associated zvrf: %d", - __func__, ifp->vrf_id); + "%s: Received Down for interface but no associated zvrf: %s(%d)", + __func__, ifp->vrf->name, ifp->vrf->vrf_id); return; } @@ -491,12 +491,12 @@ static void connected_delete_helper(struct connected *ifc, struct prefix *p) connected_withdraw(ifc); /* Schedule LSP forwarding entries for processing, if appropriate. */ - if (ifp->vrf_id == VRF_DEFAULT) { + if (ifp->vrf->vrf_id == VRF_DEFAULT) { if (IS_ZEBRA_DEBUG_MPLS) zlog_debug( "%u: IF %s IP %pFX address delete, scheduling MPLS processing", - ifp->vrf_id, ifp->name, p); - mpls_mark_lsps_for_processing(vrf_info_lookup(ifp->vrf_id), p); + ifp->vrf->vrf_id, ifp->name, p); + mpls_mark_lsps_for_processing(ifp->vrf->info, p); } } diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c index c3faf22d1..4e4ebc9cd 100644 --- a/zebra/if_ioctl.c +++ b/zebra/if_ioctl.c @@ -152,7 +152,7 @@ static int if_get_hwaddr(struct interface *ifp) ifreq.ifr_addr.sa_family = AF_INET; /* Fetch Hardware address if available. */ - ret = vrf_if_ioctl(SIOCGIFHWADDR, (caddr_t)&ifreq, ifp->vrf_id); + ret = vrf_if_ioctl(SIOCGIFHWADDR, (caddr_t)&ifreq, ifp->vrf->vrf_id); if (ret < 0) ifp->hw_addr_len = 0; else { diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index 187cd10e9..1c6c70ae8 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -423,8 +423,7 @@ static uint32_t get_iflink_speed(struct interface *interface, int *error) /* use ioctl to get IP address of an interface */ frr_with_privs(&zserv_privs) { sd = vrf_socket(PF_INET, SOCK_DGRAM, IPPROTO_IP, - interface->vrf_id, - NULL); + interface->vrf->vrf_id, NULL); if (sd < 0) { if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug("Failure to read interface %s speed: %d %s", @@ -435,7 +434,7 @@ static uint32_t get_iflink_speed(struct interface *interface, int *error) return 0; } /* Get the current link state for the interface */ - rc = vrf_ioctl(interface->vrf_id, sd, SIOCETHTOOL, + rc = vrf_ioctl(interface->vrf->vrf_id, sd, SIOCETHTOOL, (char *)&ifdata); } if (rc < 0) { @@ -1809,7 +1808,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) ifp = if_get_by_name(name, vrf_id, NULL); } else { /* pre-configured interface, learnt now */ - if (ifp->vrf_id != vrf_id) + if (ifp->vrf->vrf_id != vrf_id) if_update_to_new_vrf(ifp, vrf_id); } @@ -1863,13 +1862,13 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) netlink_proc_dplane_if_protodown(ifp->info, !!protodown); } - } else if (ifp->vrf_id != vrf_id) { + } else if (ifp->vrf->vrf_id != vrf_id) { /* VRF change for an interface. */ if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug( "RTM_NEWLINK vrf-change for %s(%u) vrf_id %u -> %u flags 0x%x", - name, ifp->ifindex, ifp->vrf_id, vrf_id, - ifi->ifi_flags); + name, ifp->ifindex, ifp->vrf->vrf_id, + vrf_id, ifi->ifi_flags); if_handle_vrf_change(ifp, vrf_id); } else { diff --git a/zebra/interface.c b/zebra/interface.c index 25eb5fff9..d300397b4 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -584,7 +584,7 @@ void if_add_update(struct interface *ifp) { struct zebra_if *if_data; struct zebra_ns *zns; - struct zebra_vrf *zvrf = vrf_info_lookup(ifp->vrf_id); + struct zebra_vrf *zvrf = ifp->vrf->info; /* case interface populate before vrf enabled */ if (zvrf->zns) @@ -611,8 +611,8 @@ void if_add_update(struct interface *ifp) if (IS_ZEBRA_DEBUG_KERNEL) { zlog_debug( "interface %s vrf %s(%u) index %d is shutdown. Won't wake it up.", - ifp->name, VRF_LOGNAME(zvrf->vrf), - ifp->vrf_id, ifp->ifindex); + ifp->name, ifp->vrf->name, + ifp->vrf->vrf_id, ifp->ifindex); } return; @@ -623,14 +623,14 @@ void if_add_update(struct interface *ifp) if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug( "interface %s vrf %s(%u) index %d becomes active.", - ifp->name, VRF_LOGNAME(zvrf->vrf), ifp->vrf_id, + ifp->name, ifp->vrf->name, ifp->vrf->vrf_id, ifp->ifindex); } else { if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug("interface %s vrf %s(%u) index %d is added.", - ifp->name, VRF_LOGNAME(zvrf->vrf), - ifp->vrf_id, ifp->ifindex); + ifp->name, ifp->vrf->name, ifp->vrf->vrf_id, + ifp->ifindex); } } @@ -769,12 +769,11 @@ void if_delete_update(struct interface *ifp) struct zebra_if *zif; if (if_is_up(ifp)) { - struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id); - flog_err( EC_LIB_INTERFACE, "interface %s vrf %s(%u) index %d is still up while being deleted.", - ifp->name, VRF_LOGNAME(vrf), ifp->vrf_id, ifp->ifindex); + ifp->name, ifp->vrf->name, ifp->vrf->vrf_id, + ifp->ifindex); return; } @@ -784,13 +783,10 @@ void if_delete_update(struct interface *ifp) /* Mark interface as inactive */ UNSET_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE); - if (IS_ZEBRA_DEBUG_KERNEL) { - struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id); - + if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug("interface %s vrf %s(%u) index %d is now inactive.", - ifp->name, VRF_LOGNAME(vrf), ifp->vrf_id, + ifp->name, ifp->vrf->name, ifp->vrf->vrf_id, ifp->ifindex); - } /* Delete connected routes from the kernel. */ if_delete_connected(ifp); @@ -814,7 +810,7 @@ void if_delete_update(struct interface *ifp) * occur with this implementation whereas it is not possible with * vrf-lite). */ - if (ifp->vrf_id && !vrf_is_backend_netns()) + if (ifp->vrf->vrf_id && !vrf_is_backend_netns()) if_handle_vrf_change(ifp, VRF_DEFAULT); /* Reset some zebra interface params to default values. */ @@ -842,7 +838,7 @@ void if_handle_vrf_change(struct interface *ifp, vrf_id_t vrf_id) { vrf_id_t old_vrf_id; - old_vrf_id = ifp->vrf_id; + old_vrf_id = ifp->vrf->vrf_id; /* Uninstall connected routes. */ if_uninstall_connected(ifp); @@ -884,7 +880,7 @@ void if_nbr_mac_to_ipv4ll_neigh_update(struct interface *ifp, struct in6_addr *address, int add) { - struct zebra_vrf *zvrf = vrf_info_lookup(ifp->vrf_id); + struct zebra_vrf *zvrf = ifp->vrf->info; struct zebra_if *zif = ifp->info; char buf[16] = "169.254.0.1"; struct in_addr ipv4_ll; @@ -1022,7 +1018,7 @@ void if_up(struct interface *ifp) { struct zebra_if *zif; struct interface *link_if; - struct zebra_vrf *zvrf = vrf_info_lookup(ifp->vrf_id); + struct zebra_vrf *zvrf = ifp->vrf->info; zif = ifp->info; zif->up_count++; @@ -1086,7 +1082,7 @@ void if_down(struct interface *ifp) { struct zebra_if *zif; struct interface *link_if; - struct zebra_vrf *zvrf = vrf_info_lookup(ifp->vrf_id); + struct zebra_vrf *zvrf = ifp->vrf->info; zif = ifp->info; zif->down_count++; @@ -1175,7 +1171,7 @@ void zebra_if_update_all_links(struct zebra_ns *zns) zlog_debug("bond mbr %s map to bond %d", zif->ifp->name, zif->bondslave_info.bond_ifindex); - zebra_l2_map_slave_to_bond(zif, ifp->vrf_id); + zebra_l2_map_slave_to_bond(zif, ifp->vrf->vrf_id); } /* update SVI linkages */ @@ -4231,7 +4227,7 @@ static int if_config_write(struct vty *vty) if_data = ifp->info; - if (ifp->vrf_id == VRF_DEFAULT) + if (ifp->vrf->vrf_id == VRF_DEFAULT) vty_frame(vty, "interface %s\n", ifp->name); else vty_frame(vty, "interface %s vrf %s\n", diff --git a/zebra/ioctl.c b/zebra/ioctl.c index 42a5bfd9d..8b30eea9f 100644 --- a/zebra/ioctl.c +++ b/zebra/ioctl.c @@ -140,7 +140,7 @@ void if_get_metric(struct interface *ifp) ifreq_set_name(&ifreq, ifp); - if (vrf_if_ioctl(SIOCGIFMETRIC, (caddr_t)&ifreq, ifp->vrf_id) < 0) + if (vrf_if_ioctl(SIOCGIFMETRIC, (caddr_t)&ifreq, ifp->vrf->vrf_id) < 0) return; ifp->metric = ifreq.ifr_metric; if (ifp->metric == 0) @@ -158,7 +158,7 @@ void if_get_mtu(struct interface *ifp) ifreq_set_name(&ifreq, ifp); #if defined(SIOCGIFMTU) - if (vrf_if_ioctl(SIOCGIFMTU, (caddr_t)&ifreq, ifp->vrf_id) < 0) { + if (vrf_if_ioctl(SIOCGIFMTU, (caddr_t)&ifreq, ifp->vrf->vrf_id) < 0) { zlog_info("Can't lookup mtu by ioctl(SIOCGIFMTU)"); ifp->mtu6 = ifp->mtu = -1; return; @@ -414,7 +414,7 @@ void if_get_flags(struct interface *ifp) ifreq_set_name(&ifreq, ifp); - ret = vrf_if_ioctl(SIOCGIFFLAGS, (caddr_t)&ifreq, ifp->vrf_id); + ret = vrf_if_ioctl(SIOCGIFFLAGS, (caddr_t)&ifreq, ifp->vrf->vrf_id); if (ret < 0) { flog_err_sys(EC_LIB_SYSTEM_CALL, "vrf_if_ioctl(SIOCGIFFLAGS %s) failed: %s", @@ -443,13 +443,13 @@ void if_get_flags(struct interface *ifp) struct if_data *ifdata = &ifdr.ifdr_data; strlcpy(ifdr.ifdr_name, ifp->name, sizeof(ifdr.ifdr_name)); - ret = vrf_if_ioctl(SIOCGIFDATA, (caddr_t)&ifdr, ifp->vrf_id); + ret = vrf_if_ioctl(SIOCGIFDATA, (caddr_t)&ifdr, ifp->vrf->vrf_id); #else struct if_data ifd = {.ifi_link_state = 0}; struct if_data *ifdata = &ifd; ifreq.ifr_data = (caddr_t)ifdata; - ret = vrf_if_ioctl(SIOCGIFDATA, (caddr_t)&ifreq, ifp->vrf_id); + ret = vrf_if_ioctl(SIOCGIFDATA, (caddr_t)&ifreq, ifp->vrf->vrf_id); #endif if (ret == -1) @@ -511,7 +511,7 @@ int if_set_flags(struct interface *ifp, uint64_t flags) ifreq.ifr_flags = ifp->flags; ifreq.ifr_flags |= flags; - ret = vrf_if_ioctl(SIOCSIFFLAGS, (caddr_t)&ifreq, ifp->vrf_id); + ret = vrf_if_ioctl(SIOCSIFFLAGS, (caddr_t)&ifreq, ifp->vrf->vrf_id); if (ret < 0) { zlog_info("can't set interface flags"); @@ -532,7 +532,7 @@ int if_unset_flags(struct interface *ifp, uint64_t flags) ifreq.ifr_flags = ifp->flags; ifreq.ifr_flags &= ~flags; - ret = vrf_if_ioctl(SIOCSIFFLAGS, (caddr_t)&ifreq, ifp->vrf_id); + ret = vrf_if_ioctl(SIOCSIFFLAGS, (caddr_t)&ifreq, ifp->vrf->vrf_id); if (ret < 0) { zlog_info("can't unset interface flags"); diff --git a/zebra/redistribute.c b/zebra/redistribute.c index 26f6d404e..c59ff1bbe 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -449,8 +449,8 @@ void zebra_interface_up_update(struct interface *ifp) struct zserv *client; if (IS_ZEBRA_DEBUG_EVENT) - zlog_debug("MESSAGE: ZEBRA_INTERFACE_UP %s(%u)", - ifp->name, ifp->vrf_id); + zlog_debug("MESSAGE: ZEBRA_INTERFACE_UP %s vrf %s(%u)", + ifp->name, ifp->vrf->name, ifp->vrf->vrf_id); if (ifp->ptm_status || !ifp->ptm_enable) { for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, @@ -475,8 +475,8 @@ void zebra_interface_down_update(struct interface *ifp) struct zserv *client; if (IS_ZEBRA_DEBUG_EVENT) - zlog_debug("MESSAGE: ZEBRA_INTERFACE_DOWN %s(%u)", - ifp->name, ifp->vrf_id); + zlog_debug("MESSAGE: ZEBRA_INTERFACE_DOWN %s vrf %s(%u)", + ifp->name, ifp->vrf->name, ifp->vrf->vrf_id); for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) { /* Do not send unsolicited messages to synchronous clients. */ @@ -494,8 +494,8 @@ void zebra_interface_add_update(struct interface *ifp) struct zserv *client; if (IS_ZEBRA_DEBUG_EVENT) - zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADD %s(%u)", ifp->name, - ifp->vrf_id); + zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADD %s vrf %s(%u)", + ifp->name, ifp->vrf->name, ifp->vrf->vrf_id); for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) { /* Do not send unsolicited messages to synchronous clients. */ @@ -514,8 +514,8 @@ void zebra_interface_delete_update(struct interface *ifp) struct zserv *client; if (IS_ZEBRA_DEBUG_EVENT) - zlog_debug("MESSAGE: ZEBRA_INTERFACE_DELETE %s(%u)", - ifp->name, ifp->vrf_id); + zlog_debug("MESSAGE: ZEBRA_INTERFACE_DELETE %s vrf %s(%u)", + ifp->name, ifp->vrf->name, ifp->vrf->vrf_id); for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) { /* Do not send unsolicited messages to synchronous clients. */ @@ -538,8 +538,8 @@ void zebra_interface_address_add_update(struct interface *ifp, if (IS_ZEBRA_DEBUG_EVENT) { p = ifc->address; zlog_debug( - "MESSAGE: ZEBRA_INTERFACE_ADDRESS_ADD %pFX on %s(%u)", - p, ifp->name, ifp->vrf_id); + "MESSAGE: ZEBRA_INTERFACE_ADDRESS_ADD %pFX on %s vrf %s(%u)", + p, ifp->name, ifp->vrf->name, ifp->vrf->vrf_id); } if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL)) @@ -575,8 +575,8 @@ void zebra_interface_address_delete_update(struct interface *ifp, if (IS_ZEBRA_DEBUG_EVENT) { p = ifc->address; zlog_debug( - "MESSAGE: ZEBRA_INTERFACE_ADDRESS_DELETE %pFX on %s(%u)", - p, ifp->name, ifp->vrf_id); + "MESSAGE: ZEBRA_INTERFACE_ADDRESS_DELETE %pFX on %s vrf %s(%u)", + p, ifp->name, ifp->vrf->name, ifp->vrf->vrf_id); } zebra_vxlan_add_del_gw_macip(ifp, ifc->address, 0); @@ -607,7 +607,7 @@ void zebra_interface_vrf_update_del(struct interface *ifp, vrf_id_t new_vrf_id) if (IS_ZEBRA_DEBUG_EVENT) zlog_debug( "MESSAGE: ZEBRA_INTERFACE_VRF_UPDATE/DEL %s VRF Id %u -> %u", - ifp->name, ifp->vrf_id, new_vrf_id); + ifp->name, ifp->vrf->vrf_id, new_vrf_id); for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) { /* Do not send unsolicited messages to synchronous clients. */ @@ -634,7 +634,7 @@ void zebra_interface_vrf_update_add(struct interface *ifp, vrf_id_t old_vrf_id) if (IS_ZEBRA_DEBUG_EVENT) zlog_debug( "MESSAGE: ZEBRA_INTERFACE_VRF_UPDATE/ADD %s VRF Id %u -> %u", - ifp->name, old_vrf_id, ifp->vrf_id); + ifp->name, old_vrf_id, ifp->vrf->vrf_id); for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) { /* Do not send unsolicited messages to synchronous clients. */ @@ -925,8 +925,8 @@ void zebra_interface_parameters_update(struct interface *ifp) struct zserv *client; if (IS_ZEBRA_DEBUG_EVENT) - zlog_debug("MESSAGE: ZEBRA_INTERFACE_LINK_PARAMS %s(%u)", - ifp->name, ifp->vrf_id); + zlog_debug("MESSAGE: ZEBRA_INTERFACE_LINK_PARAMS %s vrf %s(%u)", + ifp->name, ifp->vrf->name, ifp->vrf->vrf_id); for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) { /* Do not send unsolicited messages to synchronous clients. */ diff --git a/zebra/router-id.c b/zebra/router-id.c index ac81d537d..ea438b436 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -159,7 +159,7 @@ void router_id_add_address(struct connected *ifc) struct prefix before; struct prefix after; struct zserv *client; - struct zebra_vrf *zvrf = vrf_info_get(ifc->ifp->vrf_id); + struct zebra_vrf *zvrf = ifc->ifp->vrf->info; afi_t afi; struct list *rid_lo; struct list *rid_all; @@ -206,7 +206,7 @@ void router_id_del_address(struct connected *ifc) struct prefix before; struct listnode *node; struct zserv *client; - struct zebra_vrf *zvrf = vrf_info_get(ifc->ifp->vrf_id); + struct zebra_vrf *zvrf = ifc->ifp->vrf->info; afi_t afi; struct list *rid_lo; struct list *rid_all; @@ -521,7 +521,7 @@ DEFUN (show_ip_router_id, vrf_name = argv[idx]->arg; } - zvrf = vrf_info_get(vrf_id); + zvrf = vrf_info_lookup(vrf_id); if (zvrf != NULL) { if (is_ipv6) { diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index b3f04e421..24c01b7f5 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -507,7 +507,7 @@ parse_nexthop_unicast(ns_id_t ns_id, struct rtmsg *rtm, struct rtattr **tb, if (index) { ifp = if_lookup_by_index_per_ns(zebra_ns_lookup(ns_id), index); if (ifp) - nh_vrf_id = ifp->vrf_id; + nh_vrf_id = ifp->vrf->vrf_id; } nh.vrf_id = nh_vrf_id; @@ -581,7 +581,7 @@ static uint8_t parse_multipath_nexthops_unicast(ns_id_t ns_id, ifp = if_lookup_by_index_per_ns(zebra_ns_lookup(ns_id), index); if (ifp) - nh_vrf_id = ifp->vrf_id; + nh_vrf_id = ifp->vrf->vrf_id; else { flog_warn( EC_ZEBRA_UNKNOWN_INTERFACE, @@ -2799,7 +2799,7 @@ static struct nexthop netlink_nexthop_process_nh(struct rtattr **tb, if (ifp) *ifp = ifp_lookup; if (ifp_lookup) - nh.vrf_id = ifp_lookup->vrf_id; + nh.vrf_id = ifp_lookup->vrf->vrf_id; else { flog_warn( EC_ZEBRA_UNKNOWN_INTERFACE, @@ -3503,8 +3503,8 @@ static int netlink_request_specific_mac_in_bridge(struct zebra_ns *zns, zlog_debug( "%s: Tx family %s IF %s(%u) vrf %s(%u) MAC %pEA vid %u", __func__, nl_family_to_str(req.ndm.ndm_family), - br_if->name, br_if->ifindex, - vrf_id_to_name(br_if->vrf_id), br_if->vrf_id, mac, vid); + br_if->name, br_if->ifindex, br_if->vrf->name, + br_if->vrf->vrf_id, mac, vid); return netlink_request(&zns->netlink_cmd, &req); } @@ -3676,7 +3676,6 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id) struct interface *link_if; struct ethaddr mac; struct ipaddr ip; - struct vrf *vrf; char buf[ETHER_ADDR_STRLEN]; int mac_present = 0; bool is_ext; @@ -3695,7 +3694,6 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id) if (!ifp || !ifp->info) return 0; - vrf = vrf_lookup_by_id(ifp->vrf_id); zif = (struct zebra_if *)ifp->info; /* Parse attributes and extract fields of interest. */ @@ -3705,7 +3703,7 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id) zlog_debug("%s family %s IF %s(%u) vrf %s(%u) - no DST", nl_msg_type_to_str(h->nlmsg_type), nl_family_to_str(ndm->ndm_family), ifp->name, - ndm->ndm_ifindex, VRF_LOGNAME(vrf), ifp->vrf_id); + ndm->ndm_ifindex, ifp->vrf->name, ifp->vrf->vrf_id); return 0; } @@ -3801,7 +3799,8 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id) nl_family_to_str( ndm->ndm_family), ifp->name, ndm->ndm_ifindex, - VRF_LOGNAME(vrf), ifp->vrf_id, + ifp->vrf->name, + ifp->vrf->vrf_id, (unsigned long)RTA_PAYLOAD( tb[NDA_LLADDR])); return 0; @@ -3825,8 +3824,8 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id) "Rx %s family %s IF %s(%u) vrf %s(%u) IP %pIA MAC %s state 0x%x flags 0x%x ext_flags 0x%x", nl_msg_type_to_str(h->nlmsg_type), nl_family_to_str(ndm->ndm_family), ifp->name, - ndm->ndm_ifindex, VRF_LOGNAME(vrf), ifp->vrf_id, - &ip, + ndm->ndm_ifindex, ifp->vrf->name, + ifp->vrf->vrf_id, &ip, mac_present ? prefix_mac2str(&mac, buf, sizeof(buf)) : "", @@ -3861,7 +3860,7 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id) zlog_debug("Rx %s family %s IF %s(%u) vrf %s(%u) IP %pIA", nl_msg_type_to_str(h->nlmsg_type), nl_family_to_str(ndm->ndm_family), ifp->name, - ndm->ndm_ifindex, VRF_LOGNAME(vrf), ifp->vrf_id, + ndm->ndm_ifindex, ifp->vrf->name, ifp->vrf->vrf_id, &ip); /* Process the delete - it may result in re-adding the neighbor if it is @@ -4004,7 +4003,7 @@ int netlink_neigh_read_specific_ip(const struct ipaddr *ip, { int ret = 0; struct zebra_ns *zns; - struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(vlan_if->vrf_id); + struct zebra_vrf *zvrf = vlan_if->vrf->info; struct zebra_dplane_info dp_info; zns = zvrf->zns; @@ -4014,7 +4013,7 @@ int netlink_neigh_read_specific_ip(const struct ipaddr *ip, if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug("%s: neigh request IF %s(%u) IP %pIA vrf %s(%u)", __func__, vlan_if->name, vlan_if->ifindex, ip, - vrf_id_to_name(vlan_if->vrf_id), vlan_if->vrf_id); + vlan_if->vrf->name, vlan_if->vrf->vrf_id); ret = netlink_request_specific_neigh_in_vlan(zns, RTM_GETNEIGH, ip, vlan_if->ifindex); diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 4d97c3c23..350b97cc5 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -99,7 +99,7 @@ static struct zebra_vrf *rtadv_interface_get_zvrf(const struct interface *ifp) if (!vrf_is_backend_netns()) return vrf_info_lookup(VRF_DEFAULT); - return vrf_info_lookup(ifp->vrf_id); + return ifp->vrf->info; } static int rtadv_increment_received(struct zebra_vrf *zvrf, ifindex_t *ifindex) @@ -210,12 +210,9 @@ static void rtadv_send_packet(int sock, struct interface *ifp, } /* Logging of packet. */ - if (IS_ZEBRA_DEBUG_PACKET) { - struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id); - + if (IS_ZEBRA_DEBUG_PACKET) zlog_debug("%s(%s:%u): Tx RA, socket %u", ifp->name, - VRF_LOGNAME(vrf), ifp->ifindex, sock); - } + ifp->vrf->name, ifp->ifindex, sock); /* Fill in sockaddr_in6. */ memset(&addr, 0, sizeof(struct sockaddr_in6)); @@ -387,11 +384,9 @@ static void rtadv_send_packet(int sock, struct interface *ifp, sizeof(struct nd_opt_rdnss) + sizeof(struct in6_addr); if (len + opt_len > max_len) { - struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id); - zlog_warn( "%s(%s:%u): Tx RA: RDNSS option would exceed MTU, omitting it", - ifp->name, VRF_LOGNAME(vrf), ifp->ifindex); + ifp->name, ifp->vrf->name, ifp->ifindex); goto no_more_opts; } struct nd_opt_rdnss *opt = (struct nd_opt_rdnss *)(buf + len); @@ -494,7 +489,8 @@ static int rtadv_timer(struct thread *thread) RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) FOR_ALL_INTERFACES (vrf, ifp) { if (if_is_loopback(ifp) || !if_is_operative(ifp) - || (vrf_is_backend_netns() && ifp->vrf_id != zvrf->vrf->vrf_id)) + || (vrf_is_backend_netns() + && ifp->vrf->vrf_id != zvrf->vrf->vrf_id)) continue; zif = ifp->info; @@ -509,17 +505,12 @@ static int rtadv_timer(struct thread *thread) <= 0) zif->rtadv.inFastRexmit = 0; - if (IS_ZEBRA_DEBUG_SEND) { - struct vrf *vrf = - vrf_lookup_by_id( - ifp->vrf_id); - + if (IS_ZEBRA_DEBUG_SEND) zlog_debug( "Fast RA Rexmit on interface %s(%s:%u)", ifp->name, - VRF_LOGNAME(vrf), + ifp->vrf->name, ifp->ifindex); - } rtadv_send_packet(zvrf->rtadv.sock, ifp, RA_ENABLE); @@ -619,14 +610,11 @@ static void rtadv_process_advert(uint8_t *msg, unsigned int len, inet_ntop(AF_INET6, &addr->sin6_addr, addr_str, INET6_ADDRSTRLEN); if (len < sizeof(struct nd_router_advert)) { - if (IS_ZEBRA_DEBUG_PACKET) { - struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id); - + if (IS_ZEBRA_DEBUG_PACKET) zlog_debug( "%s(%s:%u): Rx RA with invalid length %d from %s", - ifp->name, VRF_LOGNAME(vrf), ifp->ifindex, len, + ifp->name, ifp->vrf->name, ifp->ifindex, len, addr_str); - } return; } @@ -634,14 +622,11 @@ static void rtadv_process_advert(uint8_t *msg, unsigned int len, rtadv_process_optional(msg + sizeof(struct nd_router_advert), len - sizeof(struct nd_router_advert), ifp, addr); - if (IS_ZEBRA_DEBUG_PACKET) { - struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id); - + if (IS_ZEBRA_DEBUG_PACKET) zlog_debug( "%s(%s:%u): Rx RA with non-linklocal source address from %s", - ifp->name, VRF_LOGNAME(vrf), ifp->ifindex, + ifp->name, ifp->vrf->name, ifp->ifindex, addr_str); - } return; } @@ -719,12 +704,9 @@ static void rtadv_process_packet(uint8_t *buf, unsigned int len, return; } - if (IS_ZEBRA_DEBUG_PACKET) { - struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id); - + if (IS_ZEBRA_DEBUG_PACKET) zlog_debug("%s(%s:%u): Rx RA/RS len %d from %s", ifp->name, - VRF_LOGNAME(vrf), ifp->ifindex, len, addr_str); - } + ifp->vrf->name, ifp->ifindex, len, addr_str); if (if_is_loopback(ifp)) return; @@ -736,11 +718,9 @@ static void rtadv_process_packet(uint8_t *buf, unsigned int len, /* ICMP message length check. */ if (len < sizeof(struct icmp6_hdr)) { - struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id); - zlog_debug( "%s(%s:%u): Rx RA with Invalid ICMPV6 packet length %d", - ifp->name, VRF_LOGNAME(vrf), ifp->ifindex, len); + ifp->name, ifp->vrf->name, ifp->ifindex, len); return; } @@ -749,20 +729,16 @@ static void rtadv_process_packet(uint8_t *buf, unsigned int len, /* ICMP message type check. */ if (icmph->icmp6_type != ND_ROUTER_SOLICIT && icmph->icmp6_type != ND_ROUTER_ADVERT) { - struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id); - zlog_debug("%s(%s:%u): Rx RA - Unwanted ICMPV6 message type %d", - ifp->name, VRF_LOGNAME(vrf), ifp->ifindex, + ifp->name, ifp->vrf->name, ifp->ifindex, icmph->icmp6_type); return; } /* Hoplimit check. */ if (hoplimit >= 0 && hoplimit != 255) { - struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id); - zlog_debug("%s(%s:%u): Rx RA - Invalid hoplimit %d", ifp->name, - VRF_LOGNAME(vrf), ifp->ifindex, hoplimit); + ifp->vrf->name, ifp->ifindex, hoplimit); return; } @@ -1295,14 +1271,12 @@ static void zebra_interface_radv_set(ZAPI_HANDLER_ARGS, int enable) zebra_route_string(client->proto)); return; } - if (vrf_is_backend_netns() && ifp->vrf_id != zvrf_id(zvrf)) { - struct vrf *vrf = zvrf->vrf; - + if (vrf_is_backend_netns() && ifp->vrf->vrf_id != zvrf_id(zvrf)) { zlog_debug( "%s:%u: IF %u RA %s client %s - VRF mismatch, IF VRF %u", - VRF_LOGNAME(vrf), zvrf_id(zvrf), ifindex, + ifp->vrf->name, zvrf_id(zvrf), ifindex, enable ? "enable" : "disable", - zebra_route_string(client->proto), ifp->vrf_id); + zebra_route_string(client->proto), ifp->vrf->vrf_id); return; } @@ -2856,13 +2830,10 @@ static int if_join_all_router(int sock, struct interface *ifp) ifp->name, ifp->ifindex, sock, safe_strerror(errno)); - if (IS_ZEBRA_DEBUG_EVENT) { - struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id); - + if (IS_ZEBRA_DEBUG_EVENT) zlog_debug( "%s(%s:%u): Join All-Routers multicast group, socket %u", - ifp->name, VRF_LOGNAME(vrf), ifp->ifindex, sock); - } + ifp->name, ifp->vrf->name, ifp->ifindex, sock); return 0; } @@ -2879,22 +2850,18 @@ static int if_leave_all_router(int sock, struct interface *ifp) ret = setsockopt(sock, IPPROTO_IPV6, IPV6_LEAVE_GROUP, (char *)&mreq, sizeof(mreq)); - if (ret < 0) { - struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id); - + if (ret < 0) flog_err_sys( EC_LIB_SOCKET, "%s(%s:%u): Failed to leave group, socket %u error %s", - ifp->name, VRF_LOGNAME(vrf), ifp->ifindex, sock, + ifp->name, ifp->vrf->name, ifp->ifindex, sock, safe_strerror(errno)); - } - if (IS_ZEBRA_DEBUG_EVENT) { - struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id); + if (IS_ZEBRA_DEBUG_EVENT) zlog_debug( "%s(%s:%u): Leave All-Routers multicast group, socket %u", - ifp->name, VRF_LOGNAME(vrf), ifp->ifindex, sock); - } + ifp->name, ifp->vrf->name, ifp->ifindex, sock); + return 0; } diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 54ab0afd5..421438a05 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -185,7 +185,7 @@ int zsend_interface_add(struct zserv *client, struct interface *ifp) { struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); - zclient_create_header(s, ZEBRA_INTERFACE_ADD, ifp->vrf_id); + zclient_create_header(s, ZEBRA_INTERFACE_ADD, ifp->vrf->vrf_id); zserv_encode_interface(s, ifp); client->ifadd_cnt++; @@ -197,7 +197,7 @@ int zsend_interface_delete(struct zserv *client, struct interface *ifp) { struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); - zclient_create_header(s, ZEBRA_INTERFACE_DELETE, ifp->vrf_id); + zclient_create_header(s, ZEBRA_INTERFACE_DELETE, ifp->vrf->vrf_id); zserv_encode_interface(s, ifp); client->ifdel_cnt++; @@ -237,7 +237,7 @@ int zsend_interface_link_params(struct zserv *client, struct interface *ifp) return 0; } - zclient_create_header(s, ZEBRA_INTERFACE_LINK_PARAMS, ifp->vrf_id); + zclient_create_header(s, ZEBRA_INTERFACE_LINK_PARAMS, ifp->vrf->vrf_id); /* Add Interface Index */ stream_putl(s, ifp->ifindex); @@ -299,7 +299,7 @@ int zsend_interface_address(int cmd, struct zserv *client, struct prefix *p; struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); - zclient_create_header(s, cmd, ifp->vrf_id); + zclient_create_header(s, cmd, ifp->vrf->vrf_id); stream_putl(s, ifp->ifindex); /* Interface address flag. */ @@ -341,7 +341,7 @@ static int zsend_interface_nbr_address(int cmd, struct zserv *client, struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); struct prefix *p; - zclient_create_header(s, cmd, ifp->vrf_id); + zclient_create_header(s, cmd, ifp->vrf->vrf_id); stream_putl(s, ifp->ifindex); /* Prefix information. */ @@ -459,7 +459,7 @@ int zsend_interface_vrf_update(struct zserv *client, struct interface *ifp, { struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); - zclient_create_header(s, ZEBRA_INTERFACE_VRF_UPDATE, ifp->vrf_id); + zclient_create_header(s, ZEBRA_INTERFACE_VRF_UPDATE, ifp->vrf->vrf_id); /* Fill in the name of the interface and its new VRF (id) */ stream_put(s, ifp->name, INTERFACE_NAMSIZ); @@ -534,7 +534,7 @@ int zsend_interface_update(int cmd, struct zserv *client, struct interface *ifp) { struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); - zclient_create_header(s, cmd, ifp->vrf_id); + zclient_create_header(s, cmd, ifp->vrf->vrf_id); zserv_encode_interface(s, ifp); if (cmd == ZEBRA_INTERFACE_UP) @@ -985,7 +985,8 @@ void zsend_nhrp_neighbor_notify(int cmd, struct interface *ifp, family2addrsize(sockunion_family(&ip))); for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) { - if (!vrf_bitmap_check(client->nhrp_neighinfo[afi], ifp->vrf_id)) + if (!vrf_bitmap_check(client->nhrp_neighinfo[afi], + ifp->vrf->vrf_id)) continue; s = stream_new(ZEBRA_MAX_PACKET_SIZ); @@ -3421,7 +3422,7 @@ static inline void zebra_gre_get(ZAPI_HANDLER_ARGS) zebra_ns_lookup(gre_info->link_nsid), gre_info->ifindex_link); if (ifp_link) - vrf_id_link = ifp_link->vrf_id; + vrf_id_link = ifp_link->vrf->vrf_id; stream_putl(s, vrf_id_link); stream_putl(s, gre_info->vtep_ip.s_addr); stream_putl(s, gre_info->vtep_ip_remote.s_addr); diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index 20aa9b843..400027254 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -3569,9 +3569,9 @@ dplane_br_port_update(const struct interface *ifp, bool non_df, ctx->zd_op = op; ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS; - ctx->zd_vrf_id = ifp->vrf_id; + ctx->zd_vrf_id = ifp->vrf->vrf_id; - zns = zebra_ns_lookup(ifp->vrf_id); + zns = zebra_ns_lookup(ifp->vrf->vrf_id); dplane_ctx_ns_init(ctx, zns, false); ctx->zd_ifindex = ifp->ifindex; @@ -3646,16 +3646,16 @@ static enum zebra_dplane_result intf_addr_update_internal( if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) zlog_debug("init intf ctx %s: idx %d, addr %u:%pFX", - dplane_op2str(op), ifp->ifindex, ifp->vrf_id, + dplane_op2str(op), ifp->ifindex, ifp->vrf->vrf_id, ifc->address); ctx = dplane_ctx_alloc(); ctx->zd_op = op; ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS; - ctx->zd_vrf_id = ifp->vrf_id; + ctx->zd_vrf_id = ifp->vrf->vrf_id; - zns = zebra_ns_lookup(ifp->vrf_id); + zns = zebra_ns_lookup(ifp->vrf->vrf_id); dplane_ctx_ns_init(ctx, zns, false); /* Init the interface-addr-specific area */ @@ -3853,9 +3853,9 @@ void dplane_mac_init(struct zebra_dplane_ctx *ctx, struct zebra_ns *zns; ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS; - ctx->zd_vrf_id = ifp->vrf_id; + ctx->zd_vrf_id = ifp->vrf->vrf_id; - zns = zebra_ns_lookup(ifp->vrf_id); + zns = zebra_ns_lookup(ifp->vrf->vrf_id); dplane_ctx_ns_init(ctx, zns, false); strlcpy(ctx->zd_ifname, ifp->name, sizeof(ctx->zd_ifname)); @@ -4078,9 +4078,9 @@ enum zebra_dplane_result dplane_neigh_table_update(const struct interface *ifp, ctx->zd_op = op; ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS; - ctx->zd_vrf_id = ifp->vrf_id; + ctx->zd_vrf_id = ifp->vrf->vrf_id; - zns = zebra_ns_lookup(ifp->vrf_id); + zns = zebra_ns_lookup(ifp->vrf->vrf_id); dplane_ctx_ns_init(ctx, zns, false); strlcpy(ctx->zd_ifname, ifp->name, sizeof(ctx->zd_ifname)); @@ -4152,10 +4152,10 @@ neigh_update_internal(enum dplane_op_e op, const struct interface *ifp, ctx->zd_op = op; ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS; - ctx->zd_vrf_id = ifp->vrf_id; + ctx->zd_vrf_id = ifp->vrf->vrf_id; dplane_ctx_set_type(ctx, protocol); - zns = zebra_ns_lookup(ifp->vrf_id); + zns = zebra_ns_lookup(ifp->vrf->vrf_id); dplane_ctx_ns_init(ctx, zns, false); strlcpy(ctx->zd_ifname, ifp->name, sizeof(ctx->zd_ifname)); @@ -4403,13 +4403,13 @@ dplane_gre_set(struct interface *ifp, struct interface *ifp_link, ctx->zd_op = op; ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS; - zns = zebra_ns_lookup(ifp->vrf_id); + zns = zebra_ns_lookup(ifp->vrf->vrf_id); if (!zns) return result; dplane_ctx_ns_init(ctx, zns, false); dplane_ctx_set_ifname(ctx, ifp->name); - ctx->zd_vrf_id = ifp->vrf_id; + ctx->zd_vrf_id = ifp->vrf->vrf_id; ctx->zd_ifindex = ifp->ifindex; if (ifp_link) ctx->u.gre.link_ifindex = ifp_link->ifindex; diff --git a/zebra/zebra_evpn.c b/zebra/zebra_evpn.c index f2da8dbf7..13b9cc200 100644 --- a/zebra/zebra_evpn.c +++ b/zebra/zebra_evpn.c @@ -417,10 +417,10 @@ int zebra_evpn_advertise_subnet(struct zebra_evpn *zevpn, struct interface *ifp, apply_mask(&p); if (advertise) - ip_prefix_send_to_client(ifp->vrf_id, &p, + ip_prefix_send_to_client(ifp->vrf->vrf_id, &p, ZEBRA_IP_PREFIX_ROUTE_ADD); else - ip_prefix_send_to_client(ifp->vrf_id, &p, + ip_prefix_send_to_client(ifp->vrf->vrf_id, &p, ZEBRA_IP_PREFIX_ROUTE_DEL); } return 0; @@ -481,7 +481,7 @@ int zebra_evpn_gw_macip_del(struct interface *ifp, struct zebra_evpn *zevpn, if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( "%u:SVI %s(%u) VNI %u, sending GW MAC %pEA IP %pIA del to BGP", - ifp->vrf_id, ifp->name, ifp->ifindex, zevpn->vni, + ifp->vrf->vrf_id, ifp->name, ifp->ifindex, zevpn->vni, &n->emac, ip); /* Remove neighbor from BGP. */ @@ -1531,7 +1531,7 @@ void zebra_evpn_rem_macip_del(vni_t vni, const struct ethaddr *macaddr, if (!mac && !n) return; - zvrf = vrf_info_lookup(zevpn->vxlan_if->vrf_id); + zvrf = zevpn->vxlan_if->vrf->info; /* Ignore the delete if this mac is a gateway mac-ip */ if (CHECK_FLAG(mac->flags, ZEBRA_MAC_LOCAL) diff --git a/zebra/zebra_evpn_mac.c b/zebra/zebra_evpn_mac.c index cdaa5ce5a..e285c206b 100644 --- a/zebra/zebra_evpn_mac.c +++ b/zebra/zebra_evpn_mac.c @@ -1877,7 +1877,7 @@ static bool zebra_evpn_local_mac_update_fwd_info(struct zebra_mac *mac, struct zebra_vrf *zvrf; struct zebra_evpn_es *es; - zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id); + zvrf = ifp->vrf->info; if (zvrf && zvrf->zns) local_ns_id = zvrf->zns->ns_id; @@ -2481,7 +2481,7 @@ int zebra_evpn_mac_gw_macip_add(struct interface *ifp, struct zebra_evpn *zevpn, ns_id_t local_ns_id = NS_DEFAULT; struct zebra_vrf *zvrf; - zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id); + zvrf = ifp->vrf->info; if (zvrf && zvrf->zns) local_ns_id = zvrf->zns->ns_id; diff --git a/zebra/zebra_evpn_neigh.c b/zebra/zebra_evpn_neigh.c index e585f5282..5fb4e0766 100644 --- a/zebra/zebra_evpn_neigh.c +++ b/zebra/zebra_evpn_neigh.c @@ -923,7 +923,7 @@ void zebra_evpn_process_neigh_on_local_mac_change(struct zebra_evpn *zevpn, struct listnode *node = NULL; struct zebra_vrf *zvrf = NULL; - zvrf = vrf_info_lookup(zevpn->vxlan_if->vrf_id); + zvrf = zevpn->vxlan_if->vrf->info; if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug("Processing neighbors on local MAC %pEA %s, VNI %u", @@ -1308,11 +1308,11 @@ int zebra_evpn_local_neigh_update(struct zebra_evpn *zevpn, } } - zvrf = vrf_info_lookup(zevpn->vxlan_if->vrf_id); + zvrf = zevpn->vxlan_if->vrf->info; if (!zvrf) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug(" Unable to find vrf for: %d", - zevpn->vxlan_if->vrf_id); + zevpn->vxlan_if->vrf->vrf_id); return -1; } @@ -2337,7 +2337,7 @@ int zebra_evpn_neigh_del_ip(struct zebra_evpn *zevpn, const struct ipaddr *ip) return 0; } - zvrf = vrf_info_lookup(zevpn->vxlan_if->vrf_id); + zvrf = zevpn->vxlan_if->vrf->info; if (!zvrf) { zlog_debug("%s: VNI %u vrf lookup failed.", __func__, zevpn->vni); diff --git a/zebra/zebra_evpn_vxlan.h b/zebra/zebra_evpn_vxlan.h index c7acd2343..3884a1e7e 100644 --- a/zebra/zebra_evpn_vxlan.h +++ b/zebra/zebra_evpn_vxlan.h @@ -28,7 +28,7 @@ zebra_get_vrr_intf_for_svi(struct interface *ifp) struct interface *tmp_if = NULL; struct zebra_if *zif = NULL; - zvrf = vrf_info_lookup(ifp->vrf_id); + zvrf = ifp->vrf->info; assert(zvrf); FOR_ALL_INTERFACES (zvrf->vrf, tmp_if) { diff --git a/zebra/zebra_l2.c b/zebra/zebra_l2.c index 420bed706..8a9f3dffe 100644 --- a/zebra/zebra_l2.c +++ b/zebra/zebra_l2.c @@ -58,7 +58,7 @@ static void map_slaves_to_bridge(struct interface *br_if, int link, struct zebra_vrf *zvrf; struct zebra_ns *zns; - zvrf = zebra_vrf_lookup_by_id(br_if->vrf_id); + zvrf = br_if->vrf->info; assert(zvrf); zns = zvrf->zns; assert(zns); @@ -425,7 +425,7 @@ void zebra_l2if_update_bridge_slave(struct interface *ifp, zif = ifp->info; assert(zif); - zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id); + zvrf = ifp->vrf->info; if (!zvrf) return; @@ -505,7 +505,7 @@ void zebra_l2if_update_bond_slave(struct interface *ifp, ifindex_t bond_ifindex, /* Set up or remove link with master */ if (bond_ifindex != IFINDEX_INTERNAL) - zebra_l2_map_slave_to_bond(zif, ifp->vrf_id); + zebra_l2_map_slave_to_bond(zif, ifp->vrf->vrf_id); else if (old_bond_ifindex != IFINDEX_INTERNAL) zebra_l2_unmap_slave_from_bond(zif); } diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c index b1d2f1f0b..c23713313 100644 --- a/zebra/zebra_ptm.c +++ b/zebra/zebra_ptm.c @@ -518,7 +518,7 @@ static int zebra_ptm_handle_bfd_msg(void *arg, void *in_ctxt, } if (!strcmp(ZEBRA_PTM_INVALID_VRF, vrf_str) && ifp) { - vrf_id = ifp->vrf_id; + vrf_id = ifp->vrf->vrf_id; } else { struct vrf *pVrf; diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 71503721d..84ab4a718 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -1030,9 +1030,9 @@ static int zevpn_build_hash_table_zns(struct ns *ns, zif->brslave_info.br_if); if (vlan_if) { zevpn->svi_if = vlan_if; - zevpn->vrf_id = vlan_if->vrf_id; + zevpn->vrf_id = vlan_if->vrf->vrf_id; zl3vni = zl3vni_from_vrf( - vlan_if->vrf_id); + vlan_if->vrf->vrf_id); if (zl3vni) listnode_add_sort( zl3vni->l2vnis, zevpn); @@ -2136,7 +2136,7 @@ static int zebra_vxlan_handle_vni_transition(struct zebra_vrf *zvrf, vni_t vni, vlan_if = zvni_map_to_svi(vxl->access_vlan, zif->brslave_info.br_if); if (vlan_if) - zevpn->vrf_id = vlan_if->vrf_id; + zevpn->vrf_id = vlan_if->vrf->vrf_id; zevpn->vxlan_if = ifp; zevpn->local_vtep_ip = vxl->vtep_ip; @@ -3975,7 +3975,7 @@ int zebra_vxlan_check_readd_vtep(struct interface *ifp, return 0; /* Locate VRF corresponding to interface. */ - zvrf = vrf_info_lookup(ifp->vrf_id); + zvrf = ifp->vrf->info; if (!zvrf) return -1; @@ -4697,11 +4697,11 @@ int zebra_vxlan_svi_up(struct interface *ifp, struct interface *link_if) zlog_debug( "SVI %s(%u) VNI %u VRF %s is UP, installing neighbors", ifp->name, ifp->ifindex, zevpn->vni, - vrf_id_to_name(ifp->vrf_id)); + ifp->vrf->name); /* update the vrf information for l2-vni and inform bgp */ zevpn->svi_if = ifp; - zevpn->vrf_id = ifp->vrf_id; + zevpn->vrf_id = ifp->vrf->vrf_id; zl3vni = zl3vni_from_vrf(zevpn->vrf_id); if (zl3vni) @@ -4743,7 +4743,8 @@ void zebra_vxlan_macvlan_down(struct interface *ifp) zlog_debug( "macvlan parent link is not found. Parent index %d ifp %s", zif->link_ifindex, - ifindex2ifname(zif->link_ifindex, ifp->vrf_id)); + ifindex2ifname(zif->link_ifindex, + ifp->vrf->vrf_id)); return; } link_zif = link_ifp->info; @@ -4914,8 +4915,8 @@ int zebra_vxlan_if_up(struct interface *ifp) zif->brslave_info.br_if); if (vlan_if) { zevpn->svi_if = vlan_if; - zevpn->vrf_id = vlan_if->vrf_id; - zl3vni = zl3vni_from_vrf(vlan_if->vrf_id); + zevpn->vrf_id = vlan_if->vrf->vrf_id; + zl3vni = zl3vni_from_vrf(vlan_if->vrf->vrf_id); if (zl3vni) listnode_add_sort_nodup(zl3vni->l2vnis, zevpn); } @@ -5268,8 +5269,8 @@ int zebra_vxlan_if_add(struct interface *ifp) zif->brslave_info.br_if); if (vlan_if) { zevpn->svi_if = vlan_if; - zevpn->vrf_id = vlan_if->vrf_id; - zl3vni = zl3vni_from_vrf(vlan_if->vrf_id); + zevpn->vrf_id = vlan_if->vrf->vrf_id; + zl3vni = zl3vni_from_vrf(vlan_if->vrf->vrf_id); if (zl3vni) listnode_add_sort_nodup(zl3vni->l2vnis, zevpn); } @@ -5278,8 +5279,7 @@ int zebra_vxlan_if_add(struct interface *ifp) zlog_debug( "Add L2-VNI %u VRF %s intf %s(%u) VLAN %u local IP %pI4 mcast_grp %pI4 master %u", vni, - vlan_if ? vrf_id_to_name(vlan_if->vrf_id) - : VRF_DEFAULT_NAME, + vlan_if ? vlan_if->vrf->name : VRF_DEFAULT_NAME, ifp->name, ifp->ifindex, vxl->access_vlan, &vxl->vtep_ip, &vxl->mcast_grp, zif->brslave_info.bridge_ifindex); |