Skip to content

Commit

Permalink
zebra: Prefer local routes when they are the same
Browse files Browse the repository at this point in the history
Currently when a local route directly matches the
connected route the connected route is preferred.
Modify the code such that the local route is preferred
instead.

Old:
L * 192.168.66.1/32 is directly connected, dummy1, 00:31:47
C>* 192.168.66.1/32 is directly connected, dummy1, 00:31:47

New:

C * 192.168.66.1/32 is directly connected, dummy1, 00:00:05
L>* 192.168.66.1/32 is directly connected, dummy1, 00:00:05

Signed-off-by: Donald Sharp <[email protected]>
  • Loading branch information
donaldsharp committed Dec 12, 2023
1 parent 315262c commit fb1f2cc
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions zebra/connected.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,15 @@ void connected_up(struct interface *ifp, struct connected *ifc)
return;
}

if (install_local) {
rib_add(afi, SAFI_UNICAST, zvrf->vrf->vrf_id, ZEBRA_ROUTE_LOCAL,
0, flags, &plocal, NULL, &nh, 0, zvrf->table_id, 0, 0,
0, 0, false);
rib_add(afi, SAFI_MULTICAST, zvrf->vrf->vrf_id,
ZEBRA_ROUTE_LOCAL, 0, flags, &plocal, NULL, &nh, 0,
zvrf->table_id, 0, 0, 0, 0, false);
}

if (!CHECK_FLAG(ifc->flags, ZEBRA_IFA_NOPREFIXROUTE)) {
rib_add(afi, SAFI_UNICAST, zvrf->vrf->vrf_id,
ZEBRA_ROUTE_CONNECT, 0, flags, &p, NULL, &nh, 0,
Expand All @@ -292,15 +301,6 @@ void connected_up(struct interface *ifp, struct connected *ifc)
zvrf->table_id, metric, 0, 0, 0, false);
}

if (install_local) {
rib_add(afi, SAFI_UNICAST, zvrf->vrf->vrf_id, ZEBRA_ROUTE_LOCAL,
0, flags, &plocal, NULL, &nh, 0, zvrf->table_id, 0, 0,
0, 0, false);
rib_add(afi, SAFI_MULTICAST, zvrf->vrf->vrf_id,
ZEBRA_ROUTE_LOCAL, 0, flags, &plocal, NULL, &nh, 0,
zvrf->table_id, 0, 0, 0, 0, false);
}

/* Schedule LSP forwarding entries for processing, if appropriate. */
if (zvrf->vrf->vrf_id == VRF_DEFAULT) {
if (IS_ZEBRA_DEBUG_MPLS)
Expand Down

0 comments on commit fb1f2cc

Please sign in to comment.