Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Very specific questions on data returned by sysctl: (1 Item)
   
Very specific questions on data returned by sysctl  
I would like to know about information in the RTM_NETMASK field returned by calls to sysctl.  Since I do not have access
 to the source code I can't determine this myself.  I would appreciate insight from anyone who has access to it.

When I retrieve the routing table (NET_RT_DUMP), the net mask field of each entry that provides one has a sa_family type
 of 255.  If I treat this field like an AF_INET family (2) I get the correct network mask.  What is the significance of 
the 255 value?

When I retrieve the interface list (NET_RT_IFLIST), some of the net mask entries have a sa_family type of AF_UNSPEC (0).
  The sysctl call returns a list of 'struct if_msghdr' fields, each followed by one or more 'struct ifa_msghdr' fields. 
 The if_msghdr field describes the interface giving the name and MAC address in the RTA_IFP field.  Following this entry
 is an ifa_msghdr field.  The RTA_IFA field repeats the interface description.  The ifm_flags field is zero.  The 
RTA_NETMASK field is the AF_UNSPEC family.  In my tests, this field has an sa_len of 11 bytes.  Is there any 
significance to these data?

Following this mystery ifa_msghdr field are more ifa_msghdr fields describing the IP addresses assigned to the interface
.  The first field describes the default IP address.  Its RTA_NETMASK family type is AF_UNSPEC, but if I treat it as 
AF_INET, I get the correct net mask.  Any remaining ifa_msghdr fields are IP aliases and the RTA_NETMASK fields are 
AF_INET.  Why is this field AF_UNSPEC and can I use it to distinguish it as the default IP address?