public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Steffen Klassert <steffen.klassert@secunet•com>
To: David Miller <davem@davemloft•net>
Cc: Herbert Xu <herbert@gondor•apana.org.au>,
	Steffen Klassert <steffen.klassert@secunet•com>,
	<netdev@vger•kernel.org>
Subject: [PATCH 08/11] xfrm: place xfrm6_local_dontfrag in xfrm.h
Date: Fri, 29 May 2020 12:30:08 +0200	[thread overview]
Message-ID: <20200529103011.30127-9-steffen.klassert@secunet.com> (raw)
In-Reply-To: <20200529103011.30127-1-steffen.klassert@secunet.com>

From: Florian Westphal <fw@strlen•de>

so next patch can re-use it from net/xfrm/xfrm_output.c without
causing a linker error when IPV6 is a module.

Signed-off-by: Florian Westphal <fw@strlen•de>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet•com>
---
 include/net/xfrm.h      | 16 ++++++++++++++++
 net/ipv6/xfrm6_output.c | 21 ++-------------------
 2 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 10295ab4cdfb..8f7fb033d557 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1993,4 +1993,20 @@ static inline int xfrm_tunnel_check(struct sk_buff *skb, struct xfrm_state *x,
 
 	return 0;
 }
+
+#if IS_ENABLED(CONFIG_IPV6)
+static inline bool xfrm6_local_dontfrag(const struct sock *sk)
+{
+	int proto;
+
+	if (!sk || sk->sk_family != AF_INET6)
+		return false;
+
+	proto = sk->sk_protocol;
+	if (proto == IPPROTO_UDP || proto == IPPROTO_RAW)
+		return inet6_sk(sk)->dontfrag;
+
+	return false;
+}
+#endif
 #endif	/* _NET_XFRM_H */
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
index 23e2b52cfba6..be64f280510c 100644
--- a/net/ipv6/xfrm6_output.c
+++ b/net/ipv6/xfrm6_output.c
@@ -23,23 +23,6 @@ int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb,
 }
 EXPORT_SYMBOL(xfrm6_find_1stfragopt);
 
-static int xfrm6_local_dontfrag(struct sk_buff *skb)
-{
-	int proto;
-	struct sock *sk = skb->sk;
-
-	if (sk) {
-		if (sk->sk_family != AF_INET6)
-			return 0;
-
-		proto = sk->sk_protocol;
-		if (proto == IPPROTO_UDP || proto == IPPROTO_RAW)
-			return inet6_sk(sk)->dontfrag;
-	}
-
-	return 0;
-}
-
 void xfrm6_local_rxpmtu(struct sk_buff *skb, u32 mtu)
 {
 	struct flowi6 fl6;
@@ -82,7 +65,7 @@ static int xfrm6_tunnel_check_size(struct sk_buff *skb)
 		skb->dev = dst->dev;
 		skb->protocol = htons(ETH_P_IPV6);
 
-		if (xfrm6_local_dontfrag(skb))
+		if (xfrm6_local_dontfrag(skb->sk))
 			xfrm6_local_rxpmtu(skb, mtu);
 		else if (skb->sk)
 			xfrm_local_error(skb, mtu);
@@ -181,7 +164,7 @@ static int __xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
 
 	toobig = skb->len > mtu && !skb_is_gso(skb);
 
-	if (toobig && xfrm6_local_dontfrag(skb)) {
+	if (toobig && xfrm6_local_dontfrag(skb->sk)) {
 		xfrm6_local_rxpmtu(skb, mtu);
 		kfree_skb(skb);
 		return -EMSGSIZE;
-- 
2.17.1


  parent reply	other threads:[~2020-05-29 10:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29 10:30 pull request (net-next): ipsec-next 2020-05-29 Steffen Klassert
2020-05-29 10:30 ` [PATCH 01/11] xfrm interface: don't take extra reference to netdev Steffen Klassert
2020-05-29 10:30 ` [PATCH 02/11] xfrm: add support for UDPv6 encapsulation of ESP Steffen Klassert
2020-05-29 10:30 ` [PATCH 03/11] xfrm: add IPv6 support for espintcp Steffen Klassert
2020-05-29 10:30 ` [PATCH 04/11] xfrm: avoid extract_output indirection for ipv4 Steffen Klassert
2020-05-29 10:30 ` [PATCH 05/11] xfrm: state: remove extract_input indirection from xfrm_state_afinfo Steffen Klassert
2020-05-29 10:30 ` [PATCH 06/11] xfrm: move xfrm4_extract_header to common helper Steffen Klassert
2020-05-29 10:30 ` [PATCH 07/11] xfrm: expose local_rxpmtu via ipv6_stubs Steffen Klassert
2020-05-29 10:30 ` Steffen Klassert [this message]
2020-05-29 10:30 ` [PATCH 09/11] xfrm: remove extract_output indirection from xfrm_state_afinfo Steffen Klassert
2020-05-29 10:30 ` [PATCH 10/11] xfrm: remove output_finish " Steffen Klassert
2020-05-29 10:30 ` [PATCH 11/11] xfrm: fix unused variable warning if CONFIG_NETFILTER=n Steffen Klassert
2020-05-29 20:03 ` pull request (net-next): ipsec-next 2020-05-29 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200529103011.30127-9-steffen.klassert@secunet.com \
    --to=steffen.klassert@secunet$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=herbert@gondor$(echo .)apana.org.au \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox