Skip to content

Commit

Permalink
libteam: ifinfo: fix rtnl dellink handling
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
  • Loading branch information
jpirko committed Mar 27, 2015
1 parent a3793b6 commit 2b10140
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions libteam/ifinfo.c
Expand Up @@ -271,6 +271,7 @@ static void event_handler_obj_input_dellink(struct nl_object *obj, void *arg)
struct rtnl_link *link;
struct team_ifinfo *ifinfo;
uint32_t ifindex;
int err;

ifinfo_destroy_removed(th);

Expand All @@ -280,6 +281,17 @@ static void event_handler_obj_input_dellink(struct nl_object *obj, void *arg)
ifinfo = ifinfo_find_create(th, ifindex);
if (!ifinfo)
return;

/* It might happen that dellink message comes even in case the device
* is not actually removed. For example in case of bridge port removal.
* So better to check actual state before taking actions
*/
err = rtnl_link_get_kernel(th->nl_cli.sock, ifindex, NULL, &link);
if (!err) {
rtnl_link_put(link);
return;
}

clear_last_changed(th);
set_changed(ifinfo, CHANGED_REMOVED);
set_call_change_handlers(th, TEAM_IFINFO_CHANGE);
Expand Down

0 comments on commit 2b10140

Please sign in to comment.