Skip to content

fix: get real ifindex for socket answers#93

Open
RobWei wants to merge 1 commit intoffnord:masterfrom
FreiFunkMuenster:vrf
Open

fix: get real ifindex for socket answers#93
RobWei wants to merge 1 commit intoffnord:masterfrom
FreiFunkMuenster:vrf

Conversation

@RobWei
Copy link
Copy Markdown

@RobWei RobWei commented Nov 25, 2025

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.conf

In 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.

Comment thread respondd.py Outdated
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))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

My pragmatic approach... I should have looked into that, thanks for the hint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants