mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: Subtleties of the 0.0.0.0 netmask (inet_ifa_match)
@ 2001-07-27 19:03 Allen Lau
  0 siblings, 0 replies; 5+ messages in thread
From: Allen Lau @ 2001-07-27 19:03 UTC (permalink / raw)
  To: Alexey Kuznetsov; +Cc: linux-kernel

Alexey,

>> The inet_ifa_match function seems to be wrong with 0.0.0.0 netmask.
>...
>> The 0.0.0.0 netmask matches everything!
>
>Of course. Zero mask matches everything.

I agree that 0.0.0.0 netmask in a route entry (dest 0.0.0.0 mask 0.0.0.0)
matches everything.
However, it is intuitively different with an interface address.
Can an IP address be on every subnet (i.e. is 10.1.1.1 prefix 0 on every
subnet)?

I believe it is not right for inet_ifa_match to answer "yes" in the context of :
     is 9.9.9.9 on the same subnet as interface address 10.1.1.1 prefix 0?

>> Will there be any routing problems if we use the 0.0.0.0 netmask?
>
>No problems provided you wanted this.
>F.e. default route is route with netmask zero, it matches all,
>so that all the addresses are routed there.
>It is exactly which happens in your setup, but all the addresses
>fall to loopback.

>Looking at your original purpose, you wanted mask 255.255.255.255.

>Alexey

Allen Lau


^ permalink raw reply	[flat|nested] 5+ messages in thread
* Subtleties of the 0.0.0.0 netmask (inet_ifa_match)
@ 2001-07-26  2:04 Allen Lau
  2001-07-27  0:32 ` Alexey Kuznetsov
  0 siblings, 1 reply; 5+ messages in thread
From: Allen Lau @ 2001-07-26  2:04 UTC (permalink / raw)
  To: linux-kernel

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-07-27 21:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <OFA1B2627C.7E519218-ON85256A96.00641020@raleigh.ibm.com >
2001-07-27 19:06 ` Subtleties of the 0.0.0.0 netmask (inet_ifa_match) kuznet
2001-07-27 21:27   ` Joshua M. Thompson
2001-07-27 19:03 Allen Lau
  -- strict thread matches above, loose matches on Subject: below --
2001-07-26  2:04 Allen Lau
2001-07-27  0:32 ` Alexey Kuznetsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®