Skip to content

Commit

Permalink
ipv6: Remove __ipv6_only_sock().
Browse files Browse the repository at this point in the history
Since commit 9fe516b ("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>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
q2ven authored and davem330 committed Apr 22, 2022
1 parent 0844d36 commit 89e9c72
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
4 changes: 1 addition & 3 deletions include/linux/ipv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion net/dccp/ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions net/ipv6/datagram.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/tcp_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions net/ipv6/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions net/sctp/ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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. */
Expand Down

0 comments on commit 89e9c72

Please sign in to comment.