All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] ipv6: Use ipv6_only_sock helper function.
@ 2022-04-20  1:58 Kuniyuki Iwashima
  2022-04-20  1:58 ` [PATCH net-next 1/2] ipv6: Remove __ipv6_only_sock() Kuniyuki Iwashima
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Kuniyuki Iwashima @ 2022-04-20  1:58 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, David Ahern
  Cc: Kuniyuki Iwashima, Kuniyuki Iwashima, netdev

The first patch removes __ipv6_only_sock(), and the second replaces
ipv6only tests with ipv6_only_sock().


Kuniyuki Iwashima (2):
  ipv6: Remove __ipv6_only_sock().
  ipv6: Use ipv6_only_sock() helper in condition.

 drivers/net/bonding/bond_main.c                               | 2 +-
 .../net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c    | 2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c     | 2 +-
 drivers/net/ethernet/netronome/nfp/crypto/tls.c               | 2 +-
 include/linux/ipv6.h                                          | 4 +---
 net/core/filter.c                                             | 2 +-
 net/dccp/ipv6.c                                               | 2 +-
 net/ipv6/af_inet6.c                                           | 2 +-
 net/ipv6/datagram.c                                           | 4 ++--
 net/ipv6/tcp_ipv6.c                                           | 2 +-
 net/ipv6/udp.c                                                | 4 ++--
 net/sctp/ipv6.c                                               | 4 ++--
 12 files changed, 15 insertions(+), 17 deletions(-)

-- 
2.30.2


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

* [PATCH net-next 1/2] ipv6: Remove __ipv6_only_sock().
  2022-04-20  1:58 [PATCH net-next 0/2] ipv6: Use ipv6_only_sock helper function Kuniyuki Iwashima
@ 2022-04-20  1:58 ` Kuniyuki Iwashima
  2022-04-20 14:55   ` David Ahern
  2022-04-20  1:58 ` [PATCH net-next 2/2] ipv6: Use ipv6_only_sock() helper in condition Kuniyuki Iwashima
  2022-04-22 12:00 ` [PATCH net-next 0/2] ipv6: Use ipv6_only_sock helper function patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Kuniyuki Iwashima @ 2022-04-20  1:58 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, David Ahern
  Cc: Kuniyuki Iwashima, Kuniyuki Iwashima, netdev

Since commit 9fe516ba3fb2 ("inet: move ipv6only in sock_common"),
ipv6_only_sock() and __ipv6_only_sock() are the same macro.  Let's
remove the one.

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
---
 include/linux/ipv6.h | 4 +---
 net/dccp/ipv6.c      | 2 +-
 net/ipv6/datagram.c  | 4 ++--
 net/ipv6/tcp_ipv6.c  | 2 +-
 net/ipv6/udp.c       | 4 ++--
 net/sctp/ipv6.c      | 4 ++--
 6 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 918bfea4ef5f..ec5ca392eaa3 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -340,8 +340,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
 	return (struct raw6_sock *)sk;
 }
 
-#define __ipv6_only_sock(sk)	(sk->sk_ipv6only)
-#define ipv6_only_sock(sk)	(__ipv6_only_sock(sk))
+#define ipv6_only_sock(sk)	(sk->sk_ipv6only)
 #define ipv6_sk_rxinfo(sk)	((sk)->sk_family == PF_INET6 && \
 				 inet6_sk(sk)->rxopt.bits.rxinfo)
 
@@ -358,7 +357,6 @@ static inline int inet_v6_ipv6only(const struct sock *sk)
 	return ipv6_only_sock(sk);
 }
 #else
-#define __ipv6_only_sock(sk)	0
 #define ipv6_only_sock(sk)	0
 #define ipv6_sk_rxinfo(sk)	0
 
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index eab3bd1ee9a0..4d95b6400915 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -892,7 +892,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
 
 		SOCK_DEBUG(sk, "connect: ipv4 mapped\n");
 
-		if (__ipv6_only_sock(sk))
+		if (ipv6_only_sock(sk))
 			return -ENETUNREACH;
 
 		sin.sin_family = AF_INET;
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index 206f66310a88..39b2327edc4e 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -145,7 +145,7 @@ int __ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr,
 	int			err;
 
 	if (usin->sin6_family == AF_INET) {
-		if (__ipv6_only_sock(sk))
+		if (ipv6_only_sock(sk))
 			return -EAFNOSUPPORT;
 		err = __ip4_datagram_connect(sk, uaddr, addr_len);
 		goto ipv4_connected;
@@ -178,7 +178,7 @@ int __ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr,
 	if (addr_type & IPV6_ADDR_MAPPED) {
 		struct sockaddr_in sin;
 
-		if (__ipv6_only_sock(sk)) {
+		if (ipv6_only_sock(sk)) {
 			err = -ENETUNREACH;
 			goto out;
 		}
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 782df529ff69..54277de7474b 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -230,7 +230,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
 		u32 exthdrlen = icsk->icsk_ext_hdr_len;
 		struct sockaddr_in sin;
 
-		if (__ipv6_only_sock(sk))
+		if (ipv6_only_sock(sk))
 			return -ENETUNREACH;
 
 		sin.sin_family = AF_INET;
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index db9449b52dbe..688af6f809fe 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1123,7 +1123,7 @@ static int udpv6_pre_connect(struct sock *sk, struct sockaddr *uaddr,
 	 * bytes that are out of the bound specified by user in addr_len.
 	 */
 	if (uaddr->sa_family == AF_INET) {
-		if (__ipv6_only_sock(sk))
+		if (ipv6_only_sock(sk))
 			return -EAFNOSUPPORT;
 		return udp_pre_connect(sk, uaddr, addr_len);
 	}
@@ -1359,7 +1359,7 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
 			msg->msg_name = &sin;
 			msg->msg_namelen = sizeof(sin);
 do_udp_sendmsg:
-			if (__ipv6_only_sock(sk))
+			if (ipv6_only_sock(sk))
 				return -ENETUNREACH;
 			return udp_sendmsg(sk, msg, len);
 		}
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 470dbdc27d58..d081858c2d07 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -926,7 +926,7 @@ static int sctp_inet6_af_supported(sa_family_t family, struct sctp_sock *sp)
 		return 1;
 	/* v4-mapped-v6 addresses */
 	case AF_INET:
-		if (!__ipv6_only_sock(sctp_opt2sk(sp)))
+		if (!ipv6_only_sock(sctp_opt2sk(sp)))
 			return 1;
 		fallthrough;
 	default:
@@ -952,7 +952,7 @@ static int sctp_inet6_cmp_addr(const union sctp_addr *addr1,
 		return 0;
 
 	/* If the socket is IPv6 only, v4 addrs will not match */
-	if (__ipv6_only_sock(sk) && af1 != af2)
+	if (ipv6_only_sock(sk) && af1 != af2)
 		return 0;
 
 	/* Today, wildcard AF_INET/AF_INET6. */
-- 
2.30.2


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

* [PATCH net-next 2/2] ipv6: Use ipv6_only_sock() helper in condition.
  2022-04-20  1:58 [PATCH net-next 0/2] ipv6: Use ipv6_only_sock helper function Kuniyuki Iwashima
  2022-04-20  1:58 ` [PATCH net-next 1/2] ipv6: Remove __ipv6_only_sock() Kuniyuki Iwashima
