Change IPv6 address/prefix output format to be bracketed.

Also add a test case for content extraction.
This commit is contained in:
Jon Siwek 2012-05-04 11:21:18 -05:00
parent 8766a2e2fc
commit 5984564946
34 changed files with 374 additions and 280 deletions

View file

@ -1,6 +1,7 @@
// See the file "COPYING" in the main distribution directory for copyright.
#include "util.h"
#include "bro_inet_ntop.h"
#include "threading/SerialTypes.h"
#include "WriterBackend.h"
@ -248,7 +249,7 @@ string WriterBackend::Render(const threading::Value::addr_t& addr) const
{
char s[INET_ADDRSTRLEN];
if ( inet_ntop(AF_INET, &addr.in.in4, s, INET_ADDRSTRLEN) == NULL )
if ( ! bro_inet_ntop(AF_INET, &addr.in.in4, s, INET_ADDRSTRLEN) )
return "<bad IPv4 address conversion>";
else
return s;
@ -257,10 +258,10 @@ string WriterBackend::Render(const threading::Value::addr_t& addr) const
{
char s[INET6_ADDRSTRLEN];
if ( inet_ntop(AF_INET6, &addr.in.in6, s, INET6_ADDRSTRLEN) == NULL )
if ( ! bro_inet_ntop(AF_INET6, &addr.in.in6, s, INET6_ADDRSTRLEN) )
return "<bad IPv6 address conversion>";
else
return s;
return string("[") + s + "]";
}
}