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:
parent
f4b0dd8b06
commit
695c62396e
1 changed files with 2 additions and 1 deletions
3
inany.h
3
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue