From 08989e46b9030671ce57b8872538d40e2ddcbbe0 Mon Sep 17 00:00:00 2001 From: meurisa Date: Fri, 12 Apr 2019 09:56:28 +0200 Subject: 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 Signed-off-by: Hans Dedecker --- system-dummy.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'system-dummy.c') diff --git a/system-dummy.c b/system-dummy.c index 11c8ccc..58fd2d0 100644 --- a/system-dummy.c +++ b/system-dummy.c @@ -181,6 +181,26 @@ static int system_route_msg(struct device *dev, struct device_route *route, cons return 0; } +static int system_neighbor_msg(struct device *dev, struct device_neighbor *neighbor, const char *type) +{ + char addr[64]; + int af = system_get_addr_family(neighbor->flags); + inet_ntop(af, &neighbor->addr.in , addr, sizeof(addr)); + + D(SYSTEM, "neigh %s %s%s%s %s\n", type, addr, neighbor->proxy ? "proxy " : "", + (neighbor->flags & DEVNEIGH_MAC) ? format_macaddr(neighbor->macaddr) : "", + neighbor->router ? "router": ""); +} +int system_add_neighbor(struct device *dev, struct device_neighbor *neighbor) +{ + return system_neighbor_msg(dev, neighbor, "add"); +} + +int system_del_neighbor(struct device *dev, struct device_neighbor *neighbor) +{ + return system_neighbor_msg(dev, neighbor, "del"); +} + int system_add_route(struct device *dev, struct device_route *route) { return system_route_msg(dev, route, "add"); -- cgit v1.2.1