From 1911a98df800cedf4c3a63b897163e2935c5f602 Mon Sep 17 00:00:00 2001 From: Cosmin Ratiu Date: Thu, 1 Oct 2009 20:27:39 +0300 Subject: [PATCH] ipv6: new sysctl for sending TLLAO with NAs Neighbor advertisements responding to unicast Neighbor Solicitations did not include the TLLAO option. This patch makes this configurable via /proc/sys/net/ipv6/ndisc_force_tllao, which by default is off. 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 on page 24 sending this to avoid a race. Signed-off-by: Cosmin Ratiu --- include/net/netns/ipv6.h | 1 + net/ipv6/ndisc.c | 1 + net/ipv6/sysctl_net_ipv6.c | 8 ++++++++ 3 files changed, 10 insertions(+), 0 deletions(-) diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index dfeb2d7..dd0a95b 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h @@ -16,6 +16,7 @@ struct netns_sysctl_ipv6 { struct ctl_table_header *frags_hdr; #endif int bindv6only; + int ndisc_force_tllao; int flush_delay; int ip6_rt_max_size; int ip6_rt_gc_min_interval; diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index f74e4e2..f08cf65 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -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 |= dev_net(dev)->ipv6.sysctl.ndisc_force_tllao; __ndisc_send(dev, neigh, daddr, src_addr, &icmp6h, solicited_addr, inc_opt ? ND_OPT_TARGET_LL_ADDR : 0); diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c index 0dc6a4e..fb423ce 100644 --- a/net/ipv6/sysctl_net_ipv6.c +++ b/net/ipv6/sysctl_net_ipv6.c @@ -37,6 +37,14 @@ static ctl_table ipv6_table_template[] = { .mode = 0644, .proc_handler = proc_dointvec }, + { + .ctl_name = CTL_UNNUMBERED, + .procname = "ndisc_force_tllao", + .data = &init_net.ipv6.sysctl.ndisc_force_tllao, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec + }, { .ctl_name = 0 } }; -- 1.6.3.3