Page MenuHomeVyOS Platform

Tunnel class Interface method get_mac() returns IP address for the tunnel interface
Closed, InvalidPublicBUG

Description

To reproduce, add gre tunnel

set interfaces tunnel tun0 encapsulation 'gre'
set interfaces tunnel tun0 remote '192.0.2.5'
set interfaces tunnel tun0 source-address '192.0.2.1'

Check MAC on tun0

>>> from vyos.ifconfig import Interface
>>> 
>>> Interface('eth0').get_mac()
'52:54:00:f1:fd:77'
>>> 
>>> Interface('tun0').get_mac()
'192.0.2.1'
>>>

Expected some n/a value

Details

Difficulty level
Unknown (require assessment)
Version
VyOS 1.5-rolling-202311150859
Why the issue appeared?
Other
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

>>> from vyos.ifconfig import Interface
>>> Interface('tun0').get_mac()
'192.0.2.1'

>>> from vyos.ifconfig import TunnelIf
>>> TunnelIf('tun0').get_mac()
'fb:75:49:15:1e:71'
>>>

This more or less works as designed.

Tunnel interfaces per-se do not have a MAC address because they do nto have a "MAC" layer, that's why an artificial MAC can be generated (e.g. for IPv6 EUI64 addressing).

https://github.com/vyos/vyos-1x/blob/current/python/vyos/ifconfig/tunnel.py#L156-L158

@Interface.register
class TunnelIf(Interface):
    ...
    def get_mac(self):
        """ Get a synthetic MAC address. """
        return self.get_mac_synthetic()
c-po renamed this task from Class Interface method get_mac() retruns IP address for the tunnel interface to Tunnel class Interface method get_mac() returns IP address for the tunnel interface.Nov 16 2023, 2:53 PM
c-po closed this task as Invalid.
c-po triaged this task as Normal priority.
c-po changed Why the issue appeared? from Will be filled on close to Other.