]> granicus.if.org Git - libnl/commitdiff
link: Ignore bridging notifications in link cache manager
authorThomas Graf <tgraf@redhat.com>
Fri, 21 Oct 2011 09:31:58 +0000 (11:31 +0200)
committerThomas Graf <tgraf@redhat.com>
Fri, 21 Oct 2011 09:31:58 +0000 (11:31 +0200)
RTM_DELLINK and RTM_NEWLINK bridging notifications should not delete/add
entries to a link cache.

lib/route/link.c

index 00beb0893c271b3eddaa061a2b392672500e8eca..b252f39baa3d3063febcacd72bac044a97f85a13 100644 (file)
@@ -528,6 +528,19 @@ errout:
        return err;
 }
 
+static int link_event_filter(struct nl_cache *cache, struct nl_object *obj)
+{
+       struct rtnl_link *link = (struct rtnl_link *) obj;
+
+       /*
+        * Ignore bridging messages when keeping the cache manager up to date.
+        */
+       if (link->l_family == AF_BRIDGE)
+               return NL_SKIP;
+
+       return NL_OK;
+}
+
 static int link_request_update(struct nl_cache *cache, struct nl_sock *sk)
 {
        int family = cache->c_iarg1;
@@ -2186,6 +2199,7 @@ static struct nl_cache_ops rtnl_link_ops = {
        .co_groups              = link_groups,
        .co_request_update      = link_request_update,
        .co_msg_parser          = link_msg_parser,
+       .co_event_filter        = link_event_filter,
        .co_obj_ops             = &link_obj_ops,
 };