Subject: Re: route(4) interface
To: None <firstname.lastname@example.org>
From: Mihai CHELARU <email@example.com>
Date: 02/26/2006 19:20:50
> 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
10.0.0.1/8'. In that moment 10.0.0.0/24 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 = 0.0.0.0 is added or deleted with
getifaddrs() or if_nameindex() but that's like stupid and I'd like to
>> 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 ? :)