Scenario: Having BGP peers defined for IPv6 to advertise tenant networks, like for a standard deployment with public IPv6 connectivity. When a router has both IPv4 and IPv6 subnets attached, updates like adding a new IPv6 subnet also create updates for the IPv4 prefixes, but these crash the peering:
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: netaddr.core.AddrFormatError: base address '2001:db8::308' is not IPv4
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: During handling of the above exception, another exception occurred:
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: Traceback (most recent call last):
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: File "/usr/local/lib/python3.10/dist-packages/os_ken/lib/hub.py", line 69, in _launch
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: return func(*args, **kwargs)
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: File "/usr/local/lib/python3.10/dist-packages/os_ken/services/protocols/bgp/base.py", line 253, in start
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: self._run(*args, **kwargs)
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: File "/usr/local/lib/python3.10/dist-packages/os_ken/services/protocols/bgp/peer.py", line 683, in _run
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: self._process_outgoing_msg_list()
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: File "/usr/local/lib/python3.10/dist-packages/os_ken/services/protocols/bgp/peer.py", line 769, in _process_outgoing_msg_list
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: self._send_outgoing_route(outgoing_msg)
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: File "/usr/local/lib/python3.10/dist-packages/os_ken/services/protocols/bgp/peer.py", line 729, in _send_outgoing_route
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: self._protocol.send(update_msg)
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: File "/usr/local/lib/python3.10/dist-packages/os_ken/services/protocols/bgp/speaker.py", line 395, in send
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: self._send_with_lock(msg)
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: File "/usr/local/lib/python3.10/dist-packages/os_ken/services/protocols/bgp/speaker.py", line 384, in _send_with_lock
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: self._socket.sendall(msg.serialize())
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: File "/usr/local/lib/python3.10/dist-packages/os_ken/lib/packet/bgp.py", line 5245, in serialize
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: tail = self.serialize_tail()
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: File "/usr/local/lib/python3.10/dist-packages/os_ken/lib/packet/bgp.py", line 5465, in serialize_tail
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: binpathattrs += pa.serialize()
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: File "/usr/local/lib/python3.10/dist-packages/os_ken/lib/packet/bgp.py", line 3661, in serialize
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: value = self.serialize_value()
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: File "/usr/local/lib/python3.10/dist-packages/os_ken/lib/packet/bgp.py", line 3871, in serialize_value
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: addrconv.ipv4.text_to_bin(self.value))
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: File "/usr/local/lib/python3.10/dist-packages/os_ken/lib/addrconv.py", line 36, in text_to_bin
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: ip = self._fallback(text, **self._addr_kwargs)
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: File "/usr/local/lib/python3.10/dist-packages/netaddr/ip/__init__.py", line 930, in __init__
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: value, prefixlen = parse_ip_network(_ipv4, addr,
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: File "/usr/local/lib/python3.10/dist-packages/netaddr/ip/__init__.py", line 803, in parse_ip_network
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: expanded_addr = _ipv4.expand_partial_address(val1)
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: File "/usr/local/lib/python3.10/dist-packages/netaddr/strategy/ipv4.py", line 259, in expand_partial_address
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: raise error
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: netaddr.core.AddrFormatError: invalid partial IPv4 address: '2001:db8::308'!
Jun 13 08:06:03 vm2 neutron-bgp-dragent[3280003]: : netaddr.core.AddrFormatError: invalid partial IPv4 address: '2001:db8::308'!
Full logs attached.
Fix proposed to branch: master /review. opendev. org/c/openstack /neutron- dynamic- routing/ +/885993
Review: https:/