Re: [OpenWrt-Devel] How to recognize if a default route is active
On 4/14/11 4:11 AM, Roberto Riggio wrote: Il 14/04/2011 12:03, Jo-Philipp Wich ha scritto: I'd suggest to use ip route list exact 0.0.0.0/0 to find the device and then the find_config() shell function to map the device to an uci interface name. Thanks very much for the quick answer. I did not know about the find_config() function. However I will rely on the route command since ip is not installed by default. BTW wouldn't be time to switch to ip? :) Yes, definitely. Parsing output from ifconfig xxx is a lot more challenging than parsing: ip -o link show xxx for instance... or: ip -o -0 addr show xxx -Philip ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] How to recognize if a default route is active
Hi, please do not do dirty hacks like relying on an interface called wan in your scripts. You should develop a hotplug handler which is invoked for ifup events on any interface. As soon as one interface appears which carries as 0/0 route, you have your wan. See the 6in4 and 6to4 packages for inspiration. ~ Jow ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] How to recognize if a default route is active
I'd suggest to use ip route list exact 0.0.0.0/0 to find the device and then the find_config() shell function to map the device to an uci interface name. ~ Jow ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] How to recognize if a default route is active
I have however a designed issue. At the moment a bash daemon periodically checks if the wan interface is up. If the check is positive then the mesh daemon advertise this gateway, otherwise the mesh interface is set as default route. in the OLSR routing protocol implementation, we have a dynamic gateway plugin. It checks (with policy routing) if connectivity with the Internet is actually working, before the router advertises a default route. you might want to check out the code on olsr.org Saverio ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel