Skip to content

Commit

Permalink
Merge pull request FRRouting#15259 from dmytroshytyi-6WIND/nexthop_re…
Browse files Browse the repository at this point in the history
…solution

zebra: add LSP entry to nexthop via recursive (part 2)
  • Loading branch information
riw777 authored Sep 10, 2024
2 parents b774fc6 + b2c2113 commit add56c6
Show file tree
Hide file tree
Showing 40 changed files with 1,078 additions and 33 deletions.
17 changes: 16 additions & 1 deletion bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -4634,7 +4634,22 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
if (aspath_get_last_as(attr->aspath) == bgp->as)
do_loop_check = 0;

if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
/* When using bgp ipv4 labeled session, the local prefix is
* received by a peer, and finds out that the proposed prefix
* and its next-hop are the same. To avoid a route loop locally,
* no nexthop entry is referenced for that prefix, and the route
* will not be selected.
*
* As it has been done for ipv4-unicast, apply the following fix
* for labeled address families: when the received peer is
* a route reflector, the prefix has to be selected, even if the
* route can not be installed locally.
*/
if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT) ||
(safi == SAFI_UNICAST && !peer->afc[afi][safi] &&
peer->afc[afi][SAFI_LABELED_UNICAST] &&
CHECK_FLAG(peer->af_flags[afi][SAFI_LABELED_UNICAST],
PEER_FLAG_REFLECTOR_CLIENT)))
bgp_nht_param_prefix = NULL;
else
bgp_nht_param_prefix = p;
Expand Down
10 changes: 10 additions & 0 deletions doc/user/zebra.rst
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,16 @@ Allocated label chunks table can be dumped using the command
range is configured, static label requests that match that
range are not accepted.

FEC nexthop entry resolution over MPLS networks
-----------------------------------------------

The LSP associated with a BGP labeled route is normally restricted to
directly-connected nexthops. If connected nexthops are not available,
the LSP entry will not be installed. This command permits the use of
recursive resolution for LSPs, similar to that available for IP routes.

.. clicmd:: mpls fec nexthop-resolution

.. _zebra-srv6:

Segment-Routing IPv6
Expand Down
9 changes: 9 additions & 0 deletions lib/nexthop.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,15 @@ struct nexthop *nexthop_next(const struct nexthop *nexthop)
return NULL;
}

struct nexthop *nexthop_next_resolution(const struct nexthop *nexthop,
bool nexthop_resolution)
{
if (nexthop_resolution)
return nexthop_next(nexthop);
/* no resolution attempt */
return nexthop->next;
}

