aboutsummaryrefslogtreecommitdiffstats
path: root/net/l2tp
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-10-08 15:44:26 -0400
committerDavid S. Miller <davem@davemloft.net>2013-10-08 15:44:26 -0400
commit8d8a51e26a6d415e1470759f2cf5f3ee3ee86196 (patch)
treee9a32c88110ccf5382726ec1d7321ebfa2e878d2 /net/l2tp
parent5c0c52c9102f90c9d5674fb6c5f4f23e3019dd9f (diff)
l2tp: Fix build warning with ipv6 disabled.
net/l2tp/l2tp_core.c: In function ‘l2tp_verify_udp_checksum’: net/l2tp/l2tp_core.c:499:22: warning: unused variable ‘tunnel’ [-Wunused-variable] Create a helper "l2tp_tunnel()" to facilitate this, and as a side effect get rid of a bunch of unnecessary void pointer casts. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/l2tp')
-rw-r--r--net/l2tp/l2tp_core.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index aedaa2cd4237..b076e8309bc2 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -115,6 +115,11 @@ struct l2tp_net {
115static void l2tp_session_set_header_len(struct l2tp_session *session, int version); 115static void l2tp_session_set_header_len(struct l2tp_session *session, int version);
116static void l2tp_tunnel_free(struct l2tp_tunnel *tunnel); 116static void l2tp_tunnel_free(struct l2tp_tunnel *tunnel);
117 117
118static inline struct l2tp_tunnel *l2tp_tunnel(struct sock *sk)
119{
120 return sk->sk_user_data;
121}
122
118static inline struct l2tp_net *l2tp_pernet(struct net *net) 123static inline struct l2tp_net *l2tp_pernet(struct net *net)
119{ 124{
120 BUG_ON(!net); 125 BUG_ON(!net);
@@ -496,7 +501,6 @@ out:
496static inline int l2tp_verify_udp_checksum(struct sock *sk, 501static inline int l2tp_verify_udp_checksum(struct sock *sk,
497 struct sk_buff *skb) 502 struct sk_buff *skb)
498{ 503{
499 struct l2tp_tunnel *tunnel = (struct l2tp_tunnel *)sk->sk_user_data;
500 struct udphdr *uh = udp_hdr(skb); 504 struct udphdr *uh = udp_hdr(skb);
501 u16 ulen = ntohs(uh->len); 505 u16 ulen = ntohs(uh->len);
502 __wsum psum; 506 __wsum psum;
@@ -505,7 +509,7 @@ static inline int l2tp_verify_udp_checksum(struct sock *sk,
505 return 0; 509 return 0;
506 510
507#if IS_ENABLED(CONFIG_IPV6) 511#if IS_ENABLED(CONFIG_IPV6)
508 if (sk->sk_family == PF_INET6 && !tunnel->v4mapped) { 512 if (sk->sk_family == PF_INET6 && !l2tp_tunnel(sk)->v4mapped) {
509 if (!uh->check) { 513 if (!uh->check) {
510 LIMIT_NETDEBUG(KERN_INFO "L2TP: IPv6: checksum is 0\n"); 514 LIMIT_NETDEBUG(KERN_INFO "L2TP: IPv6: checksum is 0\n");
511 return 1; 515 return 1;
@@ -1305,10 +1309,9 @@ EXPORT_SYMBOL_GPL(l2tp_xmit_skb);
1305 */ 1309 */
1306static void l2tp_tunnel_destruct(struct sock *sk) 1310static void l2tp_tunnel_destruct(struct sock *sk)
1307{ 1311{
1308 struct l2tp_tunnel *tunnel; 1312 struct l2tp_tunnel *tunnel = l2tp_tunnel(sk);
1309 struct l2tp_net *pn; 1313 struct l2tp_net *pn;
1310 1314
1311 tunnel = sk->sk_user_data;
1312 if (tunnel == NULL) 1315 if (tunnel == NULL)
1313 goto end; 1316 goto end;
1314 1317
@@ -1676,7 +1679,7 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32
1676 } 1679 }
1677 1680
1678 /* Check if this socket has already been prepped */ 1681 /* Check if this socket has already been prepped */
1679 tunnel = (struct l2tp_tunnel *)sk->sk_user_data; 1682 tunnel = l2tp_tunnel(sk);
1680 if (tunnel != NULL) { 1683 if (tunnel != NULL) {
1681 /* This socket has already been prepped */ 1684 /* This socket has already been prepped */
1682 err = -EBUSY; 1685 err = -EBUSY;