neutron/neutron
Brian Haley 44c113651b 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
(cherry picked from commit 793dfb04d0)
2024-03-04 16:18:10 +00:00
..
agent Fix iptables mapping of 'ipip' protocol 2024-03-04 16:18:10 +00:00
api Improve the SG RPC callback `security_group_info_for_ports` 2023-12-21 19:50:22 +00:00
cmd [OVN] Warn about invalid OVN and FIP PF config during start of Neutron 2024-02-13 16:51:46 +01:00
common Merge "Log warning about port forwardings that won't work properly" into stable/2023.2 2024-02-15 10:31:14 +00:00
conf docs: update default value of metadata workers for ml2/ovn 2023-11-21 09:14:07 +00:00
core_extensions Revert "Set system_scope='all' in elevated context" 2021-06-15 10:29:20 +02:00
db Disallow subnet cidr of :: without PD 2024-02-13 18:38:47 +00:00
exceptions Change API to validate network MTU minimums 2023-04-26 12:22:30 -04:00
extensions Default SG rules - use new rules templates to create rules for SGs 2023-08-30 10:18:19 +00:00
hacking Fix some pylint indentation warnings 2022-12-12 11:48:25 -05:00
ipam Improve message for subnet gateway out of host IP addresses range 2023-01-30 18:43:24 -03:00
locale Imported Translations from Zanata 2023-05-16 03:00:56 +00:00
notifiers Fix some pylint indentation warnings 2022-12-12 11:48:25 -05:00
objects Improve the SG RPC callback `security_group_info_for_ports` 2023-12-21 19:50:22 +00:00
pecan_wsgi Fix some new pylint "R" warnings 2023-07-18 18:06:51 -04:00
plugins [OVN] A LRP in an external tunnelled network has no chassis 2024-02-16 09:40:26 +00:00
privileged Retry `set|get_link_attribute(s)` if the interface is not present 2024-02-23 20:24:27 +00:00
profiling Fix some new pylint "E" warnings 2023-06-22 20:41:29 -04:00
quota [sqlalchemy-20] Add missing DB context decorator 2022-12-02 02:38:36 +01:00
scheduler [OVN] The L3 scheduler does not use all chassis by default 2023-05-25 15:26:31 +02:00
server Initialize logger for rpc-server and wsgi script 2023-08-10 02:03:53 +00:00
services Log warning about port forwardings that won't work properly 2024-02-13 17:02:30 +01:00
tests Fix iptables mapping of 'ipip' protocol 2024-03-04 16:18:10 +00:00
__init__.py Remove usage of six.PY2 2020-05-22 12:59:01 -04:00
_i18n.py
auth.py Add fake_project_id middleware for noauth 2021-07-05 21:18:09 +05:30
manager.py Remove usage of six.add_metaclass 2020-05-21 14:41:18 -04:00
neutron_plugin_base_v2.py Remove usage of six.add_metaclass 2020-05-21 14:41:18 -04:00
opts.py Add extra router attributes for ECMP and BFD 2023-07-25 17:03:34 +02:00
policy.py Merge "Fix some new pylint "R" warnings" 2023-07-28 06:58:46 +00:00
service.py Merge "Initialize logger for rpc-server and wsgi script" 2023-08-11 02:39:52 +00:00
version.py
worker.py
wsgi.py Fix some pylint indentation warnings 2022-07-01 17:52:59 -04:00