Commit 7016e062 authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

net: Convert int functions to bool

Global function ipv6_rcv_saddr_equal and static functions
ipv6_rcv_saddr_equal and ipv4_rcv_saddr_equal currently return int.

bool is slightly more descriptive for these functions so change
their return type from int to bool.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 785ec874
...@@ -94,8 +94,8 @@ int __ipv6_get_lladdr(struct inet6_dev *idev, struct in6_addr *addr, ...@@ -94,8 +94,8 @@ int __ipv6_get_lladdr(struct inet6_dev *idev, struct in6_addr *addr,
u32 banned_flags); u32 banned_flags);
int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr, int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr,
u32 banned_flags); u32 banned_flags);
int inet_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2, bool inet_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2,
bool match_wildcard); bool match_wildcard);
void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr); void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr);
void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr); void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr);
......
...@@ -39,11 +39,11 @@ EXPORT_SYMBOL(inet_csk_timer_bug_msg); ...@@ -39,11 +39,11 @@ EXPORT_SYMBOL(inet_csk_timer_bug_msg);
* IPV6_ADDR_ANY only equals to IPV6_ADDR_ANY, * IPV6_ADDR_ANY only equals to IPV6_ADDR_ANY,
* and 0.0.0.0 equals to 0.0.0.0 only * and 0.0.0.0 equals to 0.0.0.0 only
*/ */
static int ipv6_rcv_saddr_equal(const struct in6_addr *sk1_rcv_saddr6, static bool ipv6_rcv_saddr_equal(const struct in6_addr *sk1_rcv_saddr6,
const struct in6_addr *sk2_rcv_saddr6, const struct in6_addr *sk2_rcv_saddr6,
__be32 sk1_rcv_saddr, __be32 sk2_rcv_saddr, __be32 sk1_rcv_saddr, __be32 sk2_rcv_saddr,
bool sk1_ipv6only, bool sk2_ipv6only, bool sk1_ipv6only, bool sk2_ipv6only,
bool match_wildcard) bool match_wildcard)
{ {
int addr_type = ipv6_addr_type(sk1_rcv_saddr6); int addr_type = ipv6_addr_type(sk1_rcv_saddr6);
int addr_type2 = sk2_rcv_saddr6 ? ipv6_addr_type(sk2_rcv_saddr6) : IPV6_ADDR_MAPPED; int addr_type2 = sk2_rcv_saddr6 ? ipv6_addr_type(sk2_rcv_saddr6) : IPV6_ADDR_MAPPED;
...@@ -52,29 +52,29 @@ static int ipv6_rcv_saddr_equal(const struct in6_addr *sk1_rcv_saddr6, ...@@ -52,29 +52,29 @@ static int ipv6_rcv_saddr_equal(const struct in6_addr *sk1_rcv_saddr6,
if (addr_type == IPV6_ADDR_MAPPED && addr_type2 == IPV6_ADDR_MAPPED) { if (addr_type == IPV6_ADDR_MAPPED && addr_type2 == IPV6_ADDR_MAPPED) {
if (!sk2_ipv6only) { if (!sk2_ipv6only) {
if (sk1_rcv_saddr == sk2_rcv_saddr) if (sk1_rcv_saddr == sk2_rcv_saddr)
return 1; return true;
if (!sk1_rcv_saddr || !sk2_rcv_saddr) if (!sk1_rcv_saddr || !sk2_rcv_saddr)
return match_wildcard; return match_wildcard;
} }
return 0; return false;
} }
if (addr_type == IPV6_ADDR_ANY && addr_type2 == IPV6_ADDR_ANY) if (addr_type == IPV6_ADDR_ANY && addr_type2 == IPV6_ADDR_ANY)
return 1; return true;
if (addr_type2 == IPV6_ADDR_ANY && match_wildcard && if (addr_type2 == IPV6_ADDR_ANY && match_wildcard &&
!(sk2_ipv6only && addr_type == IPV6_ADDR_MAPPED)) !(sk2_ipv6only && addr_type == IPV6_ADDR_MAPPED))
return 1; return true;
if (addr_type == IPV6_ADDR_ANY && match_wildcard && if (addr_type == IPV6_ADDR_ANY && match_wildcard &&
!(sk1_ipv6only && addr_type2 == IPV6_ADDR_MAPPED)) !(sk1_ipv6only && addr_type2 == IPV6_ADDR_MAPPED))
return 1; return true;
if (sk2_rcv_saddr6 && if (sk2_rcv_saddr6 &&
ipv6_addr_equal(sk1_rcv_saddr6, sk2_rcv_saddr6)) ipv6_addr_equal(sk1_rcv_saddr6, sk2_rcv_saddr6))
return 1; return true;
return 0; return false;
} }
#endif #endif
...@@ -82,20 +82,20 @@ static int ipv6_rcv_saddr_equal(const struct in6_addr *sk1_rcv_saddr6, ...@@ -82,20 +82,20 @@ static int ipv6_rcv_saddr_equal(const struct in6_addr *sk1_rcv_saddr6,
* match_wildcard == false: addresses must be exactly the same, i.e. * match_wildcard == false: addresses must be exactly the same, i.e.
* 0.0.0.0 only equals to 0.0.0.0 * 0.0.0.0 only equals to 0.0.0.0
*/ */
static int ipv4_rcv_saddr_equal(__be32 sk1_rcv_saddr, __be32 sk2_rcv_saddr, static bool ipv4_rcv_saddr_equal(__be32 sk1_rcv_saddr, __be32 sk2_rcv_saddr,
bool sk2_ipv6only, bool match_wildcard) bool sk2_ipv6only, bool match_wildcard)
{ {
if (!sk2_ipv6only) { if (!sk2_ipv6only) {
if (sk1_rcv_saddr == sk2_rcv_saddr) if (sk1_rcv_saddr == sk2_rcv_saddr)
return 1; return true;
if (!sk1_rcv_saddr || !sk2_rcv_saddr) if (!sk1_rcv_saddr || !sk2_rcv_saddr)
return match_wildcard; return match_wildcard;
} }
return 0; return false;
} }
int inet_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2, bool inet_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2,
bool match_wildcard) bool match_wildcard)
{ {
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
if (sk->sk_family == AF_INET6) if (sk->sk_family == AF_INET6)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment