Module: sip-router
Branch: kamailio_3.0
Commit: fc67150b32deac0da3246763f4c9e32747f546d8
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=fc67150…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Fri Sep 3 10:14:26 2010 +0200
core: socket_str enclose IPv6 addresses in betwen [ ]
- string representation of socket string takes in consideration IPv6
addresses
(cherry picked from commit 426c6b7e2103d38aca47ca9728d22355bd44b7e9)
Conflicts:
pkg/kamailio/debian-lenny
---
pkg/kamailio/debian-lenny | 1 -
socket_info.c | 9 +++++++++
socket_info.h | 2 +-
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/pkg/kamailio/debian-lenny b/pkg/kamailio/debian-lenny
deleted file mode 120000
index b2f7fd3..0000000
--- a/pkg/kamailio/debian-lenny
+++ /dev/null
@@ -1 +0,0 @@
-debian
\ No newline at end of file
diff --git a/socket_info.c b/socket_info.c
index 6627d70..a1f8bb0 100644
--- a/socket_info.c
+++ b/socket_info.c
@@ -321,6 +321,9 @@ int socket2str(char* s, int* len, struct socket_info* si)
proto.len = strlen(proto.s);
l = proto.len + si->address_str.len + si->port_no_str.len + 2;
+
+ if(si->address.af==AF_INET6)
+ l += 2;
if (*len < l) {
ERR("socket2str: Destionation buffer too short\n");
@@ -331,8 +334,14 @@ int socket2str(char* s, int* len, struct socket_info* si)
memcpy(s, proto.s, proto.len);
s += proto.len;
*s = ':'; s++;
+ if(si->address.af==AF_INET6) {
+ *s = '['; s++;
+ }
memcpy(s, si->address_str.s, si->address_str.len);
s += si->address_str.len;
+ if(si->address.af==AF_INET6) {
+ *s = ']'; s++;
+ }
*s = ':'; s++;
memcpy(s, si->port_no_str.s, si->port_no_str.len);
s += si->port_no_str.len;
diff --git a/socket_info.h b/socket_info.h
index 6da9437..7923e65 100644
--- a/socket_info.h
+++ b/socket_info.h
@@ -47,7 +47,7 @@
* the text description of any socket, not counting the terminating zero added
* by socket2str */
#define MAX_SOCKET_STR (sizeof("unknown") - 1 + IP_ADDR_MAX_STR_SIZE + \
- INT2STR_MAX_LEN + 2)
+ INT2STR_MAX_LEN + 2 + 2)
int socket2str(char* s, int* len, struct socket_info* si);