pyroute2
pyroute2 copied to clipboard
IPRoute decoding exceptions on linux kernel 6.6 (IFLA_INET6_ADDR_GEN_MODE)
(Sorry the original issue description was almost wrong due to a mixture of:
- a race condition in ifstate were two processes have used the same netlink socket in their IPRoute instances resulting in corrupted netlink messages
- /me seeing a ipv6 address related decoding error... while having in mind that there was a new protocol attribute for ip addresses in recent linux kernel releases :facepalm: )
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
Thanks for the report, investigating!