core: [add rfc5549 support] - WebUI doesn't allow IPv4 routes with IPv6 gateway
Important notices
Before you add a new report, we ask you kindly to acknowledge the following:
- I have read the contributing guide lines at https://github.com/opnsense/core/blob/master/CONTRIBUTING.md
- I am convinced that my issue is new after having checked both open and closed issues at https://github.com/opnsense/core/issues?q=is%3Aissue
Describe the bug
I’ve just set up a new instance of Opnsense 24.7 with the intention of replacing my old Linux router. I tried to replicate the following route that’s working just fine on my current Linux system:
$ ip -4 r show 10.0.0.0
10.0.0.0/24 via inet6 fe80::1234:56ff:fe78:90ab dev eth3
but I can’t manage to do that. I added fe80:🔢56ff:fe78:90ab as a Gateway, then tried to configure a route. But it just errors out with “Specify a valid gateway from the list matching the networks ip protocol.”
I mean, yes, it is an unusual route. But all a “route” really is is a statement like “Please send all packets to network A to the Ethernet MAC address of the device that has IP address B”, so there isn’t really any reason for network A and IP B to belong to the same address family - is there?
If I add this very same route on the command line using # route add -net 10.0.0.0/24 -inet6 fe80::1234:56ff:fe78:90ab%re0, it adds the route just fine, it works, and it also shows up in the WebUI under System -> Routes -> Status, but it does not show up under Routes -> Configuration.
To Reproduce
Steps to reproduce the behavior:
- Go to System -> Gateways -> Configuration
- Add a new gateway with an IPv6 address
- Go to System -> Routes -> Configuration
- Try to add a route using this gateway to an IPv4 destination.
Expected behavior
I expected it to create the route, just like it would when adding the route manually on the CLI. But instead, it returns an error.
Describe alternatives you considered
A workaround would be to add an additional IPv4 address to that device so it can be reached with the same address family as the target network, but in my opinion the goal should be to move away from IPv4 whenever possible.
I could also just add the route using the command line instead of the GUI, but I fear that that might break at some time in the future or with an update or something.
Screenshots
Additional context
I also tried to “fool” the GUI by adding an IPv4 gateway, then adding the route, then editing the Gateway to be IPv6 instead. The route is then correctly displayed under System -> Routes -> Configuration but not under System -> Routes -> Status, and it doesn’t seem to be active.
Also, when I DO manually add the route using the CLI, it looks like not even the system expects such a route, since when I enter “netstat -rn” to look at the routes, the columns are all messed up. But that’s probably something that needs to be fixed in the underlying OS.
Internet:
Destination Gateway Flags Netif Expire
10.0.0.0/24 fe80::1234:56ff:fe78:90ab%re0 UGS re0
127.0.0.1 link#2 UH lo0
192.168.1.1 link#2 UHS lo0
Environment
OPNsense 24.7 (amd64).
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (8 by maintainers)
Commits related to this issue
- System: Routes: Configuration - add support for rfc5549, closes https://github.com/opnsense/core/issues/8157 This change lifts the constraint for matching protocols when the next hop is ipv6 and the ... — committed to fork-the-planet/opnsense-core by AdSchellevis 2 years ago
- System: Routes: Configuration - add support for rfc5549, missing implementation part for https://github.com/opnsense/core/issues/8157 When specifying different protocols for target network and gatewa... — committed to opnsense/core by AdSchellevis 2 years ago
I managed to reproduce the route not being added.
I’m using the os-tailscale plugin that was released like two weeks ago, and this issue occurs when I add a route with a gateway in the tailscale network. And the issue also occurs with “normal” routes so again not an issue with your code changes.
I’ll go report that to the tailscale plugin developers. I’m assuming that maybe the OS routes are added before the tailscale plugin is ready and thus it’s unable to add a route pointing to the not-yet-connected tailscale network.
The rest seems to be working, or at least not more broken than before, so I’d say this is fixed. Thanks for the quick fix!
Wow, that was faster than I expected. I’ll give this a try and see if it works or if I see other issues in the webui.
ok, let’s flip this into a feature request then, it shouldn’t be a huge change.
Will do so once my new network card arrives, the one I intended to use in my machine is apparently not supported so I can’t finish setting this up yet.