route allowed IPs created routes for the IP range on the wireguard network, not to the wireguard peer, so that has nothing to do with this.
I know how to delete the route, the problem is that it is regenerated each time the failover occurs, or when the device reboots.
I did some more experiments and here are my findings;
I have both WAN and the mobile connection set as failover. When the device boots, I have these routes;
default via 192.168.180.1 dev eth0.2 proto static src 192.168.180.125 metric 1
default dev wwan0 proto static scope link src 10.6.17.167 metric 2
[mobile IP] dev wwan0 proto static scope link metric 2
[wg peer IP] via 192.168.180.1 dev eth0.2 proto static metric 1
172.21.0.0/16 dev wg_ses proto static scope link
172.23.0.0/16 dev wg_ses proto static scope link
192.168.1.0/24 dev br-lan proto static scope link metric 1
192.168.180.0/24 dev eth0.2 proto static scope link metric
This is all fine. The route for the peer IP is weird, since it should just use the default route, but ok.
If I then unplug the WAN cable, it changes the routes, including the WG route to this;
default dev wwan0 proto static scope link src 10.6.17.167 metric 2
[mobile IP] dev wwan0 proto static scope link metric 2
[wg peer IP] dev wwan0 proto static scope link metric 2
172.21.0.0/16 dev wg_ses proto static scope link
172.23.0.0/16 dev wg_ses proto static scope link
192.168.1.0/24 dev br-lan proto static scope link metric 1
This is also fine! The peer IP route is still not doing anything in particular, but it's ok.
Finally if I plug the cable back into the WAN port, I end up with these routes;
default via 192.168.180.1 dev eth0.2 proto static src 192.168.180.125 metric 1
default dev wwan0 proto static scope link src 10.6.17.167 metric 2
[mobile IP] dev wwan0 proto static scope link metric 2
[wg peer IP] dev wwan0 proto static scope link metric 2
172.21.0.0/16 dev wg_ses proto static scope link
172.23.0.0/16 dev wg_ses proto static scope link
192.168.1.0/24 dev br-lan proto static scope link metric 1
192.168.180.0/24 dev eth0.2 proto static scope link metric 1
As you can see, the default route via WAN is back and all traffic routes via that unless it goes to the internal network. The route to the wireguard peer REMAINS and all WG traffic is routed via the mobile connection until I reset the device.
This is a problem. Either the route needs to switch back - which it doesn't - or it should not be there at all and simply use the default route and everything would be fine.
I have no idea why this happens, or where. I found that script mentioned earlier and it appears to be part of the wireguard package.
How can I avoid this route being created, or force it to switch back?