diff --git a/src/netlink/cnetlink.cc b/src/netlink/cnetlink.cc index 67b30e8c..2669055b 100644 --- a/src/netlink/cnetlink.cc +++ b/src/netlink/cnetlink.cc @@ -1880,20 +1880,37 @@ std::deque 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();