fix: get real ifindex for socket answers#93
Conversation
| socket.sendto(response, self.client_address) | ||
| addr, port, flow, scope = self.client_address | ||
| real_ifindex = socket.if_nametoindex(iface) | ||
| sock.sendto(response, (addr, port, 0, real_ifindex)) |
There was a problem hiding this comment.
iface is util.ifindex_to_iface(ifindex), so you can just use ifindex instead of looking up the name (I just happened to make the same fix to the C respondd implementation, as I was looking into VRFs recently)
There was a problem hiding this comment.
One other concern (for which I don't have a full solution in the C implementation yet) is requests via global addresses, which don't have a scope ID - these would use the routing table of respondd's VRF, which may not allow the request to be answered correctly if it was received via a different VRF. I don't know if this is a problem for mesh-announce.
There was a problem hiding this comment.
ifaceisutil.ifindex_to_iface(ifindex), so you can just useifindexinstead of looking up the name (I just happened to make the same fix to the C respondd implementation, as I was looking into VRFs recently)
My pragmatic approach... I should have looked into that, thanks for the hint.
In Freifunk Münsterland we are using VRFs on our gateways.
That means, that the mesh-announce will be startet with
ExecStart=/usr/sbin/ip vrf exec ffnet /opt/mesh-announce/respondd.py -d /opt/mesh-announce/providers -f /opt/mesh-announce/respondd.confIn this configuration, it appears that respondd responds using the ifindex from the vrf-master interface at the socket level.
This fix will pick the right ifindex.