diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-08-11 00:55:20 -0700 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-08-11 00:55:20 -0700 |
commit | 213dec4c14f6c15bf91273185dfbc802339edc33 (patch) | |
tree | 8f4356747aaa9e4889a55e8eb01209f8c5d9a7f4 /src/inet.c | |
parent | 4415df317fd3c9356635703b1d3cdd329112caef (diff) | |
download | connman-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.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -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); |