Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Dec 2009 15:39:37 +0000 (UTC)
From:      Hajimu UMEMOTO <ume@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r200102 - head/sys/netinet/ipfw
Message-ID:  <200912041539.nB4Fdbhg058935@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ume
Date: Fri Dec  4 15:39:37 2009
New Revision: 200102
URL: http://svn.freebsd.org/changeset/base/200102

Log:
  Use INET_ADDRSTRLEN and INET6_ADDRSTRLEN rather than hard
  coded number.
  
  Spotted by:	bz

Modified:
  head/sys/netinet/ipfw/ip_fw2.c

Modified: head/sys/netinet/ipfw/ip_fw2.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw2.c	Fri Dec  4 14:18:30 2009	(r200101)
+++ head/sys/netinet/ipfw/ip_fw2.c	Fri Dec  4 15:39:37 2009	(r200102)
@@ -899,7 +899,11 @@ ipfw_log(struct ip_fw *f, u_int hlen, st
 
 	} else {
 		int len;
-		char src[48], dst[48];
+#ifdef INET6
+		char src[INET6_ADDRSTRLEN + 2], dst[INET6_ADDRSTRLEN + 2];
+#else
+		char src[INET_ADDRSTRLEN], dst[INET_ADDRSTRLEN];
+#endif
 		struct icmphdr *icmp;
 		struct tcphdr *tcp;
 		struct udphdr *udp;
@@ -1054,7 +1058,11 @@ static __inline void
 unlink_dyn_rule_print(struct ipfw_flow_id *id)
 {
 	struct in_addr da;
-	char src[48], dst[48];
+#ifdef INET6
+	char src[INET6_ADDRSTRLEN], dst[INET6_ADDRSTRLEN];
+#else
+	char src[INET_ADDRSTRLEN], dst[INET_ADDRSTRLEN];
+#endif
 
 #ifdef INET6
 	if (IS_IP6_FLOW_ID(id)) {
@@ -1416,8 +1424,14 @@ add_dyn_rule(struct ipfw_flow_id *id, u_
 	V_dyn_count++;
 	DEB({
 		struct in_addr da;
-		char src[48];
-		char dst[48];
+#ifdef INET6
+		char src[INET6_ADDRSTRLEN];
+		char dst[INET6_ADDRSTRLEN];
+#else
+		char src[INET_ADDRSTRLEN];
+		char dst[INET_ADDRSTRLEN];
+#endif
+
 #ifdef INET6
 		if (IS_IP6_FLOW_ID(&(r->id))) {
 			ip6_sprintf(src, &r->id.src_ip6);
@@ -1490,7 +1504,11 @@ install_state(struct ip_fw *rule, ipfw_i
 	static int last_log;
 	ipfw_dyn_rule *q;
 	struct in_addr da;
-	char src[48], dst[48];
+#ifdef INET6
+	char src[INET6_ADDRSTRLEN + 2], dst[INET6_ADDRSTRLEN + 2];
+#else
+	char src[INET_ADDRSTRLEN], dst[INET_ADDRSTRLEN];
+#endif
 
 	src[0] = '\0';
 	dst[0] = '\0';



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