From: Rob D. <rk...@rk...> - 2012-12-10 00:30:56
|
A couple of bug reports mention problems with the get_host_and_port function, so I've rewritten it to use memmove rather than strcpy (so that we can safely use the same string as both the source and the destination), and also to not unnecessarily destroy the address string passed in. I've also written some crude unit tests to verify that this function works correctly now; running "make unittest" will create a sipp binary that just runs some unit tests, complains about them if they fail, and exits. (I expect this function to only be used by developers.) Currently the only unit tests are of get_host_and_port, passing in: * IPv6 address, not bracketed * IPv6 address, bracketed, no port * IPv6 address, bracketed, with port * IPv4 address, no port * IPv4 address, with port * Hostname, no port * Hostname, with port There's certainly scope to test more and to improve the way we do this testing (e.g. creating a separate sipp_ut binary), but I decided not to let the perfect be the enemy of the good. I'll leave this up for review for at least a week or two before checking it in. Best, Rob |