diff options
author | David S. Miller <davem@davemloft.net> | 2018-03-23 11:24:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-03-23 11:31:58 -0400 |
commit | 03fe2debbb2771fb90881e4ce8109b09cf772a5c (patch) | |
tree | fbaf8738296b2e9dcba81c6daef2d515b6c4948c /net/l2tp | |
parent | 6686c459e1449a3ee5f3fd313b0a559ace7a700e (diff) | |
parent | f36b7534b83357cf52e747905de6d65b4f7c2512 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Fun set of conflict resolutions here...
For the mac80211 stuff, these were fortunately just parallel
adds. Trivially resolved.
In drivers/net/phy/phy.c we had a bug fix in 'net' that moved the
function phy_disable_interrupts() earlier in the file, whilst in
'net-next' the phy_error() call from this function was removed.
In net/ipv4/xfrm4_policy.c, David Ahern's changes to remove the
'rt_table_id' member of rtable collided with a bug fix in 'net' that
added a new struct member "rt_mtu_locked" which needs to be copied
over here.
The mlxsw driver conflict consisted of net-next separating
the span code and definitions into separate files, whilst
a 'net' bug fix made some changes to that moved code.
The mlx5 infiniband conflict resolution was quite non-trivial,
the RDMA tree's merge commit was used as a guide here, and
here are their notes:
====================
Due to bug fixes found by the syzkaller bot and taken into the for-rc
branch after development for the 4.17 merge window had already started
being taken into the for-next branch, there were fairly non-trivial
merge issues that would need to be resolved between the for-rc branch
and the for-next branch. This merge resolves those conflicts and
provides a unified base upon which ongoing development for 4.17 can
be based.
Conflicts:
drivers/infiniband/hw/mlx5/main.c - Commit 42cea83f9524
(IB/mlx5: Fix cleanup order on unload) added to for-rc and
commit b5ca15ad7e61 (IB/mlx5: Add proper representors support)
add as part of the devel cycle both needed to modify the
init/de-init functions used by mlx5. To support the new
representors, the new functions added by the cleanup patch
needed to be made non-static, and the init/de-init list
added by the representors patch needed to be modified to
match the init/de-init list changes made by the cleanup
patch.
Updates:
drivers/infiniband/hw/mlx5/mlx5_ib.h - Update function
prototypes added by representors patch to reflect new function
names as changed by cleanup patch
drivers/infiniband/hw/mlx5/ib_rep.c - Update init/de-init
stage list to match new order from cleanup patch
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/l2tp')
-rw-r--r-- | net/l2tp/l2tp_core.c | 46 | ||||
-rw-r--r-- | net/l2tp/l2tp_core.h | 3 |
2 files changed, 24 insertions, 25 deletions
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 189a12a5e4ac..b86868da50d4 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c | |||
@@ -111,6 +111,13 @@ struct l2tp_net { | |||
111 | spinlock_t l2tp_session_hlist_lock; | 111 | spinlock_t l2tp_session_hlist_lock; |
112 | }; | 112 | }; |
113 | 113 | ||
114 | #if IS_ENABLED(CONFIG_IPV6) | ||
115 | static bool l2tp_sk_is_v6(struct sock *sk) | ||
116 | { | ||
117 | return sk->sk_family == PF_INET6 && | ||
118 | !ipv6_addr_v4mapped(&sk->sk_v6_daddr); | ||
119 | } | ||
120 | #endif | ||
114 | 121 | ||
115 | static inline struct l2tp_tunnel *l2tp_tunnel(struct sock *sk) | 122 | static inline struct l2tp_tunnel *l2tp_tunnel(struct sock *sk) |
116 | { | 123 | { |
@@ -1049,7 +1056,7 @@ static int l2tp_xmit_core(struct l2tp_session *session, struct sk_buff *skb, | |||
1049 | /* Queue the packet to IP for output */ | 1056 | /* Queue the packet to IP for output */ |
1050 | skb->ignore_df = 1; | 1057 | skb->ignore_df = 1; |
1051 | #if IS_ENABLED(CONFIG_IPV6) | 1058 | #if IS_ENABLED(CONFIG_IPV6) |
1052 | if (tunnel->sock->sk_family == PF_INET6 && !tunnel->v4mapped) | 1059 | if (l2tp_sk_is_v6(tunnel->sock)) |
1053 | error = inet6_csk_xmit(tunnel->sock, skb, NULL); | 1060 | error = inet6_csk_xmit(tunnel->sock, skb, NULL); |
1054 | else | 1061 | else |
1055 | #endif | 1062 | #endif |
@@ -1112,6 +1119,15 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len | |||
1112 | goto out_unlock; | 1119 | goto out_unlock; |
1113 | } | 1120 | } |
1114 | 1121 | ||
1122 | /* The user-space may change the connection status for the user-space | ||
1123 | * provided socket at run time: we must check it under the socket lock | ||
1124 | */ | ||
1125 | if (tunnel->fd >= 0 && sk->sk_state != TCP_ESTABLISHED) { | ||
1126 | kfree_skb(skb); | ||
1127 | ret = NET_XMIT_DROP; | ||
1128 | goto out_unlock; | ||
1129 | } | ||
1130 | |||
1115 | /* Get routing info from the tunnel socket */ | 1131 | /* Get routing info from the tunnel socket */ |
1116 | skb_dst_drop(skb); | 1132 | skb_dst_drop(skb); |
1117 | skb_dst_set(skb, dst_clone(__sk_dst_check(sk, 0))); | 1133 | skb_dst_set(skb, dst_clone(__sk_dst_check(sk, 0))); |
@@ -1131,7 +1147,7 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len | |||
1131 | 1147 | ||
1132 | /* Calculate UDP checksum if configured to do so */ | 1148 | /* Calculate UDP checksum if configured to do so */ |
1133 | #if IS_ENABLED(CONFIG_IPV6) | 1149 | #if IS_ENABLED(CONFIG_IPV6) |
1134 | if (sk->sk_family == PF_INET6 && !tunnel->v4mapped) | 1150 | if (l2tp_sk_is_v6(sk)) |
1135 | udp6_set_csum(udp_get_no_check6_tx(sk), | 1151 | udp6_set_csum(udp_get_no_check6_tx(sk), |
1136 | skb, &inet6_sk(sk)->saddr, | 1152 | skb, &inet6_sk(sk)->saddr, |
1137 | &sk->sk_v6_daddr, udp_len); | 1153 | &sk->sk_v6_daddr, udp_len); |
@@ -1457,9 +1473,14 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 | |||
1457 | encap = cfg->encap; | 1473 | encap = cfg->encap; |
1458 | 1474 | ||
1459 | /* Quick sanity checks */ | 1475 | /* Quick sanity checks */ |
1476 | err = -EPROTONOSUPPORT; | ||
1477 | if (sk->sk_type != SOCK_DGRAM) { | ||
1478 | pr_debug("tunl %hu: fd %d wrong socket type\n", | ||
1479 | tunnel_id, fd); | ||
1480 | goto err; | ||
1481 | } | ||
1460 | switch (encap) { | 1482 | switch (encap) { |
1461 | case L2TP_ENCAPTYPE_UDP: | 1483 | case L2TP_ENCAPTYPE_UDP: |
1462 | err = -EPROTONOSUPPORT; | ||
1463 | if (sk->sk_protocol != IPPROTO_UDP) { | 1484 | if (sk->sk_protocol != IPPROTO_UDP) { |
1464 | pr_err("tunl %hu: fd %d wrong protocol, got %d, expected %d\n", | 1485 | pr_err("tunl %hu: fd %d wrong protocol, got %d, expected %d\n", |
1465 | tunnel_id, fd, sk->sk_protocol, IPPROTO_UDP); | 1486 | tunnel_id, fd, sk->sk_protocol, IPPROTO_UDP); |
@@ -1467,7 +1488,6 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 | |||
1467 | } | 1488 | } |
1468 | break; | 1489 | break; |
1469 | case L2TP_ENCAPTYPE_IP: | 1490 | case L2TP_ENCAPTYPE_IP: |
1470 | err = -EPROTONOSUPPORT; | ||
1471 | if (sk->sk_protocol != IPPROTO_L2TP) { | 1491 | if (sk->sk_protocol != IPPROTO_L2TP) { |
1472 | pr_err("tunl %hu: fd %d wrong protocol, got %d, expected %d\n", | 1492 | pr_err("tunl %hu: fd %d wrong protocol, got %d, expected %d\n", |
1473 | tunnel_id, fd, sk->sk_protocol, IPPROTO_L2TP); | 1493 | tunnel_id, fd, sk->sk_protocol, IPPROTO_L2TP); |
@@ -1507,24 +1527,6 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 | |||
1507 | if (cfg != NULL) | 1527 | if (cfg != NULL) |
1508 | tunnel->debug = cfg->debug; | 1528 | tunnel->debug = cfg->debug; |
1509 | 1529 | ||
1510 | #if IS_ENABLED(CONFIG_IPV6) | ||
1511 | if (sk->sk_family == PF_INET6) { | ||
1512 | struct ipv6_pinfo *np = inet6_sk(sk); | ||
1513 | |||
1514 | if (ipv6_addr_v4mapped(&np->saddr) && | ||
1515 | ipv6_addr_v4mapped(&sk->sk_v6_daddr)) { | ||
1516 | struct inet_sock *inet = inet_sk(sk); | ||
1517 | |||
1518 | tunnel->v4mapped = true; | ||
1519 | inet->inet_saddr = np->saddr.s6_addr32[3]; | ||
1520 | inet->inet_rcv_saddr = sk->sk_v6_rcv_saddr.s6_addr32[3]; | ||
1521 | inet->inet_daddr = sk->sk_v6_daddr.s6_addr32[3]; | ||
1522 | } else { | ||
1523 | tunnel->v4mapped = false; | ||
1524 | } | ||
1525 | } | ||
1526 | #endif | ||
1527 | |||
1528 | /* Mark socket as an encapsulation socket. See net/ipv4/udp.c */ | 1530 | /* Mark socket as an encapsulation socket. See net/ipv4/udp.c */ |
1529 | tunnel->encap = encap; | 1531 | tunnel->encap = encap; |
1530 | if (encap == L2TP_ENCAPTYPE_UDP) { | 1532 | if (encap == L2TP_ENCAPTYPE_UDP) { |
diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h index a1aa9550f04e..2718d0b284d0 100644 --- a/net/l2tp/l2tp_core.h +++ b/net/l2tp/l2tp_core.h | |||
@@ -188,9 +188,6 @@ struct l2tp_tunnel { | |||
188 | struct sock *sock; /* Parent socket */ | 188 | struct sock *sock; /* Parent socket */ |
189 | int fd; /* Parent fd, if tunnel socket | 189 | int fd; /* Parent fd, if tunnel socket |
190 | * was created by userspace */ | 190 | * was created by userspace */ |
191 | #if IS_ENABLED(CONFIG_IPV6) | ||
192 | bool v4mapped; | ||
193 | #endif | ||
194 | 191 | ||
195 | struct work_struct del_work; | 192 | struct work_struct del_work; |
196 | 193 | ||