Skip to content

Commit

Permalink
[vs] Skip MACsec clean up if /sbin/ip is not accessible (sonic-net#750)
Browse files Browse the repository at this point in the history
Some build containers for sonic-buildimage may not have ip command, and for non MACsec test's this is not required to be present.
  • Loading branch information
kcudnik committed Dec 17, 2020
1 parent a77909d commit a43bf56
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions vslib/src/MACsecManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <swss/logger.h>
#include <swss/exec.h>

#include <unistd.h>

#include <regex>
#include <cstring>
#include <system_error>
Expand Down Expand Up @@ -833,6 +835,12 @@ void MACsecManager::cleanup_macsec_device() const
{
SWSS_LOG_ENTER();

if (access("/sbin/ip", F_OK) == -1)
{
SWSS_LOG_WARN("file /sbin/ip not accessible, skipping");
return;
}

std::string macsecInfos;

if (!exec("/sbin/ip macsec show", macsecInfos))
Expand Down

0 comments on commit a43bf56

Please sign in to comment.