projects
/
project
/
netifd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
move broadcast address handling to the core
[project/netifd.git]
/
proto.c
diff --git
a/proto.c
b/proto.c
index
81469f9
..
c100735
100644
(file)
--- a/
proto.c
+++ b/
proto.c
@@
-123,7
+123,8
@@
proto_parse_ip_addr_string(const char *str, bool v6, int mask)
}
static bool
}
static bool
-parse_addr(struct interface *iface, const char *str, bool v6, int mask, bool ext)
+parse_addr(struct interface *iface, const char *str, bool v6, int mask,
+ bool ext, uint32_t broadcast)
{
struct device_addr *addr;
{
struct device_addr *addr;
@@
-133,6
+134,9
@@
parse_addr(struct interface *iface, const char *str, bool v6, int mask, bool ext
return false;
}
return false;
}
+ if (broadcast)
+ addr->broadcast = broadcast;
+
if (ext)
addr->flags |= DEVADDR_EXTERNAL;
if (ext)
addr->flags |= DEVADDR_EXTERNAL;
@@
-141,7
+145,8
@@
parse_addr(struct interface *iface, const char *str, bool v6, int mask, bool ext
}
static int
}
static int
-parse_address_option(struct interface *iface, struct blob_attr *attr, bool v6, int netmask, bool ext)
+parse_address_option(struct interface *iface, struct blob_attr *attr, bool v6,
+ int netmask, bool ext, uint32_t broadcast)
{
struct blob_attr *cur;
int n_addr = 0;
{
struct blob_attr *cur;
int n_addr = 0;
@@
-152,7
+157,8
@@
parse_address_option(struct interface *iface, struct blob_attr *attr, bool v6, i
return -1;
n_addr++;
return -1;
n_addr++;
- if (!parse_addr(iface, blobmsg_data(cur), v6, netmask, ext))
+ if (!parse_addr(iface, blobmsg_data(cur), v6, netmask, ext,
+ broadcast))
return -1;
}
return -1;
}
@@
-188,6
+194,7
@@
proto_apply_ip_settings(struct interface *iface, struct blob_attr *attr, bool ex
const char *error;
unsigned int netmask = 32;
int n_v4 = 0, n_v6 = 0;
const char *error;
unsigned int netmask = 32;
int n_v4 = 0, n_v6 = 0;
+ uint32_t broadcast = 0;
blobmsg_parse(proto_ip_attributes, __OPT_MAX, tb, blob_data(attr), blob_len(attr));
blobmsg_parse(proto_ip_attributes, __OPT_MAX, tb, blob_data(attr), blob_len(attr));
@@
-200,10
+207,12
@@
proto_apply_ip_settings(struct interface *iface, struct blob_attr *attr, bool ex
}
if (tb[OPT_IPADDR])
}
if (tb[OPT_IPADDR])
- n_v4 = parse_address_option(iface, tb[OPT_IPADDR], false, netmask, ext);
+ n_v4 = parse_address_option(iface, tb[OPT_IPADDR], false,
+ netmask, ext, broadcast);
if (tb[OPT_IP6ADDR])
if (tb[OPT_IP6ADDR])
- n_v6 = parse_address_option(iface, tb[OPT_IP6ADDR], true, netmask, ext);
+ n_v6 = parse_address_option(iface, tb[OPT_IP6ADDR], true,
+ netmask, ext, 0);
if (!n_v4 && !n_v6) {
error = "NO_ADDRESS";
if (!n_v4 && !n_v6) {
error = "NO_ADDRESS";