Hi,

I need to do 2 things:
1. Monitor when interfaces go up or down. (Or perhaps when addresses get added/deleted). 2. Given a destination address, figure out the source address (which interface it's going to go out of).

After some reading, it looks like the best option is to use rtnetlink and
for 1. listen for rtm_new/dellink (or rtm__new/deladdr) messages from kernel.
for 2. use rtnetlink and rtm_getroute option or maybe read /proc/net/route

I have some concerns. For example, older messages in this list point out that netlink messages are unreliable. So you might not get all rtm_newlink messages. Another example, iptables can be used to force a particular route, this would not show up in /proc/net/route or the routing entries.

But generally speaking, are my choices to solve my problems 1 and 2 the correct ones or are there easier ways (ie, some functions I can just call)?

Thanks,

Chinh
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to