public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* net/ipv4/arp.c: arp_rcv, rfc2131 BREAKS communication
@ 2001-11-24 21:56 pjordan
  0 siblings, 0 replies; 7+ messages in thread
From: pjordan @ 2001-11-24 21:56 UTC (permalink / raw)
  To: linux-kernel

Hi, 

The following lines from arp.c refer to somethign in RFC2131 as an excuse for
sending out a malformed arp packet.

        /* Special case: IPv4 duplicate address detection packet (RFC2131) */
        if (sip == 0) {
                if (arp->ar_op == __constant_htons(ARPOP_REQUEST) &&
                    inet_addr_type(tip) == RTN_LOCAL)
                        arp_send(ARPOP_REPLY,ETH_P_ARP,tip,dev,tip,sha,dev->dev_addr,dev->dev_addr);
                goto out;
        }


In practice, when using a dhcp relay agent, and a client
(PowerPC Open Firmware in this example) sends a "gratutitous arp"

'arp who-has' from 0.0.0.0 to 192.168.2.1 for example,
the above lines of code send an arp reply that does not have the mac address
of the interface that made the 'arp who-has' and thus this interface
is not able to see the reply.  This means that now 192.168.2.1
is invisible to this machine and it can communicate with it.

Asjusting the above line to :
    arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha);

fixes the problem and normal communication can occur.
This of course makes this paragraph completely irrelevant.

Furthemre the following section from RFC2131 makes NO reference
to sending an arp packet with such a malformed structure.
"must fill in its own hardware address as the sender's hardware address"
is not strange behaviour, and DOES NOT refer to what a machine should
do when it RECEIVES an arp request packet from IP 0.0.0.0, but refers to
what a machine should do when it SENDS a gratuitous arp packet, one that
is not a response to an 'arp who-has' but IS an 'arp who-has'.

RFC2131 snippet BEGIN

     The client SHOULD perform a check on the
   suggested address to ensure that the address is not already in use.  For
   example, if the client is on a network that supports ARP, the client may
   issue an ARP request for the suggested request.  When broadcasting an ARP
   request for the suggested address, the client must fill in its own hardware
   address as the sender's hardware address, and 0 as the sender's IP address,
   to avoid confusing ARP caches in other hosts on the same subnet.  If the
   network address appears to be in use, the client MUST send a DHCPDECLINE
   message to the server.  The client SHOULD broadcast an ARP reply to announce
   the client's new IP address and clear any outdated ARP cache entries in
   hosts on the client's subnet.

RFC2131 snippet END


Furthermore,

In http://alternic.net/drafts/drafts-j-k/draft-jou-duplicate-ip-address-01.html

Which Updates RFC 826


We see reference to the gratuitous arp packet reception and the proper reply.

BEGIN snippet

   (ii) If a host receives an ARP request packet in which the
      Target IP address and the Sender IP address are the same and it
      matches one of its interface addresses, it then implies
      IP address duplication happens. The host MUST send a link layer
      broadcast ARP reply as defined below. The host MAY also log or
      display warning messages to indicate the detection of IP address
      duplication.

       48.bit Destination Address     = 0xffffffffffff (broadcast)
       48.bit Source Address          = Hardware adderss of interface
       16.bit Frame type              = 0x806 (ARP)
       ----------------------
       16.bit Hardware type           = 0x1 (Ethernet)
       16.bit Protocol Type           = 0x800 (IP)
        8.bit Hardware Address size   = 6
        8.bit Protocol Address size   = 4
       16.bit Opcode                  = 2 (Reply)
       48.bit Sender Ethernet Address = Hardware address of interface
       32.bit Sender IP Address       = Local IP address
       48.bit Target Ethernet Address = Sender Addr in Request packet
       32.bit Target IP Address       = Local IP Address

END snippet

So here yes we see sender and target IP and ethernet addresses being
sent out as the local addresses, but note that the first two lines refer to

   (ii) If a host receives an ARP request packet in which the
      Target IP address and the Sender IP address are the same and it

