This commit is contained in:
Nils Schneider 2016-08-29 13:01:44 +00:00 committed by GitHub
commit 7ee5c5ba96
4 changed files with 70 additions and 8 deletions

View File

@ -54,6 +54,7 @@ Packages
package/gluon-config-mode-geo-location
package/gluon-ebtables-filter-multicast
package/gluon-ebtables-filter-ra-dhcp
package/gluon-next-node
Releases
--------

View File

@ -0,0 +1,22 @@
gluon-next-node
===============
This package provides a virtual interface (tied to *br-client*) called
*local-node* using the same MAC, IPv4 and IPv6 addresses across all nodes in
a mesh. Thus, the node that the client is currently connected to, can always
be reached under a known address.
The IPv6 address is marked as deprecated to prevent it from being used as a
source address for packages originating from a node.
site.conf
---------
next_node.mac
MAC address to be set on the interface.
next_node.ip4
IPv4 address to be set on the interface.
next_node.ip6
IPv6 address to be set on the interface.

View File

@ -19,14 +19,23 @@ c:section('network', 'device', 'local_node_dev',
local prefix4 = ip.IPv4(site.prefix4)
c:delete('network', 'local_node')
c:section('network', 'interface', 'local_node',
{
ifname = 'local-node',
proto = 'static',
ipaddr = site.next_node.ip4,
netmask = prefix4:mask():string(),
ip6addr = site.next_node.ip6 .. '/128',
}
c:delete('network', 'local_node4')
c:delete('network', 'local_node6')
c:section('network', 'interface', 'local_node4',
{
ifname = 'local-node',
proto = 'static',
ipaddr = site.next_node.ip4 .. '/32',
}
)
c:section('network', 'interface', 'local_node6',
{
ifname = 'local-node',
proto = 'static_deprecated',
ip6addr = site.next_node.ip6,
}
)
c:delete('network', 'local_node_route6')

View File

@ -0,0 +1,30 @@
#!/bin/sh
. /lib/functions.sh
. ../netifd-proto.sh
init_proto "$@"
proto_static_deprecated_init_config() {
renew_handler=1
proto_config_add_string 'ip6addr:ip6addr'
}
proto_static_deprecated_setup() {
local config="$1"
local iface="$2"
local ip6addr
json_get_vars ip6addr
proto_init_update "*" 1
proto_add_ipv6_address "$ip6addr" "" "0"
proto_send_update "$config"
}
proto_static_deprecated_teardown() {
local config="$1"
}
add_protocol static_deprecated