aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2025-04-10 17:16:39 +1000
committerStefano Brivio <sbrivio@redhat.com>2025-04-10 19:46:13 +0200
commit695c62396eb3f4627c1114ce444394e3ba34373a (patch)
tree6727cac8140c8bb3acd44b77285a4563a9387c19
parentf4b0dd8b06850bacb2da57c8576e3377daa88572 (diff)
downloadpasst-695c62396eb3f4627c1114ce444394e3ba34373a.tar
passt-695c62396eb3f4627c1114ce444394e3ba34373a.tar.gz
passt-695c62396eb3f4627c1114ce444394e3ba34373a.tar.bz2
passt-695c62396eb3f4627c1114ce444394e3ba34373a.tar.lz
passt-695c62396eb3f4627c1114ce444394e3ba34373a.tar.xz
passt-695c62396eb3f4627c1114ce444394e3ba34373a.tar.zst
passt-695c62396eb3f4627c1114ce444394e3ba34373a.zip
inany: Improve ASSERT message for bad socket family
inany_from_sockaddr() can only handle sockaddrs of family AF_INET or AF_INET6 and asserts if given something else. I hit this assertion while debugging something else, and wanted to see what the bad sockaddr family was. Now that we have ASSERT_WITH_MSG() its easy to add this information. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--inany.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/inany.h b/inany.h
index 6a12c29..1c247e1 100644
--- a/inany.h
+++ b/inany.h
@@ -252,7 +252,8 @@ static inline void inany_from_sockaddr(union inany_addr *aa, in_port_t *port,
*port = ntohs(sa->sa4.sin_port);
} else {
/* Not valid to call with other address families */
- ASSERT(0);
+ ASSERT_WITH_MSG(0, "Unexpected sockaddr family: %u",
+ sa->sa_family);
}
}