Skip to content

Commit

Permalink
cnetlink: adapt mdb handling to fixed upstream working
Browse files Browse the repository at this point in the history
Signed-off-by: Jonas Gorski <[email protected]>
  • Loading branch information
KanjiMonster committed May 29, 2024
1 parent b85be60 commit ce9d99f
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions src/netlink/cnetlink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1880,20 +1880,37 @@ std::deque<rtnl_neigh *> cnetlink::search_fdb(uint16_t vid, nl_addr *lladdr) {

void cnetlink::route_mdb_apply(const nl_obj &obj) {

switch (obj.get_msg_type()) {
case RTM_NEWMDB:
switch (obj.get_action()) {
case NL_ACT_NEW:
assert(obj.get_new_obj());
LOG(INFO) << __FUNCTION__ << ": new mdb entry";

VLOG(2) << __FUNCTION__ << ": add mdb " << obj.get_old_obj();

if (bridge)
bridge->mdb_entry_add(MDB_CAST(obj.get_new_obj()));

break;
case NL_ACT_CHANGE:
assert(obj.get_new_obj());
assert(obj.get_old_obj());

VLOG(2) << __FUNCTION__ << ": change new mdb " << obj.get_new_obj();
VLOG(2) << __FUNCTION__ << ": change old mdb " << obj.get_old_obj();

if (bridge) {
bridge->mdb_entry_remove(MDB_CAST(obj.get_old_obj()));
bridge->mdb_entry_add(MDB_CAST(obj.get_new_obj()));
}

break;
case RTM_DELMDB:
case NL_ACT_DEL:
assert(obj.get_old_obj());
LOG(INFO) << __FUNCTION__ << ": deleting mdb entry";

VLOG(2) << __FUNCTION__ << ": del route " << obj.get_old_obj();

if (bridge)
bridge->mdb_entry_remove(MDB_CAST(obj.get_new_obj()));
bridge->mdb_entry_remove(MDB_CAST(obj.get_old_obj()));

break;
default:
LOG(ERROR) << __FUNCTION__ << ": invalid action " << obj.get_action();
Expand Down

0 comments on commit ce9d99f

Please sign in to comment.