1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

addons: address: policy: l3_intf_arp_accept accept arp_accept value

the policy l3_intf_arp_accept now accepts boolean value True(1)/False(0) as well
as normal arp_accept values

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
This commit is contained in:
Julien Fortin
2022-05-27 11:58:34 +02:00
parent 89df6ae095
commit 8126ef0c00

View File

@ -9,6 +9,8 @@ import json
import time
import subprocess
from distutils.util import strtobool
try:
from ifupdown2.lib.addon import AddonWithIpBlackList
from ifupdown2.nlmanager.nlmanager import Link
@ -226,9 +228,21 @@ class address(AddonWithIpBlackList, moduleBase):
module_name=self.__class__.__name__,
attr='l3_intf_arp_accept'
),
default=False
default=0
)
try:
l3_intf_arp_accept_str = policymanager.policymanager_api.get_module_globals(
module_name=self.__class__.__name__,
attr="l3_intf_arp_accept"
)
try:
self.l3_intf_arp_accept = int(l3_intf_arp_accept_str)
except:
self.l3_intf_arp_accept = int(strtobool(l3_intf_arp_accept_str))
except:
self.l3_intf_arp_accept = 0
self.l3_intf_default_gateway_set_onlink = utils.get_boolean_from_string(
policymanager.policymanager_api.get_module_globals(
module_name=self.__class__.__name__,
@ -441,7 +455,7 @@ class address(AddonWithIpBlackList, moduleBase):
if self.l3_intf_arp_accept:
if up:
self.write_file('/proc/sys/net/ipv4/conf/%s' % ifaceobj.name +
'/arp_accept', '1')
'/arp_accept', str(self.l3_intf_arp_accept))
else:
self.write_file('/proc/sys/net/ipv4/conf/%s' % ifaceobj.name +
'/arp_accept', '0')