summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2013-10-14 22:54:21 +0200
committerSteven Barth <steven@midlink.org>2013-10-14 22:54:21 +0200
commit24cf1c534166aedd4af0498257a05a265128733d (patch)
tree409290c66da31d180977c899214d8ae1dfe5bd16 /src
parent9dc77ae1b6c2379a2cd7ba631fcefdd243fcda85 (diff)
Fix config parsing
Diffstat (limited to 'src')
-rw-r--r--src/config.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/config.c b/src/config.c
index 07dad1f..9228a37 100644
--- a/src/config.c
+++ b/src/config.c
@@ -344,21 +344,34 @@ int config_parse_interface(struct blob_attr *b, const char *name, bool overwrite
}
}
- if ((c = tb[IFACE_ATTR_RA]))
- if ((iface->ra = parse_mode(blobmsg_get_string(c))) < 0)
+ int mode;
+ if ((c = tb[IFACE_ATTR_RA])) {
+ if ((mode = parse_mode(blobmsg_get_string(c))) >= 0)
+ iface->ra = mode;
+ else
goto err;
+ }
- if ((c = tb[IFACE_ATTR_DHCPV4]))
- if ((iface->dhcpv4 = parse_mode(blobmsg_get_string(c))) < 0)
+ if ((c = tb[IFACE_ATTR_DHCPV4])) {
+ if ((mode = parse_mode(blobmsg_get_string(c))) >= 0)
+ iface->dhcpv4 = mode;
+ else
goto err;
+ }
- if ((c = tb[IFACE_ATTR_DHCPV6]))
- if ((iface->dhcpv6 = parse_mode(blobmsg_get_string(c))) < 0)
+ if ((c = tb[IFACE_ATTR_DHCPV6])) {
+ if ((mode = parse_mode(blobmsg_get_string(c))) >= 0)
+ iface->dhcpv6 = mode;
+ else
goto err;
+ }
- if ((c = tb[IFACE_ATTR_NDP]))
- if ((iface->ndp = parse_mode(blobmsg_get_string(c))) < 0)
+ if ((c = tb[IFACE_ATTR_NDP])) {
+ if ((mode = parse_mode(blobmsg_get_string(c))) >= 0)
+ iface->ndp = mode;
+ else
goto err;
+ }
if ((c = tb[IFACE_ATTR_DNS])) {
struct blob_attr *cur;