summaryrefslogtreecommitdiff
path: root/interface-ip.c
diff options
context:
space:
mode:
authorFlorian Eckert <fe@dev.tdt.de>2020-11-24 08:18:00 +0100
committerHauke Mehrtens <hauke@hauke-m.de>2021-04-03 17:24:32 +0200
commit327da9895327bc56b23413ee91a6e6b6e0e4329d (patch)
tree7a32adaef7056a0953441541f1f102b8fe90337d /interface-ip.c
parentf8899b9ba4caa99ac64d3c1abac48ccb1421bd79 (diff)
downloadnetifd-327da9895327bc56b23413ee91a6e6b6e0e4329d.tar.gz
netifd: add possibility to switch off route config
This change adds the new configuration option `disabled` for the route section, which can be used to temporarily disable the section so that the route is not set. The advantage is that we do not have to delete this route configuration section to achieve this. config route option disabled '1 Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Diffstat (limited to 'interface-ip.c')
-rw-r--r--interface-ip.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/interface-ip.c b/interface-ip.c
index 1444fbf..648f521 100644
--- a/interface-ip.c
+++ b/interface-ip.c
@@ -43,6 +43,7 @@ enum {
ROUTE_ONLINK,
ROUTE_TYPE,
ROUTE_PROTO,
+ ROUTE_DISABLED,
__ROUTE_MAX
};
@@ -59,6 +60,7 @@ static const struct blobmsg_policy route_attr[__ROUTE_MAX] = {
[ROUTE_ONLINK] = { .name = "onlink", .type = BLOBMSG_TYPE_BOOL },
[ROUTE_TYPE] = { .name = "type", .type = BLOBMSG_TYPE_STRING },
[ROUTE_PROTO] = { .name = "proto", .type = BLOBMSG_TYPE_STRING },
+ [ROUTE_DISABLED] = { .name = "disabled", .type = BLOBMSG_TYPE_BOOL },
};
const struct uci_blob_param_list route_attr_list = {
@@ -394,6 +396,9 @@ interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6)
blobmsg_parse(route_attr, __ROUTE_MAX, tb, blobmsg_data(attr), blobmsg_data_len(attr));
+ if ((cur = tb[ROUTE_DISABLED]) != NULL && blobmsg_get_bool(cur))
+ return;
+
if (!iface) {
if ((cur = tb[ROUTE_INTERFACE]) == NULL)
return;