Page MenuHomeVyOS Platform

Show MAC address VRF and MTU by default for "show interfaces"
Closed, ResolvedPublicFEATURE REQUEST

Description

  • Show MAC address VRF and MTU by default for show interfaces
  • The current show interfaces swap with show interfaces summary

Details

Version
-
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Unspecified (please specify)

Event Timeline

Viacheslav changed the task status from Open to In progress.Nov 17 2023, 7:45 AM
Viacheslav claimed this task.

Great addition, it has one minor bug.

On a system running bridges and VRFs the content is mixed up:

vyos@PE1:~$ show interfaces
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface    IP Address        MAC                VRF        MTU  S/L    Description
-----------  ----------------  -----------------  -------  -----  -----  -------------
br1          -                 aa:34:29:79:1f:54  default   1500  u/u
br1.20       -                 aa:34:29:79:1f:54  default   1500  u/u
br1.3002     100.0.0.50/31     aa:34:29:79:1f:54  black     1500  u/u    P2P-to-B_CE1
br1.4000     -                 aa:34:29:79:1f:54  black     1500  u/u
dum0         1.1.1.1/32        4a:17:06:b5:76:35  default   1500  u/u
eth0         100.0.0.11/31     50:00:00:02:00:00  default   1400  u/u    P2P-to-INET
eth1         -                 50:00:00:02:00:01  br1       1500  u/u
eth2         -                 50:00:00:02:00:02  br1       1500  u/u
eth3         172.18.200.11/24  50:00:00:02:00:03  MGMT      1500  u/u
lo           127.0.0.1/8       00:00:00:00:00:00  default  65536  u/u
             ::1/128
vxlan1       -                 9a:39:5a:ae:64:b0  br1       1500  u/u
wg1          100.0.0.1/30      n/a                default   1600  u/u

The reason for this is that the Linux Kernel operates using the master device for both a bridge and a VRF.

To verify:

>>> from vyos.utils.network import get_interface_config
>>> get_interface_config('eth1')['master']
'br1'
>>> get_interface_config('eth3')['master']
'MGMT'

I'd probably expect something like:

vyos@PE1:~$ show interfaces
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface    IP Address        MAC                Bridge VRF        MTU  S/L    Description
-----------  ----------------  -----------------  ------ -------  -----  -----  -------------
br1          -                 aa:34:29:79:1f:54  -      default   1500  u/u
br1.20       -                 aa:34:29:79:1f:54  -      default   1500  u/u
br1.3002     100.0.0.50/31     aa:34:29:79:1f:54  -      black     1500  u/u    P2P-to-B_CE1
br1.4000     -                 aa:34:29:79:1f:54  -      black     1500  u/u
dum0         1.1.1.1/32        4a:17:06:b5:76:35  -      default   1500  u/u
eth0         100.0.0.11/31     50:00:00:02:00:00  -      default   1400  u/u    P2P-to-INET
eth1         -                 50:00:00:02:00:01  br1    -         1500  u/u
eth2         -                 50:00:00:02:00:02  br1    -         1500  u/u
eth3         172.18.200.11/24  50:00:00:02:00:03  -      MGMT      1500  u/u
lo           127.0.0.1/8       00:00:00:00:00:00  -      default  65536  u/u
             ::1/128                              -      
vxlan1       -                 9a:39:5a:ae:64:b0  br1    -         1500  u/u
wg1          100.0.0.1/30      n/a                -      default   1600  u/u

As an Interface assigned to a VRF can not be assigned to a bridge. But the bridge can be assigned to a VRF.

The "VRF" or to be correct the master device is retrieved here: https://github.com/vyos/vyos-1x/blob/current/python/vyos/ifconfig/interface.py#L116-L119

How should this be fixed? We can either extend the op-mode helper script to make use of ConfigTreequery() to search the VRF and bridge names in questions, or improve the helpers.

We can get the list of all interfaces inside a vrf by:

vyos@PE1:~$ bridge link show br1
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br1 state forwarding priority 32 cost 100
4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br1 state forwarding priority 32 cost 100
17: vxlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br1 state forwarding priority 32 cost 100

or our wrapper: vyos.utils.network.get_vrf_members() and then we need to reverse the search. This can be done by fixing our wrapper vyos.utils.network.get_interface_vrf() to not work on the master device option

Viacheslav moved this task from Open to Finished on the VyOS 1.5 Circinus board.
Viacheslav moved this task from Open to Finished on the VyOS 1.4 Sagitta board.