neutron/neutron/agent
Brian Haley 793dfb04d0 Fix iptables mapping of 'ipip' protocol
Map 'ipip' to use the string 'ipencap' so the
IptablesFirewallDriver class in neutron works correctly.
Once neutron-lib is bumped this can be removed.

Add tests for IP protocol 'ipip', '4' and '94' to make
sure the IptablesFirewallDriver class in neutron treats
them correctly.

Long description below.

This is one of those confusing edge cases and I think
Linux is conspiring against us. Let me explain.

1) neutron-lib does correctly define the protocol name 'ipip' as 4.

2) The linux kernel uses the same in in.h:

 IPPROTO_IPIP = 4
 IPPROTO_BEETPH = 94 (?)

3) iptables maps 'ipip' to 94 and 'ipencap' to 4.

 # for num in {0..255}; do iptables -A INPUT -p $num; done
 # iptables-save | grep -E 'ipip|ipencap'
 -A INPUT -p ipencap
 -A INPUT -p ipip

4) /etc/protocols does the same as iptables:

 grep -E 'ipencap|ipip' /etc/protocols
 ipencap 4 IP-ENCAP # IP encapsulated in IP (officially ``IP'')
 ipip 94 IPIP # IP-within-IP Encapsulation Protocol

5) getprotoby{name|number} does what /etc/protocols does:

 $ getprotobyname ipip
 struct protoent: (0x7fbbbcca9c60)
   p_name ipip
   p_aliases IPIP
   p_proto 94

 $ getprotobynumber 4
 struct protoent: (0x7fc51ad86be0)
   p_name ipencap
   p_aliases IP-ENCAP
   p_proto 4

Neutron actually builds a mapping based on the getprotoby*
calls, so in the iptables case it winds-up doing the wrong
thing.

Partial-bug: #2054324
Change-Id: Icc84b54be07d39059723d6c233c03aa130102423
2024-02-27 15:08:19 -05:00
..
common Make get_ports RPC method common for the DHCP and Metadata agent 2024-01-16 15:30:24 -05:00
dhcp Make get_ports RPC method common for the DHCP and Metadata agent 2024-01-16 15:30:24 -05:00
l2 Add host metadata haproxy manager 2023-05-08 08:38:54 +08:00
l3 Consume code from neutron-lib 2024-01-19 17:18:57 -05:00
linux Fix iptables mapping of 'ipip' protocol 2024-02-27 15:08:19 -05:00
metadata Consume code from neutron-lib 2024-01-19 17:18:57 -05:00
ovn Merge "[OVN] Add the bridge name and datapath type to the port VIF details" 2024-01-30 11:57:59 +00:00
ovsdb Use ovs constants from neutron-lib 2022-06-17 10:36:44 +05:30
windows Remove rootwrap execution (1) 2021-02-06 16:22:43 +00:00
__init__.py Empty files should not contain copyright or license 2014-10-20 00:50:32 +00:00
agent_extensions_manager.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
dhcp_agent.py Don't register config options on imports 2022-04-13 05:49:15 +00:00
firewall.py [ovs fw] Restrict IPv6 NA and DHCP(v6) IP and MAC source addresses 2021-04-13 15:15:41 +02:00
l3_agent.py Add rate-limiting to metadata agents 2023-05-17 18:52:25 -05:00
metadata_agent.py Add [metadata_rate_limiting] options to example config files 2023-11-28 10:20:35 +09:00
resource_cache.py Cleanup fanout queues on ovs agent stop 2022-09-09 09:03:45 +02:00
rpc.py python-3.12: do not use datetime.datetime.utcnow() 2024-01-20 04:30:48 +00:00
securitygroups_rpc.py Missing SG rule default group extension in ``Ml2Plugin`` 2023-10-09 14:11:49 +00:00