Fix netmask from prefix length string conversion
authorMarcel Holtmann <marcel@holtmann.org>
Sun, 20 Dec 2009 18:39:53 +0000 (10:39 -0800)
committerMarcel Holtmann <marcel@holtmann.org>
Sun, 20 Dec 2009 18:39:53 +0000 (10:39 -0800)
src/ipconfig.c

index a8b15fa..3a73ecc 100644 (file)
@@ -934,13 +934,15 @@ void __connman_ipconfig_append_ipv4(struct connman_ipconfig *ipconfig,
                return;
 
        if (ipconfig->system->local != NULL) {
+               in_addr_t addr;
                struct in_addr netmask;
                char *mask;
 
                connman_dbus_dict_append_basic(iter, "Address",
                                DBUS_TYPE_STRING, &ipconfig->system->local);
 
-               netmask.s_addr = ~0 << (32 - ipconfig->system->prefixlen);
+               addr = 0xffffffff << (32 - ipconfig->system->prefixlen);
+               netmask.s_addr = htonl(addr);
                mask = inet_ntoa(netmask);
                connman_dbus_dict_append_basic(iter, "Netmask",
                                                DBUS_TYPE_STRING, &mask);