FRRouting / frr

The FRRouting Protocol Suite
https://frrouting.org/
Other
3.17k stars 1.22k forks source link

ip of deleted GRE interface remains in running config, removing it returns an error #15081

Closed ThomasOberhammer closed 1 month ago

ThomasOberhammer commented 7 months ago

Describe the bug

When deleting a GRE interfaces using the ip command, the IP of the interface will still be shown in the running configuration. Removing it via the vtysh interface results in an error.

Is this a bug, or does the IP have to be removed in a different way?

To Reproduce

# starting point: system with GRE interface
[netb-sg024-1:~]# ip addr show dev t4_21505
169: t4_21505@NONE: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1700 qdisc noqueue state UNKNOWN group default qlen 1000
    link/gre 200.24.1.2 peer 200.13.1.2
    inet 213.156.234.48 peer 213.156.234.41/32 scope global t4_21505
       valid_lft forever preferred_lft forever

[netb-sg024-1:~]# vtysh -c 'sh run' | grep t4_21505 -A 1
interface t4_21505
 ip address 213.156.234.48 peer 213.156.234.41/32

# remove GRE interface
[netb-sg024-1:~]# ip addr flush dev t4_21505
[netb-sg024-1:~]# ip tunnel del t4_21505

# IP is still in running config
[netb-sg024-1:~]# vtysh -c 'sh run' | grep t4_21505 -A 1
interface t4_21505
 ip address 213.156.234.48 peer 213.156.234.41/32

# removing the IP does exit with a non-0 value
[netb-sg024-1:~]# vtysh -c 'configure' -c 'interface t4_21505' -c 'no ip address 213.156.234.48 peer 213.156.234.41/32'; echo $?
1

Expected behavior IP should be removed from the running configuration without returning an error.

Versions

Additional context The actual problem is that this breaks the reload script. The command itself works and removes the IP from the running config, but this is still seen as an error.

# remove interface from system and frr config
[netb-sg024-1:~]# ip tunnel del t4_21505
[netb-sg024-1:~]# vim /opt/OSAGfrrouting/etc/zebra.conf # remove the configuration related to the interface

!interface t4_21505
!  ip address 213.156.234.48 peer 213.156.234.41/32

# run the reload script
[netb-sg024-1:~]# /opt/OSAGfrrouting/sbin/frr-reload.py --reload --confdir /opt/OSAGfrrouting/etc --daemon zebra /opt/OSAGfrrouting/etc/zebra.conf --debug
"interface t4_21505 --  no" we failed to remove this command
2024-01-03 11:31:38,136 DEBUG: Running Frr Config (Pass #0)
interface t4_21505
ip address 213.156.234.48 peer 213.156.234.41/32
exit

2024-01-03 11:31:38,233  INFO: Failed to execute interface t4_21505  no ip address 213.156.234.48 peer 213.156.234.41/32
2024-01-03 11:31:38,331  INFO: Failed to execute interface t4_21505  no ip address 213.156.234.48 peer
2024-01-03 11:31:38,408  INFO: Failed to execute interface t4_21505  no ip address 213.156.234.48
2024-01-03 11:31:38,488  INFO: Failed to execute interface t4_21505  no ip address
2024-01-03 11:31:38,565  INFO: Failed to execute interface t4_21505  no ip
2024-01-03 11:31:38,638  INFO: Failed to execute interface t4_21505  no
2024-01-03 11:31:38,638 ERROR: "interface t4_21505 --  no" we failed to remove this command
2024-01-03 11:31:38,638 ERROR:

2024-01-03 11:31:38,720 DEBUG: Running Frr Config (Pass #1)
<no more interface t4_21505>
ThomasOberhammer commented 7 months ago

I have been looking into this using gdb and figured that the non-zero exit code originates from this function which will return 13 (CMD_WARNING_CONFIG_FAILED): https://github.com/FRRouting/frr/blob/frr-8.5.3/vtysh/vtysh.c#L263

The error itself is most likely coming from here: https://github.com/FRRouting/frr/blob/frr-8.5.3/zebra/interface.c#L4179

ThomasOberhammer commented 7 months ago

We tested this also with version 9.1, the behaviour is still the same.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 180 days with no activity. Comment or remove the autoclose label in order to avoid having this issue closed.

frrbot[bot] commented 1 month ago

This issue will be automatically closed in the specified period unless there is further activity.