/* Return the next nexthop in the tree that is resolved and active */
struct nexthop *nexthop_next_active_resolved(const struct nexthop *nexthop)
{
Expand Down
2 changes: 2 additions & 0 deletions lib/nexthop.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ extern bool nexthop_labels_match(const struct nexthop *nh1,
extern const char *nexthop2str(const struct nexthop *nexthop,
char *str, int size);
extern struct nexthop *nexthop_next(const struct nexthop *nexthop);
extern struct nexthop *nexthop_next_resolution(const struct nexthop *nexthop,
bool nexthop_resolution);
extern struct nexthop *
nexthop_next_active_resolved(const struct nexthop *nexthop);
extern unsigned int nexthop_level(const struct nexthop *nexthop);
Expand Down
Empty file.
24 changes: 24 additions & 0 deletions tests/topotests/zebra_fec_nexthop_resolution/r1/bgpd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
!
router bgp 65500
bgp router-id 192.0.2.1
neighbor 192.0.2.3 remote-as 65500
neighbor 192.0.2.3 update-source lo
neighbor 192.0.2.7 remote-as 65500
neighbor 192.0.2.7 ttl-security hops 10
neighbor 192.0.2.7 disable-connected-check
neighbor 192.0.2.7 update-source lo
!
address-family ipv4 unicast
network 192.0.2.1/32
no neighbor 192.0.2.3 activate
neighbor 192.0.2.7 activate
exit-address-family
!
address-family ipv4 labeled-unicast
neighbor 192.0.2.3 activate
neighbor 192.0.2.3 route-reflector-client
neighbor 192.0.2.3 next-hop-self force
exit-address-family
!
exit
!
25 changes: 25 additions & 0 deletions tests/topotests/zebra_fec_nexthop_resolution/r1/ospfd.conf.after
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
log stdout
!
interface lo
ip ospf passive
exit
!
interface r1-eth0
ip ospf network point-to-point
ip ospf hello-interval 1
exit
!
router ospf
ospf router-id 192.0.2.1
network 192.0.2.1/32 area 0.0.0.0
network 192.168.1.0/24 area 0.0.0.0
passive-interface lo
capability opaque
mpls-te on
mpls-te router-address 192.0.2.1
segment-routing on
segment-routing global-block 1000 10000 local-block 32000 32999
segment-routing node-msd 8
segment-routing prefix 192.0.2.1/32 index 11
exit
!
13 changes: 13 additions & 0 deletions tests/topotests/zebra_fec_nexthop_resolution/r1/zebra.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
interface lo
ip address 192.0.2.1/32
mpls enable
exit
!
interface r1-eth0
ip address 192.168.1.1/24
mpls enable
link-params
enable
exit-link-params
exit
!
23 changes: 23 additions & 0 deletions tests/topotests/zebra_fec_nexthop_resolution/r2/bgpd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
router bgp 65500
bgp router-id 192.0.2.2
neighbor 192.0.2.1 remote-as 65500
neighbor 192.0.2.1 update-source lo
neighbor 192.0.2.3 remote-as 65500
neighbor 192.0.2.3 update-source lo
!
address-family ipv4 unicast
network 192.0.2.2/32
no neighbor 192.0.2.1 activate
no neighbor 192.0.2.3 activate
exit-address-family
!
address-family ipv4 labeled-unicast
neighbor 192.0.2.1 activate
neighbor 192.0.2.1 route-reflector-client
neighbor 192.0.2.1 next-hop-self force
neighbor 192.0.2.3 activate
neighbor 192.0.2.3 route-reflector-client
neighbor 192.0.2.3 next-hop-self force
exit-address-family
exit
!
25 changes: 25 additions & 0 deletions tests/topotests/zebra_fec_nexthop_resolution/r2/isisd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
!
interface lo
ip router isis 1
isis hello-interval 1
isis hello-multiplier 3
exit
!
interface r2-eth1
ip router isis 2
isis hello-interval 1
isis hello-multiplier 3
exit
!
router isis 1
is-type level-1
net 49.0000.0007.e901.2223.00
lsp-timers gen-interval 1 refresh-interval 900 max-lifetime 1200
mpls-te on
mpls-te router-address 192.0.2.2
segment-routing on
segment-routing global-block 11000 20000 local-block 36000 36999
segment-routing node-msd 8
segment-routing prefix 192.0.2.2/32 index 22 no-php-flag
exit
!
32 changes: 32 additions & 0 deletions tests/topotests/zebra_fec_nexthop_resolution/r2/ospfd.conf.after
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
log stdout
!
interface lo
ip ospf network point-to-point
ip ospf passive
exit
!
interface r2-eth0
ip ospf network point-to-point
ip ospf hello-interval 1
exit
!
interface r2-eth1
ip ospf network point-to-point
ip ospf hello-interval 1
exit
!
router ospf
ospf router-id 192.0.2.2
network 192.0.2.2/32 area 0.0.0.0
network 192.168.1.0/24 area 0.0.0.0
network 192.168.2.0/24 area 0.0.0.0
passive-interface lo
capability opaque
mpls-te on
mpls-te router-address 192.0.2.2
segment-routing on
segment-routing global-block 1000 10000 local-block 36000 36999
segment-routing node-msd 8
segment-routing prefix 192.0.2.2/32 index 22
exit
!
16 changes: 16 additions & 0 deletions tests/topotests/zebra_fec_nexthop_resolution/r2/zebra.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
!
interface lo
ip address 192.0.2.2/32
mpls enable
exit
!
interface r2-eth0
ip address 192.168.1.2/24
mpls enable
exit
!
interface r2-eth1
ip address 192.168.2.2/24
mpls enable
exit
!
23 changes: 23 additions & 0 deletions tests/topotests/zebra_fec_nexthop_resolution/r3/bgpd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
router bgp 65500
bgp router-id 192.0.2.3
neighbor 192.0.2.1 remote-as 65500
neighbor 192.0.2.1 update-source lo
neighbor 192.0.2.5 remote-as 65500
neighbor 192.0.2.5 update-source lo
!
address-family ipv4 unicast
network 192.0.2.3/32
no neighbor 192.0.2.1 activate
no neighbor 192.0.2.5 activate
exit-address-family
!
address-family ipv4 labeled-unicast
neighbor 192.0.2.1 activate
neighbor 192.0.2.1 route-reflector-client
neighbor 192.0.2.1 next-hop-self force
neighbor 192.0.2.5 activate
neighbor 192.0.2.5 route-reflector-client
neighbor 192.0.2.5 next-hop-self force
exit-address-family
exit
!
25 changes: 25 additions & 0 deletions tests/topotests/zebra_fec_nexthop_resolution/r3/isisd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
!
interface lo
ip router isis 1
isis hello-interval 1
isis hello-multiplier 3
exit
!
interface r3-eth1
ip router isis 1
isis hello-interval 1
isis hello-multiplier 3
exit
!
router isis 1
is-type level-1
net 49.0000.0007.e901.3333.00
lsp-timers gen-interval 1 refresh-interval 900 max-lifetime 1200
mpls-te on
mpls-te router-address 192.0.2.3
segment-routing on
segment-routing global-block 11000 12000 local-block 36000 36999
segment-routing node-msd 8
segment-routing prefix 192.0.2.3/32 index 33
exit
!
26 changes: 26 additions & 0 deletions tests/topotests/zebra_fec_nexthop_resolution/r3/ospfd.conf.after
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
log stdout
!
interface lo
ip ospf network point-to-point
ip ospf passive
exit
!
interface r3-eth0
ip ospf network point-to-point
ip ospf hello-interval 1
exit
!
router ospf
ospf router-id 192.0.2.3
network 192.0.2.3/32 area 0.0.0.0
network 192.168.2.0/24 area 0.0.0.0
passive-interface lo
capability opaque
mpls-te on
mpls-te router-address 192.0.2.3
segment-routing on
segment-routing global-block 1000 10000 local-block 30000 30999
segment-routing node-msd 8
segment-routing prefix 192.0.2.3/32 index 33
exit
!
19 changes: 19 additions & 0 deletions tests/topotests/zebra_fec_nexthop_resolution/r3/zebra.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
!
interface lo
ip address 192.0.2.3/32
mpls enable
exit
!
interface r3-eth0
ip address 192.168.2.3/24
mpls enable
link-params
enable
exit-link-params
exit
!
interface r3-eth1
ip address 192.168.3.3/24
mpls enable
exit
!
24 changes: 24 additions & 0 deletions tests/topotests/zebra_fec_nexthop_resolution/r4/bgpd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
!
router bgp 65500
bgp router-id 192.0.2.4
neighbor 192.0.2.1 remote-as 65500
neighbor 192.0.2.1 ttl-security hops 10
neighbor 192.0.2.1 disable-connected-check
neighbor 192.0.2.1 update-source lo
neighbor 192.0.2.3 remote-as 65500
neighbor 192.0.2.3 update-source lo
!
address-family ipv4 unicast
network 192.0.2.4/32
neighbor 192.0.2.1 activate
no neighbor 192.0.2.3 activate
exit-address-family
!
address-family ipv4 labeled-unicast
neighbor 192.0.2.3 activate
neighbor 192.0.2.3 route-reflector-client
neighbor 192.0.2.3 next-hop-self force
exit-address-family
!
exit
!
31 changes: 31 additions & 0 deletions tests/topotests/zebra_fec_nexthop_resolution/r4/isisd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
!
interface lo
ip router isis 1
isis hello-interval 1
isis hello-multiplier 3
exit
!
interface r4-eth0
ip router isis 1
isis hello-interval 1
isis hello-multiplier 3
exit
!
interface r4-eth1
ip router isis 1
isis hello-interval 1
isis hello-multiplier 3
exit
!
router isis 1
is-type level-1
net 49.0000.0007.e901.4444.00
lsp-timers gen-interval 1 refresh-interval 900 max-lifetime 1200
mpls-te on
mpls-te router-address 192.0.2.4
segment-routing on
segment-routing global-block 11000 12000 local-block 37000 37999
segment-routing node-msd 8
segment-routing prefix 192.0.2.4/32 index 44
exit
!
Loading

0 comments on commit add56c6

Please sign in to comment.