1
0
Fork 0
mirror of https://passt.top/passt synced 2025-06-05 07:27:16 +02:00

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>
This commit is contained in:
David Gibson 2025-04-10 17:16:39 +10:00 committed by Stefano Brivio
parent f4b0dd8b06
commit 695c62396e

View file

@ -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);
}
}