[net-next:master 73/84] net/ipv4/tcp_metrics.c:252:3: error: implicit declaration of function 'inet6_twsk'

3 messages, 2 authors, 2012-07-11 · open the first message on its own page

[net-next:master 73/84] net/ipv4/tcp_metrics.c:252:3: error: implicit declaration of function 'inet6_twsk'

From: <hidden>
Date: 2012-07-11 09:12:41

Hi David,

Kernel build failed on

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head:   fdd28d7328f4c3ddf77ba163e257d7dc48392767
commit: 81166dd6fa8eb780b2132d32fbc77eb6ac04e44e [73/84] tcp: Move timestamps from inetpeer to metrics cache.
config: i386-randconfig-net2 (attached as .config)

All related error/warning messages:

net/ipv4/tcp_metrics.c: In function '__tcp_get_metrics_tw':
net/ipv4/tcp_metrics.c:252:3: error: implicit declaration of function 'inet6_twsk' [-Werror=implicit-function-declaration]
net/ipv4/tcp_metrics.c:252:7: warning: assignment makes pointer from integer without a cast [enabled by default]
net/ipv4/tcp_metrics.c:253:41: error: dereferencing pointer to incomplete type

vim +252 net/ipv4/tcp_metrics.c
   249			hash = (__force unsigned int) addr.addr.a4;
   250			break;
   251		case AF_INET6:
 > 252			tw6 = inet6_twsk((struct sock *)tw);
   253			*(struct in6_addr *)addr.addr.a6 = tw6->tw_v6_daddr;
   254			hash = ((__force unsigned int) addr.addr.a6[0] ^
   255				(__force unsigned int) addr.addr.a6[1] ^

The problem is, inet6_twsk() and struct inet6_timewait_sock are only
defined in include/linux/ipv6.h under CONFIG_IPV6.

---
0-DAY kernel build testing backend         Open Source Technology Centre
Fengguang Wu [off-list ref]                     Intel Corporation

Re: [net-next:master 73/84] net/ipv4/tcp_metrics.c:252:3: error: implicit declaration of function 'inet6_twsk'

From: David Miller <davem@davemloft.net>
Date: 2012-07-11 09:39:40

From: wfg@linux.intel.com
Date: Wed, 11 Jul 2012 17:12:33 +0800
net/ipv4/tcp_metrics.c: In function '__tcp_get_metrics_tw':
net/ipv4/tcp_metrics.c:252:3: error: implicit declaration of function 'inet6_twsk' [-Werror=implicit-function-declaration]
net/ipv4/tcp_metrics.c:252:7: warning: assignment makes pointer from integer without a cast [enabled by default]
net/ipv4/tcp_metrics.c:253:41: error: dereferencing pointer to incomplete type
Fixed as follows:

====================
ipv6: Move ipv6 twsk accessors outside of CONFIG_IPV6 ifdefs.

Fixes build when ipv6 is disabled.

Reported-by: Fengguang Wu <redacted>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/linux/ipv6.h |   32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 8260ef7..bc6c8fd 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -410,6 +410,22 @@ struct tcp6_sock {
 
 extern int inet6_sk_rebuild_header(struct sock *sk);
 
+struct inet6_timewait_sock {
+	struct in6_addr tw_v6_daddr;
+	struct in6_addr	tw_v6_rcv_saddr;
+};
+
+struct tcp6_timewait_sock {
+	struct tcp_timewait_sock   tcp6tw_tcp;
+	struct inet6_timewait_sock tcp6tw_inet6;
+};
+
+static inline struct inet6_timewait_sock *inet6_twsk(const struct sock *sk)
+{
+	return (struct inet6_timewait_sock *)(((u8 *)sk) +
+					      inet_twsk(sk)->tw_ipv6_offset);
+}
+
 #if IS_ENABLED(CONFIG_IPV6)
 static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
 {
@@ -459,28 +475,12 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
 #define __ipv6_only_sock(sk)	(inet6_sk(sk)->ipv6only)
 #define ipv6_only_sock(sk)	((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk))
 
-struct inet6_timewait_sock {
-	struct in6_addr tw_v6_daddr;
-	struct in6_addr	tw_v6_rcv_saddr;
-};
-
-struct tcp6_timewait_sock {
-	struct tcp_timewait_sock   tcp6tw_tcp;
-	struct inet6_timewait_sock tcp6tw_inet6;
-};
-
 static inline u16 inet6_tw_offset(const struct proto *prot)
 {
 	return prot->twsk_prot->twsk_obj_size -
 			sizeof(struct inet6_timewait_sock);
 }
 
-static inline struct inet6_timewait_sock *inet6_twsk(const struct sock *sk)
-{
-	return (struct inet6_timewait_sock *)(((u8 *)sk) +
-					      inet_twsk(sk)->tw_ipv6_offset);
-}
-
 static inline struct in6_addr *__inet6_rcv_saddr(const struct sock *sk)
 {
 	return likely(sk->sk_state != TCP_TIME_WAIT) ?
-- 
1.7.10.4

Re: [net-next:master 73/84] net/ipv4/tcp_metrics.c:252:3: error: implicit declaration of function 'inet6_twsk'

From: Fengguang Wu <hidden>
Date: 2012-07-11 09:45:16

On Wed, Jul 11, 2012 at 02:39:39AM -0700, David Miller wrote:
From: wfg@linux.intel.com
Date: Wed, 11 Jul 2012 17:12:33 +0800
quoted
net/ipv4/tcp_metrics.c: In function '__tcp_get_metrics_tw':
net/ipv4/tcp_metrics.c:252:3: error: implicit declaration of function 'inet6_twsk' [-Werror=implicit-function-declaration]
net/ipv4/tcp_metrics.c:252:7: warning: assignment makes pointer from integer without a cast [enabled by default]
net/ipv4/tcp_metrics.c:253:41: error: dereferencing pointer to incomplete type
Fixed as follows:

====================
ipv6: Move ipv6 twsk accessors outside of CONFIG_IPV6 ifdefs.

Fixes build when ipv6 is disabled.

Reported-by: Fengguang Wu <redacted>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/linux/ipv6.h |   32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
It worked, thanks!

Fengguang
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help