Module: sip-router
Branch: sr_3.0
Commit: 722228264fae8dbf6329385806d610ffc84325e0
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=722228264fae8dbf6329385806d610ffc84325e0

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Andrei Pelinescu-Onciul <[email protected]>
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);
 


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to