Skip to content

Commit

Permalink
Merge branch 'rc_network_fix_map'
Browse files Browse the repository at this point in the history
  • Loading branch information
msmith626 committed Jul 30, 2024
2 parents 70d0dda + 6d60402 commit b011cb6
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2024-07-30 Marc A. Smith <[email protected]>

Merge branch 'rc_network_fix_map'

rc.network: handle any egress priority mapping values that have changed -- if we detect any that aren't in the config, then remove the VLAN interface so we can start fresh

2024-07-25 Marc A. Smith <[email protected]>

Merge branch 'alua_ssh_tweak'
Expand Down
43 changes: 43 additions & 0 deletions etc/rc.d/rc.network
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,49 @@ if (($ARGV[0] eq "start") || ($ARGV[0] eq "apply")) {
if ($each =~ /.*\.\d+/) {
my $vlan_iface = $net_if_dir . "/" . $each;
my @vlan_if_parts = split(/\./, $each);
# Handle any old VLAN egress priority map values
my $vlanegressmap = "";
if (exists($ini_hash{$each . ":vlanegressmap"})) {
$vlanegressmap = $ini_hash{$each . ":vlanegressmap"};
}
my %egprio_hash = map {$_ => 1} split(/,/, $vlanegressmap);
my $vlan_conf_file = "/proc/net/vlan/" . $each;
if ( -e "$vlan_conf_file") {
open(VLAN_CONF, "$vlan_conf_file") ||
die("ERROR: Can't open $vlan_conf_file $!");
my @vlan_conf_lines = <VLAN_CONF>;
close(VLAN_CONF);
foreach my $vlan_conf_line (@vlan_conf_lines) {
if ($vlan_conf_line =~ /EGRESS priority mappings:/) {
$vlan_conf_line =~ s/ EGRESS priority mappings: //;
chomp $vlan_conf_line;
my @egress_prio_maps = split(/ /, $vlan_conf_line);
foreach my $each_map (@egress_prio_maps) {
if (not exists $egprio_hash{"$each_map"}) {
printf("EGRESS priority mappings changed!" .
" Removing VLAN interface " . $each .
"...\n");
system($vconfig_prog . " rem " . $each .
" 2>&1");
if ($? == -1) {
print("ERROR: Running $vconfig_prog " .
"failed: $!\n");
next;
}
my $exit_status = $? >> 8;
if ($exit_status != 0) {
print("ERROR: The $vconfig_prog " .
"program exited with " .
"value $exit_status.\n");
next;
}
last;
}
}
last;
}
}
}
if (! -e "$vlan_iface") {
printf("Creating VLAN interface " . $each . "...\n");
system($vconfig_prog . " add " . $vlan_if_parts[0] .
Expand Down

0 comments on commit b011cb6

Please sign in to comment.