Skip to content

Commit

Permalink
Added support for syncing ports with Infiniband prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
Itamar Talmon authored and Itamar Talmon committed Jun 1, 2022
1 parent 7350d49 commit 8679c67
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions portsyncd/linksync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "producerstatetable.h"
#include "tokenize.h"
#include "exec.h"
#include "schema.h"

#include "linkcache.h"
#include "portsyncd/linksync.h"
Expand All @@ -20,6 +21,7 @@
#include <set>
#include <sstream>
#include <iomanip>
#include <regex>

using namespace std;
using namespace swss;
Expand All @@ -28,7 +30,6 @@ using namespace swss;
#define TEAM_DRV_NAME "team"

const string MGMT_PREFIX = "eth";
const string INTFS_PREFIX = "Ethernet";
const string LAG_PREFIX = "PortChannel";

extern set<string> g_portSet;
Expand Down Expand Up @@ -128,7 +129,7 @@ LinkSync::LinkSync(DBConnector *appl_db, DBConnector *state_db) :
string key = idx_p->if_name;

/* Skip all non-frontpanel ports */
if (key.compare(0, INTFS_PREFIX.length(), INTFS_PREFIX))
if (!regex_match(key, regex(FRONT_PANEL_PORT_PREFIX_REGEX)))
{
continue;
}
Expand Down Expand Up @@ -165,7 +166,7 @@ void LinkSync::onMsg(int nlmsg_type, struct nl_object *obj)
struct rtnl_link *link = (struct rtnl_link *)obj;
string key = rtnl_link_get_name(link);

if (key.compare(0, INTFS_PREFIX.length(), INTFS_PREFIX) &&
if (!regex_match(key, regex(FRONT_PANEL_PORT_PREFIX_REGEX)) &&
key.compare(0, LAG_PREFIX.length(), LAG_PREFIX) &&
key.compare(0, MGMT_PREFIX.length(), MGMT_PREFIX))
{
Expand Down

0 comments on commit 8679c67

Please sign in to comment.