linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Subtleties of the 0.0.0.0 netmask (inet_ifa_match)
       [not found] <OFA1B2627C.7E519218-ON85256A96.00641020@raleigh.ibm.com >
@ 2001-07-27 19:06 ` kuznet
  2001-07-27 21:27   ` Joshua M. Thompson
  0 siblings, 1 reply; 5+ messages in thread
From: kuznet @ 2001-07-27 19:06 UTC (permalink / raw)
  To: Allen Lau; +Cc: linux-kernel

Hello!

> Can an IP address be on every subnet (i.e. is 10.1.1.1 prefix 0 on every
> subnet)?

Of course. Why not? This means that 10.1.1.1 is address of this
interface and all the rest of internet is attached to this interface directly.

The thing which you want is 255.255.255.255.

Alexey

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

* Re: Subtleties of the 0.0.0.0 netmask (inet_ifa_match)
  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
  0 siblings, 0 replies; 5+ messages in thread
From: Joshua M. Thompson @ 2001-07-27 21:27 UTC (permalink / raw)
  To: linux-kernel

On Fri, 27 Jul 2001 kuznet@ms2.inr.ac.ru wrote:

> Hello!
>
> > Can an IP address be on every subnet (i.e. is 10.1.1.1 prefix 0 on every
> > subnet)?
>
> Of course. Why not? This means that 10.1.1.1 is address of this
> interface and all the rest of internet is attached to this interface directly.

Which is actually used by some routing hardware. Ascend Pipelines have a
mode ("Proxy Mode=Always") in which the router answers any ARP request for
off-net IPs with its own MAC address. The idea then is to configure all
your machines to assume the entire Internet is on your local subnet and
the router will pick up the packets destined for the outside world
automatically. Kinda silly really but it does happen.

-- 
Head Developer           | "...and we have C(n) = (n (n + 1))/ 2. Easy as pie.
Big Net, Inc.            |  Actually easier, Pi = Sum 8 / ((4n + 1)(4n + 3))."
                         |                   - Donald E. KNUTH


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

* 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

* Re: 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, 0 replies; 5+ messages in thread
From: Alexey Kuznetsov @ 2001-07-27  0:32 UTC (permalink / raw)
  To: Allen Lau; +Cc: linux-kernel

Hello!

>   o Does addresses with 0.0.0.0 netmask have scope RT_SCOPE_NOWHERE?

Why?

>   o and does it imply that routing would never route to them?

Even if you set this, it does not imply anything, but that address
will not be used on any packet while automaitc source address selection.


>   o Are there subtle differences between 0.0.0.0 and 255.255.255.255 netmasks?

Subtle? :-) They are on exactly opposite poles.


> 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.


> 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

^ 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;
as well as URLs for NNTP newsgroup(s).