summaryrefslogtreecommitdiff
path: root/src/inet.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-08-11 00:55:20 -0700
committerMarcel Holtmann <marcel@holtmann.org>2009-08-11 00:55:20 -0700
commit213dec4c14f6c15bf91273185dfbc802339edc33 (patch)
tree8f4356747aaa9e4889a55e8eb01209f8c5d9a7f4 /src/inet.c
parent4415df317fd3c9356635703b1d3cdd329112caef (diff)
downloadconnman-213dec4c14f6c15bf91273185dfbc802339edc33.tar.gz
connman-213dec4c14f6c15bf91273185dfbc802339edc33.tar.bz2
connman-213dec4c14f6c15bf91273185dfbc802339edc33.zip
Use global IP address structure for transaction
Diffstat (limited to 'src/inet.c')
-rw-r--r--src/inet.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/inet.c b/src/inet.c
index 3fc162c6..09183a09 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -455,8 +455,7 @@ done:
return device;
}
-int connman_inet_set_address(int index, struct in_addr address,
- struct in_addr netmask, struct in_addr broadcast)
+int connman_inet_set_address(int index, struct connman_ipaddress *ipaddress)
{
struct ifreq ifr;
struct sockaddr_in addr;
@@ -478,7 +477,7 @@ int connman_inet_set_address(int index, struct in_addr address,
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
- addr.sin_addr = address;
+ addr.sin_addr.s_addr = inet_addr(ipaddress->local);
memcpy(&ifr.ifr_addr, &addr, sizeof(ifr.ifr_addr));
err = ioctl(sk, SIOCSIFADDR, &ifr);
@@ -488,7 +487,7 @@ int connman_inet_set_address(int index, struct in_addr address,
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
- addr.sin_addr = netmask;
+ addr.sin_addr.s_addr = htonl(~(0xfffffffflu >> ipaddress->prefixlen));
memcpy(&ifr.ifr_netmask, &addr, sizeof(ifr.ifr_netmask));
err = ioctl(sk, SIOCSIFNETMASK, &ifr);
@@ -498,7 +497,7 @@ int connman_inet_set_address(int index, struct in_addr address,
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
- addr.sin_addr = broadcast;
+ addr.sin_addr.s_addr = inet_addr(ipaddress->broadcast);
memcpy(&ifr.ifr_broadaddr, &addr, sizeof(ifr.ifr_broadaddr));
err = ioctl(sk, SIOCSIFBRDADDR, &ifr);