From 3ef28a46842b5a2b68be7d246b00176957efd1e3 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Sun, 22 Jul 2018 07:58:29 +0200 Subject: [PATCH] gluon-client-bridge: Revert "move IPv4 local subnet route to br-client (#1312)" The commit b3762fc61cca ("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 commit b3762fc61cca3eb2525170bafc8387afa2dc9371 and adds an upgrade code to remove local_node_route on on existing installations. --- .../lib/gluon/upgrade/310-gluon-client-bridge-local-node | 3 ++- .../lib/gluon/upgrade/320-gluon-mesh-batman-adv-client-bridge | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/310-gluon-client-bridge-local-node b/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/310-gluon-client-bridge-local-node index 4b51db0c..824d8d40 100755 --- a/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/310-gluon-client-bridge-local-node +++ b/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/310-gluon-client-bridge-local-node @@ -23,7 +23,8 @@ uci:section('network', 'device', 'local_node_dev', { local ip4, ip6 if next_node.ip4 then - ip4 = next_node.ip4 .. '/32' + local plen = site.prefix4():match('/%d+$') + ip4 = next_node.ip4 .. plen end if next_node.ip6 then diff --git a/package/gluon-mesh-batman-adv/luasrc/lib/gluon/upgrade/320-gluon-mesh-batman-adv-client-bridge b/package/gluon-mesh-batman-adv/luasrc/lib/gluon/upgrade/320-gluon-mesh-batman-adv-client-bridge index a03ea658..85c21ac4 100755 --- a/package/gluon-mesh-batman-adv/luasrc/lib/gluon/upgrade/320-gluon-mesh-batman-adv-client-bridge +++ b/package/gluon-mesh-batman-adv/luasrc/lib/gluon/upgrade/320-gluon-mesh-batman-adv-client-bridge @@ -25,10 +25,6 @@ uci:section('network', 'interface', 'client', { uci:delete('network', 'client_lan') uci:delete('network', 'local_node_route') -uci:section('network', 'route', 'local_node_route', { - interface = 'client', - target = site.prefix4(), -}) uci:delete('network', 'local_node_route6') uci:section('network', 'route6', 'local_node_route6', {