diff options
-rw-r--r-- | net/l2tp/l2tp_core.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 83421c6f0bef..e22512e32827 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c | |||
@@ -1457,9 +1457,14 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 | |||
1457 | encap = cfg->encap; | 1457 | encap = cfg->encap; |
1458 | 1458 | ||
1459 | /* Quick sanity checks */ | 1459 | /* Quick sanity checks */ |
1460 | err = -EPROTONOSUPPORT; | ||
1461 | if (sk->sk_type != SOCK_DGRAM) { | ||
1462 | pr_debug("tunl %hu: fd %d wrong socket type\n", | ||
1463 | tunnel_id, fd); | ||
1464 | goto err; | ||
1465 | } | ||
1460 | switch (encap) { | 1466 | switch (encap) { |
1461 | case L2TP_ENCAPTYPE_UDP: | 1467 | case L2TP_ENCAPTYPE_UDP: |
1462 | err = -EPROTONOSUPPORT; | ||
1463 | if (sk->sk_protocol != IPPROTO_UDP) { | 1468 | if (sk->sk_protocol != IPPROTO_UDP) { |
1464 | pr_err("tunl %hu: fd %d wrong protocol, got %d, expected %d\n", | 1469 | pr_err("tunl %hu: fd %d wrong protocol, got %d, expected %d\n", |
1465 | tunnel_id, fd, sk->sk_protocol, IPPROTO_UDP); | 1470 | tunnel_id, fd, sk->sk_protocol, IPPROTO_UDP); |
@@ -1467,7 +1472,6 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 | |||
1467 | } | 1472 | } |
1468 | break; | 1473 | break; |
1469 | case L2TP_ENCAPTYPE_IP: | 1474 | case L2TP_ENCAPTYPE_IP: |
1470 | err = -EPROTONOSUPPORT; | ||
1471 | if (sk->sk_protocol != IPPROTO_L2TP) { | 1475 | if (sk->sk_protocol != IPPROTO_L2TP) { |
1472 | pr_err("tunl %hu: fd %d wrong protocol, got %d, expected %d\n", | 1476 | pr_err("tunl %hu: fd %d wrong protocol, got %d, expected %d\n", |
1473 | tunnel_id, fd, sk->sk_protocol, IPPROTO_L2TP); | 1477 | tunnel_id, fd, sk->sk_protocol, IPPROTO_L2TP); |