static gboolean ts_recheck(gpointer user_data) { GSList *ts; ts = __connman_timeserver_get_all(__connman_service_get_default()); if (!ts) { DBG("timeservers disabled"); return TRUE; } if (g_strcmp0(ts_current, ts->data) != 0) { DBG("current %s preferred %s", ts_current, (char *)ts->data); g_slist_free_full(ts, g_free); __connman_timeserver_sync(NULL); return FALSE; } DBG(""); g_slist_free_full(ts, g_free); return TRUE; }
static void update_ipconfig(struct connman_service *service, struct connman_ipconfig *ipconfig) { if (service == NULL || service != __connman_service_get_default()) return; if (ipconfig != __connman_service_get_ip6config(service)) return; if (__connman_ipconfig_ipv6_is_enabled(ipconfig) == FALSE) { if (default_interface != NULL) { int ifindex; ifindex = connman_inet_ifindex(default_interface); __connman_dhcpv6_stop_pd(ifindex); g_free(default_interface); default_interface = NULL; } DBG("No IPv6 support for interface %s", __connman_ipconfig_get_ifname(ipconfig)); return; } /* * Did we had PD activated already? If not, then start it. */ if (default_interface == NULL) { DBG("IPv6 ipconfig %p changed for interface %s", ipconfig, __connman_ipconfig_get_ifname(ipconfig)); setup_prefix_delegation(service); } }
static void dhcpv6_renew_callback(struct connman_network *network, connman_bool_t success, gpointer data) { DBG("network %p success %d data %p", network, success, data); if (success == TRUE) dhcpv6_callback(network, success, data); else setup_prefix_delegation(__connman_service_get_default()); }
static void dhcpv6_renew_callback(struct connman_network *network, enum __connman_dhcpv6_status status, gpointer data) { DBG("network %p status %d data %p", network, status, data); if (status == CONNMAN_DHCPV6_STATUS_SUCCEED) dhcpv6_callback(network, status, data); else setup_prefix_delegation(__connman_service_get_default()); }
static gboolean do_setup(gpointer data) { int ret; timer_uplink = 0; if (default_interface == NULL) DBG("No uplink connection, retrying prefix delegation"); ret = setup_prefix_delegation(__connman_service_get_default()); if (ret < 0 && ret != -EINPROGRESS) return TRUE; /* delegation error, try again */ return FALSE; }
/* * This function must be called everytime the default service changes, the * service timeserver(s) or gatway changes or the global timeserver(s) changes. */ int __connman_timeserver_sync(struct connman_service *default_service) { struct connman_service *service; if (default_service) service = default_service; else service = __connman_service_get_default(); if (!service) return -EINVAL; if (!resolv) return 0; /* * Before we start creating the new timeserver list we must stop * any ongoing ntp query and server resolution. */ __connman_ntp_stop(); ts_recheck_disable(); if (resolv_id > 0) g_resolv_cancel_lookup(resolv, resolv_id); g_slist_free_full(ts_list, g_free); ts_list = __connman_timeserver_get_all(service); __connman_service_timeserver_changed(service, ts_list); if (!ts_list) { DBG("No timeservers set."); return 0; } ts_recheck_enable(); __connman_timeserver_sync_next(); return 0; }
int __connman_ipv6pd_setup(const char *bridge) { struct connman_service *service; int err; if (connman_inet_is_ipv6_supported() == FALSE) return -EPFNOSUPPORT; if (bridge_index >= 0) { DBG("Prefix delegation already running"); return -EALREADY; } err = connman_notifier_register(&pd_notifier); if (err < 0) return err; bridge_index = connman_inet_ifindex(bridge); timer_hash = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, cleanup_timer); err = __connman_inet_ipv6_start_recv_rs(bridge_index, rs_received, NULL, &rs_context); if (err < 0) DBG("Cannot receive router solicitation %d/%s", err, strerror(-err)); service = __connman_service_get_default(); if (service != NULL) { /* * We have an uplink connection already, try to use it. */ return setup_prefix_delegation(service); } /* * The prefix delegation is started after have got the uplink * connection up i.e., when the default service is setup in which * case the update_default_interface() will be called. */ return -EINPROGRESS; }