Bugzilla – Bug 2176
Building Ipv4 address from char* doesn't look reliable
Last modified: 2015-11-07 17:48:34 UTC
I forgot a "." when building the string "10.2.0.0" (was doing "10.2.00") and then instead of failing ns3 builded the ip "0.10.2.0". I think ns3 should either: - fail in such a case (this is the class constructor) - or change the API to allow for the conversion to fail and be checked.
Tried to look for a test suite to add my test but could not find it thus the addition of a test suite for that would be nice too.
I don't think that we need a test case for this. The constructor now fails with an assert in the following cases: 1) missing a dot (i.e., less than 3 dots), 2) leading dot in the string (e.g., ".1.1.1") 3) trailing dot in the string (e.g., "1.1.1.") Pushed in changeset: 11754:b3aa90cf76b9
changeset: 11755:82d8459595ce Forgot one last case: "1..1.1", as is, the user forgot one number in the middle. Forgetting 2 numbers (3 dots in a row) is included in this one.