svinota / pyroute2

Python Netlink and PF_ROUTE library — network configuration and monitoring
https://pyroute2.org/
Other
930 stars 244 forks source link

IPRoute decoding exceptions on linux kernel 6.6 (IFLA_INET6_ADDR_GEN_MODE) #1166

Open liske opened 5 months ago

liske commented 5 months ago

(Sorry the original issue description was almost wrong due to a mixture of:


Here is the dump for IPRoute.get_addr() on linux 6.6 having a link-local address from SLAAC and a manually configured one:

 {'attrs': [('IFA_ADDRESS', 'fe80::290:bff:fea0:f19d'),
            ('IFA_CACHEINFO', {'ifa_preferred': 4294967295, 'ifa_valid': 4294967295, 'cstamp': 92517, 'tstamp': 92517}),
            ('IFA_FLAGS', 128),
            ('UNKNOWN', {'header': {'length': 5, 'type': 11}})],
  'event': 'RTM_NEWADDR',
  'family': 10,
  'flags': 128,
  'header': {'error': None,
             'flags': 2,
             'length': 80,
             'pid': 15390,
             'sequence_number': 259,
             'stats': Stats(qsize=0, delta=0, delay=0),
             'target': 'localhost',
             'type': 20},
  'index': 46,
  'prefixlen': 64,
  'scope': 253},
 {'attrs': [('IFA_ADDRESS', 'fe80::defa'),
            ('IFA_CACHEINFO', {'ifa_preferred': 4294967295, 'ifa_valid': 4294967295, 'cstamp': 89555, 'tstamp': 89555}),
            ('IFA_FLAGS', 128)],
  'event': 'RTM_NEWADDR',
  'family': 10,
  'flags': 128,
  'header': {'error': None,
             'flags': 2,
             'length': 72,
             'pid': 15390,
             'sequence_number': 259,
             'stats': Stats(qsize=0, delta=0, delay=0),
             'target': 'localhost',
             'type': 20},
  'index': 46,
  'prefixlen': 64,
  'scope': 253})

The unknown header is the proto attribute, isn't it?

# ip -d addr show dev vlan2 | tail -n 4
    inet6 fe80::290:bff:fea0:f19d/64 scope link proto kernel_ll 
       valid_lft forever preferred_lft forever
    inet6 fe80::defa/64 scope link 
       valid_lft forever preferred_lft forever
svinota commented 5 months ago

Thanks for the report, investigating!