Skip to content

Commit

Permalink
[tunnel_pkt_handler]: Skip nonexistent intfs (#12424)
Browse files Browse the repository at this point in the history
- 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 <lawlee@microsoft.com>
  • Loading branch information
theasianpianist authored Oct 20, 2022
1 parent cf20aea commit 37ad8be
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion dockers/docker-orchagent/tunnel_packet_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from sonic_py_common import logger as log

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

Expand Down

0 comments on commit 37ad8be

Please sign in to comment.