Re: [-mm patch] IPV6 must select XFRM

Masahide NAKAMURA
2007-09-03T11:02:21Z

[-- Attachment #1: Type: text/plain, Size: 1359 bytes --]

Hello,

On Sun, 2 Sep 2007 13:25:57 +0200
Adrian Bunk <bunk@kernel.org> wrote:

> On Fri, Aug 31, 2007 at 09:58:22PM -0700, Andrew Morton wrote:
> >...
> > Changes since 2.6.23-rc3-mm1:
> >...
> > git-net.patch
> >...
> > git trees
> >...
>
> This patch fixes the following compile error:
>
> <-- snip -->
>
> ...
> LD .tmp_vmlinux1
> net/built-in.o: In function `inet6_csk_xmit':
> (.text+0x72b0f): undefined reference to `flow_cache_genid'
> net/built-in.o: In function `inet6_csk_xmit':
> (.text+0x72be5): undefined reference to `flow_cache_genid'
> make[1]: *** [.tmp_vmlinux1] Error 1
>
> <-- snip -->
>
> Signed-off-by: Adrian Bunk <bunk@kernel.org>
>
> ---
> --- a/net/ipv6/Kconfig
> +++ b/net/ipv6/Kconfig
> @@ -5,6 +5,7 @@
> # IPv6 as module will cause a CRASH if you try to unload it
> config IPV6
> tristate "The IPv6 protocol"
> + select XFRM
> default m
> ---help---
> This is complemental support for the IP version 6.
>
> -

Thank you for catching this. the issue is caused with patch
"[IPV6] XFRM: Fix connected socket to use transformation."
which I sent to netdev.
(a85d5450ddeb959bdf9e4603f9c06e9d79217cfa on net-2.6.24).

I'd prefer to modify the original patch to use "ifdef CONFIG_XFRM"
than changing kernel config depends. Does it make sense?

Please review the attached patch.

--
Masahide NAKAMURA

[-- Attachment #2: 0001-PATCH-IPV6-XFRM-Fix-dependency-issue-at-inet6_csk_xmit.txt --]
[-- Type: application/octet-stream, Size: 2113 bytes --]

From c9b0d15f8222de7854a6ad504c4562004b99e487 Mon Sep 17 00:00:00 2001
From: Masahide NAKAMURA <nakam@linux-ipv6.org>
Date: Mon, 3 Sep 2007 19:31:32 +0900
Subject: [PATCH] [IPV6] XFRM: Fix dependency issue at inet6_csk_xmit.

Signed-off-by: Masahide NAKAMURA <nakam@linux-ipv6.org>
---
include/net/ip6_fib.h | 2 ++
net/ipv6/inet6_connection_sock.c | 31 ++++++++++++++++++-------------
2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 85d6d9f..8578213 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -106,7 +106,9 @@ struct rt6_info

u8 rt6i_protocol;

+#ifdef CONFIG_XFRM
u32 rt6i_flow_cache_genid;
+#endif
};

static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
index f389322..25b9317 100644
--- a/net/ipv6/inet6_connection_sock.c
+++ b/net/ipv6/inet6_connection_sock.c
@@ -143,29 +143,34 @@ static inline
void __inet6_csk_dst_store(struct sock *sk, struct dst_entry *dst,
struct in6_addr *daddr, struct in6_addr *saddr)
{
- struct rt6_info *rt = (struct rt6_info *)dst;
-
__ip6_dst_store(sk, dst, daddr, saddr);
- rt->rt6i_flow_cache_genid = atomic_read(&flow_cache_genid);
+
+#ifdef CONFIG_XFRM
+ if (dst) {
+ struct rt6_info *rt = (struct rt6_info *)dst;
+ rt->rt6i_flow_cache_genid = atomic_read(&flow_cache_genid);
+ }
+#endif
}

static inline
struct dst_entry *__inet6_csk_dst_check(struct sock *sk, u32 cookie)
{
struct dst_entry *dst;
- struct rt6_info *rt;

dst = __sk_dst_check(sk, cookie);
- if (!dst)
- goto end;
-
- rt = (struct rt6_info *)dst;
- if (rt->rt6i_flow_cache_genid != atomic_read(&flow_cache_genid)) {
- sk->sk_dst_cache = NULL;
- dst_release(dst);
- dst = NULL;
+
+#ifdef CONFIG_XFRM
+ if (dst) {
+ struct rt6_info *rt = (struct rt6_info *)dst;
+ if (rt->rt6i_flow_cache_genid != atomic_read(&flow_cache_genid)) {
+ sk->sk_dst_cache = NULL;
+ dst_release(dst);
+ dst = NULL;
+ }
}
- end:
+#endif
+
return dst;
}

--
1.4.4.2