Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jrouzierinverse committed Jul 11, 2024
1 parent fca86b7 commit 938017a
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions html/pfappserver/lib/pfappserver/Model/Interface.pm
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ sub create {
}

# Create requested virtual interface
my $cmd = "sudo ip link add link $physical_interface name $physical_interface.$vlan_id type vlan id $vlan_id";
eval { $status = safe_pf_run("sudo", "ip", "link", "add", "link", $physical_interface, "name", "$physical_interface.$vlan_id", "type", "vlan", "id", $vlan_id) };
if ( $@ ) {
$status_msg = ["Error in creating interface VLAN [_1]",$interface];
Expand Down Expand Up @@ -333,7 +332,6 @@ sub update {
my $isDefaultRoute = (defined($interface_before->{ipaddress}) && $gateway eq $interface_before->{ipaddress});

# Delete previous IP address
my $cmd;
if (defined($interface_before->{address}) && $interface_before->{address} ne '') {
eval { $status = safe_pf_run(qw(sudo ip addr del), $interface_before->{address},'dev',$interface_before->{name}) };
if ( $@ || $status ) {
Expand All @@ -352,7 +350,6 @@ sub update {

$logger->debug("IP address has changed ($interface $ipaddress/$netmask)");

$cmd = sprintf "sudo ip addr add %s/%i broadcast %s dev %s", $ipaddress, $netmask, $broadcast, $interface;
eval { $status = safe_pf_run(qw(sudo ip addr add), "${ipaddress}/${netmask}", 'broadcast', $broadcast, 'dev', $interface) };
if ( $@ || $status ) {
$status_msg = ["Can't add new IP address on interface [_1] ([_2])",$interface,$ipaddress];
Expand All @@ -371,9 +368,7 @@ sub update {
$network_configuration_changed = $TRUE;

# Delete previous IP address
my $cmd;
if ( defined($interface_before->{ipv6_network}) && $interface_before->{ipv6_network} ne '' ) {
$cmd = sprintf "sudo ip -6 addr del %s dev %s", $interface_before->{ipv6_network}, $interface_before->{name};
eval { $status = safe_pf_run(qw(sudo ip -6 addr del), $interface_before->{ipv6_network}, 'dev', $interface_before->{name}) };
if ( $@ || $status ) {
$status_msg = ["Can't delete previous IPv6 address of interface [_1] ([_2])", $interface, $interface_before->{ipv6_network}];
Expand All @@ -395,7 +390,6 @@ sub update {
if ( $@ || $status ) {
$status_msg = ["Can't add new IPv6 address on interface [_1] ([_2])", $interface, $ipv6_address];
$logger->error($status);
$logger->error("$cmd: $status");
return ($STATUS::INTERNAL_SERVER_ERROR, $status_msg);
}
}
Expand Down Expand Up @@ -789,7 +783,6 @@ sub up {
return ($STATUS::PRECONDITION_FAILED, $status_msg);
}

my $cmd = sprintf "sudo ip link set %s up", $interface;
eval { $status = safe_pf_run(qw(sudo ip link set), $interface, 'up') };
if ( $@ ) {
$status_msg = ["Can't enable interface [_1]",$interface];
Expand Down

0 comments on commit 938017a

Please sign in to comment.