@@ -217,6 +217,7 @@ def apply_eip(self, eip):
217217 NIC_PREFIXLEN = eip .nicPrefixLen
218218 NIC_IP = eip .nicIp
219219 NIC_MAC = eip .nicMac
220+ NIC_MAC_IN_EBTALES = ip .removeZeroFromMacAddress (NIC_MAC )
220221 NS_NAME = "%s_%s" % (eip .publicBridgeName , eip .vip .replace ("." , "_" ))
221222 ADDFDB = eip .addfdb
222223 PRINIC = eip .physicalNic
@@ -366,6 +367,7 @@ def set_gateway_arp_if_needed():
366367 if not GATEWAY :
367368 raise Exception ('cannot find the device[%s] in the namespace[%s]' % (PRI_IDEV , NS_NAME ))
368369
370+ GATEWAY = ip .removeZeroFromMacAddress (GATEWAY )
369371 create_ebtable_rule_if_needed ('nat' , CHAIN_NAME , "-p ARP --arp-op Request --arp-ip-dst {{NIC_GATEWAY}} -j arpreply --arpreply-mac {{GATEWAY}}" )
370372
371373 for BLOCK_DEV in [PRI_ODEV , PUB_ODEV ]:
@@ -374,7 +376,7 @@ def set_gateway_arp_if_needed():
374376 bash_errorout (EBTABLES_CMD + ' -t nat -N {{BLOCK_CHAIN_NAME}}' )
375377
376378 create_ebtable_rule_if_needed ('nat' , 'POSTROUTING' , "-p ARP -o {{BLOCK_DEV}} -j {{BLOCK_CHAIN_NAME}}" )
377- create_ebtable_rule_if_needed ('nat' , BLOCK_CHAIN_NAME , "-p ARP -o {{BLOCK_DEV}} --arp-op Request --arp-ip-dst {{NIC_GATEWAY}} --arp-mac-src ! {{NIC_MAC }} -j DROP" )
379+ create_ebtable_rule_if_needed ('nat' , BLOCK_CHAIN_NAME , "-p ARP -o {{BLOCK_DEV}} --arp-op Request --arp-ip-dst {{NIC_GATEWAY}} --arp-mac-src ! {{NIC_MAC_IN_EBTALES }} -j DROP" )
378380
379381 BLOCK_CHAIN_NAME = '{{NIC_NAME}}-arp'
380382 if bash_r (EBTABLES_CMD + ' -t nat -L {{BLOCK_CHAIN_NAME}} > /dev/null 2>&1' ) != 0 :
@@ -473,7 +475,7 @@ def add_filter_to_prevent_namespace_arp_request():
473475
474476 create_ebtable_rule_if_needed ('nat' , 'PREROUTING' , '-i {{PRI_ODEV}} -j {{PRI_ODEV_CHAIN}}' )
475477 create_ebtable_rule_if_needed ('nat' , PRI_ODEV_CHAIN ,
476- "-p ARP --arp-op Request --arp-ip-dst {{NIC_IP}} -j arpreply --arpreply-mac {{NIC_MAC }}" , True )
478+ "-p ARP --arp-op Request --arp-ip-dst {{NIC_IP}} -j arpreply --arpreply-mac {{NIC_MAC_IN_EBTALES }}" , True )
477479 create_ebtable_rule_if_needed ('nat' , PRI_ODEV_CHAIN , "-p ARP --arp-op Request -j DROP" )
478480
479481 newCreated = False
0 commit comments