Subject: Re: route(4) interface
To: None <>
From: Mihai CHELARU <>
List: tech-net
Date: 02/26/2006 19:20:50 wrote:
> On Sun, Feb 26, 2006 at 12:03:51AM +0200, Mihai CHELARU wrote:
>> 1) I'm trying to capture all routing changes that appear in a system. 
>> Right now I'm selecting a PF_ROUTE socket and get data from there. But I 
>> observed that directly connected routes changes are not reported via 
>> this interface. How can I see these changes ?
> What do you mean with "directly connected route"? ARP packets? I don't
> think they trigger routing messages and I wouldn't like them to trigger
> them either.

I mean routes that are added when you do 'ifconfig tap0 inet'. In that moment is added as connected to 
interface tap0. I was mistaking when I said those changes are not 
reported but as far as I see they are reported without netmask and 
that's totally useless to me. I could walk interfaces again everytime a 
route without gateway and prefix = is added or deleted with 
getifaddrs() or if_nameindex() but that's like stupid and I'd like to 
avoid it.

>> 3) I need a portable (POSIX ?) interface to dump all the routing table. 
>> I saw that route(8) does that by triggering a sysctl but I don't think 
>> that's very portable. Any other methods ?
> The only semi-portable interfaces I can think of are "netstat -rn",
> "route -n show" and SNMP :-)

I don't think you're suggesting doing system() with stdout redirected, 
right ? :)