---
src/service.c | 111 +++++++++++++++++++++++++++++----------------------------
1 file changed, 56 insertions(+), 55 deletions(-)
diff --git a/src/service.c b/src/service.c
index dfe1752..bc6e86f 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1123,29 +1123,29 @@ void __connman_service_nameserver_clear(struct
connman_service *service)
update_nameservers(service);
}
-static void add_nameserver_route(int family, int index, char *nameserver,
+static void add_nameserver_route(int family, int ifindex, char *nameserver,
const char *gw)
{
switch (family) {
case AF_INET:
- if (connman_inet_compare_subnet(index, nameserver) == TRUE)
+ if (connman_inet_compare_subnet(ifindex, nameserver) == TRUE)
break;
- if (connman_inet_add_host_route(index, nameserver, gw) < 0)
+ if (connman_inet_add_host_route(ifindex, nameserver, gw) < 0)
/* For P-t-P link the above route add will fail */
- connman_inet_add_host_route(index, nameserver, NULL);
+ connman_inet_add_host_route(ifindex, nameserver, NULL);
break;
case AF_INET6:
- if (connman_inet_add_ipv6_host_route(index, nameserver,
+ if (connman_inet_add_ipv6_host_route(ifindex, nameserver,
gw) < 0)
- connman_inet_add_ipv6_host_route(index, nameserver,
+ connman_inet_add_ipv6_host_route(ifindex, nameserver,
NULL);
break;
}
}
-static void nameserver_add_routes(int index, char **nameservers,
+static void nameserver_add_routes(int ifindex, char **nameservers,
const char *gw)
{
int i, family;
@@ -1155,11 +1155,11 @@ static void nameserver_add_routes(int index, char
**nameservers,
if (family < 0)
continue;
- add_nameserver_route(family, index, nameservers[i], gw);
+ add_nameserver_route(family, ifindex, nameservers[i], gw);
}
}
-static void nameserver_del_routes(int index, char **nameservers,
+static void nameserver_del_routes(int ifindex, char **nameservers,
enum connman_ipconfig_type type)
{
int i, family;
@@ -1172,12 +1172,12 @@ static void nameserver_del_routes(int index, char
**nameservers,
switch (family) {
case AF_INET:
if (type != CONNMAN_IPCONFIG_TYPE_IPV6)
- connman_inet_del_host_route(index,
+ connman_inet_del_host_route(ifindex,
nameservers[i]);
break;
case AF_INET6:
if (type != CONNMAN_IPCONFIG_TYPE_IPV4)
- connman_inet_del_ipv6_host_route(index,
+ connman_inet_del_ipv6_host_route(ifindex,
nameservers[i]);
break;
}
@@ -1187,22 +1187,22 @@ static void nameserver_del_routes(int index, char
**nameservers,
void __connman_service_nameserver_add_routes(struct connman_service *service,
const char *gw)
{
- int index = -1;
+ int ifindex = -1;
if (service == NULL)
return;
if (service->network != NULL)
- index = connman_network_get_index(service->network);
+ ifindex = connman_network_get_index(service->network);
else if (service->provider != NULL)
- index = connman_provider_get_index(service->provider);
+ ifindex = connman_provider_get_index(service->provider);
if (service->nameservers_config != NULL) {
/*
* Configured nameserver takes preference over the
* discoverd nameserver gathered from DHCP, VPN, etc.
*/
- nameserver_add_routes(index, service->nameservers_config, gw);
+ nameserver_add_routes(ifindex, service->nameservers_config, gw);
} else if (service->nameservers != NULL) {
/*
* We add nameservers host routes for nameservers that
@@ -1211,28 +1211,28 @@ void __connman_service_nameserver_add_routes(struct
connman_service *service,
* tries to reach them. The subnet route is installed
* when setting the interface IP address.
*/
- nameserver_add_routes(index, service->nameservers, gw);
+ nameserver_add_routes(ifindex, service->nameservers, gw);
}
}
void __connman_service_nameserver_del_routes(struct connman_service *service,
enum connman_ipconfig_type type)
{
- int index = -1;
+ int ifindex = -1;
if (service == NULL)
return;
if (service->network != NULL)
- index = connman_network_get_index(service->network);
+ ifindex = connman_network_get_index(service->network);
else if (service->provider != NULL)
- index = connman_provider_get_index(service->provider);
+ ifindex = connman_provider_get_index(service->provider);
if (service->nameservers_config != NULL)
- nameserver_del_routes(index, service->nameservers_config,
+ nameserver_del_routes(ifindex, service->nameservers_config,
type);
else if (service->nameservers != NULL)
- nameserver_del_routes(index, service->nameservers, type);
+ nameserver_del_routes(ifindex, service->nameservers, type);
}
static struct connman_stats *stats_get(struct connman_service *service)
@@ -3010,7 +3010,7 @@ static DBusMessage *set_property(DBusConnection *conn,
} else if (g_str_equal(name, "Nameservers.Configuration") == TRUE) {
DBusMessageIter entry;
GString *str;
- int index;
+ int ifindex;
const char *gw;
if (type != DBUS_TYPE_ARRAY)
@@ -3020,8 +3020,8 @@ static DBusMessage *set_property(DBusConnection *conn,
if (str == NULL)
return __connman_error_invalid_arguments(msg);
- index = connman_network_get_index(service->network);
- gw = __connman_ipconfig_get_gateway_from_index(index,
+ ifindex = connman_network_get_index(service->network);
+ gw = __connman_ipconfig_get_gateway_from_index(ifindex,
CONNMAN_IPCONFIG_TYPE_ALL);
if (gw && strlen(gw))
@@ -3899,20 +3899,20 @@ static void append_removed(gpointer key, gpointer
value, gpointer user_data)
static gboolean service_send_changed(gpointer data)
{
- DBusMessage *signal;
+ DBusMessage *dbus_signal;
DBusMessageIter iter, array;
DBG("");
- signal = dbus_message_new_signal(CONNMAN_MANAGER_PATH,
+ dbus_signal = dbus_message_new_signal(CONNMAN_MANAGER_PATH,
CONNMAN_MANAGER_INTERFACE, "ServicesChanged");
- if (signal == NULL)
+ if (dbus_signal == NULL)
return FALSE;
- __connman_dbus_append_objpath_dict_array(signal,
+ __connman_dbus_append_objpath_dict_array(dbus_signal,
service_append_ordered, NULL);
- dbus_message_iter_init_append(signal, &iter);
+ dbus_message_iter_init_append(dbus_signal, &iter);
dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
DBUS_TYPE_OBJECT_PATH_AS_STRING, &array);
@@ -3920,8 +3920,8 @@ static gboolean service_send_changed(gpointer data)
dbus_message_iter_close_container(&iter, &array);
- dbus_connection_send(connection, signal, NULL);
- dbus_message_unref(signal);
+ dbus_connection_send(connection, dbus_signal, NULL);
+ dbus_message_unref(dbus_signal);
g_hash_table_remove_all(services_notify->remove);
g_hash_table_remove_all(services_notify->add);
@@ -4306,30 +4306,30 @@ enum connman_service_type
connman_service_get_type(struct connman_service *servi
*/
char *connman_service_get_interface(struct connman_service *service)
{
- int index;
+ int ifindex;
if (service == NULL)
return NULL;
if (service->type == CONNMAN_SERVICE_TYPE_VPN) {
if (service->ipconfig_ipv4)
- index = __connman_ipconfig_get_index(
+ ifindex = __connman_ipconfig_get_index(
service->ipconfig_ipv4);
else if (service->ipconfig_ipv6)
- index = __connman_ipconfig_get_index(
+ ifindex = __connman_ipconfig_get_index(
service->ipconfig_ipv6);
else
return NULL;
- return connman_inet_ifname(index);
+ return connman_inet_ifname(ifindex);
}
if (service->network == NULL)
return NULL;
- index = connman_network_get_index(service->network);
+ ifindex = connman_network_get_index(service->network);
- return connman_inet_ifname(index);
+ return connman_inet_ifname(ifindex);
}
/**
@@ -5823,10 +5823,10 @@ static const struct connman_ipconfig_ops service_ops = {
.route_unset = service_route_changed,
};
-static void setup_ip4config(struct connman_service *service, int index,
+static void setup_ip4config(struct connman_service *service, int ifindex,
enum connman_ipconfig_method method)
{
- service->ipconfig_ipv4 = __connman_ipconfig_create(index,
+ service->ipconfig_ipv4 = __connman_ipconfig_create(ifindex,
CONNMAN_IPCONFIG_TYPE_IPV4);
if (service->ipconfig_ipv4 == NULL)
return;
@@ -5838,9 +5838,9 @@ static void setup_ip4config(struct connman_service
*service, int index,
__connman_ipconfig_set_ops(service->ipconfig_ipv4, &service_ops);
}
-static void setup_ip6config(struct connman_service *service, int index)
+static void setup_ip6config(struct connman_service *service, int ifindex)
{
- service->ipconfig_ipv6 = __connman_ipconfig_create(index,
+ service->ipconfig_ipv6 = __connman_ipconfig_create(ifindex,
CONNMAN_IPCONFIG_TYPE_IPV6);
if (service->ipconfig_ipv6 == NULL)
return;
@@ -5868,14 +5868,14 @@ void __connman_service_read_ip4config(struct
connman_service *service)
}
void __connman_service_create_ip4config(struct connman_service *service,
- int index)
+ int ifindex)
{
DBG("ipv4 %p", service->ipconfig_ipv4);
if (service->ipconfig_ipv4 != NULL)
return;
- setup_ip4config(service, index, CONNMAN_IPCONFIG_METHOD_DHCP);
+ setup_ip4config(service, ifindex, CONNMAN_IPCONFIG_METHOD_DHCP);
__connman_service_read_ip4config(service);
}
@@ -5897,14 +5897,14 @@ void __connman_service_read_ip6config(struct
connman_service *service)
}
void __connman_service_create_ip6config(struct connman_service *service,
- int index)
+ int ifindex)
{
DBG("ipv6 %p", service->ipconfig_ipv6);
if (service->ipconfig_ipv6 != NULL)
return;
- setup_ip6config(service, index);
+ setup_ip6config(service, ifindex);
__connman_service_read_ip6config(service);
}
@@ -5942,7 +5942,7 @@ struct connman_service
*__connman_service_lookup_from_network(struct connman_net
return service;
}
-struct connman_service *__connman_service_lookup_from_index(int index)
+struct connman_service *__connman_service_lookup_from_index(int ifindex)
{
struct connman_service *service;
GSequenceIter *iter;
@@ -5953,11 +5953,11 @@ struct connman_service
*__connman_service_lookup_from_index(int index)
service = g_sequence_get(iter);
if (__connman_ipconfig_get_index(service->ipconfig_ipv4)
- == index)
+ == ifindex)
return service;
if (__connman_ipconfig_get_index(service->ipconfig_ipv6)
- == index)
+ == ifindex)
return service;
iter = g_sequence_iter_next(iter);
@@ -6137,7 +6137,7 @@ struct connman_service *
__connman_service_create_from_network(struct connman_ne
const char *ident, *group;
char *name;
unsigned int *auto_connect_types;
- int i, index;
+ int i, ifindex;
DBG("network %p", network);
@@ -6202,13 +6202,13 @@ struct connman_service *
__connman_service_create_from_network(struct connman_ne
update_from_network(service, network);
- index = connman_network_get_index(network);
+ ifindex = connman_network_get_index(network);
if (service->ipconfig_ipv4 == NULL)
- setup_ip4config(service, index, CONNMAN_IPCONFIG_METHOD_DHCP);
+ setup_ip4config(service, ifindex, CONNMAN_IPCONFIG_METHOD_DHCP);
if (service->ipconfig_ipv6 == NULL)
- setup_ip6config(service, index);
+ setup_ip6config(service, ifindex);
service_register(service);
@@ -6321,7 +6321,7 @@ __connman_service_create_from_provider(struct
connman_provider *provider)
struct connman_service *service;
const char *ident, *str;
char *name;
- int index = connman_provider_get_index(provider);
+ int ifindex = connman_provider_get_index(provider);
DBG("provider %p", provider);
@@ -6358,10 +6358,11 @@ __connman_service_create_from_provider(struct
connman_provider *provider)
service->strength = 0;
if (service->ipconfig_ipv4 == NULL)
- setup_ip4config(service, index, CONNMAN_IPCONFIG_METHOD_MANUAL);
+ setup_ip4config(service, ifindex,
+ CONNMAN_IPCONFIG_METHOD_MANUAL);
if (service->ipconfig_ipv6 == NULL)
- setup_ip6config(service, index);
+ setup_ip6config(service, ifindex);
service_register(service);
--
1.7.9.5
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman