diff options
author | Thomas Haller <thaller@redhat.com> | 2020-02-10 15:50:38 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-02-10 16:44:17 +0100 |
commit | 90c5d1d99cea8a8a8edafb0c02f421979cf56b37 (patch) | |
tree | e82c1e7ee24dbe1ad7c65a323d3eb435ab5ec4f2 | |
parent | df6129d93a8445c649126cebffac3cb1192de771 (diff) | |
download | NetworkManager-90c5d1d99cea8a8a8edafb0c02f421979cf56b37.tar.gz |
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
-rw-r--r-- | shared/nm-glib-aux/nm-shared-utils.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/shared/nm-glib-aux/nm-shared-utils.c b/shared/nm-glib-aux/nm-shared-utils.c index befde06d1f..44079dcf3a 100644 --- a/shared/nm-glib-aux/nm-shared-utils.c +++ b/shared/nm-glib-aux/nm-shared-utils.c @@ -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 |