From owner-svn-src-head@FreeBSD.ORG Fri Dec 4 15:39:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 007621065DB6; Fri, 4 Dec 2009 15:39:38 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E3E918FC1C; Fri, 4 Dec 2009 15:39:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB4Fdbd4058937; Fri, 4 Dec 2009 15:39:37 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB4Fdbhg058935; Fri, 4 Dec 2009 15:39:37 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <200912041539.nB4Fdbhg058935@svn.freebsd.org> From: Hajimu UMEMOTO Date: Fri, 4 Dec 2009 15:39:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200102 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2009 15:39:38 -0000 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';