krb5 commit: Add sa_is_wildcard() helper to socket-utils.h
Greg Hudson
ghudson at mit.edu
Mon Jan 9 11:25:00 EST 2017
https://github.com/krb5/krb5/commit/715b3979525e5045fd66ffebdf98cec67fb58dfe
commit 715b3979525e5045fd66ffebdf98cec67fb58dfe
Author: Greg Hudson <ghudson at mit.edu>
Date: Mon Dec 26 18:47:00 2016 -0500
Add sa_is_wildcard() helper to socket-utils.h
src/include/socket-utils.h | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/include/socket-utils.h b/src/include/socket-utils.h
index 1566636..e1f33aa 100644
--- a/src/include/socket-utils.h
+++ b/src/include/socket-utils.h
@@ -119,6 +119,17 @@ sa_is_inet(struct sockaddr *sa)
return sa->sa_family == AF_INET || sa->sa_family == AF_INET6;
}
+/* Return true if sa is an IPv4 or IPv6 wildcard address. */
+static inline int
+sa_is_wildcard(struct sockaddr *sa)
+{
+ if (sa->sa_family == AF_INET6)
+ return IN6_IS_ADDR_UNSPECIFIED(&sa2sin6(sa)->sin6_addr);
+ else if (sa->sa_family == AF_INET)
+ return sa2sin(sa)->sin_addr.s_addr == INADDR_ANY;
+ return 0;
+}
+
/* Return the length of an IPv4 or IPv6 socket structure; abort if it is
* neither. */
static inline socklen_t
More information about the cvs-krb5
mailing list