diff --git a/net.pl b/net.pl index 4bc9a55..ffb2d1b 100755 --- a/net.pl +++ b/net.pl @@ -33,7 +33,7 @@ my @allifaces = qw(bnxt em igc ix ixl); my @allmodifymodes = qw(none jumbo nolro nopf notso); -my @allpseudos = qw(none bridge carp gif veb vlan); +my @allpseudos = qw(none bridge carp gif gre veb vlan); my @allsetupmodes = (qw(build install upgrade sysupgrade keep kernel reboot tools), "cvs,build", "cvs,kernel"); my @alltestmodes = qw(all fragment icmp tcp udp splice); diff --git a/netlink.pl b/netlink.pl index 352fc9e..22b170e 100755 --- a/netlink.pl +++ b/netlink.pl @@ -29,7 +29,7 @@ my @allifaces = qw(none em igc ix ixl bnxt); my @allmodifymodes = qw(none jumbo nolro nopf notso); -my @allpseudos = qw(none bridge carp gif veb vlan); +my @allpseudos = qw(none bridge carp gif gre veb vlan); my @alltestmodes = sort qw(all fragment icmp tcp udp splice); my %opts; @@ -296,6 +296,7 @@ sub good { printcmd('sysctl', 'net.inet.ip.forwarding=1'); printcmd('sysctl', 'net.inet6.ip6.forwarding=1'); +printcmd('sysctl', 'net.inet.gre.allow=1'); # allow tcpbench to bind on ipv6 addresses without explicitly providing it printcmd('ssh', $lnx_l_ssh, 'sysctl','net.ipv6.bindv6only=1'); @@ -510,6 +511,50 @@ sub good { printcmd('ssh', $ssh, 'ip', 'link', 'set', 'dev', $lnx_if, 'up'); } $lnx_ipdev = $lnx_pdev; +} elsif ($pseudo eq 'gre') { + my $gre_l_key = "2${line}1"; + my $gre_r_key = "2${line}2"; + + # configure OpenBSD tunnel addresses + printcmd('ifconfig', $obsd_l_if, 'inet', "$obsd_l_tunnel_addr/24"); + printcmd('ifconfig', $obsd_r_if, 'inet', "$obsd_r_tunnel_addr/24"); + printcmd('ifconfig', 'gre0', 'create'); + printcmd('ifconfig', 'gre1', 'create'); + printcmd('ifconfig', 'gre0', 'vnetid', $gre_l_key, + 'tunnel', $obsd_l_tunnel_addr, $lnx_l_tunnel_addr); + printcmd('ifconfig', 'gre1', 'vnetid', $gre_r_key, + 'tunnel', $obsd_r_tunnel_addr, $lnx_r_tunnel_addr); + printcmd('ifconfig', $obsd_l_if, 'up'); + printcmd('ifconfig', $obsd_r_if, 'up'); + $obsd_l_ipdev = "gre0"; + $obsd_r_ipdev = "gre1"; + $obsd_l_prefix = 32; + $obsd_l_prefix6 = 128; + $obsd_r_prefix = 32; + $obsd_r_prefix6 = 128; + @obsd_l_dest_addr = $lnx_l_addr; + @obsd_l_dest_addr6 = $lnx_l_addr6; + @obsd_r_dest_addr = $lnx_r_addr; + @obsd_r_dest_addr6 = $lnx_r_addr6; + + # configure Linux tunnel addresses + foreach my $ssh ($lnx_l_ssh, $lnx_r_ssh) { + printcmd('ssh', $ssh, 'modprobe', 'ip_gre'); + } + printcmd('ssh', $lnx_l_ssh, 'ip', 'address', 'add', $lnx_l_tunnel_net, + 'dev', $lnx_if); + printcmd('ssh', $lnx_r_ssh, 'ip', 'address', 'add', $lnx_r_tunnel_net, + 'dev', $lnx_if); + printcmd('ssh', $lnx_l_ssh, 'ip', 'link', 'add', 'name', $lnx_pdev, + 'type', 'gre', 'key', $gre_l_key, + 'local', $lnx_l_tunnel_addr, 'remote', $obsd_l_tunnel_addr); + printcmd('ssh', $lnx_r_ssh, 'ip', 'link', 'add', 'name', $lnx_pdev, + 'type', 'gre', 'key', $gre_r_key, + 'local', $lnx_r_tunnel_addr, 'remote', $obsd_r_tunnel_addr); + foreach my $ssh ($lnx_l_ssh, $lnx_r_ssh) { + printcmd('ssh', $ssh, 'ip', 'link', 'set', 'dev', $lnx_if, 'up'); + } + $lnx_ipdev = $lnx_pdev; } elsif ($pseudo eq 'veb') { printcmd('ifconfig', 'veb0', 'create'); printcmd('ifconfig', 'vport0', 'create');