From: Johannes Berg Date: Fri, 21 Sep 2012 07:38:15 +0000 (+0300) Subject: rtnl: Ignore netlink messages generated by wext X-Git-Tag: 1.8~82 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=baca46719603974ed6849996c50a66f4ebeb5ff1;p=platform%2Fupstream%2Fconnman.git rtnl: Ignore netlink messages generated by wext 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. --- diff --git a/src/rtnl.c b/src/rtnl.c index e4b35c2c..5f3fe155 100644 --- a/src/rtnl.c +++ b/src/rtnl.c @@ -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>",