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

server: fix nic path update #404

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
31 changes: 19 additions & 12 deletions api/server/graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -989,17 +989,24 @@ void Graph::NicConfigAntiSpoof(const app::Nic &nic, bool enable) {
void Graph::LinkSniffer(const app::Nic &nic, Graph::BrickShrPtr n_sniffer) {
Graph::GraphNic *g_nic = FindNic(nic);

if (nic.bypass_filtering) {
unlink(g_nic->vhost);
g_nic->head = n_sniffer;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was broken, it's still broken(because it's ignore the possibility of a switch), either fix this, or error out any use of that branch, thanks

link(n_sniffer, g_nic->vhost);
link(vtep_, g_nic->head);
add_vni(vtep_, g_nic->head, nic.vni);
} else {
unlink_edge(g_nic->antispoof, g_nic->vhost);
g_nic->head = n_sniffer;
link(g_nic->antispoof, n_sniffer);
link(n_sniffer, g_nic->vhost);
auto it = vnis_.find(nic.vni);
if (it != vnis_.end()) {
struct GraphVni &g_vni = it->second;
if (nic.bypass_filtering) {
unlink(g_nic->vhost);
link(n_sniffer, g_nic->vhost);
if (g_vni.nics.size() == 0) {
link(vtep_, n_sniffer);
add_vni(vtep_, g_nic->head, nic.vni);
} else {
link(g_vni.sw, n_sniffer);
add_vni(g_vni.sw, g_nic->head, nic.vni);
}
} else {
unlink_edge(g_nic->antispoof, g_nic->vhost);
link(g_nic->antispoof, n_sniffer);
link(n_sniffer, g_nic->vhost);
}
}
}

Expand Down Expand Up @@ -1067,7 +1074,7 @@ void Graph::NicConfigPacketTracePath(const app::Nic &nic,
FILE *n_pcap_file;
std::string name;
if (nic.packet_trace_path == update_path) {
LOG_INFO_("packet trace path %s is already exist",
LOG_INFO_("packet trace path %s is already exist",
update_path.c_str());
return;
}
Expand Down