Skip to content

Fix mxrouter del vlan #453

Merged
merged 2 commits into from
Mar 18, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
mxrouter: Don't remove vlan interfaces twice
When a vlan interface definition is removed from the configuration,
currently the code attempts to remove the actual vlan interface twice:
once by the general logic ($have_if, $want_if -> unconfigure_if()) and
once by the special logic ($have_vlan, $want_vlan -> unconfigure_vlan()).

Remove the later.
donald committed Mar 18, 2025
commit 3c22ccd0e4a0b2a206321a3c73756c784a5a4e11
21 changes: 1 addition & 20 deletions mxrouter/mxrouterctl
Original file line number Diff line number Diff line change
@@ -292,18 +292,6 @@ sub read_active_vlans {
return ($have_vlan);
}

sub unconfigure_vlans {
my ($have_vlan)=@_;

for my $device (sort keys %$have_vlan) {
sys("ip link set dev $device down");
}
for my $device (sort keys %$have_vlan) {
my ($base_device,$vlan_num)=$device=~/^([^.]+)\.(.+)$/;
sys("ip link delete $device");
}
}

sub configure_vlans {
my ($want_vlan)=@_;
for my $device (sort keys %$want_vlan) {
@@ -514,20 +502,14 @@ sub start {

my ($have_vlan)=read_active_vlans();
delete $have_vlan->{$_} for keys %$want_if; # vlan interfaces created in main and moved via interface()
my ($new_vlan,$del_vlan)=({},{});
my $new_vlan = {};

for (keys %$want_vlan) {
$new_vlan->{$_}=$want_vlan->{$_}
unless exists $have_vlan->{$_}
&& $have_vlan->{$_}[0] eq $want_vlan->{$_}[0]
&& $have_vlan->{$_}[1] eq $want_vlan->{$_}[1];
}
for (keys %$have_vlan) {
$del_vlan->{$_}=$have_vlan->{$_}
unless exists $want_vlan->{$_}
&& $have_vlan->{$_}[0] eq $want_vlan->{$_}[0]
&& $have_vlan->{$_}[1] eq $want_vlan->{$_}[1];
}

for (keys %$ip_want_addr) {
$new_addr->{$_}=$ip_want_addr->{$_}
@@ -577,7 +559,6 @@ sub start {
stop_process_if($process_radvd);
unconfigure_route($del_route);
unconfigure_ip($del_addr);
unconfigure_vlans($del_vlan);
unconfigure_if($del_if);

configure_if($want_if);