Page MenuHomeVyOS Platform

Remove of policy route throws CLI error
Closed, ResolvedPublicBUG

Description

With the following configuration:

cpo@BR1# show policy route
 route pppoe-out {
     description "PPPoE TCPMSS clamping"
     enable-default-log
     rule 100 {
         protocol tcp
         set {
             tcp-mss 1448
         }
         tcp {
             flags SYN
         }
     }
 }

cpo@BR1# show interfaces ethernet eth1 pppoe 0 policy
 route pppoe-out
cpo@BR1# delete policy route
[edit]

cpo@BR1# commit
[ policy route pppoe-out ]
rm: cannot remove ‘/var/run/vyatta_policy_ref’: No such file or directory

Details

Difficulty level
Easy (less than an hour)
Version
VyOS 1.2.0-EPA3
Why the issue appeared?
Implementation mistake
Is it a breaking change?
Perfectly compatible
Issue type
Unspecified (please specify)

Related Objects

Event Timeline

c-po removed c-po as the assignee of this task.
c-po created this task.

/opt/vyatta/sbin/vyatta-firewall.pl contains lines

my $fw_stateful_file = '/var/run/vyatta_fw_stateful';
my $fw_tree_file     = '/var/run/vyatta_fw_trees';
my $policy_ref_file  = '/var/run/vyatta_policy_ref';

After creating policy route. And check files

[email protected]# file /var/run/vyatta_fw_stateful
/var/run/vyatta_fw_stateful: cannot open `/var/run/vyatta_fw_stateful' (No such file or directory)
[edit]
[email protected]# file /var/run/vyatta_policy_ref
/var/run/vyatta_policy_ref: cannot open `/var/run/vyatta_policy_ref' (No such file or directory)
[edit]
[email protected]#

$policy_ref_file figured in sub (add_route_table, remove_route_table, flush_route_table)

No file, nothing to delete

So we can use "key -f" in command rm, line 296

system("rm $refcnt_file"); <== line 296

sub write_refcnt_file {
    my ($refcnt_file, @lines) = @_;

    if (scalar(@lines) > 0) {
        open(my $FILE, '>', $refcnt_file) or die "Error: write $!";
        print $FILE join("\n", @lines), "\n";
        close($FILE);
    } else {
        system("rm -f $refcnt_file");
    }
}

We need to check how safe this option is.

[email protected]# delete policy
[edit]
[email protected]# commit
[email protected]#
[edit]

PR https://github.com/vyos/vyatta-cfg-firewall/pull/18

set policy route pppoe-out rule 100 protocol 'tcp'
set policy route pppoe-out rule 100 set tcp-mss '1448'
set policy route pppoe-out rule 100 tcp flags 'SYN'
commit

vyos@r1-roll# delete policy 
[edit]
vyos@r1-roll# commit
[edit]
vyos@r1-roll#
dmbaturin assigned this task to Viacheslav.
dmbaturin changed Why the issue appeared? from Will be filled on close to Implementation mistake.
dmbaturin set Is it a breaking change? to Perfectly compatible.
dmbaturin set Issue type to Unspecified (please specify).