netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pull request (net-next): ipsec-next 2019-11-13
@ 2019-11-13 11:33 Steffen Klassert
  2019-11-13 11:33 ` [PATCH 1/2] xfrm: remove the unnecessary .net_exit for xfrmi Steffen Klassert
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Steffen Klassert @ 2019-11-13 11:33 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev

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(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] xfrm: remove the unnecessary .net_exit for xfrmi
  2019-11-13 11:33 pull request (net-next): ipsec-next 2019-11-13 Steffen Klassert
@ 2019-11-13 11:33 ` Steffen Klassert
  2019-11-13 11:33 ` [PATCH 2/2] xfrm: ifdef setsockopt(UDP_ENCAP_ESPINUDP/UDP_ENCAP_ESPINUDP_NON_IKE) Steffen Klassert
  2019-11-13 19:59 ` pull request (net-next): ipsec-next 2019-11-13 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Steffen Klassert @ 2019-11-13 11:33 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev

From: Xin Long <lucien.xin@gmail.com>

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.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/xfrm/xfrm_interface.c | 23 -----------------------
 1 file changed, 23 deletions(-)

diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c
index 2ab4859df55a..fb4d1f99b0a7 100644
--- a/net/xfrm/xfrm_interface.c
+++ b/net/xfrm/xfrm_interface.c
@@ -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),
 };
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] xfrm: ifdef setsockopt(UDP_ENCAP_ESPINUDP/UDP_ENCAP_ESPINUDP_NON_IKE)
  2019-11-13 11:33 pull request (net-next): ipsec-next 2019-11-13 Steffen Klassert
  2019-11-13 11:33 ` [PATCH 1/2] xfrm: remove the unnecessary .net_exit for xfrmi Steffen Klassert
@ 2019-11-13 11:33 ` Steffen Klassert
  2019-11-13 19:59 ` pull request (net-next): ipsec-next 2019-11-13 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Steffen Klassert @ 2019-11-13 11:33 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev

From: Alexey Dobriyan <adobriyan@gmail.com>

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

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 include/net/xfrm.h | 7 -------
 net/ipv4/udp.c     | 2 ++
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index aa08a7a5f6ac..dda3c025452e 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -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,
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index cf755156a684..f1c514cb4e87 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: pull request (net-next): ipsec-next 2019-11-13
  2019-11-13 11:33 pull request (net-next): ipsec-next 2019-11-13 Steffen Klassert
  2019-11-13 11:33 ` [PATCH 1/2] xfrm: remove the unnecessary .net_exit for xfrmi Steffen Klassert
  2019-11-13 11:33 ` [PATCH 2/2] xfrm: ifdef setsockopt(UDP_ENCAP_ESPINUDP/UDP_ENCAP_ESPINUDP_NON_IKE) Steffen Klassert
@ 2019-11-13 19:59 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-11-13 19:59 UTC (permalink / raw)
  To: steffen.klassert; +Cc: herbert, netdev

From: Steffen Klassert <steffen.klassert@secunet.com>
Date: Wed, 13 Nov 2019 12:33:56 +0100

> 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-13 19:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13 11:33 pull request (net-next): ipsec-next 2019-11-13 Steffen Klassert
2019-11-13 11:33 ` [PATCH 1/2] xfrm: remove the unnecessary .net_exit for xfrmi Steffen Klassert
2019-11-13 11:33 ` [PATCH 2/2] xfrm: ifdef setsockopt(UDP_ENCAP_ESPINUDP/UDP_ENCAP_ESPINUDP_NON_IKE) Steffen Klassert
2019-11-13 19:59 ` pull request (net-next): ipsec-next 2019-11-13 David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).