f238b01173
macvlan interfaces never directly exchange traffic with the underlying interface, but only with other hosts behind the interface. In consequence, router advertisements from the uradvd running on br-client could never reach local-node, preventing it from getting an IPv6 address without RAs from an external radvd. Fix this be replacing the macvlan interface with a veth pair (with the peer interface in br-client). As a side effect, this saves about 5KB of flash, as the veth module is simpler than macvlan.
48 lines
901 B
Lua
Executable File
48 lines
901 B
Lua
Executable File
#!/usr/bin/lua
|
|
|
|
local site = require 'gluon.site_config'
|
|
local sysconfig = require 'gluon.sysconfig'
|
|
|
|
local uci = require('simple-uci').cursor()
|
|
|
|
|
|
uci:delete('network', 'local_node_dev')
|
|
uci:section('network', 'device', 'local_node_dev', {
|
|
type = 'veth',
|
|
name = 'local-node',
|
|
macaddr = site.next_node.mac,
|
|
peer_name = 'local-port',
|
|
peer_macaddr = sysconfig.primary_mac,
|
|
})
|
|
|
|
|
|
local ip4, ip6
|
|
|
|
if site.next_node.ip4 then
|
|
local plen = site.prefix4:match('/%d+$')
|
|
ip4 = site.next_node.ip4 .. plen
|
|
end
|
|
|
|
if site.next_node.ip6 then
|
|
ip6 = site.next_node.ip6 .. '/128'
|
|
end
|
|
|
|
uci:delete('network', 'local_node')
|
|
uci:section('network', 'interface', 'local_node', {
|
|
ifname = 'local-node',
|
|
proto = 'static',
|
|
ipaddr = ip4,
|
|
ip6addr = ip6,
|
|
})
|
|
|
|
uci:save('network')
|
|
|
|
|
|
uci:delete('dhcp', 'local_node')
|
|
uci:section('dhcp', 'dhcp', 'local_node', {
|
|
interface = 'local_node',
|
|
ignore = true,
|
|
})
|
|
|
|
uci:save('dhcp')
|