Skip to content

Commit

Permalink
updated HariSekhonUtils.pm allow vlans in isInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
samsk committed Aug 23, 2024
1 parent 31f2d0e commit 64e6d3d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions HariSekhonUtils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2183,9 +2183,15 @@ sub isInt ($;$) {
sub isInterface ($) {
my $interface = shift;
defined($interface) || return;
my $vlan;
($interface, $vlan) = split(/\./, $interface);
$interface = validate_alnum($interface, "interface");
if ($interface && $vlan) {
$vlan = validate_integer($vlan, "interface.vlan", 1, 4094);
$interface .= "." . $vlan;
}
# TODO: consider checking if the interface actually exists on the system
$interface =~ /^((?:em|eth|bond|lo|docker)\d+|lo|veth[A-Fa-f0-9]+)$/ or return;
return $1;
return $interface;
}


Expand Down

0 comments on commit 64e6d3d

Please sign in to comment.