@ 2022-04-20  1:58 ` Kuniyuki Iwashima
  2022-04-20 14:56   ` David Ahern
  2022-04-22 12:00 ` [PATCH net-next 0/2] ipv6: Use ipv6_only_sock helper function patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Kuniyuki Iwashima @ 2022-04-20  1:58 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, David Ahern
  Cc: Kuniyuki Iwashima, Kuniyuki Iwashima, netdev

This patch replaces some sk_ipv6only tests with ipv6_only_sock().

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
---
 drivers/net/bonding/bond_main.c                                | 2 +-
 drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c | 2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c      | 2 +-
 drivers/net/ethernet/netronome/nfp/crypto/tls.c                | 2 +-
 net/core/filter.c                                              | 2 +-
 net/ipv6/af_inet6.c                                            | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 15eddca7b4b6..00e6bc591f77 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -5221,7 +5221,7 @@ static void bond_sk_to_flow(struct sock *sk, struct flow_keys *flow)
 	switch (sk->sk_family) {
 #if IS_ENABLED(CONFIG_IPV6)
 	case AF_INET6:
-		if (sk->sk_ipv6only ||
+		if (ipv6_only_sock(sk) ||
 		    ipv6_addr_type(&sk->sk_v6_daddr) != IPV6_ADDR_MAPPED) {
 			flow->control.addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS;
 			flow->addrs.v6addrs.src = inet6_sk(sk)->saddr;
diff --git a/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c b/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
index 59683f79959c..60b648b46f75 100644
--- a/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
+++ b/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
@@ -483,7 +483,7 @@ static int chcr_ktls_dev_add(struct net_device *netdev, struct sock *sk,
 		tx_info->ip_family = AF_INET;
 #if IS_ENABLED(CONFIG_IPV6)
 	} else {
-		if (!sk->sk_ipv6only &&
+		if (!ipv6_only_sock(sk) &&
 		    ipv6_addr_type(&sk->sk_v6_daddr) == IPV6_ADDR_MAPPED) {
 			memcpy(daaddr, &sk->sk_daddr, 4);
 			tx_info->ip_family = AF_INET;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
index 4c4ee524176c..3ae6067c7e6b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
@@ -102,7 +102,7 @@ struct mlx5_flow_handle *mlx5e_accel_fs_add_sk(struct mlx5e_priv *priv,
 		break;
 #if IS_ENABLED(CONFIG_IPV6)
 	case AF_INET6:
-		if (!sk->sk_ipv6only &&
+		if (!ipv6_only_sock(sk) &&
 		    ipv6_addr_type(&sk->sk_v6_daddr) == IPV6_ADDR_MAPPED) {
 			accel_fs_tcp_set_ipv4_flow(spec, sk);
 			ft = &fs_tcp->tables[ACCEL_FS_IPV4_TCP];
diff --git a/drivers/net/ethernet/netronome/nfp/crypto/tls.c b/drivers/net/ethernet/netronome/nfp/crypto/tls.c
index 84d66d138c3d..78368e71ce83 100644
--- a/drivers/net/ethernet/netronome/nfp/crypto/tls.c
+++ b/drivers/net/ethernet/netronome/nfp/crypto/tls.c
@@ -289,7 +289,7 @@ nfp_net_tls_add(struct net_device *netdev, struct sock *sk,
 	switch (sk->sk_family) {
 #if IS_ENABLED(CONFIG_IPV6)
 	case AF_INET6:
-		if (sk->sk_ipv6only ||
+		if (ipv6_only_sock(sk) ||
 		    ipv6_addr_type(&sk->sk_v6_daddr) != IPV6_ADDR_MAPPED) {
 			req_sz = sizeof(struct nfp_crypto_req_add_v6);
 			ipv6 = true;
diff --git a/net/core/filter.c b/net/core/filter.c
index 143f442a9505..2ed81c48c282 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -7099,7 +7099,7 @@ BPF_CALL_5(bpf_tcp_gen_syncookie, struct sock *, sk, void *, iph, u32, iph_len,
 	 */
 	switch (((struct iphdr *)iph)->version) {
 	case 4:
-		if (sk->sk_family == AF_INET6 && sk->sk_ipv6only)
+		if (sk->sk_family == AF_INET6 && ipv6_only_sock(sk))
 			return -EINVAL;
 
 		mss = tcp_v4_get_syncookie(sk, iph, th, &cookie);
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 6595a78672c8..70564ddccc46 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -318,7 +318,7 @@ static int __inet6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len,
 		/* Binding to v4-mapped address on a v6-only socket
 		 * makes no sense
 		 */
-		if (sk->sk_ipv6only) {
+		if (ipv6_only_sock(sk)) {
 			err = -EINVAL;
 			goto out;
 		}
-- 
2.30.2


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

* Re: [PATCH net-next 1/2] ipv6: Remove __ipv6_only_sock().
  2022-04-20  1:58 ` [PATCH net-next 1/2] ipv6: Remove __ipv6_only_sock() Kuniyuki Iwashima
@ 2022-04-20 14:55   ` David Ahern
  0 siblings, 0 replies; 6+ messages in thread
From: David Ahern @ 2022-04-20 14:55 UTC (permalink / raw)
  To: Kuniyuki Iwashima, David S. Miller, Jakub Kicinski
  Cc: Kuniyuki Iwashima, netdev

On 4/19/22 7:58 PM, Kuniyuki Iwashima wrote:
> Since commit 9fe516ba3fb2 ("inet: move ipv6only in sock_common"),
> ipv6_only_sock() and __ipv6_only_sock() are the same macro.  Let's
> remove the one.
> 
> Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
> ---
>  include/linux/ipv6.h | 4 +---
>  net/dccp/ipv6.c      | 2 +-
>  net/ipv6/datagram.c  | 4 ++--
>  net/ipv6/tcp_ipv6.c  | 2 +-
>  net/ipv6/udp.c       | 4 ++--
>  net/sctp/ipv6.c      | 4 ++--
>  6 files changed, 9 insertions(+), 11 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>

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

* Re: [PATCH net-next 2/2] ipv6: Use ipv6_only_sock() helper in condition.
  2022-04-20  1:58 ` [PATCH net-next 2/2] ipv6: Use ipv6_only_sock() helper in condition Kuniyuki Iwashima
@ 2022-04-20 14:56   ` David Ahern
  0 siblings, 0 replies; 6+ messages in thread
From: David Ahern @ 2022-04-20 14:56 UTC (permalink / raw)
  To: Kuniyuki Iwashima, David S. Miller, Jakub Kicinski
  Cc: Kuniyuki Iwashima, netdev

On 4/19/22 7:58 PM, Kuniyuki Iwashima wrote:
> This patch replaces some sk_ipv6only tests with ipv6_only_sock().
> 
> Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
> ---
>  drivers/net/bonding/bond_main.c                                | 2 +-
>  drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c | 2 +-
>  drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c      | 2 +-
>  drivers/net/ethernet/netronome/nfp/crypto/tls.c                | 2 +-
>  net/core/filter.c                                              | 2 +-
>  net/ipv6/af_inet6.c                                            | 2 +-
>  6 files changed, 6 insertions(+), 6 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>

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

* Re: [PATCH net-next 0/2] ipv6: Use ipv6_only_sock helper function.
  2022-04-20  1:58 [PATCH net-next 0/2] ipv6: Use ipv6_only_sock helper function Kuniyuki Iwashima
  2022-04-20  1:58 ` [PATCH net-next 1/2] ipv6: Remove __ipv6_only_sock() Kuniyuki Iwashima
  2022-04-20  1:58 ` [PATCH net-next 2/2] ipv6: Use ipv6_only_sock() helper in condition Kuniyuki Iwashima
@ 2022-04-22 12:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-04-22 12:00 UTC (permalink / raw)
  To: Kuniyuki Iwashima; +Cc: davem, kuba, dsahern, kuni1840, netdev

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Wed, 20 Apr 2022 10:58:49 +0900 you wrote:
> The first patch removes __ipv6_only_sock(), and the second replaces
> ipv6only tests with ipv6_only_sock().
> 
> 
> Kuniyuki Iwashima (2):
>   ipv6: Remove __ipv6_only_sock().
>   ipv6: Use ipv6_only_sock() helper in condition.
> 
> [...]

Here is the summary with links:
  - [net-next,1/2] ipv6: Remove __ipv6_only_sock().
    https://git.kernel.org/netdev/net-next/c/89e9c7280075
  - [net-next,2/2] ipv6: Use ipv6_only_sock() helper in condition.
    https://git.kernel.org/netdev/net-next/c/81ee0eb6c0fe

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-04-22 12:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20  1:58 [PATCH net-next 0/2] ipv6: Use ipv6_only_sock helper function Kuniyuki Iwashima
2022-04-20  1:58 ` [PATCH net-next 1/2] ipv6: Remove __ipv6_only_sock() Kuniyuki Iwashima
2022-04-20 14:55   ` David Ahern
2022-04-20  1:58 ` [PATCH net-next 2/2] ipv6: Use ipv6_only_sock() helper in condition Kuniyuki Iwashima
2022-04-20 14:56   ` David Ahern
2022-04-22 12:00 ` [PATCH net-next 0/2] ipv6: Use ipv6_only_sock helper function patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.