dhcpv4: return pointer
authorPatrick Grimm <stargieg@gmail.com>
Mon, 15 Jun 2015 01:38:09 +0000 (03:38 +0200)
committerPatrick Grimm <stargieg@gmail.com>
Mon, 15 Jun 2015 01:38:09 +0000 (03:38 +0200)
Signed-off-by: Patrick Grimm <patrick@lunatiki.de>
src/ubus.c

index 63bfd3c4c395a6c2a807a1a194b35d20ac0b5c43..2b6b1c7e56911719003d91bccb7fb224b9158cf9 100644 (file)
@@ -372,7 +372,7 @@ bool ubus_has_prefix(const char *name, const char *ifname)
        return false;
 }
 
-struct in_addr ubus_get_address4(const char *name)
+struct in_addr* ubus_get_address4(const char *name)
 {
        struct blob_attr *c, *cur;
        unsigned rem;
@@ -397,7 +397,7 @@ struct in_addr ubus_get_address4(const char *name)
                        blobmsg_for_each_attr(d, cur, drem) {
                                struct blob_attr *addr[ADDR_ATTR_MAX];
                                blobmsg_parse(addr_attrs, ADDR_ATTR_MAX, addr, blobmsg_data(d), blobmsg_data_len(d));
-                               struct in_addr addr4;
+                               struct in_addr *addr4;
                                if (inet_pton(AF_INET, blobmsg_get_string(addr[ADDR_ATTR_ADDRESS]), &addr4) == 1)
                                        return addr4;
                        }
@@ -407,7 +407,7 @@ struct in_addr ubus_get_address4(const char *name)
        return NULL;
 }
 
-struct in_addr ubus_get_mask4(const char *name)
+struct in_addr* ubus_get_mask4(const char *name)
 {
        struct blob_attr *c, *cur;
        unsigned rem;
@@ -432,7 +432,7 @@ struct in_addr ubus_get_mask4(const char *name)
                        blobmsg_for_each_attr(d, cur, drem) {
                                struct blob_attr *addr[ADDR_ATTR_MAX];
                                blobmsg_parse(addr_attrs, ADDR_ATTR_MAX, addr, blobmsg_data(d), blobmsg_data_len(d));
-                               struct in_addr addr4;
+                               struct in_addr *addr4;
                                if (inet_pton(AF_INET, blobmsg_get_string(addr[ADDR_ATTR_MASK]), &addr4) == 1)
                                        return addr4;
                        }