Netmasks and PF_ROUTE rockets

Bruce M Simpson bms at spc.org
Thu Aug 14 11:56:32 PDT 2003


Bill,

Thanks for your help the other week. It seems, though, that in order to
fix my code, I had to replicate exactly what route(8) did.

Specifically, it fills out the netmask sockaddr_in in this way: it counts
the number of bytes of netmask set within the sockaddr and sets sin_len
accordingly.  It is also necessary to pad each sockaddr after the rtmsg
header to the nearest longword, otherwise nothing works.

I have actually managed to panic the 5.1 kernel by passing a wrongly
formatted routing message in.

The on-demand routing example now works on its own without the need for
the user to configure an interface or a route; they do have to specify
a network address in CIDR notation which will be used with the XRESOLVE
flag and the disc1 interface. 

They also need to kldload if_disc, I haven't brought maybeload in from
ifconfig(8) [yet].

BMS


More information about the freebsd-net mailing list