---
 src/connection.c |   84 +++++++++++++++++++++++++++---------------------------
 1 file changed, 42 insertions(+), 42 deletions(-)

diff --git a/src/connection.c b/src/connection.c
index d40f428..3fd4db1 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -54,7 +54,7 @@ struct gateway_data {
 
 static GHashTable *gateway_hash = NULL;
 
-static struct gateway_config *find_gateway(int index, const char *gateway)
+static struct gateway_config *find_gateway(int ifindex, const char *gateway)
 {
        GHashTableIter iter;
        gpointer value, key;
@@ -67,12 +67,12 @@ static struct gateway_config *find_gateway(int index, const 
char *gateway)
        while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
                struct gateway_data *data = value;
 
-               if (data->ipv4_gateway != NULL && data->index == index &&
+               if (data->ipv4_gateway != NULL && data->index == ifindex &&
                                g_str_equal(data->ipv4_gateway->gateway,
                                        gateway) == TRUE)
                        return data->ipv4_gateway;
 
-               if (data->ipv6_gateway != NULL && data->index == index &&
+               if (data->ipv6_gateway != NULL && data->index == ifindex &&
                                g_str_equal(data->ipv6_gateway->gateway,
                                        gateway) == TRUE)
                        return data->ipv6_gateway;
@@ -109,7 +109,7 @@ static struct gateway_data *lookup_gateway_data(struct 
gateway_config *config)
 /*
  * Find the gateway that is serving the VPN link
  */
-static struct gateway_data *find_phy_gateway(int index, const char *gateway)
+static struct gateway_data *find_phy_gateway(int ifindex, const char *gateway)
 {
        GHashTableIter iter;
        gpointer value, key;
@@ -122,12 +122,12 @@ static struct gateway_data *find_phy_gateway(int index, 
const char *gateway)
        while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
                struct gateway_data *data = value;
 
-               if (data->ipv4_gateway != NULL && data->index != index &&
+               if (data->ipv4_gateway != NULL && data->index != ifindex &&
                                g_str_equal(data->ipv4_gateway->gateway,
                                        gateway) == TRUE)
                        return data;
 
-               if (data->ipv6_gateway != NULL && data->index != index &&
+               if (data->ipv6_gateway != NULL && data->index != ifindex &&
                                g_str_equal(data->ipv6_gateway->gateway,
                                        gateway) == TRUE)
                        return data;
@@ -147,7 +147,7 @@ static void set_vpn_routes(struct gateway_data *new_gateway,
        struct gateway_data *data;
        struct connman_ipconfig *ipconfig;
        char *dest;
-       int index;
+       int ifindex;
 
        if (type == CONNMAN_IPCONFIG_TYPE_IPV4) {
                ipconfig = __connman_service_get_ip4config(service);
@@ -167,8 +167,8 @@ static void set_vpn_routes(struct gateway_data *new_gateway,
        else if (gateway != NULL)
                config->vpn_ip = g_strdup(gateway);
 
-       index = __connman_ipconfig_get_index(ipconfig);
-       data = find_phy_gateway(index, gateway);
+       ifindex = __connman_ipconfig_get_index(ipconfig);
+       data = find_phy_gateway(ifindex, gateway);
 
        if (data == NULL)
                goto done;
@@ -311,7 +311,7 @@ static int disable_gateway(struct gateway_data *data,
 }
 
 static struct gateway_data *add_gateway(struct connman_service *service,
-                                       int index, const char *gateway,
+                                       int ifindex, const char *gateway,
                                        enum connman_ipconfig_type type)
 {
        struct gateway_data *data, *old;
@@ -324,7 +324,7 @@ static struct gateway_data *add_gateway(struct 
connman_service *service,
        if (data == NULL)
                return NULL;
 
-       data->index = index;
+       data->index = ifindex;
 
        config = g_try_new0(struct gateway_config, 1);
        if (config == NULL) {
@@ -387,7 +387,7 @@ static struct gateway_data *add_gateway(struct 
connman_service *service,
 static void set_default_gateway(struct gateway_data *data,
                                enum connman_ipconfig_type type)
 {
-       int index;
+       int ifindex;
        int status4 = 0, status6 = 0;
        int do_ipv4 = FALSE, do_ipv6 = FALSE;
 
@@ -437,12 +437,12 @@ static void set_default_gateway(struct gateway_data *data,
                return;
        }
 
-       index = __connman_service_get_index(data->service);
+       ifindex = __connman_service_get_index(data->service);
 
        if (do_ipv4 == TRUE && data->ipv4_gateway != NULL &&
                        g_strcmp0(data->ipv4_gateway->gateway,
                                                        "0.0.0.0") == 0) {
-               if (connman_inet_set_gateway_interface(index) < 0)
+               if (connman_inet_set_gateway_interface(ifindex) < 0)
                        return;
                goto done;
        }
@@ -450,17 +450,17 @@ static void set_default_gateway(struct gateway_data *data,
        if (do_ipv6 == TRUE && data->ipv6_gateway != NULL &&
                        g_strcmp0(data->ipv6_gateway->gateway,
                                                        "::") == 0) {
-               if (connman_inet_set_ipv6_gateway_interface(index) < 0)
+               if (connman_inet_set_ipv6_gateway_interface(ifindex) < 0)
                        return;
                goto done;
        }
 
        if (do_ipv6 == TRUE && data->ipv6_gateway != NULL)
-               status6 = connman_inet_set_ipv6_gateway_address(index,
+               status6 = connman_inet_set_ipv6_gateway_address(ifindex,
                                                data->ipv6_gateway->gateway);
 
        if (do_ipv4 == TRUE && data->ipv4_gateway != NULL)
-               status4 = connman_inet_set_gateway_address(index,
+               status4 = connman_inet_set_gateway_address(ifindex,
                                                data->ipv4_gateway->gateway);
 
        if (status4 < 0 || status6 < 0)
@@ -473,7 +473,7 @@ done:
 static void unset_default_gateway(struct gateway_data *data,
                                enum connman_ipconfig_type type)
 {
-       int index;
+       int ifindex;
        int do_ipv4 = FALSE, do_ipv6 = FALSE;
 
        if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
@@ -518,28 +518,28 @@ static void unset_default_gateway(struct gateway_data 
*data,
                return;
        }
 
-       index = __connman_service_get_index(data->service);
+       ifindex = __connman_service_get_index(data->service);
 
        if (do_ipv4 == TRUE && data->ipv4_gateway != NULL &&
                        g_strcmp0(data->ipv4_gateway->gateway,
                                                        "0.0.0.0") == 0) {
-               connman_inet_clear_gateway_interface(index);
+               connman_inet_clear_gateway_interface(ifindex);
                return;
        }
 
        if (do_ipv6 == TRUE && data->ipv6_gateway != NULL &&
                        g_strcmp0(data->ipv6_gateway->gateway,
                                                        "::") == 0) {
-               connman_inet_clear_ipv6_gateway_interface(index);
+               connman_inet_clear_ipv6_gateway_interface(ifindex);
                return;
        }
 
        if (do_ipv6 == TRUE && data->ipv6_gateway != NULL)
-               connman_inet_clear_ipv6_gateway_address(index,
+               connman_inet_clear_ipv6_gateway_address(ifindex,
                                                data->ipv6_gateway->gateway);
 
        if (do_ipv4 == TRUE && data->ipv4_gateway != NULL)
-               connman_inet_clear_gateway_address(index,
+               connman_inet_clear_gateway_address(ifindex,
                                                data->ipv4_gateway->gateway);
 }
 
@@ -614,7 +614,7 @@ static gboolean choose_default_gateway(struct gateway_data 
*data,
        return downgraded;
 }
 
-static void connection_newgateway(int index, const char *gateway)
+static void connection_newgateway(int ifindex, const char *gateway)
 {
        struct gateway_config *config;
        struct gateway_data *data;
@@ -622,9 +622,9 @@ static void connection_newgateway(int index, const char 
*gateway)
        gpointer value, key;
        gboolean found = FALSE;
 
-       DBG("index %d gateway %s", index, gateway);
+       DBG("index %d gateway %s", ifindex, gateway);
 
-       config = find_gateway(index, gateway);
+       config = find_gateway(ifindex, gateway);
        if (config == NULL)
                return;
 
@@ -694,14 +694,14 @@ static void remove_gateway(gpointer user_data)
        g_free(data);
 }
 
-static void connection_delgateway(int index, const char *gateway)
+static void connection_delgateway(int ifindex, const char *gateway)
 {
        struct gateway_config *config;
        struct gateway_data *data;
 
-       DBG("index %d gateway %s", index, gateway);
+       DBG("index %d gateway %s", ifindex, gateway);
 
-       config = find_gateway(index, gateway);
+       config = find_gateway(ifindex, gateway);
        if (config != NULL)
                config->active = FALSE;
 
@@ -774,7 +774,7 @@ void __connman_connection_gateway_activate(struct 
connman_service *service,
                data->ipv6_gateway->active = TRUE;
 }
 
-static void add_host_route(int family, int index, const char *gateway,
+static void add_host_route(int family, int ifindex, const char *gateway,
                        enum connman_service_type service_type)
 {
        switch (family) {
@@ -786,7 +786,7 @@ static void add_host_route(int family, int index, const 
char *gateway,
                         * back to itself and not routed into phy link gateway.
                         */
                        if (service_type != CONNMAN_SERVICE_TYPE_VPN)
-                               connman_inet_add_host_route(index, gateway,
+                               connman_inet_add_host_route(ifindex, gateway,
                                                                        NULL);
                } else {
                        /*
@@ -796,8 +796,8 @@ static void add_host_route(int family, int index, const 
char *gateway,
                         * usage if default route is not directed to them)
                         */
                        char *dest;
-                       if (connman_inet_get_dest_addr(index, &dest) == 0) {
-                               connman_inet_add_host_route(index, dest, NULL);
+                       if (connman_inet_get_dest_addr(ifindex, &dest) == 0) {
+                               connman_inet_add_host_route(ifindex, dest, 
NULL);
                                g_free(dest);
                        }
                }
@@ -806,14 +806,14 @@ static void add_host_route(int family, int index, const 
char *gateway,
        case AF_INET6:
                if (g_strcmp0(gateway, "::") != 0) {
                        if (service_type != CONNMAN_SERVICE_TYPE_VPN)
-                               connman_inet_add_ipv6_host_route(index,
+                               connman_inet_add_ipv6_host_route(ifindex,
                                                                gateway, NULL);
                } else {
                        /* P-t-P link, add route to destination */
                        char *dest;
-                       if (connman_inet_ipv6_get_dest_addr(index,
+                       if (connman_inet_ipv6_get_dest_addr(ifindex,
                                                                &dest) == 0) {
-                               connman_inet_add_ipv6_host_route(index, dest,
+                               connman_inet_add_ipv6_host_route(ifindex, dest,
                                                                NULL);
                                g_free(dest);
                        }
@@ -833,9 +833,9 @@ int __connman_connection_gateway_add(struct connman_service 
*service,
                type6 = CONNMAN_IPCONFIG_TYPE_UNKNOWN;
        enum connman_service_type service_type =
                                        connman_service_get_type(service);
-       int index;
+       int ifindex;
 
-       index = __connman_service_get_index(service);
+       ifindex = __connman_service_get_index(service);
 
        /*
         * If gateway is NULL, it's a point to point link and the default
@@ -849,9 +849,9 @@ int __connman_connection_gateway_add(struct connman_service 
*service,
                gateway = "::";
 
        DBG("service %p index %d gateway %s vpn ip %s type %d",
-               service, index, gateway, peer, type);
+               service, ifindex, gateway, peer, type);
 
-       new_gateway = add_gateway(service, index, gateway, type);
+       new_gateway = add_gateway(service, ifindex, gateway, type);
        if (new_gateway == NULL)
                return -EINVAL;
 
@@ -862,7 +862,7 @@ int __connman_connection_gateway_add(struct connman_service 
*service,
 
        if (type == CONNMAN_IPCONFIG_TYPE_IPV4 &&
                                new_gateway->ipv4_gateway != NULL) {
-               add_host_route(AF_INET, index, gateway, service_type);
+               add_host_route(AF_INET, ifindex, gateway, service_type);
                __connman_service_nameserver_add_routes(service,
                                        new_gateway->ipv4_gateway->gateway);
                type4 = CONNMAN_IPCONFIG_TYPE_IPV4;
@@ -870,7 +870,7 @@ int __connman_connection_gateway_add(struct connman_service 
*service,
 
        if (type == CONNMAN_IPCONFIG_TYPE_IPV6 &&
                                new_gateway->ipv6_gateway != NULL) {
-               add_host_route(AF_INET6, index, gateway, service_type);
+               add_host_route(AF_INET6, ifindex, gateway, service_type);
                __connman_service_nameserver_add_routes(service,
                                        new_gateway->ipv6_gateway->gateway);
                type6 = CONNMAN_IPCONFIG_TYPE_IPV6;
-- 
1.7.9.5

_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to