forked from Mirrors/sngrep
cr: display ipv6 addresses in backets #330
This commit is contained in:
parent
ed41e9e1cc
commit
eb9b59b1d6
|
@ -120,10 +120,18 @@ msg_get_attribute(sip_msg_t *msg, int id, char *value)
|
|||
|
||||
switch (id) {
|
||||
case SIP_ATTR_SRC:
|
||||
sprintf(value, "%s:%u", msg->packet->src.ip, msg->packet->src.port);
|
||||
if (msg->packet->ip_version == 6) {
|
||||
sprintf(value, "[%s]:%u", msg->packet->src.ip, msg->packet->src.port);
|
||||
} else {
|
||||
sprintf(value, "%s:%u", msg->packet->src.ip, msg->packet->src.port);
|
||||
}
|
||||
break;
|
||||
case SIP_ATTR_DST:
|
||||
sprintf(value, "%s:%u", msg->packet->dst.ip, msg->packet->dst.port);
|
||||
if (msg->packet->ip_version == 6) {
|
||||
sprintf(value, "[%s]:%u", msg->packet->dst.ip, msg->packet->dst.port);
|
||||
} else {
|
||||
sprintf(value, "%s:%u", msg->packet->dst.ip, msg->packet->dst.port);
|
||||
}
|
||||
break;
|
||||
case SIP_ATTR_METHOD:
|
||||
sprintf(value, "%.*s", SIP_ATTR_MAXLEN, sip_get_msg_reqresp_str(msg));
|
||||
|
|
Loading…
Reference in New Issue