diff options
author | Andy Zhou <azhou@nicira.com> | 2014-09-16 20:31:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-19 15:57:15 -0400 |
commit | c8fffcea0a079f933b4e98adf9ebaa384dc943b6 (patch) | |
tree | 66c2bda47dc1639ff82def2b97f21614cfcf89db /net/l2tp | |
parent | acbf74a763002bdc74ccfcdac22360bf18e305c5 (diff) |
l2tp: Refactor l2tp core driver to make use of the common UDP tunnel functions
Simplify l2tp implementation using common UDP tunnel APIs.
Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/l2tp')
-rw-r--r-- | net/l2tp/l2tp_core.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 2aa2b6c15f20..895348e44c7d 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c | |||
@@ -1392,8 +1392,6 @@ static int l2tp_tunnel_sock_create(struct net *net, | |||
1392 | if (err < 0) | 1392 | if (err < 0) |
1393 | goto out; | 1393 | goto out; |
1394 | 1394 | ||
1395 | udp_set_convert_csum(sock->sk, true); | ||
1396 | |||
1397 | break; | 1395 | break; |
1398 | 1396 | ||
1399 | case L2TP_ENCAPTYPE_IP: | 1397 | case L2TP_ENCAPTYPE_IP: |
@@ -1584,19 +1582,17 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 | |||
1584 | /* Mark socket as an encapsulation socket. See net/ipv4/udp.c */ | 1582 | /* Mark socket as an encapsulation socket. See net/ipv4/udp.c */ |
1585 | tunnel->encap = encap; | 1583 | tunnel->encap = encap; |
1586 | if (encap == L2TP_ENCAPTYPE_UDP) { | 1584 | if (encap == L2TP_ENCAPTYPE_UDP) { |
1587 | /* Mark socket as an encapsulation socket. See net/ipv4/udp.c */ | 1585 | struct udp_tunnel_sock_cfg udp_cfg; |
1588 | udp_sk(sk)->encap_type = UDP_ENCAP_L2TPINUDP; | 1586 | |
1589 | udp_sk(sk)->encap_rcv = l2tp_udp_encap_recv; | 1587 | udp_cfg.sk_user_data = tunnel; |
1590 | udp_sk(sk)->encap_destroy = l2tp_udp_encap_destroy; | 1588 | udp_cfg.encap_type = UDP_ENCAP_L2TPINUDP; |
1591 | #if IS_ENABLED(CONFIG_IPV6) | 1589 | udp_cfg.encap_rcv = l2tp_udp_encap_recv; |
1592 | if (sk->sk_family == PF_INET6 && !tunnel->v4mapped) | 1590 | udp_cfg.encap_destroy = l2tp_udp_encap_destroy; |
1593 | udpv6_encap_enable(); | ||
1594 | else | ||
1595 | #endif | ||
1596 | udp_encap_enable(); | ||
1597 | } | ||
1598 | 1591 | ||
1599 | sk->sk_user_data = tunnel; | 1592 | setup_udp_tunnel_sock(net, sock, &udp_cfg); |
1593 | } else { | ||
1594 | sk->sk_user_data = tunnel; | ||
1595 | } | ||
1600 | 1596 | ||
1601 | /* Hook on the tunnel socket destructor so that we can cleanup | 1597 | /* Hook on the tunnel socket destructor so that we can cleanup |
1602 | * if the tunnel socket goes away. | 1598 | * if the tunnel socket goes away. |