ipconfig: Have separate callbacks for route changes.
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Tue, 3 Jan 2012 12:36:26 +0000 (14:36 +0200)
committerDaniel Wagner <daniel.wagner@bmw-carit.de>
Thu, 5 Jan 2012 10:09:16 +0000 (11:09 +0100)
Route changes should not trigger ip_bound or ip_release callbacks
in service.c as that can cause too early transition into IPv6 ready state.
The ip_bound (in __connman_ipconfig_newaddr()) and ip_release (in
__connman_ipconfig_deladdr()) are enough to trigger a transition
in IPv6 state.

This also prevents too many notifier calls in session as we only
notify session when address changes.

include/ipconfig.h
src/ipconfig.c

index 34463eb..295bba8 100644 (file)
@@ -81,6 +81,8 @@ struct connman_ipconfig_ops {
        void (*lower_down) (struct connman_ipconfig *ipconfig);
        void (*ip_bound) (struct connman_ipconfig *ipconfig);
        void (*ip_release) (struct connman_ipconfig *ipconfig);
+       void (*route_set) (struct connman_ipconfig *ipconfig);
+       void (*route_unset) (struct connman_ipconfig *ipconfig);
 };
 
 struct connman_ipconfig *connman_ipconfig_create(int index,
index 20207a1..950229d 100644 (file)
@@ -941,8 +941,8 @@ void __connman_ipconfig_newroute(int index, int family, unsigned char scope,
                        if (ipconfig->ops == NULL)
                                continue;
 
-                       if (ipconfig->ops->ip_bound)
-                               ipconfig->ops->ip_bound(ipconfig);
+                       if (ipconfig->ops->route_set)
+                               ipconfig->ops->route_set(ipconfig);
                }
        }
 
@@ -1003,8 +1003,8 @@ void __connman_ipconfig_delroute(int index, int family, unsigned char scope,
                        if (ipconfig->ops == NULL)
                                continue;
 
-                       if (ipconfig->ops->ip_release)
-                               ipconfig->ops->ip_release(ipconfig);
+                       if (ipconfig->ops->route_unset)
+                               ipconfig->ops->route_unset(ipconfig);
                }
        }