foreach my $ip (keys %{$delete->{ipaddr}}) {
cmd("ip a d $ip dev $ifname");
}
- foreach my $ip (keys %{$add->{ipaddr}}) {
- cmd("ip a a $ip dev $ifname");
- }
-
foreach my $route (keys %{$delete->{route}}) {
cmd("ip r d $route dev $ifname");
}
+
+ foreach my $ip (keys %{$add->{ipaddr}}) {
+ cmd("ip a a $ip dev $ifname");
+ }
foreach my $route (keys %{$add->{route}}) {
cmd("ip r a $route dev $ifname");
}
cmd("ifconfig $ifname delete $ip");
}
}
+ foreach my $route (keys %{$delete->{route}}) {
+ if ($route =~ /:/) {
+ cmd("route delete -inet6 $route -iface $ifname");
+ } else {
+ cmd("route delete -inet $route -iface $ifname");
+ }
+ }
foreach my $ip (keys %{$add->{ipaddr}}) {
my @ip = split /\//, $ip;
cmd("ifconfig $ifname add $ip[0]/$ip[1] $ip[0]");
}
}
- foreach my $route (keys %{$delete->{route}}) {
- if ($route =~ /:/) {
- cmd("route delete -inet6 $route -iface $ifname");
- } else {
- cmd("route delete -inet $route -iface $ifname");
- }
- }
foreach my $route (keys %{$add->{route}}) {
if ($route =~ /:/) {
cmd("route add -inet6 $route -iface $ifname");