rtnl: Ignore netlink messages generated by wext
authorJohannes Berg <johannes.berg@intel.com>
Fri, 21 Sep 2012 07:38:15 +0000 (10:38 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 24 Sep 2012 08:07:50 +0000 (11:07 +0300)
ConnMan should just ignore netlink messages generated by wext
as described in commit 4997f6e38f34effc00179e849dee0dc2e2263d3a.

Handle wext message detection using the IFLA_WIRELESS type
because the ifinfomsg ifi_change field is reserved for future
use and code using it for wext detection has been removed.

src/rtnl.c

index e4b35c2ce07204a5aec4cdc9fb1110537fbcd024..5f3fe155dd9fda5eb7e14ab2eb47dcac7c0b597c 100644 (file)
@@ -356,10 +356,10 @@ static const char *operstate2str(unsigned char operstate)
        return "";
 }
 
-static void extract_link(struct ifinfomsg *msg, int bytes,
+static connman_bool_t extract_link(struct ifinfomsg *msg, int bytes,
                                struct ether_addr *address, const char **ifname,
                                unsigned int *mtu, unsigned char *operstate,
-                                               struct rtnl_link_stats *stats)
+                               struct rtnl_link_stats *stats)
 {
        struct rtattr *attr;
 
@@ -389,8 +389,12 @@ static void extract_link(struct ifinfomsg *msg, int bytes,
                        break;
                case IFLA_LINKMODE:
                        break;
+               case IFLA_WIRELESS:
+                       return FALSE;
                }
        }
+
+       return TRUE;
 }
 
 static void process_newlink(unsigned short type, int index, unsigned flags,
@@ -407,7 +411,9 @@ static void process_newlink(unsigned short type, int index, unsigned flags,
        GSList *list;
 
        memset(&stats, 0, sizeof(stats));
-       extract_link(msg, bytes, &address, &ifname, &mtu, &operstate, &stats);
+       if (extract_link(msg, bytes, &address, &ifname, &mtu, &operstate,
+                                       &stats) == FALSE)
+               return;
 
        snprintf(ident, 13, "%02x%02x%02x%02x%02x%02x",
                                                address.ether_addr_octet[0],
@@ -489,7 +495,9 @@ static void process_dellink(unsigned short type, int index, unsigned flags,
        GSList *list;
 
        memset(&stats, 0, sizeof(stats));
-       extract_link(msg, bytes, NULL, &ifname, NULL, &operstate, &stats);
+       if (extract_link(msg, bytes, NULL, &ifname, NULL, &operstate,
+                                       &stats) == FALSE)
+               return;
 
        if (operstate != 0xff)
                connman_info("%s {dellink} index %d operstate %u <%s>",