diff options
author | meurisa <alexander.meuris@technicolor.com> | 2019-04-12 09:56:28 +0200 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2019-04-15 22:31:38 +0200 |
commit | 08989e46b9030671ce57b8872538d40e2ddcbbe0 (patch) | |
tree | c0119c3ca57b572adcfa6462d34411a6e0c2f0ac /system-dummy.c | |
parent | bfd4de3666901070d805878e55b02417fef6277c (diff) | |
download | netifd-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 'system-dummy.c')
-rw-r--r-- | system-dummy.c | 20 |
1 files changed, 20 insertions, 0 deletions
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"); |