Skip to content

Commit

Permalink
Remove all old addresses on wrong interface of linux netlink.
Browse files Browse the repository at this point in the history
  • Loading branch information
bluhm committed Dec 24, 2023
1 parent 48bd990 commit 29984de
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions netlink.pl
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,14 @@ sub good {
printcmd('ssh', $lnx_l_ssh, qw(
for if in), $lnx_if, $lnx_pdev, qw(; do
for net in), $lnx_l_net, $lnx_l_net6, qw(; do
ip addr delete $net dev $if ;
ip address delete $net dev $if ;
done ;
done));
printcmd('ssh', $lnx_r_ssh, qw(
for if in), $lnx_if, $lnx_pdev, qw(; do
for net in), $lnx_r_net, $lnx_r_net6, qw(; do
ip addr delete $net dev $if ;
for net in),
$lnx_r_net, $lnx_r_net6, @lnx_r_net_range, @lnx_r_net6_range, qw(; do
ip address delete $net dev $if ;
done ;
done));

Expand Down Expand Up @@ -435,12 +436,12 @@ sub good {

printcmd('ssh', $lnx_l_ssh, qw(
for net in), $lnx_l_net, $lnx_l_net6, qw(; do
ip addr add $net dev), $lnx_ipdev, qw(;
ip address add $net dev), $lnx_ipdev, qw(;
done));
printcmd('ssh', $lnx_r_ssh, qw(
for net in),
$lnx_r_net, $lnx_r_net6, @lnx_r_net_range, @lnx_r_net6_range, qw(; do
ip addr add $net dev), $lnx_ipdev, qw(;
ip address add $net dev), $lnx_ipdev, qw(;
done));
foreach my $ssh ($lnx_l_ssh, $lnx_r_ssh) {
printcmd('ssh', $ssh, 'ip', 'link', 'set', 'dev', $lnx_ipdev, 'up');
Expand Down

0 comments on commit 29984de

Please sign in to comment.