Merge "Trivial: check if ipv6 is available for IptablesManager" into stable/ussuri

This commit is contained in:
Zuul 2021-08-23 21:36:06 +00:00 committed by Gerrit Code Review
commit 8e581d31cd
2 changed files with 6 additions and 4 deletions

View File

@ -1799,9 +1799,9 @@ class DeviceManager(object):
def fill_dhcp_udp_checksums(self, namespace):
"""Ensure DHCP reply packets always have correct UDP checksums."""
iptables_mgr = iptables_manager.IptablesManager(use_ipv6=True,
nat=False,
namespace=namespace)
iptables_mgr = iptables_manager.IptablesManager(
use_ipv6=netutils.is_ipv6_enabled(), nat=False,
namespace=namespace)
ipv4_rule = ('-p udp -m udp --dport %d -j CHECKSUM --checksum-fill'
% constants.DHCP_RESPONSE_PORT)
ipv6_rule = ('-p udp -m udp --dport %d -j CHECKSUM --checksum-fill'

View File

@ -18,6 +18,7 @@ import re
from neutron_lib import constants as n_const
from oslo_concurrency import lockutils
from oslo_log import log
from oslo_utils import netutils
from oslo_utils import uuidutils
from ovsdbapp.backend.ovs_idl import event as row_event
from ovsdbapp.backend.ovs_idl import vlog
@ -372,7 +373,8 @@ class MetadataAgent(object):
return
iptables_mgr = iptables_manager.IptablesManager(
use_ipv6=True, nat=False, namespace=namespace, external_lock=False)
use_ipv6=netutils.is_ipv6_enabled(), nat=False,
namespace=namespace, external_lock=False)
rule = '-p tcp -m tcp -j CHECKSUM --checksum-fill'
iptables_mgr.ipv4['mangle'].add_rule('POSTROUTING', rule, wrap=False)
iptables_mgr.apply()