3ef28a4684
The commitb3762fc61c
("gluon-client-bridge: move IPv4 local subnet route to br-client (#1312)") moves the IPv4 prefix from the local-port interface to br-client. A client requesting an IPv4 connection to the IPv4 anycast address of the node (the device running gluon) will create following packets: 1. ARP packet from client to get the MAC of the mac address of the anycast IPv4 address 2. ARP reply from node to client with the anycast MAC address for the IPv4 anycast address 3. IPv4 packet from client which requires reply (for example ICMP echo request) 4. ARP request for the client MAC address for its IPv4 address in prefix4 (done with the mac address of br-client and transmitted over br-client) 5. IPv4 packet from node (transmitted over br-client with br-client MAC address) as reply for the client IPv4 packet (for example ICMP echo reply) The step 4 and 5 are problematic here because packets use the node specific MAC addresses from br-client instead of the anycast MAC address. The client will receive the ARP packet with the node specific MAC address and change their own neighbor IP (translation) table. This will for example break the access to the status page to the connected device or the anycast DNS forwarder implementation when the client roams to a different node. This reverts commitb3762fc61c
and adds an upgrade code to remove local_node_route on on existing installations.
53 lines
1005 B
Lua
Executable File
53 lines
1005 B
Lua
Executable File
#!/usr/bin/lua
|
|
|
|
local client_bridge = require 'gluon.client_bridge'
|
|
local site = require 'gluon.site'
|
|
local sysconfig = require 'gluon.sysconfig'
|
|
|
|
local uci = require('simple-uci').cursor()
|
|
|
|
|
|
local next_node = site.next_node({})
|
|
|
|
|
|
uci:delete('network', 'local_node_dev')
|
|
uci:section('network', 'device', 'local_node_dev', {
|
|
type = 'veth',
|
|
name = 'local-node',
|
|
macaddr = client_bridge.next_node_macaddr(),
|
|
peer_name = 'local-port',
|
|
peer_macaddr = sysconfig.primary_mac,
|
|
})
|
|
|
|
|
|
local ip4, ip6
|
|
|
|
if next_node.ip4 then
|
|
local plen = site.prefix4():match('/%d+$')
|
|
ip4 = next_node.ip4 .. plen
|
|
end
|
|
|
|
if next_node.ip6 then
|
|
ip6 = 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,
|
|
ip6deprecated = true,
|
|
})
|
|
|
|
uci:save('network')
|
|
|
|
|
|
uci:delete('dhcp', 'local_node')
|
|
uci:section('dhcp', 'dhcp', 'local_node', {
|
|
interface = 'local_node',
|
|
ignore = true,
|
|
})
|
|
|
|
uci:save('dhcp')
|