shared: add debugging statement for assertion in nm_utils_parse_inaddr_bin_full()

There are crashes where this assertion fails, but it's not clear
how that could happen (because the input text seems a usual IPv4 address).

Try to collect some more information about what failed. It's only
enabled with NM_MORE_ASSERTS anyway.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1797915
This commit is contained in:
Thomas Haller 2020-02-10 15:50:38 +01:00
parent df6129d93a
commit 90c5d1d99c

View file

@ -784,7 +784,11 @@ nm_utils_parse_inaddr_bin_full (int addr_family,
/* The legacy parser should accept everything that inet_pton() accepts too. Meaning,
* it should strictly parse *more* formats. And of course, parse it the same way. */
nm_assert (_parse_legacy_addr4 (text, &a));
if (!_parse_legacy_addr4 (text, &a)) {
char buf[INET_ADDRSTRLEN];
g_error ("unexpected assertion failure: could parse \"%s\" as %s, but not accepted by legacy parser", text, _nm_utils_inet4_ntop (addrbin.addr4, buf));
}
nm_assert (addrbin.addr4 == a);
}
#endif