diff --git a/mxrouter/mxrouterctl b/mxrouter/mxrouterctl index 457241a..d394948 100755 --- a/mxrouter/mxrouterctl +++ b/mxrouter/mxrouterctl @@ -374,6 +374,7 @@ sub radvd { } our $want_if; +our $want_veth; our $DHCRELAY_FORWARD; our %DHCRELAY_IF; @@ -483,7 +484,7 @@ sub start { netif_is_up('lo') or sys('ip link set lo up'); - for my $dev (keys %$want_if) { + for my $dev (keys %$want_if, keys %$want_veth) { netif_is_up($dev) or sys('ip','link','set',$dev,'up'); } @@ -622,6 +623,11 @@ sub interface { $want_if->{$dev}=1; } +sub veth { + my ($dev) = @_; + $want_veth->{$dev} = 1; +} + my @SAVED_ARGV=@ARGV; GetOptions(OPTIONS) or die USAGE; @@ -776,6 +782,9 @@ if (!$opt_this_ns) { for my $dev (sort keys %$want_if) { move_dev_into_ns($dev,$NETNS); } + for my $dev (sort keys %$want_veth) { + sys('ip', 'link', 'add', $dev, 'type', 'veth', 'peer', 'name', $dev, 'netns', $NETNS); + } system('ip','netns','exec',$NETNS,$0,'--this-ns',@SAVED_ARGV) and exit 1; } elsif ($cmd eq 'stop') { have_netns($NETNS) or die "not running (network namespace $NETNS does not exist)\n";