[sr-dev] git:master:3708022d: Revert "core: add new function buf_print_ip(..) to print an IP address to an buffer"

Henning Westerholt hw at skalatan.de
Mon Mar 23 15:08:13 CET 2020


Module: kamailio
Branch: master
Commit: 3708022dfa24cf250cb34f0d5e5f990711f91d1b
URL: https://github.com/kamailio/kamailio/commit/3708022dfa24cf250cb34f0d5e5f990711f91d1b

Author: Henning Westerholt <hw at skalatan.de>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2020-03-23T15:05:51+01:00

Revert "core: add new function  buf_print_ip(..) to print an IP address to an buffer"

This reverts commit 4acca8ad2f31f465b08f15d98cc4780236e2beb0.

---

Modified: src/core/ip_addr.c
Modified: src/core/ip_addr.h

---

Diff:  https://github.com/kamailio/kamailio/commit/3708022dfa24cf250cb34f0d5e5f990711f91d1b.diff
Patch: https://github.com/kamailio/kamailio/commit/3708022dfa24cf250cb34f0d5e5f990711f91d1b.patch

---

diff --git a/src/core/ip_addr.c b/src/core/ip_addr.c
index 82f746e0d6..9989063fff 100644
--- a/src/core/ip_addr.c
+++ b/src/core/ip_addr.c
@@ -274,35 +274,6 @@ void stdout_print_ip(struct ip_addr* ip)
 }
 
 
-void buf_print_ip(char *buf, struct ip_addr* ip, unsigned int len)
-{
-	if (len < INET6_ADDRSTRLEN) {
-		LM_ERR("insufficent buffer length\n");
-		return;
-	}
-	switch(ip->af){
-		case AF_INET:
-			snprintf(buf, len, "%d.%d.%d.%d",	ip->u.addr[0],
-								ip->u.addr[1],
-								ip->u.addr[2],
-								ip->u.addr[3]);
-			break;
-		case AF_INET6:
-			snprintf(buf, len, "%x:%x:%x:%x:%x:%x:%x:%x",	htons(ip->u.addr16[0]),
-									htons(ip->u.addr16[1]),
-									htons(ip->u.addr16[2]),
-									htons(ip->u.addr16[3]),
-									htons(ip->u.addr16[4]),
-									htons(ip->u.addr16[5]),
-									htons(ip->u.addr16[6]),
-									htons(ip->u.addr16[7])
-				);
-			break;
-		default:
-			snprintf(buf, len, "warning unknown address family %d\n", ip->af);
-	}
-}
-
 
 void print_net(struct net* net)
 {
diff --git a/src/core/ip_addr.h b/src/core/ip_addr.h
index 896d4b757e..9a7b67ac5d 100644
--- a/src/core/ip_addr.h
+++ b/src/core/ip_addr.h
@@ -265,8 +265,6 @@ int mk_net_str(struct net* dst, str* s);
 
 void print_ip(char* prefix, struct ip_addr* ip, char* suffix);
 void stdout_print_ip(struct ip_addr* ip);
-void buf_print_ip(char *buf, struct ip_addr* ip, unsigned int len);
-
 void print_net(struct net* net);
 
 char* get_proto_name(unsigned int proto);




More information about the sr-dev mailing list