mirror of
https://github.com/openappsec/openappsec.git
synced 2025-09-29 19:24:26 +03:00
sync code
This commit is contained in:
@@ -53,6 +53,7 @@ operator<<(ostream &os, const IPType &t)
|
||||
return os << "Invalid(" << static_cast<uint>(t) << ")";
|
||||
}
|
||||
|
||||
static const AlertInfo alert(AlertTeam::CORE, "IP address");
|
||||
// Format an IP address. Use a pair, becuase it depends on the type (v4/v6)
|
||||
ostream &
|
||||
IPAddr::print(ostream &os) const
|
||||
@@ -63,12 +64,12 @@ IPAddr::print(ostream &os) const
|
||||
switch (type) {
|
||||
case IPType::V4: {
|
||||
formatted_addr = inet_ntop(AF_INET, &v4, buf, sizeof(buf));
|
||||
dbgAssert(formatted_addr == buf) << "Failed to convert an IPv4 address";
|
||||
dbgAssert(formatted_addr == buf) << alert("conversion error") << "Failed to convert an IPv4 address";
|
||||
break;
|
||||
}
|
||||
case IPType::V6: {
|
||||
formatted_addr = inet_ntop(AF_INET6, &v6, buf, sizeof(buf));
|
||||
dbgAssert(formatted_addr == buf) << "Failed to convert an IPv6 address";
|
||||
dbgAssert(formatted_addr == buf) << alert("conversion error") << "Failed to convert an IPv6 address";
|
||||
break;
|
||||
}
|
||||
case IPType::UNINITIALIZED: {
|
||||
@@ -115,8 +116,10 @@ ConnKey::reverse()
|
||||
size_t
|
||||
ConnKey::hash() const
|
||||
{
|
||||
dbgAssert(src.type != IPType::UNINITIALIZED) << "ConnKey::hash was called on an uninitialized object";
|
||||
size_t seed = 0; // XXX: random seed for security?
|
||||
dbgAssert(src.type != IPType::UNINITIALIZED)
|
||||
<< alert("hashing")
|
||||
<< "ConnKey::hash was called on an uninitialized object";
|
||||
size_t seed = 0;
|
||||
hashCombine(seed, static_cast<u_char>(src.type));
|
||||
hashCombine(seed, src.proto);
|
||||
hashCombine(seed, src);
|
||||
|
Reference in New Issue
Block a user