Skip to content

Commit 888f6ec

Browse files
theasianpianistqiluo-msft
authored andcommitted
[tunnel_pkt_handler]: Skip nonexistent intfs (#12424)
- Skip the interface status check if the interface does not exist. In the future, when the interface is created/comes up this check will be triggered again. Signed-off-by: Lawrence Lee <[email protected]>
1 parent 8087043 commit 888f6ec

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

dockers/docker-orchagent/tunnel_packet_handler.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from sonic_py_common import logger as log
1717

1818
from pyroute2 import IPRoute
19+
from pyroute2.netlink.exceptions import NetlinkError
1920
from scapy.layers.inet import IP
2021
from scapy.layers.inet6 import IPv6
2122
from scapy.sendrecv import AsyncSniffer
@@ -115,7 +116,14 @@ def get_up_portchannels(self):
115116
portchannel_intf_names = [name for name, _ in self.portchannel_intfs]
116117
link_statuses = []
117118
for intf in portchannel_intf_names:
118-
status = self.netlink_api.link("get", ifname=intf)
119+
try:
120+
status = self.netlink_api.link("get", ifname=intf)
121+
except NetlinkError:
122+
# Continue if we find a non-existent interface since we don't
123+
# need to listen on it while it's down/not created. Once it comes up,
124+
# we will get another netlink message which will trigger this check again
125+
logger.log_notice("Skipping non-existent interface {}".format(intf))
126+
continue
119127
link_statuses.append(status[0])
120128
up_portchannels = []
121129

0 commit comments

Comments
 (0)