Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
05-03-2013, 06:13 AM
|
#1
|
LQ Newbie
Registered: Nov 2011
Posts: 6
Rep:
|
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
|
|
|
05-03-2013, 09:00 AM
|
#2
|
Senior Member
Registered: Aug 2009
Posts: 3,790
|
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.
|
|
|
05-03-2013, 10:04 AM
|
#3
|
LQ Newbie
Registered: Nov 2011
Posts: 6
Original Poster
Rep:
|
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
|
|
|
05-03-2013, 09:05 PM
|
#4
|
Senior Member
Registered: Aug 2009
Posts: 3,790
|
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.
|
|
|
05-07-2013, 06:30 AM
|
#5
|
LQ Newbie
Registered: Nov 2011
Posts: 6
Original Poster
Rep:
|
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 01:48 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|