So again, how does the snippet of code at the top of this message from arp.c
in any way follow this scheme.  It looks for arp packets from 0.0.0.0
not packets with 'target and sender IP address are the same'.



So, can we have this apparently stupid error fixed please.
.. or can someone show the stupidity in my reasoning.

Kind regards,

Peter

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: net/ipv4/arp.c: arp_rcv, rfc2131 BREAKS communication
@ 2001-11-25 12:10 Julian Anastasov
  2001-11-26  2:19 ` pjordan
  0 siblings, 1 reply; 7+ messages in thread
From: Julian Anastasov @ 2001-11-25 12:10 UTC (permalink / raw)
  To: pjordan; +Cc: linux-kernel


	Hello,

pjordan@whitehorse.blackwire.com wrote:

>        16.bit Opcode                  = 2 (Reply)
>        48.bit Sender Ethernet Address = Hardware address of interface
>        32.bit Sender IP Address       = Local IP address
>        48.bit Target Ethernet Address = Sender Addr in Request packet
>        32.bit Target IP Address       = Local IP Address

	It seems in this experimental draft we see that the symmetry
is broken. The reply is from SIP to TIP and both are "Local IP address"
but the SHA and THA are different. When in replies SIP==TIP this is
something like we reply ourselfs. IMO, the same should be for SHA and
THA. Why to do duplicate address detection with SIP loaded with TIP?
There is already a way to do DAD: with SIP=0. May be the authors don't
know this solution? SIP=0 is used exactly for this purpose, not to
disturb the other hosts that already know TIP by some MAC. In this
draft I was not able to understand how DAD is performed. Of course,
with any mechanism used there is a race where two host can do DAD,
then nobody replies and then the both decide to configure the IPs.
But then who will agree to remove its IP? Someone would require
election process, something like VRRP. Or may be to configure the
IP (but not to advertise it if other hosts ask, i.e. passive mode),
to do DAD with SIP 0, to wait 1-2 seconds (or short random time) and
during that time to listen for remote hosts doing DAD and if
there are no other hosts that do DAD to advertise the IP. I agree that
after the IP is configured gratuitous ARP can be sent (and it is used in
setups where the IP is moved between the hosts to update the cached
values in remote caches) but I'm not sure the proposed scheme to remove
the duplicated IP is the best we can see, how you feel it?:

[
 (iii) If a host receives an ARP reply with both sender IP address
      and the target IP address fields match one of its interfaces,
      it MUST turn off the interface to stop using this address.
      It May log or display warning messages to indicate the error.
]

	What happens if we don't want to do it? Also, think for
shared IP addresses (same IP on many hosts, not advertised with
ARP from all hosts but still configured on some interface).

> So again, how does the snippet of code at the top of this message from arp.c
> in any way follow this scheme.  It looks for arp packets from 0.0.0.0
> not packets with 'target and sender IP address are the same'.

	IMO, the clients that do duplicate address detection shouldn't
drop replies that have THA != Destination Hardware Address. What is
that? A security measure? Linux does not check THA at all. And DAD
should be performed with SIP=0, why with SIP==TIP and when detection
is detected (and the remote caches damaged) the TIP to be unconfigured?
SIP=0 is the only way not to disturb the others because both the
requests and the replies with SIP!=0 can damage the caches (because
they are broadcasts destined to ff:ff:ff:ff:ff:ff).

	If your fix works for "PowerPC Open Firmware" then this
stack performs extra checks that I'm not sure they are specified
somewhere and are needed at all. May be I'm missing some standard?

Regards

--
Julian Anastasov <ja@ssi.bg>


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

end of thread, other threads:[~2001-11-29 19:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-11-24 21:56 net/ipv4/arp.c: arp_rcv, rfc2131 BREAKS communication pjordan
  -- strict thread matches above, loose matches on Subject: below --
2001-11-25 12:10 Julian Anastasov
2001-11-26  2:19 ` pjordan
2001-11-26  3:23   ` pjordan
2001-11-26  6:59   ` Bernd Eckenfels
2001-11-26 11:12   ` Julian Anastasov
2001-11-29 19:11     ` kuznet

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