From 1376d2e807dc020d027dc5fa07e317ab066eda75 Mon Sep 17 00:00:00 2001 From: Brian Haley Date: Mon, 15 Jul 2019 15:35:47 -0400 Subject: [PATCH] Only have one number to name mapping for IPv6 ICMP Neutron normalized the IPv6 ICMP protocol string to 'ipv6-icmp', but the number to name mapping dict incorrectly shows 'icmpv6': >>> constants.IP_PROTOCOL_NUM_TO_NAME_MAP['58'] 'icmpv6' This is because in the name to number mapping dict there are two keys, 'ipv6-icmp' and 'icmpv6', that have a value of 58 in order to keep backwards-compatibility. Since the number to name mapping is built automatically from that, it overwrites the '58' key value to be 'icmpv6'. Filter it out so there is only a single mapping to 'ipv6-icmp'. Change-Id: I6b6c34c13f006ffca4cb4e2f18a2f825764374ec Related-bug: #1582500 --- neutron_lib/constants.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/neutron_lib/constants.py b/neutron_lib/constants.py index 5ba3c6d9a..4d388444c 100644 --- a/neutron_lib/constants.py +++ b/neutron_lib/constants.py @@ -429,7 +429,10 @@ ETHERTYPE_IPV6 = 0x86DD IP_PROTOCOL_NAME_ALIASES = {PROTO_NAME_IPV6_ICMP_LEGACY: PROTO_NAME_IPV6_ICMP} -IP_PROTOCOL_NUM_TO_NAME_MAP = {str(v): k for k, v in IP_PROTOCOL_MAP.items()} +# We only want one mapping from '58' to 'ipv6-icmp' since that is the +# normalized string, the name to number mapping can have both +IP_PROTOCOL_NUM_TO_NAME_MAP = ({str(v): k for k, v in IP_PROTOCOL_MAP.items() + if k != PROTO_NAME_IPV6_ICMP_LEGACY}) # When using iptables-save we specify '-p {proto}', # but sometimes those values are not identical. This is a map