netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Chavey <chavey@google.com>
To: Octavian Purdila <opurdila@ixiacom.com>
Cc: netdev@vger.kernel.org
Subject: Re: [RFC] ipv4: support for request type gratuitous ARP
Date: Wed, 6 Jan 2010 12:24:22 -0800	[thread overview]
Message-ID: <97949e3e1001061224n73e6adecv83cb114b8b046807@mail.gmail.com> (raw)
In-Reply-To: <201001050004.45004.opurdila@ixiacom.com>

Reviewed-by: Laurent Chavey <chavey@google.com>

On Mon, Jan 4, 2010 at 2:04 PM, Octavian Purdila <opurdila@ixiacom.com> wrote:
>
> Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
> ---
>
> I've noticed that even though we currently support response type gratuitous ARP
> [response type, source mac, dest mac, source IP, source IP] *with a clean ARP table*
> we do not support the request type [request type, source mac, ff:ff:ff:ff:ff:ff, source IP, source IP].
>
> This patch makes request type work as well, but RFC2002 says that gratuitous ARP
> (both request and response) must update the ARP table *if* the IP already
> exists in the table:
>
>          In either case, for a gratuitous ARP, the ARP packet MUST be
>          transmitted as a local broadcast packet on the local link.  As
>          specified in [16], any node receiving any ARP packet (Request or
>          Reply) MUST update its local ARP cache with the Sender Protocol
>          and Hardware Addresses in the ARP packet, if the receiving node
>          has an entry for that IP address already in its ARP cache.  This
>          requirement in the ARP protocol applies even for ARP Request
>          packets, and for ARP Reply packets that do not match any ARP
>          Request transmitted by the receiving node [16].
>
> so, I am not sure if this is right. But current behavior for response type
> gratuitous ARP does not seem to be covered by the RFC either.
>
>  net/ipv4/arp.c |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
> index c95cd93..81ef2d5 100644
> --- a/net/ipv4/arp.c
> +++ b/net/ipv4/arp.c
> @@ -811,8 +811,13 @@ static int arp_process(struct sk_buff *skb)
>                goto out;
>        }
>
> -       if (arp->ar_op == htons(ARPOP_REQUEST) &&
> -           ip_route_input(skb, tip, sip, 0, dev) == 0) {
> +       if (arp->ar_op == htons(ARPOP_REQUEST)) {
> +               /* gratuitous ARP */
> +               if (tip == sip) {
> +                       n = neigh_event_ns(&arp_tbl, sha, &sip, dev);
> +                       goto update;
> +               } else if (ip_route_input(skb, tip, sip, 0, dev) != 0)
> +                       goto update_lookup;
>
>                rt = skb_rtable(skb);
>                addr_type = rt->rt_type;
> @@ -853,6 +858,7 @@ static int arp_process(struct sk_buff *skb)
>                }
>        }
>
> +update_lookup:
>        /* Update our ARP tables */
>
>        n = __neigh_lookup(&arp_tbl, &sip, dev, 0);
> @@ -868,6 +874,7 @@ static int arp_process(struct sk_buff *skb)
>                        n = __neigh_lookup(&arp_tbl, &sip, dev, 1);
>        }
>
> +update:
>        if (n) {
>                int state = NUD_REACHABLE;
>                int override;
> --
> 1.5.6.5
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

  reply	other threads:[~2010-01-06 20:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-04 22:04 [RFC] ipv4: support for request type gratuitous ARP Octavian Purdila
2010-01-06 20:24 ` Laurent Chavey [this message]
2010-01-10 21:21 ` David Miller
2010-01-11 21:31   ` Octavian Purdila
2010-01-16 22:18   ` [PATCH v2] " Octavian Purdila
2010-01-17 13:45     ` Julian Anastasov
2010-01-17 18:55       ` Octavian Purdila
2010-01-17 20:43         ` Julian Anastasov
2010-01-18  3:05           ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97949e3e1001061224n73e6adecv83cb114b8b046807@mail.gmail.com \
    --to=chavey@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=opurdila@ixiacom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).