diff --git a/net.pl b/net.pl index 1622f6c..a61d920 100755 --- a/net.pl +++ b/net.pl @@ -33,7 +33,7 @@ my @allifaces = qw(bnxt em igc ix ixl re vio vmx); my @allmodifymodes = qw(none jumbo nolro nopf notso); -my @allpseudos = qw(none bridge carp gif gre veb vlan wg); +my @allpseudos = qw(none bridge carp gif gif6 gre veb vlan wg); my @allsetupmodes = (qw(build install upgrade sysupgrade keep kernel reboot tools), "cvs,build", "cvs,kernel"); my @alltestmodes = qw(all icmp tcp udp splice); diff --git a/netlink.pl b/netlink.pl index 7524bd3..3b32f3a 100755 --- a/netlink.pl +++ b/netlink.pl @@ -29,7 +29,7 @@ my @allifaces = qw(none bnxt em igc ix ixl re vio vmx); my @allmodifymodes = qw(none jumbo nolro nopf notso); -my @allpseudos = qw(none bridge carp gif gre veb vlan wg); +my @allpseudos = qw(none bridge carp gif gif6 gre veb vlan wg); my @alltestmodes = sort qw(all icmp tcp udp splice); my %opts; @@ -112,15 +112,15 @@ $testmode{"${_}4"} = $testmode{"${_}6"} = 1 if $_ !~ /[46]$/; } -my $ip4prefix = '10.10'; +my $ip4prefix = '10.10.'; my $ip6prefix = 'fdd7:e83e:66bd:10'; my $obsd_l_if = $iftype . $left_ifidx; my $obsd_l_ipdev = $obsd_l_if; -my $obsd_l_addr = "$ip4prefix.${line}1.2"; -my $obsd_l_net = "$ip4prefix.${line}1.0/24"; -my $obsd_l_net_flat = "$ip4prefix.${line}0.0/21"; +my $obsd_l_addr = "${ip4prefix}${line}1.2"; +my $obsd_l_net = "${ip4prefix}${line}1.0/24"; +my $obsd_l_net_flat = "${ip4prefix}${line}0.0/21"; my $obsd_l_prefix = 24; my $obsd_l_prefix_flat = 21; my $obsd_l_addr6 = "${ip6prefix}${line}1::2"; @@ -131,28 +131,32 @@ my @obsd_l_addr_range = map { "$obsd_l_addr$_" } 0..9; my @obsd_l_addr6_range = map { "$obsd_l_addr6$_" } 0..9; -my $obsd_l_tunnel_addr = "$ip4prefix.${line}3.2"; -my $obsd_l_tunnel_net = "$ip4prefix.${line}3.0/24"; +my $obsd_l_tunnel_addr = "${ip4prefix}${line}3.2"; +my $obsd_l_tunnel_net = "${ip4prefix}${line}3.0/24"; +my $obsd_l_tunnel_addr6 = "${ip6prefix}${line}3::2"; +my $obsd_l_tunnel_net6 = "${ip6prefix}${line}3::/64"; my $obsd_r_if = $iftype . $right_ifidx; my $obsd_r_ipdev = $obsd_r_if; -my $obsd_r_addr = "$ip4prefix.${line}2.3"; -my $obsd_r_net = "$ip4prefix.${line}2.0/24"; +my $obsd_r_addr = "${ip4prefix}${line}2.3"; +my $obsd_r_net = "${ip4prefix}${line}2.0/24"; my $obsd_r_prefix = 24; my $obsd_r_addr6 = "${ip6prefix}${line}2::3"; my $obsd_r_net6 = "${ip6prefix}${line}2::/64"; my $obsd_r_prefix6 = 64; -my $obsd_r_tunnel_addr = "$ip4prefix.${line}4.3"; -my $obsd_r_tunnel_net = "$ip4prefix.${line}4.0/24"; +my $obsd_r_tunnel_addr = "${ip4prefix}${line}4.3"; +my $obsd_r_tunnel_net = "${ip4prefix}${line}4.0/24"; +my $obsd_r_tunnel_addr6 = "${ip6prefix}${line}4::3"; +my $obsd_r_tunnel_net6 = "${ip6prefix}${line}3::/64"; my $lnx_if = $linux_if; my $lnx_pdev = "$lnx_if.$line"; my $lnx_ipdev = $lnx_if; my $lnx_l_mtu = 1500; -my $lnx_l_addr = "$ip4prefix.${line}1.1"; +my $lnx_l_addr = "${ip4prefix}${line}1.1"; my $lnx_l_net = "$lnx_l_addr/24"; my $lnx_l_net_flat = "$lnx_l_addr/21"; my $lnx_l_addr6 = "${ip6prefix}${line}1::1"; @@ -160,11 +164,13 @@ my $lnx_l_net6_flat = "$lnx_l_addr6/60"; my $lnx_l_ssh = $linux_left_ssh; -my $lnx_l_tunnel_addr = "$ip4prefix.${line}3.1"; +my $lnx_l_tunnel_addr = "${ip4prefix}${line}3.1"; my $lnx_l_tunnel_net = "$lnx_l_tunnel_addr/24"; +my $lnx_l_tunnel_addr6 = "${ip6prefix}${line}3::1"; +my $lnx_l_tunnel_net6 = "$lnx_l_tunnel_addr6/64"; my $lnx_r_mtu = 1500; -my $lnx_r_addr = "$ip4prefix.${line}2.4"; +my $lnx_r_addr = "${ip4prefix}${line}2.4"; my $lnx_r_net = "$lnx_r_addr/24"; my $lnx_r_net_flat = "$lnx_r_addr/21"; my $lnx_r_addr6 = "${ip6prefix}${line}2::4"; @@ -178,8 +184,10 @@ my @lnx_r_addr6_range = map { "$lnx_r_addr6$_" } 0..9; my @lnx_r_net6_range = map { "$_/64" } @lnx_r_addr6_range; my @lnx_r_net6_range_flat = map { "$_/60" } @lnx_r_addr6_range; -my $lnx_r_tunnel_addr = "$ip4prefix.${line}4.4"; +my $lnx_r_tunnel_addr = "${ip4prefix}${line}4.4"; my $lnx_r_tunnel_net = "$lnx_r_tunnel_addr/24"; +my $lnx_r_tunnel_addr6 = "${ip6prefix}${line}4::4"; +my $lnx_r_tunnel_net6 = "$lnx_r_tunnel_addr6/64"; my (@obsd_l_dest_addr, @obsd_l_dest_addr6, @obsd_r_dest_addr, @obsd_r_dest_addr6); @@ -261,7 +269,7 @@ sub good { for if in), $lnx_if, $lnx_pdev, qw(; do for net in), $lnx_l_net, $lnx_l_net6, $lnx_l_net_flat, $lnx_l_net6_flat, - $lnx_l_tunnel_net, qw(; do + $lnx_l_tunnel_net, $lnx_l_tunnel_net6, qw(; do ip address delete $net dev $if ; done ; done)); @@ -271,7 +279,7 @@ sub good { $lnx_r_net, $lnx_r_net6, $lnx_r_net_flat, $lnx_r_net6_flat, @lnx_r_net_range, @lnx_r_net6_range, @lnx_r_net_range_flat, @lnx_r_net6_range_flat, - $lnx_r_tunnel_net, qw(; do + $lnx_r_tunnel_net, $lnx_r_tunnel_net6, qw(; do ip address delete $net dev $if ; done ; done)); @@ -458,6 +466,47 @@ sub good { printcmd('ssh', $ssh, 'ip', 'link', 'set', 'dev', $lnx_if, 'up'); } $lnx_ipdev = $lnx_pdev; +} elsif ($pseudo eq 'gif6') { + # configure OpenBSD tunnel addresses + printcmd('ifconfig', $obsd_l_if, 'inet6', "$obsd_l_tunnel_addr6/64"); + printcmd('ifconfig', $obsd_r_if, 'inet6', "$obsd_r_tunnel_addr6/64"); + printcmd('ifconfig', 'gif0', 'create'); + printcmd('ifconfig', 'gif1', 'create'); + printcmd('ifconfig', 'gif0', 'mtu', '1460', + 'tunnel', $obsd_l_tunnel_addr6, $lnx_l_tunnel_addr6); + printcmd('ifconfig', 'gif1', 'mtu', '1460', + 'tunnel', $obsd_r_tunnel_addr6, $lnx_r_tunnel_addr6); + printcmd('ifconfig', $obsd_l_if, 'up'); + printcmd('ifconfig', $obsd_r_if, 'up'); + $obsd_l_ipdev = "gif0"; + $obsd_r_ipdev = "gif1"; + $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; + + foreach my $ssh ($lnx_l_ssh, $lnx_r_ssh) { + printcmd('ssh', $ssh, 'modprobe', 'ip6_tunnel'); + } + # configure Linux tunnel addresses + printcmd('ssh', $lnx_l_ssh, 'ip', 'address', 'add', $lnx_l_tunnel_net6, + 'dev', $lnx_if); + printcmd('ssh', $lnx_r_ssh, 'ip', 'address', 'add', $lnx_r_tunnel_net6, + 'dev', $lnx_if); + printcmd('ssh', $lnx_l_ssh, 'ip', 'link', 'add', 'name', $lnx_pdev, + 'type', 'ip6tnl', 'mode', 'any', 'encaplimit', 'none', + 'local', $lnx_l_tunnel_addr6, 'remote', $obsd_l_tunnel_addr6); + printcmd('ssh', $lnx_r_ssh, 'ip', 'link', 'add', 'name', $lnx_pdev, + 'type', 'ip6tnl', 'mode', 'any', 'encaplimit', 'none', + 'local', $lnx_r_tunnel_addr6, 'remote', $obsd_r_tunnel_addr6); + 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 'gre') { my $gre_l_key = "2${line}1"; my $gre_r_key = "2${line}2";