summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-05-06 16:41:40 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2019-05-06 19:42:23 +0200
commit56e7825479d12a9a9cf5e108c02432ea17e5b236 (patch)
tree281733b5c72256ca0e017b1d1dc8100297ef7ba8 /zebra
parentMerge pull request #4233 from qlyoung/fix-zapi-msg-debugs (diff)
downloadfrr-56e7825479d12a9a9cf5e108c02432ea17e5b236.tar.xz
frr-56e7825479d12a9a9cf5e108c02432ea17e5b236.zip
zebra: Be consistent in how we call rib_add( and rib_delete( with tableid
The rib_add( and rib_delete( functions are there to allow kernel interactions with the creation of routes. Fixup the code to be consistent in the passup of the tableid. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/connected.c51
-rw-r--r--zebra/kernel_socket.c8
2 files changed, 39 insertions, 20 deletions
diff --git a/zebra/connected.c b/zebra/connected.c
index 7114a3286..bba221c2c 100644
--- a/zebra/connected.c
+++ b/zebra/connected.c
@@ -209,8 +209,16 @@ void connected_up(struct interface *ifp, struct connected *ifc)
.ifindex = ifp->ifindex,
.vrf_id = ifp->vrf_id,
};
+ struct zebra_vrf *zvrf;
uint32_t metric;
+ zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id);
+ if (!zvrf) {
+ flog_err(EC_ZEBRA_VRF_NOT_FOUND,
+ "%s: Received Up for interface but no associated zvrf: %d",
+ __PRETTY_FUNCTION__, ifp->vrf_id);
+ return;
+ }
if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))
return;
@@ -246,11 +254,11 @@ void connected_up(struct interface *ifp, struct connected *ifc)
metric = (ifc->metric < (uint32_t)METRIC_MAX) ?
ifc->metric : ifp->metric;
- rib_add(afi, SAFI_UNICAST, ifp->vrf_id, ZEBRA_ROUTE_CONNECT, 0, 0, &p,
- NULL, &nh, RT_TABLE_MAIN, metric, 0, 0, 0);
+ rib_add(afi, SAFI_UNICAST, zvrf->vrf->vrf_id, ZEBRA_ROUTE_CONNECT,
+ 0, 0, &p, NULL, &nh, zvrf->table_id, metric, 0, 0, 0);
- rib_add(afi, SAFI_MULTICAST, ifp->vrf_id, ZEBRA_ROUTE_CONNECT, 0, 0, &p,
- NULL, &nh, RT_TABLE_MAIN, metric, 0, 0, 0);
+ rib_add(afi, SAFI_MULTICAST, zvrf->vrf->vrf_id, ZEBRA_ROUTE_CONNECT,
+ 0, 0, &p, NULL, &nh, zvrf->table_id, metric, 0, 0, 0);
if (IS_ZEBRA_DEBUG_RIB_DETAILED) {
char buf[PREFIX_STRLEN];
@@ -260,19 +268,19 @@ void connected_up(struct interface *ifp, struct connected *ifc)
ifp->vrf_id, ifp->name,
prefix2str(&p, buf, sizeof(buf)));
}
- rib_update(ifp->vrf_id, RIB_UPDATE_IF_CHANGE);
+ rib_update(zvrf->vrf->vrf_id, RIB_UPDATE_IF_CHANGE);
/* Schedule LSP forwarding entries for processing, if appropriate. */
- if (ifp->vrf_id == VRF_DEFAULT) {
+ if (zvrf->vrf->vrf_id == VRF_DEFAULT) {
if (IS_ZEBRA_DEBUG_MPLS) {
char buf[PREFIX_STRLEN];
zlog_debug(
"%u: IF %s IP %s address add/up, scheduling MPLS processing",
- ifp->vrf_id, ifp->name,
+ zvrf->vrf->vrf_id, ifp->name,
prefix2str(&p, buf, sizeof(buf)));
}
- mpls_mark_lsps_for_processing(vrf_info_lookup(ifp->vrf_id), &p);
+ mpls_mark_lsps_for_processing(zvrf, &p);
}
}
@@ -377,6 +385,15 @@ void connected_down(struct interface *ifp, struct connected *ifc)
.ifindex = ifp->ifindex,
.vrf_id = ifp->vrf_id,
};
+ struct zebra_vrf *zvrf;
+
+ zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id);
+ if (!zvrf) {
+ flog_err(EC_ZEBRA_VRF_NOT_FOUND,
+ "%s: Received Up for interface but no associated zvrf: %d",
+ __PRETTY_FUNCTION__, ifp->vrf_id);
+ return;
+ }
if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))
return;
@@ -410,34 +427,34 @@ void connected_down(struct interface *ifp, struct connected *ifc)
* Same logic as for connected_up(): push the changes into the
* head.
*/
- rib_delete(afi, SAFI_UNICAST, ifp->vrf_id, ZEBRA_ROUTE_CONNECT, 0, 0,
- &p, NULL, &nh, 0, 0, 0, false);
+ rib_delete(afi, SAFI_UNICAST, zvrf->vrf->vrf_id, ZEBRA_ROUTE_CONNECT,
+ 0, 0, &p, NULL, &nh, zvrf->table_id, 0, 0, false);
- rib_delete(afi, SAFI_MULTICAST, ifp->vrf_id, ZEBRA_ROUTE_CONNECT, 0, 0,
- &p, NULL, &nh, 0, 0, 0, false);
+ rib_delete(afi, SAFI_MULTICAST, zvrf->vrf->vrf_id, ZEBRA_ROUTE_CONNECT,
+ 0, 0, &p, NULL, &nh, zvrf->table_id, 0, 0, false);
if (IS_ZEBRA_DEBUG_RIB_DETAILED) {
char buf[PREFIX_STRLEN];
zlog_debug(
"%u: IF %s IP %s address down, scheduling RIB processing",
- ifp->vrf_id, ifp->name,
+ zvrf->vrf->vrf_id, ifp->name,
prefix2str(&p, buf, sizeof(buf)));
}
- rib_update(ifp->vrf_id, RIB_UPDATE_IF_CHANGE);
+ rib_update(zvrf->vrf->vrf_id, RIB_UPDATE_IF_CHANGE);
/* Schedule LSP forwarding entries for processing, if appropriate. */
- if (ifp->vrf_id == VRF_DEFAULT) {
+ if (zvrf->vrf->vrf_id == VRF_DEFAULT) {
if (IS_ZEBRA_DEBUG_MPLS) {
char buf[PREFIX_STRLEN];
zlog_debug(
"%u: IF %s IP %s address down, scheduling MPLS processing",
- ifp->vrf_id, ifp->name,
+ zvrf->vrf->vrf_id, ifp->name,
prefix2str(&p, buf, sizeof(buf)));
}
- mpls_mark_lsps_for_processing(vrf_info_lookup(ifp->vrf_id), &p);
+ mpls_mark_lsps_for_processing(zvrf, &p);
}
}
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index 13d2185b0..5f4bd3bbc 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -1138,14 +1138,16 @@ void rtm_read(struct rt_msghdr *rtm)
*/
if (rtm->rtm_type == RTM_CHANGE)
rib_delete(afi, SAFI_UNICAST, VRF_DEFAULT, ZEBRA_ROUTE_KERNEL,
- 0, zebra_flags, &p, NULL, NULL, 0, 0, 0, true);
+ 0, zebra_flags, &p, NULL, NULL, RT_TABLE_MAIN,
+ 0, 0, true);
if (rtm->rtm_type == RTM_GET || rtm->rtm_type == RTM_ADD
|| rtm->rtm_type == RTM_CHANGE)
rib_add(afi, SAFI_UNICAST, VRF_DEFAULT, ZEBRA_ROUTE_KERNEL, 0,
- zebra_flags, &p, NULL, &nh, 0, 0, 0, 0, 0);
+ zebra_flags, &p, NULL, &nh, RT_TABLE_MAIN, 0, 0, 0, 0);
else
rib_delete(afi, SAFI_UNICAST, VRF_DEFAULT, ZEBRA_ROUTE_KERNEL,
- 0, zebra_flags, &p, NULL, &nh, 0, 0, 0, true);
+ 0, zebra_flags, &p, NULL, &nh, RT_TABLE_MAIN,
+ 0, 0, true);
}
/* Interface function for the kernel routing table updates. Support