Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vlanmgrd]: Create a dummy interface and put into the Bridge #730

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions cfgmgr/vlanmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,21 @@ VlanMgr::VlanMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, c

// Initialize Linux dot1q bridge and enable vlan filtering
// The command should be generated as:
// /bin/bash -c "/sbin/ip link del Bridge 2>/dev/null ;
// /bin/bash -c "/sbin/ip link del Bridge 2>/dev/null;
// /sbin/ip link add Bridge up type bridge &&
// /sbin/bridge vlan del vid 1 dev Bridge self"
// /sbin/bridge vlan del vid 1 dev Bridge self;
// /sbin/ip link del dummy 2>/dev/null;
// /sbin/ip link add dummy type dummy &&"
// /sbin/ip link set dummy up master Bridge"

const std::string cmds = std::string("")
+ BASH_CMD + " -c \""
+ IP_CMD + " link del " + DOT1Q_BRIDGE_NAME + " 2>/dev/null; "
+ IP_CMD + " link add " + DOT1Q_BRIDGE_NAME + " up type bridge && "
+ BRIDGE_CMD + " vlan del vid " + DEFAULT_VLAN_ID + " dev " + DOT1Q_BRIDGE_NAME + " self\"";
+ BRIDGE_CMD + " vlan del vid " + DEFAULT_VLAN_ID + " dev " + DOT1Q_BRIDGE_NAME + " self; "
+ IP_CMD + " link del dummy 2>/dev/null; "
+ IP_CMD + " link add dummy type dummy && "
+ IP_CMD + " link set dummy up master " + DOT1Q_BRIDGE_NAME + "\"";

std::string res;
EXEC_WITH_ERROR_THROW(cmds, res);
Expand Down