Subtleties of the 0.0.0.0 netmask (inet_ifa_match)

From: Allen Lau (pflau@us.ibm.com)
Date: Wed Jul 25 2001 - 21:04:31 EST


Hi,

This is a load balancing specific question. We configure load balancer IP addresses (which are regular
addresses like 10.1.1.1) on the loopback interface with 0.0.0.0 netmask. The purpose is to receive
clients requests with those address, and for routing to ignore them when sending the replies.

  o Does addresses with 0.0.0.0 netmask have scope RT_SCOPE_NOWHERE?
  o and does it imply that routing would never route to them?

We also configure load balancer IP address with 255.255.255.255 netmask which should not match any
route entry except the host entry itself within the box.

  o Are there subtle differences between 0.0.0.0 and 255.255.255.255 netmasks?

The inet_ifa_match function seems to be wrong with 0.0.0.0 netmask. Who uses it?

extern __inline__ int inet_ifa_match(u32 addr, struct in_ifaddr *ifa)
{
        return !((addr^ifa->ifa_address)&ifa->ifa_mask);
}

The 0.0.0.0 netmask matches everything! For example:
        addr=9.9.9.9 ifa_address=10.1.1.1 ifa_mask=0.0.0.0 inet_ifa_match=1
        addr=9.9.9.9 ifa_address=10.1.1.1 ifa_mask=255.255.255.255 inet_ifa_match=0

Will there be any routing problems if we use the 0.0.0.0 netmask?

Thanks for any info.
Allen Lau

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Jul 31 2001 - 21:00:25 EST