Skip to contentSkip to conversation

pull request (net-next): ipsec-next 2019-11-13

PATCH New Steffen Klassert 2 participants 4 messages Nov 13, 2019

Subsystems (4)
lore
Share & tools
lore

Steffen Klassert

author maintainer
#0 lore raw

1) Remove a unnecessary net_exit function from the xfrm interface. From Xin Long.

2) Assign xfrm4_udp_encap_rcv to a UDP socket only if xfrm is configured. From Alexey Dobriyan.

Please pull or let me know if there are problems.

Thanks!

The following changes since commit 02dc96ef6c25f990452c114c59d75c368a1f4c8f:

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net (2019-09-28 17:47:33 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next.git master

for you to fetch changes up to fd1ac07f3f17fbbc2f08e3b43951bed937d86a7b:

xfrm: ifdef setsockopt(UDP_ENCAP_ESPINUDP/UDP_ENCAP_ESPINUDP_NON_IKE) (2019-10-09 06:55:32 +0200)

----------------------------------------------------------------
Alexey Dobriyan (1):
xfrm: ifdef setsockopt(UDP_ENCAP_ESPINUDP/UDP_ENCAP_ESPINUDP_NON_IKE)

Xin Long (1):
xfrm: remove the unnecessary .net_exit for xfrmi

 include/net/xfrm.h        |  7 -------
 net/ipv4/udp.c            |  2 ++
 net/xfrm/xfrm_interface.c | 23 -----------------------
 3 files changed, 2 insertions(+), 30 deletions(-)
author maintainer
#1 lore raw

PATCH 1/2 xfrm: remove the unnecessary .net_exit for xfrmi

From: Xin Long <[email protected]>

The xfrm_if(s) on each netns can be deleted when its xfrmi dev is deleted. xfrmi dev's removal can happen when:

a. netns is being removed and all xfrmi devs will be deleted.

b. rtnl_link_unregister(&xfrmi_link_ops) in xfrmi_fini() when
xfrm_interface.ko is being unloaded.

So there's no need to use xfrmi_exit_net() to clean any xfrm_if up.

v1->v2:
- Fix some changelog.

---
 net/xfrm/xfrm_interface.c | 23 -----------------------
 1 file changed, 23 deletions(-)
net/xfrm/xfrm_interface.c +0 -23
index 2ab4859df55a..fb4d1f99b0a7 100644
@@ -732,30 +732,7 @@ static struct rtnl_link_ops xfrmi_link_ops __read_mostly = {
 	.get_link_net	= xfrmi_get_link_net,
 };
 
-static void __net_exit xfrmi_destroy_interfaces(struct xfrmi_net *xfrmn)
-{
-	struct xfrm_if *xi;
-	LIST_HEAD(list);
-
-	xi = rtnl_dereference(xfrmn->xfrmi[0]);
-	if (!xi)
-		return;
-
-	unregister_netdevice_queue(xi->dev, &list);
-	unregister_netdevice_many(&list);
-}
-
-static void __net_exit xfrmi_exit_net(struct net *net)
-{
-	struct xfrmi_net *xfrmn = net_generic(net, xfrmi_net_id);
-
-	rtnl_lock();
-	xfrmi_destroy_interfaces(xfrmn);
-	rtnl_unlock();
-}
-
 static struct pernet_operations xfrmi_net_ops = {
-	.exit = xfrmi_exit_net,
 	.id   = &xfrmi_net_id,
 	.size = sizeof(struct xfrmi_net),
 };
Signature · 1 line
2.17.1
author maintainer
#2 lore raw

PATCH 2/2 xfrm: ifdef setsockopt(UDP_ENCAP_ESPINUDP/UDP_ENCAP_ESPINUDP_NON_IKE)

In reply to Steffen Klassert

From: Alexey Dobriyan <[email protected]>

If IPsec is not configured, there is no reason to delay the inevitable.

---
 include/net/xfrm.h | 7 -------
 net/ipv4/udp.c     | 2 ++
 2 files changed, 2 insertions(+), 7 deletions(-)
include/net/xfrm.h +0 -7
index aa08a7a5f6ac..dda3c025452e 100644
@@ -1613,13 +1613,6 @@ static inline int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optv
 {
  	return -ENOPROTOOPT;
 }
-
-static inline int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
-{
- 	/* should not happen */
- 	kfree_skb(skb);
-	return 0;
-}
 #endif
 
 struct dst_entry *__xfrm_dst_lookup(struct net *net, int tos, int oif,
net/ipv4/udp.c +2 -0
index cf755156a684..f1c514cb4e87 100644
@@ -2520,9 +2520,11 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
 	case UDP_ENCAP:
 		switch (val) {
 		case 0:
+#ifdef CONFIG_XFRM
 		case UDP_ENCAP_ESPINUDP:
 		case UDP_ENCAP_ESPINUDP_NON_IKE:
 			up->encap_rcv = xfrm4_udp_encap_rcv;
+#endif
 			/* FALLTHROUGH */
 		case UDP_ENCAP_L2TPINUDP:
 			up->encap_type = val;
Signature · 1 line
2.17.1
maintainer
#3 lore raw
In reply to Steffen Klassert

From: Steffen Klassert <[email protected]>
Date: Wed, 13 Nov 2019 12:33:56 +0100

Quoted 7 lines

1) Remove a unnecessary net_exit function from the xfrm interface. From Xin Long.

2) Assign xfrm4_udp_encap_rcv to a UDP socket only if xfrm is configured. From Alexey Dobriyan.

Please pull or let me know if there are problems.

Also pulled, thanks.