Skip to content

Commit

Permalink
Run multicast send and receive test in netlink.
Browse files Browse the repository at this point in the history
  • Loading branch information
bluhm committed Jan 9, 2025
1 parent 12be562 commit 1801dec
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 8 deletions.
4 changes: 2 additions & 2 deletions net.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/perl

# Copyright (c) 2018-2024 Alexander Bluhm <[email protected]>
# Copyright (c) 2018-2025 Alexander Bluhm <[email protected]>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
Expand Down Expand Up @@ -36,7 +36,7 @@
my @allpseudos = qw(none bridge carp gif gif6 gre veb vlan vxlan wg);
my @allsetupmodes = (qw(build install upgrade sysupgrade keep kernel reboot
tools), "cvs,build", "cvs,kernel");
my @alltestmodes = qw(all icmp tcp udp splice);
my @alltestmodes = qw(all icmp tcp udp splice mcast);

my %opts;
getopts('b:c:d:D:h:i:m:N:P:ps:v', \%opts) or do {
Expand Down
12 changes: 8 additions & 4 deletions netbench.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/perl

# Copyright (c) 2022-2024 Alexander Bluhm <[email protected]>
# Copyright (c) 2022-2025 Alexander Bluhm <[email protected]>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
Expand Down Expand Up @@ -29,12 +29,12 @@
);

my %opts;
getopts('A:a:B:b:C:c:d:f:i:l:m:N:P:s:t:v', \%opts) or do {
getopts('A:a:B:b:C:c:d:f:i:l:m:N:P:R:S:s:t:v', \%opts) or do {
print STDERR <<"EOF";
usage: netbench.pl [-v] [-A address] -a address [-B bitrate] [-b bufsize]
[-C pseudo] [-c client] [-d delay] [-f frames] [-i idle] [-l length]
[-m mmsglen] [-P packetrate] [-p pseudo] [-s server] [-t timeout]
[test ...]
[-m mmsglen] [-P packetrate] [-p pseudo] [-R ifaddr] [-S ifaddr]
[-s server] [-t timeout] [test ...]
-A address IP address of relay
-a address IP address for packet destination
-B bitrate bits per seconds send rate
Expand All @@ -47,6 +47,8 @@
-m mmsglen number of mmsghdr for sendmmsg or recvmmsg
-N repeat run instances in parallel with incremented address
-P packet packets per seconds send rate
-R ifaddr multicast receive interface address or name
-S ifaddr multicast send interface address or name
-l length set length of udp payload
-s sever connect via ssh to start packet consumer
-t timeout send duration and receive timeout, default 1
Expand Down Expand Up @@ -235,6 +237,7 @@ sub start_server_udp {
push @cmd, "-m$opts{m}" if defined($opts{m});
push @cmd, "-N$opts{N}" if defined($opts{N});
push @cmd, "-P$opts{P}" if defined($opts{P});
push @cmd, "-I$opts{R}" if defined($opts{R});
push @cmd, '-p0';
push @cmd, "-t$timeout" if defined($opts{t});
push @cmd, ('recv', $proc->{addr});
Expand All @@ -257,6 +260,7 @@ sub start_client_udp {
push @cmd, "-m$opts{m}" if defined($opts{m});
push @cmd, "-N$opts{N}" if defined($opts{N});
push @cmd, "-P$opts{P}" if defined($opts{P});
push @cmd, "-I$opts{S}" if defined($opts{S});
push @cmd, "-p$proc->{port}";
push @cmd, "-t$opts{t}" if defined($opts{t});
push @cmd, ('send', $proc->{addr});
Expand Down
77 changes: 75 additions & 2 deletions netlink.pl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/perl

# Copyright (c) 2022 Moritz Buhl <[email protected]>
# Copyright (c) 2018-2024 Alexander Bluhm <[email protected]>
# Copyright (c) 2018-2025 Alexander Bluhm <[email protected]>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
Expand Down Expand Up @@ -30,7 +30,7 @@
my @allifaces = qw(none bge bnxt em ice igc ix ixl re vio vmx);
my @allmodifymodes = qw(none jumbo nolro nopf notso);
my @allpseudos = qw(none bridge carp gif gif6 gre veb vlan vxlan wg);
my @alltestmodes = sort qw(all icmp tcp udp splice);
my @alltestmodes = sort qw(all icmp tcp udp splice mcast);

my %opts;
getopts('c:e:i:m:t:v', \%opts) or do {
Expand Down Expand Up @@ -193,6 +193,11 @@
my $lnx_r_tunnel_addr6 = "${ip6prefix}${line}4::4";
my $lnx_r_tunnel_net6 = "$lnx_r_tunnel_addr6/64";

my $mcast_l_addr = "234.${ip4prefix}${line}1";
my $mcast_r_addr = "234.${ip4prefix}${line}2";
my $mcast_l_addr6 = "ff34:40:${ip6prefix}${line}1::1";
my $mcast_r_addr6 = "ff34:40:${ip6prefix}${line}2::1";

my (@obsd_l_dest_addr, @obsd_l_dest_addr6,
@obsd_r_dest_addr, @obsd_r_dest_addr6);

Expand Down Expand Up @@ -1249,6 +1254,74 @@ sub pingflood_finalize {
parser => \&netbench_parser,
} if $testmode{splice6};
}
push @tests, {
testcmd => [$netbench,
'-v',
'-B1000000000',
'-b1000000',
'-d1',
'-f1',
'-i0',
'-N10',
"-R$obsd_l_addr",
"-S$lnx_l_addr",
"-c$lnx_l_ssh",
"-a$mcast_l_addr",
'-t10',
'udpbench'],
parser => \&netbench_parser,
} if $testmode{mcast4};
push @tests, {
testcmd => [$netbench,
'-v',
'-B1000000000',
'-b1000000',
'-d1',
'-f1',
'-i0',
'-N10',
"-R$obsd_l_ipdev",
"-S$lnx_ipdev",
"-c$lnx_l_ssh",
"-a$mcast_l_addr6",
'-t10',
'udpbench'],
parser => \&netbench_parser,
} if $testmode{mcast6};
push @tests, {
testcmd => [$netbench,
'-v',
'-B1000000000',
'-b1000000',
'-d1',
'-f1',
'-i0',
'-N10',
"-R$lnx_r_addr",
"-S$obsd_r_addr",
"-s$lnx_r_ssh",
"-a$mcast_r_addr",
'-t10',
'udpbench'],
parser => \&netbench_parser,
} if $testmode{mcast4};
push @tests, {
testcmd => [$netbench,
'-v',
'-B1000000000',
'-b1000000',
'-d1',
'-f1',
'-i0',
'-N10',
"-R$lnx_ipdev",
"-S$obsd_r_ipdev",
"-s$lnx_r_ssh",
"-a$mcast_r_addr6",
'-t10',
'udpbench'],
parser => \&netbench_parser,
} if $testmode{mcast6};

my @stats = (
{
Expand Down

0 comments on commit 1801dec

Please sign in to comment.