mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 05:27:16 +02:00
Merge pull request #18652 from donaldsharp/pim_ssmpingd
Some checks are pending
build-test / Build the x86 ubuntu 22.04 docker image (push) Waiting to run
build-test / Test ubuntu x86 docker image (push) Blocked by required conditions
build-test / Build the ARM ubuntu 22.04 docker image (push) Waiting to run
build-test / Test ubuntu ARM docker image (push) Blocked by required conditions
Some checks are pending
build-test / Build the x86 ubuntu 22.04 docker image (push) Waiting to run
build-test / Test ubuntu x86 docker image (push) Blocked by required conditions
build-test / Build the ARM ubuntu 22.04 docker image (push) Waiting to run
build-test / Test ubuntu ARM docker image (push) Blocked by required conditions
Fix Pim ssmpingd
This commit is contained in:
commit
1b0bac0e68
|
@ -35,7 +35,8 @@ Installing Topotest Requirements
|
|||
iputils-ping \
|
||||
iptables \
|
||||
tshark \
|
||||
valgrind
|
||||
valgrind \
|
||||
ssmping
|
||||
python3 -m pip install wheel
|
||||
python3 -m pip install 'pytest>=8.3.2' 'pytest-asyncio>=0.24.0' 'pytest-xdist>=3.6.1'
|
||||
python3 -m pip install 'scapy>=2.4.5'
|
||||
|
|
|
@ -66,6 +66,7 @@ RUN apt update && apt upgrade -y && \
|
|||
snmp \
|
||||
snmp-mibs-downloader \
|
||||
snmpd \
|
||||
ssmping \
|
||||
sudo \
|
||||
time \
|
||||
tshark \
|
||||
|
|
|
@ -155,10 +155,13 @@ static inline int ssmpingd_setsockopt(int fd, pim_addr addr, int mttl)
|
|||
|
||||
static int ssmpingd_socket(pim_addr addr, int port, int mttl)
|
||||
{
|
||||
struct sockaddr_storage sockaddr;
|
||||
#if PIM_IPV == 4
|
||||
struct sockaddr_in sockaddr;
|
||||
#else
|
||||
struct sockaddr_in6 sockaddr;
|
||||
#endif
|
||||
int fd;
|
||||
int ret;
|
||||
socklen_t len = sizeof(sockaddr);
|
||||
|
||||
fd = socket(PIM_AF, SOCK_DGRAM, IPPROTO_UDP);
|
||||
if (fd < 0) {
|
||||
|
@ -167,8 +170,15 @@ static int ssmpingd_socket(pim_addr addr, int port, int mttl)
|
|||
__func__, errno, safe_strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
pim_socket_getsockname(fd, (struct sockaddr *)&sockaddr, &len);
|
||||
#if PIM_IPV == 4
|
||||
sockaddr.sin_addr = addr;
|
||||
sockaddr.sin_port = htons(port);
|
||||
sockaddr.sin_family = PIM_AF;
|
||||
#else
|
||||
sockaddr.sin6_addr = addr;
|
||||
sockaddr.sin6_port = htons(port);
|
||||
sockaddr.sin6_family = PIM_AF;
|
||||
#endif
|
||||
|
||||
if (bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr))) {
|
||||
zlog_warn(
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
router bgp 65001
|
||||
no bgp ebgp-requires-policy
|
||||
neighbor 10.0.30.3 remote-as external
|
||||
neighbor 10.0.30.3 timers 3 10
|
||||
redistribute connected
|
32
tests/topotests/pim_basic/r1/frr.conf
Normal file
32
tests/topotests/pim_basic/r1/frr.conf
Normal file
|
@ -0,0 +1,32 @@
|
|||
hostname r1
|
||||
!
|
||||
service integrated-vtysh-config
|
||||
!
|
||||
interface r1-eth0
|
||||
ip address 10.0.20.1/24
|
||||
ip igmp
|
||||
ip pim
|
||||
!
|
||||
interface r1-eth1
|
||||
ip address 10.0.30.1/24
|
||||
ip pim
|
||||
!
|
||||
interface r1-eth2
|
||||
ip address 10.0.40.1/24
|
||||
ip igmp
|
||||
ip pim
|
||||
!
|
||||
interface lo
|
||||
ip address 10.254.0.1/32
|
||||
ip pim
|
||||
!
|
||||
router bgp 65001
|
||||
no bgp ebgp-requires-policy
|
||||
neighbor 10.0.30.3 remote-as external
|
||||
neighbor 10.0.30.3 timers 3 10
|
||||
redistribute connected
|
||||
!
|
||||
router pim
|
||||
rp 10.254.0.3
|
||||
join-prune-interval 5
|
||||
!
|
|
@ -1,18 +0,0 @@
|
|||
hostname r1
|
||||
!
|
||||
interface r1-eth0
|
||||
ip igmp
|
||||
ip pim
|
||||
!
|
||||
interface r1-eth1
|
||||
ip pim
|
||||
!
|
||||
interface r1-eth2
|
||||
ip igmp
|
||||
ip pim
|
||||
!
|
||||
interface lo
|
||||
ip pim
|
||||
!
|
||||
ip pim rp 10.254.0.3
|
||||
ip pim join-prune-interval 5
|
|
@ -1,14 +0,0 @@
|
|||
hostname r1
|
||||
!
|
||||
interface r1-eth0
|
||||
ip address 10.0.20.1/24
|
||||
!
|
||||
interface r1-eth1
|
||||
ip address 10.0.30.1/24
|
||||
!
|
||||
interface r1-eth2
|
||||
ip address 10.0.40.1/24
|
||||
!
|
||||
interface lo
|
||||
ip address 10.254.0.1/32
|
||||
!
|
|
@ -1,8 +1,15 @@
|
|||
hostname r2
|
||||
!
|
||||
frr version 8.4
|
||||
frr defaults traditional
|
||||
!
|
||||
service integrated-vtysh-config
|
||||
!
|
||||
interface r2-eth0
|
||||
ip address 10.0.20.2/24
|
||||
!
|
||||
interface lo
|
||||
ip address 10.254.0.2/32
|
||||
!
|
||||
line vty
|
||||
!
|
|
@ -1 +0,0 @@
|
|||
hostname r2
|
|
@ -1,5 +1,8 @@
|
|||
hostname r3
|
||||
!
|
||||
!
|
||||
service integrated-vtysh-config
|
||||
!
|
||||
interface r3-eth0
|
||||
ip address 10.0.40.4/24
|
||||
!
|
|
@ -1 +0,0 @@
|
|||
hostname r3
|
|
@ -1,5 +0,0 @@
|
|||
router bgp 65003
|
||||
no bgp ebgp-requires-policy
|
||||
neighbor 10.0.30.1 remote-as external
|
||||
neighbor 10.0.30.1 timers 3 10
|
||||
redistribute connected
|
26
tests/topotests/pim_basic/rp/frr.conf
Normal file
26
tests/topotests/pim_basic/rp/frr.conf
Normal file
|
@ -0,0 +1,26 @@
|
|||
hostname rp
|
||||
!
|
||||
!
|
||||
service integrated-vtysh-config
|
||||
!
|
||||
interface rp-eth0
|
||||
ip address 10.0.30.3/24
|
||||
ip pim
|
||||
!
|
||||
interface lo
|
||||
ip address 10.254.0.3/32
|
||||
ip pim
|
||||
!
|
||||
router bgp 65003
|
||||
no bgp ebgp-requires-policy
|
||||
neighbor 10.0.30.1 remote-as external
|
||||
neighbor 10.0.30.1 timers 3 10
|
||||
redistribute connected
|
||||
!
|
||||
router pim
|
||||
join-prune-interval 5
|
||||
rp 10.254.0.3
|
||||
register-accept-list ACCEPT
|
||||
!
|
||||
ip prefix-list ACCEPT seq 5 permit 10.0.20.0/24 le 32
|
||||
!
|
|
@ -1,13 +0,0 @@
|
|||
hostname rp
|
||||
!
|
||||
interface rp-eth0
|
||||
ip pim
|
||||
!
|
||||
interface lo
|
||||
ip pim
|
||||
!
|
||||
ip pim join-prune-interval 5
|
||||
ip pim rp 10.254.0.3
|
||||
ip pim register-accept-list ACCEPT
|
||||
|
||||
ip prefix-list ACCEPT seq 5 permit 10.0.20.0/24 le 32
|
|
@ -1,8 +0,0 @@
|
|||
hostname rp
|
||||
!
|
||||
interface rp-eth0
|
||||
ip address 10.0.30.3/24
|
||||
!
|
||||
interface lo
|
||||
ip address 10.254.0.3/32
|
||||
!
|
|
@ -71,16 +71,15 @@ def setup_module(mod):
|
|||
tgen = Topogen(build_topo, mod.__name__)
|
||||
tgen.start_topology()
|
||||
|
||||
# For all registered routers, load the zebra configuration file
|
||||
# For all registered routers, load the integrated configuration file
|
||||
for rname, router in tgen.routers().items():
|
||||
router.load_config(
|
||||
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
|
||||
)
|
||||
router.load_config(
|
||||
TopoRouter.RD_PIM, os.path.join(CWD, "{}/pimd.conf".format(rname))
|
||||
)
|
||||
router.load_config(
|
||||
TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname))
|
||||
router.load_frr_config(
|
||||
os.path.join(CWD, "{}/frr.conf".format(rname)),
|
||||
[
|
||||
(TopoRouter.RD_ZEBRA, None),
|
||||
(TopoRouter.RD_PIM, None),
|
||||
(TopoRouter.RD_BGP, None),
|
||||
],
|
||||
)
|
||||
|
||||
# After loading the configurations, this function loads configured daemons.
|
||||
|
@ -218,6 +217,27 @@ def test_pim_igmp_report():
|
|||
p.wait()
|
||||
|
||||
|
||||
def test_pim_ssm_ping():
|
||||
"Test SSM ping functionality between r1 and r2"
|
||||
logger.info("Testing SSM ping from r1 to r2")
|
||||
|
||||
tgen = get_topogen()
|
||||
|
||||
if tgen.routers_have_failure():
|
||||
pytest.skip(tgen.errors)
|
||||
|
||||
r1 = tgen.gears["r1"]
|
||||
r2 = tgen.gears["r2"]
|
||||
|
||||
r2.vtysh_cmd("conf\nip ssmpingd 10.0.20.2")
|
||||
|
||||
# Run ssmping from r1 to r2
|
||||
output = r1.run("ssmping -I r1-eth0 10.0.20.2 -c 5")
|
||||
|
||||
# Check if we got successful responses
|
||||
assert "5 packets received" in output, "SSM ping failed"
|
||||
|
||||
|
||||
def test_memory_leak():
|
||||
"Run the memory leak test and report results."
|
||||
tgen = get_topogen()
|
||||
|
|
Loading…
Reference in a new issue