LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-03-2013, 05:13 AM   #1
nethomas1968
LQ Newbie
 
Registered: Nov 2011
Posts: 6

Rep: Reputation: Disabled
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
 
Old 05-03-2013, 08:00 AM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
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.
 
Old 05-03-2013, 09:04 AM   #3
nethomas1968
LQ Newbie
 
Registered: Nov 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
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
 
Old 05-03-2013, 08:05 PM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
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.
 
Old 05-07-2013, 05:30 AM   #5
nethomas1968
LQ Newbie
 
Registered: Nov 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Chemistry problem: Identify duplicates and non-duplicates within TWO sdf files robertselwyne Programming 5 12-09-2011 06:20 AM
iptables(marking) + ip rule add fwmark 1 table 200 + ip route add via GW table 200 ?? amitsharma_26 Linux - Networking 9 05-26-2010 06:42 AM
Route Table XaViaR Linux - General 7 03-18-2006 09:01 AM
I am not able to add a new route to my route table using route command prashanth s j Linux - Networking 2 09-03-2005 04:34 AM
Route table christianj Linux - Networking 3 11-17-2002 08:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration