ipv6: Use ipv6_only_sock() helper in condition.
This patch replaces some sk_ipv6only tests with ipv6_only_sock(). Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.co.jp> Reviewed-by: David Ahern <dsahern@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
89e9c72800
commit
81ee0eb6c0
|
@ -5226,7 +5226,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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue