neutron/neutron
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
..
agent Fix iptables mapping of 'ipip' protocol 2024-02-27 15:08:19 -05:00
api Create a policy rule to control if a rule belongs to the default SG 2023-10-09 14:11:55 +00:00
cmd [OVN] Warn about invalid OVN and FIP PF config during start of Neutron 2024-02-06 14:46:48 +00:00
common Merge "Log warning about port forwardings that won't work properly" 2024-02-12 13:09:57 +00:00
conf [S-RBAC] Change policies for port's binding:profile field 2024-02-16 16:10:43 +01:00
core_extensions Revert "Set system_scope='all' in elevated context" 2021-06-15 10:29:20 +02:00
db Merge "Disallow subnet cidr of :: without PD" 2024-02-13 21:48:00 +00:00
exceptions Consume code from neutron-lib 2024-01-19 17:18:57 -05:00
extensions Add policy enforcer for "tags" service plugin 2023-10-14 15:41:06 +00:00
hacking Update hacking version 2024-02-08 10:34:10 -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 Update hacking version 2024-02-08 10:34:10 -05:00
objects Remove _use_db_facade() 2024-01-12 18:29:00 -05:00
pecan_wsgi Fix some new pylint "R" warnings 2023-07-18 18:06:51 -04:00
plugins Merge "[OVN] Add ``ProviderResourceAssociation`` to any ML2/OVN router" 2024-02-16 16:00:59 +00:00
privileged Retry ``set|get_link_attribute(s)`` if the interface is not present 2024-02-21 07:46:53 +00:00
profiling Fix some new pylint "E" warnings 2023-06-22 20:41:29 -04:00
quota Create a single method to set the quota usage dirty bit 2023-07-06 06:06:23 +00:00
scheduler [ovn] AZs distribution in L3 port scheduler 2024-01-26 15:22:34 +01:00
server Merge "Register GMR with config" 2023-12-08 18:32:17 +00:00
services Merge "Log warning about port forwardings that won't work properly" 2024-02-12 13:09:57 +00:00
tests Fix iptables mapping of 'ipip' protocol 2024-02-27 15:08:19 -05:00
__init__.py Update hacking version 2024-02-08 10:34:10 -05: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 [metadata_rate_limiting] options to example config files 2023-11-28 10:20:35 +09:00
policy.py Merge "Fix some new pylint "R" warnings" 2023-07-28 06:58:46 +00:00
service.py Merge "Completely disable rpc workers when rpc_workers=0" 2024-02-12 21:03:08 +00:00
version.py
worker.py Change process name of neutron-server to match worker role 2019-03-01 14:18:09 -05:00
wsgi.py Fix some pylint indentation warnings 2022-07-01 17:52:59 -04:00