summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authormeurisa <alexander.meuris@technicolor.com>2019-04-12 09:56:28 +0200
committerHans Dedecker <dedeckeh@gmail.com>2019-04-15 22:31:38 +0200
commit08989e46b9030671ce57b8872538d40e2ddcbbe0 (patch)
treec0119c3ca57b572adcfa6462d34411a6e0c2f0ac /config.c
parentbfd4de3666901070d805878e55b02417fef6277c (diff)
downloadnetifd-08989e46b9030671ce57b8872538d40e2ddcbbe0.tar.gz
interface: add neighbor config support
The neighbor or neighbor6 network section makes neighbours configurable via UCI or proto shell handlers. It allows to install neighbor proxy entries or static neighbor entries The neighbor or neighbor6 section has the following types: interface : declares the logical OpenWrt interface ipaddr : the ip address of the neighbor mac : the mac address of the neighbor proxy : specifies whether the neighbor ia a proxy entry (can be 1 or 0) router : specifies whether the neighbor is a router (can be 1 or 0) Signed-off-by: Alexander Meuris <meurisalexander@gmail.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'config.c')
-rw-r--r--config.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/config.c b/config.c
index be10379..843c53f 100644
--- a/config.c
+++ b/config.c
@@ -144,6 +144,17 @@ config_parse_route(struct uci_section *s, bool v6)
}
static void
+config_parse_neighbor(struct uci_section *s, bool v6)
+{
+ void *neighbor;
+ blob_buf_init(&b,0);
+ neighbor = blobmsg_open_array(&b, "neighbor");
+ uci_to_blob(&b,s, &neighbor_attr_list);
+ blobmsg_close_array(&b, neighbor);
+ interface_ip_add_neighbor(NULL, blob_data(b.head), v6);
+}
+
+static void
config_parse_rule(struct uci_section *s, bool v6)
{
void *rule;
@@ -251,7 +262,7 @@ config_init_interfaces(void)
}
static void
-config_init_routes(void)
+config_init_ip(void)
{
struct interface *iface;
struct uci_element *e;
@@ -266,6 +277,10 @@ config_init_routes(void)
config_parse_route(s, false);
else if (!strcmp(s->type, "route6"))
config_parse_route(s, true);
+ if (!strcmp(s->type, "neighbor"))
+ config_parse_neighbor(s, false);
+ else if (!strcmp(s->type, "neighbor6"))
+ config_parse_neighbor(s, true);
}
vlist_for_each_element(&interfaces, iface, node)
@@ -417,7 +432,7 @@ config_init_all(void)
device_reset_config();
config_init_devices();
config_init_interfaces();
- config_init_routes();
+ config_init_ip();
config_init_rules();
config_init_globals();
config_init_wireless();