svn commit: r238978 - head/sys/netinet/ipfw

Luigi Rizzo luigi at FreeBSD.org
Wed Aug 1 18:52:08 UTC 2012


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) {


More information about the svn-src-all mailing list