Skip to content

Commit

Permalink
Merge pull request #17256 from FRRouting/mergify/bp/dev/10.2/pr-17216
Browse files Browse the repository at this point in the history
pimd, tests: fix bsr assert and expand topotest to pimv6 (backport #17216)
  • Loading branch information
Jafaral authored Oct 28, 2024
2 parents 4309d91 + 288d274 commit f6ef4e9
Show file tree
Hide file tree
Showing 9 changed files with 405 additions and 56 deletions.
14 changes: 12 additions & 2 deletions pimd/pim_bsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1650,8 +1650,18 @@ static void pim_cand_bsr_pending_expire(struct event *t)
struct bsm_scope *scope = EVENT_ARG(t);

assertf(scope->state == BSR_PENDING, "state=%d", scope->state);
assertf(pim_addr_is_any(scope->current_bsr), "current_bsr=%pPA",
&scope->current_bsr);

if (!pim_addr_is_any(scope->current_bsr)) {
assertf(scope->cand_bsr_prio >= scope->current_bsr_prio,
"cand_bsr %pPA prio %u is less than current_bsr %pPA prio %u",
&scope->bsr_addrsel.run_addr, scope->current_bsr_prio, &scope->current_bsr,
scope->cand_bsr_prio);

if (scope->cand_bsr_prio == scope->current_bsr_prio)
assertf(pim_addr_cmp(scope->bsr_addrsel.run_addr, scope->current_bsr) > 0,
"cand_bsr %pPA < current_bsr %pPA", &scope->bsr_addrsel.run_addr,
&scope->current_bsr);
}

if (PIM_DEBUG_BSM)
zlog_debug("Elected BSR, wait expired without preferable BSMs");
Expand Down
31 changes: 26 additions & 5 deletions pimd/pim_nht.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,19 @@ bool pim_nht_bsr_rpf_check(struct pim_instance *pim, pim_addr bsr_addr,
nbr = pim_neighbor_find(ifp, znh->nexthop_addr, true);
if (!nbr)
continue;

return znh->ifindex == src_ifp->ifindex &&
(!pim_addr_cmp(znh->nexthop_addr, src_ip));
/* Are we on the correct interface? */
if (znh->ifindex == src_ifp->ifindex) {
/* Do we have the correct NH ? */
if (!pim_addr_cmp(znh->nexthop_addr, src_ip))
return true;
/*
* check If the packet came from the neighbor,
* and the dst is a secondary address on the connected interface
*/
return (!pim_addr_cmp(nbr->source_addr, src_ip) &&
pim_if_connected_to_source(ifp, znh->nexthop_addr));
}
return false;
}
return false;
}
Expand Down Expand Up @@ -409,8 +419,19 @@ bool pim_nht_bsr_rpf_check(struct pim_instance *pim, pim_addr bsr_addr,
if (!nbr)
continue;

return nh->ifindex == src_ifp->ifindex &&
(!pim_addr_cmp(nhaddr, src_ip));
/* Are we on the correct interface? */
if (nh->ifindex == src_ifp->ifindex) {
/* Do we have the correct NH ? */
if (!pim_addr_cmp(nhaddr, src_ip))
return true;
/*
* check If the packet came from the neighbor,
* and the dst is a secondary address on the connected interface
*/
return (!pim_addr_cmp(nbr->source_addr, src_ip) &&
pim_if_connected_to_source(ifp, nhaddr));
}
return false;
}
return false;
}
Expand Down
26 changes: 25 additions & 1 deletion tests/topotests/pim_cand_rp_bsr/r1/frr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,45 @@ log file /tmp/r1-frr.log
!
!debug pim packet
!debug pim bsm
!debug pimv6 bsm
!
ip route 0.0.0.0/0 10.0.0.4
!
interface lo
ip address 10.0.0.1/32
ipv6 address fd00:0:0:0::1/128
ip pim
ipv6 pim
ipv6 ospf6 area 0
!
interface r1-eth0
ip address 10.0.0.1/24
ipv6 address fd00:0:0:0::1/64
ip igmp
ip pim
ipv6 pim
ipv6 ospf6 area 0
!
interface r1-eth1
ip address 10.0.1.1/24
ipv6 address fd00:0:0:1::1/64
ip igmp
ip pim
ipv6 pim
ipv6 ospf6 area 0
!
router pim
bsr candidate-bsr priority 200 source address 10.0.0.1
!
router pim6
bsr candidate-bsr priority 200 source address fd00:0:0:0::1
!
router ospf
ospf router-id 10.0.0.1
network 10.0.0.0/16 area 0
!
router ospf6
ospf6 router-id 10.0.0.1
!
ip forwarding
ipv6 forwarding
!
30 changes: 28 additions & 2 deletions tests/topotests/pim_cand_rp_bsr/r2/frr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,46 @@ hostname r2
password zebra
log file /tmp/r2-frr.log
!
ip route 0.0.0.0/0 10.0.0.4
!debug pim packet
!debug pim bsm
!debug pimv6 bsm
!
interface lo
ip address 10.0.0.2/32
ipv6 address fd00:0:0:0::2/128
ip pim
ipv6 pim
ipv6 ospf6 area 0
!
interface r2-eth0
ip address 10.0.0.2/24
ipv6 address fd00:0:0:0::2/64
ip igmp
ip pim
ipv6 pim
ipv6 ospf6 area 0
!
interface r2-eth1
ip address 10.0.2.2/24
ipv6 address fd00:0:0:2::2/64
ip igmp
ip pim
ipv6 pim
ipv6 ospf6 area 0
!
router pim
bsr candidate-bsr priority 100 source address 10.0.0.2
bsr candidate-bsr priority 100
!
router pim6
bsr candidate-bsr priority 100
!
router ospf
ospf router-id 10.0.0.2
network 10.0.0.0/16 area 0
!
router ospf6
ospf6 router-id 10.0.0.2
!
ip forwarding
ipv6 forwarding
!
24 changes: 22 additions & 2 deletions tests/topotests/pim_cand_rp_bsr/r3/frr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,48 @@ log file /tmp/r3-frr.log
!
!debug pim packet
!debug pim bsm
!debug pimv6 bsm
!
ip route 0.0.0.0/0 10.0.3.4
ip route 10.0.6.0/24 10.0.3.6
!
interface r3-eth0
ip address 10.0.1.3/24
ipv6 address fd00:0:0:1::3/64
ip igmp
ip pim
ipv6 pim
ipv6 ospf6 area 0
!
interface r3-eth1
ip address 10.0.3.3/24
ipv6 address fd00:0:0:3::3/64
ip igmp
ip pim
ipv6 pim
ipv6 ospf6 area 0
!
interface r3-eth2
ip address 10.0.4.3/24
ipv6 address fd00:0:0:4::3/64
ip igmp
ip pim
ipv6 pim
ipv6 ospf6 area 0
!
router pim
bsr candidate-rp group 239.0.0.0/16
bsr candidate-rp priority 10 source address 10.0.3.3
!
router pim6
bsr candidate-rp group ffbb::/64
bsr candidate-rp priority 10 source address fd00:0:0:3::3
!
router ospf
ospf router-id 10.0.1.3
network 10.0.0.0/16 area 0
!
router ospf6
ospf6 router-id 10.0.1.3
!
ip forwarding
ipv6 forwarding
!
37 changes: 33 additions & 4 deletions tests/topotests/pim_cand_rp_bsr/r4/frr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,64 @@ hostname r4
password zebra
log file /tmp/r4-frr.log
!
ip route 10.0.1.0/24 10.0.0.1
ip route 10.0.4.0/24 10.0.3.3
ip route 10.0.6.0/24 10.0.3.6
!
interface lo
ip address 10.0.3.4/32
ipv6 address fd00:0:0:3::4/64
ip pim
ipv6 pim
!
interface r4-eth0
ip address 10.0.2.4/24
ipv6 address fd00:0:0:2::4/64
ip igmp
ip pim
ipv6 pim
ipv6 ospf6 area 0
!
interface r4-eth1
ip address 10.0.3.4/24
ipv6 address fd00:0:0:3::4/64
ip igmp
ip pim
ipv6 pim
ipv6 ospf6 area 0
!
interface r4-eth2
ip address 10.0.5.4/24
ipv6 address fd00:0:0:5::4/64
ip igmp
ip pim
ipv6 pim
ipv6 ospf6 area 0
!
interface r4-eth3
ip address 10.0.0.4/24
ipv6 address fd00:0:0:0::4/64
ip igmp
ip pim
ipv6 pim
ipv6 ospf6 area 0
!
router pim
bsr candidate-rp group 239.0.0.0/24
bsr candidate-rp group 239.0.0.0/16
bsr candidate-rp group 239.0.0.0/8
bsr candidate-rp priority 20 source address 10.0.3.4
bsr candidate-rp priority 20
!
router pim6
bsr candidate-rp group ffbb::/124
bsr candidate-rp group ffbb::/64
bsr candidate-rp group ffbb::/108
bsr candidate-rp priority 20
!
router ospf
ospf router-id 10.0.2.4
network 10.0.0.0/16 area 0
!
router ospf6
ospf6 router-id 10.0.2.4
!
ip forwarding
ipv6 forwarding
!
19 changes: 18 additions & 1 deletion tests/topotests/pim_cand_rp_bsr/r5/frr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,32 @@ hostname r5
password zebra
log file /tmp/r5-frr.log
!
ip route 0.0.0.0/0 10.0.4.3
!
interface r5-eth0
ip address 10.0.4.5/24
ipv6 address fd00:0:0:4::5/64
ip igmp
ip pim
ipv6 pim
ipv6 ospf6 area 0
!
interface r5-eth1
ip address 10.0.6.5/24
ipv6 address fd00:0:0:6::5/64
ip igmp
ip pim
ipv6 pim
ipv6 ospf6 area 0
!
router pim6
!
router ospf
ospf router-id 10.0.4.5
network 10.0.0.0/16 area 0
!
router ospf6
ospf6 router-id 10.0.4.5
!
ip forwarding
ipv6 forwarding
!
22 changes: 21 additions & 1 deletion tests/topotests/pim_cand_rp_bsr/r6/frr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,40 @@ hostname r6
password zebra
log file /tmp/r6-frr.log
!
ip route 0.0.0.0/0 10.0.6.6
!
interface r6-eth0
ip address 10.0.5.6/24
ipv6 address fd00:0:0:5::6/64
ip igmp
ip pim
ipv6 pim
ipv6 ospf6 area 0
!
interface r6-eth1
ip address 10.0.6.6/24
ipv6 address fd00:0:0:6::6/64
ip igmp
ip pim
ipv6 pim
ipv6 ospf6 area 0
!
interface r6-eth2
ip address 10.0.3.6/24
ipv6 address fd00:0:0:3::6/64
ip igmp
ip pim
ipv6 pim
ipv6 ospf6 area 0
!
router pim6
!
router ospf
ospf router-id 10.0.5.6
network 10.0.0.0/16 area 0
!
router ospf6
ospf6 router-id 10.0.5.6
!
ip forwarding
ipv6 forwarding
!
Loading

0 comments on commit f6ef4e9

Please sign in to comment.