X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=proto-static.c;h=b8f341238a0144754a9c31457278491394d82999;hp=f5d676a7bf1e05959edb71b0e135871213e151cc;hb=3ff220f1861f76ddfeb1aebc61ffbaf14b6d60df;hpb=5e5cd11724f6cf86edc5796e6b805573c767f757 diff --git a/proto-static.c b/proto-static.c index f5d676a..b8f3412 100644 --- a/proto-static.c +++ b/proto-static.c @@ -103,20 +103,18 @@ static int proto_apply_static_settings(struct interface *iface, struct blob_attr *attr) { struct blob_attr *tb[__OPT_MAX]; - struct in_addr ina; const char *error; - int netmask = 32; + unsigned int netmask = 32; int n_v4 = 0, n_v6 = 0; blobmsg_parse(static_attrs, __OPT_MAX, tb, blob_data(attr), blob_len(attr)); if (tb[OPT_NETMASK]) { - if (!inet_aton(blobmsg_data(tb[OPT_NETMASK]), &ina)) { + netmask = parse_netmask_string(blobmsg_data(tb[OPT_NETMASK]), false); + if (netmask > 32) { error = "INVALID_NETMASK"; goto error; } - - netmask = 32 - fls(~(ntohl(ina.s_addr))); } if (tb[OPT_IPADDR])