]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
make TLLAO option for NA packets configurable
authorOctavian Purdila <opurdila@ixiacom.com>
Fri, 2 Oct 2009 11:39:15 +0000 (11:39 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 7 Oct 2009 08:10:45 +0000 (01:10 -0700)
On Friday 02 October 2009 20:53:51 you wrote:

> This is good although I would have shortened the name.

Ah, I knew I forgot something :) Here is v4.

tavi

>From 24d96d825b9fa832b22878cc6c990d5711968734 Mon Sep 17 00:00:00 2001
From: Octavian Purdila <opurdila@ixiacom.com>
Date: Fri, 2 Oct 2009 00:51:15 +0300
Subject: [PATCH] ipv6: new sysctl for sending TLLAO with unicast NAs

Neighbor advertisements responding to unicast neighbor solicitations
did not include the target link-layer address option. This patch adds
a new sysctl option (disabled by default) which controls whether this
option should be sent even with unicast NAs.

The need for this arose because certain routers expect the TLLAO in
some situations even as a response to unicast NS packets.

Moreover, RFC 2461 recommends sending this to avoid a race condition
(section 4.4, Target link-layer address)

Signed-off-by: Cosmin Ratiu <cratiu@ixiacom.com>
Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/networking/ip-sysctl.txt
include/linux/ipv6.h
net/ipv6/addrconf.c
net/ipv6/ndisc.c

index fbe427a6580cc5996a3352c4115327db371eaecc..a0e134dd2523ff0bf7c9868af08170aa68c8b233 100644 (file)
@@ -1086,6 +1086,24 @@ accept_dad - INTEGER
        2: Enable DAD, and disable IPv6 operation if MAC-based duplicate
           link-local address has been found.
 
+force_tllao - BOOLEAN
+       Enable sending the target link-layer address option even when
+       responding to a unicast neighbor solicitation.
+       Default: FALSE
+
+       Quoting from RFC 2461, section 4.4, Target link-layer address:
+
+       "The option MUST be included for multicast solicitations in order to
+       avoid infinite Neighbor Solicitation "recursion" when the peer node
+       does not have a cache entry to return a Neighbor Advertisements
+       message.  When responding to unicast solicitations, the option can be
+       omitted since the sender of the solicitation has the correct link-
+       layer address; otherwise it would not have be able to send the unicast
+       solicitation in the first place. However, including the link-layer
+       address in this case adds little overhead and eliminates a potential
+       race condition where the sender deletes the cached link-layer address
+       prior to receiving a response to a previous solicitation."
+
 icmp/*:
 ratelimit - INTEGER
        Limit the maximal rates for sending ICMPv6 packets.
index c662efa6828985a4025951a1c655cf5bf85300cf..ae74ede1abe70ea054dbdad96cd8afaa1c3d8787 100644 (file)
@@ -167,6 +167,7 @@ struct ipv6_devconf {
 #endif
        __s32           disable_ipv6;
        __s32           accept_dad;
+       __s32           force_tllao;
        void            *sysctl;
 };
 
index 1fd0a3d775d26767dec15c78f599dc96b1c3c08d..bdcee6981c60c9eaea5995930d322e5d94b4bc04 100644 (file)
@@ -4352,6 +4352,14 @@ static struct addrconf_sysctl_table
                        .mode           =       0644,
                        .proc_handler   =       proc_dointvec,
                },
+               {
+                       .ctl_name       = CTL_UNNUMBERED,
+                       .procname       = "force_tllao",
+                       .data           = &ipv6_devconf.force_tllao,
+                       .maxlen         = sizeof(int),
+                       .mode           = 0644,
+                       .proc_handler   = proc_dointvec
+               },
                {
                        .ctl_name       =       0,      /* sentinel */
                }
index f74e4e2cdd061433345929399b7a7266b32dacec..3507cfe1e7a2101b9dbc2193f9186ca81baadfe4 100644 (file)
@@ -598,6 +598,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
        icmp6h.icmp6_solicited = solicited;
        icmp6h.icmp6_override = override;
 
+       inc_opt |= ifp->idev->cnf.force_tllao;
        __ndisc_send(dev, neigh, daddr, src_addr,
                     &icmp6h, solicited_addr,
                     inc_opt ? ND_OPT_TARGET_LL_ADDR : 0);