diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-06-15 14:27:35 -0400 |
|---|---|---|
| committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2019-08-06 22:41:28 -0300 |
| commit | 0e64ed022892be68b9655a81c82094378c2eb10f (patch) | |
| tree | a2f408d3b9cccd6b407efdc239ec3060e692492d /eigrpd/eigrp_zebra.c | |
| parent | e944996140173700f73281cf7efc444377eec331 (diff) | |
eigrpd: Convert eigrp_zebra.c to use appropriate vrf_id
Use the appropriate vrf_id in eigrp_zebra based off of the
struct eigrp *eigrp.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'eigrpd/eigrp_zebra.c')
| -rw-r--r-- | eigrpd/eigrp_zebra.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/eigrpd/eigrp_zebra.c b/eigrpd/eigrp_zebra.c index 1252593826..63cbe84ef2 100644 --- a/eigrpd/eigrp_zebra.c +++ b/eigrpd/eigrp_zebra.c @@ -59,7 +59,8 @@ static int eigrp_interface_address_add(ZAPI_CALLBACK_ARGS); static int eigrp_interface_address_delete(ZAPI_CALLBACK_ARGS); static int eigrp_interface_state_up(ZAPI_CALLBACK_ARGS); static int eigrp_interface_state_down(ZAPI_CALLBACK_ARGS); -static struct interface *zebra_interface_if_lookup(struct stream *); +static struct interface *zebra_interface_if_lookup(struct stream *, + vrf_id_t vrf_id); static int eigrp_zebra_read_route(ZAPI_CALLBACK_ARGS); @@ -257,7 +258,7 @@ static int eigrp_interface_state_up(ZAPI_CALLBACK_ARGS) { struct interface *ifp; - ifp = zebra_interface_if_lookup(zclient->ibuf); + ifp = zebra_interface_if_lookup(zclient->ibuf, vrf_id); if (ifp == NULL) return 0; @@ -328,7 +329,8 @@ static int eigrp_interface_state_down(ZAPI_CALLBACK_ARGS) return 0; } -static struct interface *zebra_interface_if_lookup(struct stream *s) +static struct interface *zebra_interface_if_lookup(struct stream *s, + vrf_id_t vrf_id) { char ifname_tmp[INTERFACE_NAMSIZ]; @@ -336,11 +338,11 @@ static struct interface *zebra_interface_if_lookup(struct stream *s) stream_get(ifname_tmp, s, INTERFACE_NAMSIZ); /* And look it up. */ - return if_lookup_by_name(ifname_tmp, VRF_DEFAULT); + return if_lookup_by_name(ifname_tmp, vrf_id); } -void eigrp_zebra_route_add(struct prefix *p, struct list *successors, - uint32_t distance) +void eigrp_zebra_route_add(struct eigrp *eigrp, struct prefix *p, + struct list *successors, uint32_t distance) { struct zapi_route api; struct zapi_nexthop *api_nh; @@ -352,7 +354,7 @@ void eigrp_zebra_route_add(struct prefix *p, struct list *successors, return; memset(&api, 0, sizeof(api)); - api.vrf_id = VRF_DEFAULT; + api.vrf_id = eigrp->vrf_id; api.type = ZEBRA_ROUTE_EIGRP; api.safi = SAFI_UNICAST; api.metric = distance; @@ -366,7 +368,7 @@ void eigrp_zebra_route_add(struct prefix *p, struct list *successors, if (count >= MULTIPATH_NUM) break; api_nh = &api.nexthops[count]; - api_nh->vrf_id = VRF_DEFAULT; + api_nh->vrf_id = eigrp->vrf_id; if (te->adv_router->src.s_addr) { api_nh->gate.ipv4 = te->adv_router->src; api_nh->type = NEXTHOP_TYPE_IPV4_IFINDEX; @@ -388,7 +390,7 @@ void eigrp_zebra_route_add(struct prefix *p, struct list *successors, zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api); } -void eigrp_zebra_route_delete(struct prefix *p) +void eigrp_zebra_route_delete(struct eigrp *eigrp, struct prefix *p) { struct zapi_route api; @@ -396,7 +398,7 @@ void eigrp_zebra_route_delete(struct prefix *p) return; memset(&api, 0, sizeof(api)); - api.vrf_id = VRF_DEFAULT; + api.vrf_id = eigrp->vrf_id; api.type = ZEBRA_ROUTE_EIGRP; api.safi = SAFI_UNICAST; memcpy(&api.prefix, p, sizeof(*p)); @@ -411,20 +413,20 @@ void eigrp_zebra_route_delete(struct prefix *p) return; } -int eigrp_is_type_redistributed(int type) +static int eigrp_is_type_redistributed(int type, vrf_id_t vrf_id) { return ((DEFAULT_ROUTE_TYPE(type)) ? vrf_bitmap_check(zclient->default_information[AFI_IP], - VRF_DEFAULT) + vrf_id) : vrf_bitmap_check(zclient->redist[AFI_IP][type], - VRF_DEFAULT)); + vrf_id)); } int eigrp_redistribute_set(struct eigrp *eigrp, int type, struct eigrp_metrics metric) { - if (eigrp_is_type_redistributed(type)) { + if (eigrp_is_type_redistributed(type, eigrp->vrf_id)) { if (eigrp_metrics_is_same(metric, eigrp->dmetric[type])) { eigrp->dmetric[type] = metric; } @@ -453,7 +455,7 @@ int eigrp_redistribute_set(struct eigrp *eigrp, int type, int eigrp_redistribute_unset(struct eigrp *eigrp, int type) { - if (eigrp_is_type_redistributed(type)) { + if (eigrp_is_type_redistributed(type, eigrp->vrf_id)) { memset(&eigrp->dmetric[type], 0, sizeof(struct eigrp_metrics)); zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, zclient, AFI_IP, type, 0, eigrp->vrf_id); |
