-   Linux - Networking (
-   -   Duplicates in route table. (

nethomas1968 05-03-2013 05:13 AM

Duplicates in route table.

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: * U 0 0 0 eth0 * U 0 0 0 wlan0
default UG 0 0 0 wlan0
default 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?



kbp 05-03-2013 08:00 AM

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.

nethomas1968 05-03-2013 09:04 AM

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 ?



kbp 05-03-2013 08:05 PM

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.

nethomas1968 05-07-2013 05:30 AM

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

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.



All times are GMT -5. The time now is 07:27 PM.