Duplicates in route table.
Hi,
I am working with a linux OS embedded device. It has a wired ethernet, and also intends to have a hotpluggable USB wifi dongle. After a few hotplugs, I notice that the network traffic stops, and I think the problem is shown through the /sbin/route command output: 192.168.1.0 * 255.255.255.0 U 0 0 0 eth0 192.168.1.0 * 255.255.255.0 U 0 0 0 wlan0 default 192.168.1.5 0.0.0.0 UG 0 0 0 wlan0 default 192.168.1.5 0.0.0.0 UG 0 0 0 eth0 Not sure if the above is clear - but it looks like there are duplicates in the route table. I can clear this by doing the following to the 'eth0' device: ifconfig eth0 down ifconfig eth0 up But, that's not an acceptable solution (or is it?). Any ideas about how to fix or refresh the route table? Regards Nick |
Seems a bit dodgy that it leaves entries in the route table .. but if you want to work around it you may want to look at creating a udev rule to clean up the route table on unplug.
|
Hi kbp, thanks for the reply.
We can tell when we get a hotplug by using netlink sockets. I understand that netlink is probably not the most modern thing to use. But, we are where we are. So, what functions could I use to clear out the route table from within a 'C' program ? Thanks Nick |
Just guessing here .. if you're using netlink sockets maybe you can send a NETLINK_ROUTE message to update the table? Not sure how you'd trigger it though.
|
I've got a solution - sort of.
When I want the wifi to be used I kill the dhclient on eth0. But, that doesn't clear it's IP address. This can be seen by doing 'ifconfig' at that point. So, I could do 'ifconfig eth0 down', followed quickly by 'ifconfi eth0 up' . But, a better way is to use 'ifconfig eth0 0.0.0.0' . That clears the IP address from the eth0. And, sometimes it refreshes the route table (but not every time). So, now I need to discover a way to check when the route table is foobared - then try my new method. Regards Nick |
All times are GMT -5. The time now is 08:22 PM. |