diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-01-12 15:20:30 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-01-12 15:20:30 +0100 |
commit | 8f43b4d8868b340a7c61e55372b01f070abfb491 (patch) | |
tree | 86ade99a03d400a521a4345be635fc311bd0c759 /zebra | |
parent | lib: Allow interface lookup by VRF_UNKNOWN (diff) | |
download | frr-8f43b4d8868b340a7c61e55372b01f070abfb491.tar.xz frr-8f43b4d8868b340a7c61e55372b01f070abfb491.zip |
zebra: Add nh_vrf_id to 'struct route_entry`
With VRF route-leaking we need to know what vrf
the nexthops are in compared to this vrf. This
code adds the nh_vrf_id to the route entry and
sets it up correctly for the non-route-leaking
case.
The assumption here is that future commits
will make the nh_vrf_id *different* than
the vrf_id.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra')
-rw-r--r-- | zebra/rib.h | 1 | ||||
-rw-r--r-- | zebra/rt_netlink.c | 1 | ||||
-rw-r--r-- | zebra/zebra_rib.c | 1 | ||||
-rw-r--r-- | zebra/zebra_rnh.c | 2 | ||||
-rw-r--r-- | zebra/zebra_static.c | 1 | ||||
-rw-r--r-- | zebra/zserv.c | 5 |
6 files changed, 11 insertions, 0 deletions
diff --git a/zebra/rib.h b/zebra/rib.h index c7e83480c..c92f54077 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -59,6 +59,7 @@ struct route_entry { /* VRF identifier. */ vrf_id_t vrf_id; + vrf_id_t nh_vrf_id; /* Which routing table */ uint32_t table; diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index a77814668..cb3f598eb 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -453,6 +453,7 @@ static int netlink_route_change_read_unicast(struct sockaddr_nl *snl, re->metric = metric; re->mtu = mtu; re->vrf_id = vrf_id; + re->nh_vrf_id = vrf_id; re->table = table; re->nexthop_num = 0; re->uptime = time(NULL); diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 41e14459b..8caa39427 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -2514,6 +2514,7 @@ int rib_add(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, u_short instance, re->mtu = mtu; re->table = table_id; re->vrf_id = vrf_id; + re->nh_vrf_id = vrf_id; re->nexthop_num = 0; re->uptime = time(NULL); re->tag = tag; diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index 33d0b3a64..3fc496ebb 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -951,6 +951,8 @@ static void copy_state(struct rnh *rnh, struct route_entry *re, state->type = re->type; state->distance = re->distance; state->metric = re->metric; + state->vrf_id = re->vrf_id; + state->nh_vrf_id = re->vrf_id; route_entry_copy_nexthops(state, re->nexthop); rnh->state = state; diff --git a/zebra/zebra_static.c b/zebra/zebra_static.c index 751ea08a3..7fdc4908b 100644 --- a/zebra/zebra_static.c +++ b/zebra/zebra_static.c @@ -155,6 +155,7 @@ void static_install_route(afi_t afi, safi_t safi, struct prefix *p, re->metric = 0; re->mtu = 0; re->vrf_id = si->vrf_id; + re->nh_vrf_id = si->vrf_id; re->table = si->vrf_id ? (zebra_vrf_lookup_by_id(si->vrf_id))->table_id diff --git a/zebra/zserv.c b/zebra/zserv.c index 7eded89f6..6c453516b 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -1146,6 +1146,7 @@ static int zread_route_add(struct zserv *client, u_short length, re->flags = api.flags; re->uptime = time(NULL); re->vrf_id = vrf_id; + re->nh_vrf_id = vrf_id; re->table = zvrf->table_id; if (CHECK_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP)) { @@ -1372,6 +1373,7 @@ static int zread_ipv4_add(struct zserv *client, u_short length, /* VRF ID */ re->vrf_id = zvrf_id(zvrf); + re->nh_vrf_id = zvrf_id(zvrf); /* Nexthop parse. */ if (CHECK_FLAG(message, ZAPI_MESSAGE_NEXTHOP)) { @@ -1581,6 +1583,7 @@ static int zread_ipv4_route_ipv6_nexthop_add(struct zserv *client, /* VRF ID */ re->vrf_id = zvrf_id(zvrf); + re->nh_vrf_id = zvrf_id(zvrf); /* We need to give nh-addr, nh-ifindex with the same next-hop object * to the re to ensure that IPv6 multipathing works; need to coalesce @@ -1866,6 +1869,8 @@ static int zread_ipv6_add(struct zserv *client, u_short length, /* VRF ID */ re->vrf_id = zvrf_id(zvrf); + re->nh_vrf_id = zvrf_id(zvrf); + re->table = zvrf->table_id; ret = rib_add_multipath(AFI_IP6, safi, &p, src_pp, re); |