summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2010-11-23 14:48:24 +0100
committerSamuel Ortiz <sameo@linux.intel.com>2010-11-23 14:53:24 +0100
commitc15a083bbe2e2966f2cd65e3085d55b21ff3013e (patch)
tree4413e292a4fca914862b6c8fb02fcd4b7f8a482a
parentcddefa2d1513e96673fcaba8984517caa0d7601d (diff)
downloadconnman-c15a083bbe2e2966f2cd65e3085d55b21ff3013e.tar.gz
connman-c15a083bbe2e2966f2cd65e3085d55b21ff3013e.tar.bz2
connman-c15a083bbe2e2966f2cd65e3085d55b21ff3013e.zip
ipv4: Use existing connman_inet_ifname() routine
-rw-r--r--src/ipv4.c27
1 files changed, 1 insertions, 26 deletions
diff --git a/src/ipv4.c b/src/ipv4.c
index 416dab26..91240153 100644
--- a/src/ipv4.c
+++ b/src/ipv4.c
@@ -36,31 +36,6 @@
#include "connman.h"
-static char *index2name(int index)
-{
- struct ifreq ifr;
- int sk, err;
-
- if (index < 0)
- return NULL;
-
- sk = socket(PF_INET, SOCK_DGRAM, 0);
- if (sk < 0)
- return NULL;
-
- memset(&ifr, 0, sizeof(ifr));
- ifr.ifr_ifindex = index;
-
- err = ioctl(sk, SIOCGIFNAME, &ifr);
-
- close(sk);
-
- if (err < 0)
- return NULL;
-
- return strdup(ifr.ifr_name);
-}
-
static int ipv4_probe(struct connman_element *element)
{
struct connman_service *service;
@@ -117,7 +92,7 @@ static int ipv4_probe(struct connman_element *element)
connection->type = CONNMAN_ELEMENT_TYPE_CONNECTION;
connection->index = element->index;
- connection->devname = index2name(element->index);
+ connection->devname = connman_inet_ifname(element->index);
ipconfig = __connman_service_get_ipconfig(service);
if (ipconfig != NULL)