On Tue, 6 Feb 2024 12:17:14 +1100
David Gibson <david(a)gibson.dropbear.id.au> wrote:
Add helpers to determine if an inany is loopback,
unspecified or multicast,
regardless of whether it's a "true" IPv6 address or an IPv4 address
represented as v4-mapped.
Sometimes we need to know if an inany is a loopback address, unspecified or
some other particular kind of address, but we don't really care if it is
IPv4.
Use the loopback helper to simplify tcp_splice_conn_from_sock() slightly.
Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
inany.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
tcp_splice.c | 15 +++------------
2 files changed, 53 insertions(+), 12 deletions(-)
diff --git a/inany.h b/inany.h
index fe652ff7..2058f145 100644
--- a/inany.h
+++ b/inany.h
@@ -55,6 +55,56 @@ static inline bool inany_equals(const union inany_addr *a,
return IN6_ARE_ADDR_EQUAL(&a->a6, &b->a6);
}
+/** inany_is_loopback - Check if address is loopback
Nit: inany_is_loopback() (and four occurrences below).
Corrected, thanks.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!