rtnl: Call __connman_technology_add_interface() after rtnl->newlink()
authorMartin Xu <martin.xu@intel.com>
Thu, 9 Dec 2010 15:10:54 +0000 (16:10 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 9 Dec 2010 15:10:54 +0000 (16:10 +0100)
The device is created and the underlying technology attached from
the rtnl newlink hook, so __connman_technology_add_interface() needs
to be called after it.

src/rtnl.c

index 8fea094..b10d835 100644 (file)
@@ -406,6 +406,7 @@ static void process_newlink(unsigned short type, int index, unsigned flags,
        struct ether_addr compare = {{ 0, 0, 0, 0, 0, 0 }};
        struct rtnl_link_stats stats;
        unsigned char operstate = 0xff;
+       struct interface_data *interface;
        const char *ifname = NULL;
        unsigned int mtu = 0;
        char ident[13], str[18];
@@ -449,10 +450,8 @@ static void process_newlink(unsigned short type, int index, unsigned flags,
                                                ifname, index, operstate,
                                                operstate2str(operstate));
 
-       if (g_hash_table_lookup(interface_list,
-                                       GINT_TO_POINTER(index)) == NULL) {
-               struct interface_data *interface;
-
+       interface = g_hash_table_lookup(interface_list, GINT_TO_POINTER(index));
+       if (interface == NULL) {
                interface = g_new0(struct interface_data, 1);
                interface->index = index;
                interface->name = g_strdup(ifname);
@@ -463,9 +462,6 @@ static void process_newlink(unsigned short type, int index, unsigned flags,
 
                if (type == ARPHRD_ETHER)
                        read_uevent(interface);
-
-               __connman_technology_add_interface(interface->service_type,
-                       interface->index, interface->name, interface->ident);
        }
 
        for (list = rtnl_list; list; list = list->next) {
@@ -475,6 +471,9 @@ static void process_newlink(unsigned short type, int index, unsigned flags,
                        rtnl->newlink(type, index, flags, change);
        }
 
+       __connman_technology_add_interface(interface->service_type,
+                       interface->index, interface->name, interface->ident);
+
        for (list = watch_list; list; list = list->next) {
                struct watch_data *watch = list->data;