LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-04-2009, 12:51 PM   #1
fzansari
LQ Newbie
 
Registered: Aug 2008
Posts: 6

Rep: Reputation: 0
using netlink to get routes from a specific routing table


I am writing a program to print routes from a specific routing table. I am not using the main or local routing table. I add routes to a fixed table with a table id 7 (that I created). The routes get added to this newly added table. I can view it with "ip route show table 7". In my program I need to print this same output. When I use RTM_GETROUTE to get all entries for table=7, the kernel replies with entries that do not belong to table=7 as well. i.e. it returns entries belonging to main routing table.

This is what I saw on the man page of rtnetlink."For RTM_GETROUTE setting rtm_dst_len and rtm_src_len to 0 means you get all entries for the specified routing table. For the other fields except rtm_table and rtm_protocol 0 is the wildcard."

I have set rtm_table to 7 and I keep all other values 0. I haven't seen the kernel code properly, but I am assuming there must be a check on the kernel side to verify what table the getroute request is for.

Any ideas?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How do I save my routes and routing tables? debloxie Linux - Networking 2 07-24-2006 02:25 AM
routing table arvind kumar Linux - Networking 2 06-08-2005 11:59 PM
netlink routing socket to observe interface changes trotters78 Programming 2 11-29-2004 06:13 PM
Adding Routes using Netlink Sockets mpls_linux Linux - Networking 0 05-22-2004 09:14 PM
comments and opinions on linux netlink routing sockets tutorial infamous41md Programming 3 11-20-2003 05:54 PM


All times are GMT -5. The time now is 03:55 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration