Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Aug 2012 18:52:08 +0000 (UTC)
From:      Luigi Rizzo <luigi@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r238978 - head/sys/netinet/ipfw
Message-ID:  <201208011852.q71Iq83L087180@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: luigi
Date: Wed Aug  1 18:52:07 2012
New Revision: 238978
URL: http://svn.freebsd.org/changeset/base/238978

Log:
  replace inet_ntoa_r with the more standard inet_ntop().
  As discussed on -current, inet_ntoa_r() is non standard,
  has different arguments in userspace and kernel, and
  almost unused (no clients in userspace, only
  net/flowtable.c, net/if_llatbl.c, netinet/in_pcb.c, netinet/tcp_subr.c
  in the kernel)

Modified:
  head/sys/netinet/ipfw/ip_fw_dynamic.c
  head/sys/netinet/ipfw/ip_fw_log.c

Modified: head/sys/netinet/ipfw/ip_fw_dynamic.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_dynamic.c	Wed Aug  1 18:49:00 2012	(r238977)
+++ head/sys/netinet/ipfw/ip_fw_dynamic.c	Wed Aug  1 18:52:07 2012	(r238978)
@@ -275,9 +275,9 @@ unlink_dyn_rule_print(struct ipfw_flow_i
 #endif
 	{
 		da.s_addr = htonl(id->src_ip);
-		inet_ntoa_r(da, src);
+		inet_ntop(AF_INET, &da, src, sizeof(src));
 		da.s_addr = htonl(id->dst_ip);
-		inet_ntoa_r(da, dst);
+		inet_ntop(AF_INET, &da, dst, sizeof(dst));
 	}
 	printf("ipfw: unlink entry %s %d -> %s %d, %d left\n",
 	    src, id->src_port, dst, id->dst_port, V_dyn_count - 1);
@@ -656,9 +656,9 @@ add_dyn_rule(struct ipfw_flow_id *id, u_
 #endif
 		{
 			da.s_addr = htonl(r->id.src_ip);
-			inet_ntoa_r(da, src);
+			inet_ntop(AF_INET, &da, src, sizeof(src));
 			da.s_addr = htonl(r->id.dst_ip);
-			inet_ntoa_r(da, dst);
+			inet_ntop(AF_INET, &da, dst, sizeof(dst));
 		}
 		printf("ipfw: add dyn entry ty %d %s %d -> %s %d, total %d\n",
 		    dyn_type, src, r->id.src_port, dst, r->id.dst_port,
@@ -740,9 +740,9 @@ ipfw_install_state(struct ip_fw *rule, i
 #endif
 	{
 		da.s_addr = htonl(args->f_id.src_ip);
-		inet_ntoa_r(da, src);
+		inet_ntop(AF_INET, &da, src, sizeof(src));
 		da.s_addr = htonl(args->f_id.dst_ip);
-		inet_ntoa_r(da, dst);
+		inet_ntop(AF_INET, &da, dst, sizeof(dst));
 	}
 	printf("ipfw: %s: type %d %s %u -> %s %u\n",
 	    __func__, cmd->o.opcode, src, args->f_id.src_port,
@@ -850,10 +850,12 @@ ipfw_install_state(struct ip_fw *rule, i
 					{
 						da.s_addr =
 						    htonl(args->f_id.src_ip);
-						inet_ntoa_r(da, src);
+						inet_ntop(AF_INET, &da, src,
+						    sizeof(src));
 						da.s_addr =
 						    htonl(args->f_id.dst_ip);
-						inet_ntoa_r(da, dst);
+						inet_ntop(AF_INET, &da, dst,
+						    sizeof(dst));
 					}
 					log(LOG_SECURITY | LOG_DEBUG,
 					    "ipfw: %d %s %s:%u -> %s:%u, %s\n",

Modified: head/sys/netinet/ipfw/ip_fw_log.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_log.c	Wed Aug  1 18:49:00 2012	(r238977)
+++ head/sys/netinet/ipfw/ip_fw_log.c	Wed Aug  1 18:52:07 2012	(r238978)
@@ -450,8 +450,8 @@ ipfw_log(struct ip_fw *f, u_int hlen, st
 			tcp = L3HDR(struct tcphdr, ip);
 			udp = L3HDR(struct udphdr, ip);
 
-			inet_ntoa_r(ip->ip_src, src);
-			inet_ntoa_r(ip->ip_dst, dst);
+			inet_ntop(AF_INET, &ip->ip_src, src, sizeof(src));
+			inet_ntop(AF_INET, &ip->ip_dst, dst, sizeof(dst));
 		}
 
 		switch (args->f_id.proto) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208011852.q71Iq83L087180>