Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Dec 2009 19:43:33 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        Hajimu UMEMOTO <ume@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r200055 - head/sys/netinet/ipfw
Message-ID:  <20091203193619.J83957@maildrop.int.zabbadoz.net>
In-Reply-To: <200912031116.nB3BGsm2091411@svn.freebsd.org>
References:  <200912031116.nB3BGsm2091411@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 3 Dec 2009, Hajimu UMEMOTO wrote:

> Author: ume
> Date: Thu Dec  3 11:16:53 2009
> New Revision: 200055
> URL: http://svn.freebsd.org/changeset/base/200055
>
> Log:
>  Teach an IPv6 to the debug prints.
>
> Modified:
>  head/sys/netinet/ipfw/ip_fw2.c
>
> Modified: head/sys/netinet/ipfw/ip_fw2.c
> ==============================================================================
> --- head/sys/netinet/ipfw/ip_fw2.c	Thu Dec  3 09:18:40 2009	(r200054)
> +++ head/sys/netinet/ipfw/ip_fw2.c	Thu Dec  3 11:16:53 2009	(r200055)
> @@ -1050,6 +1050,28 @@ hash_packet(struct ipfw_flow_id *id)
> 	return i;
> }
>
> +static __inline void
> +unlink_dyn_rule_print(struct ipfw_flow_id *id)
> +{
> +	struct in_addr da;
> +	char src[48], dst[48];

Does it need to be 48 rather than 46? You do not have the [] here.
If not INET6_ADDRSTRLEN is what we use elsewhere.  I would actually
prefer to only have
#ifdef INET6
 	char src[INET6_ADDRSTRLEN|48], ..
#else
 	char src[INET_ADDRSTRLEN|18], ..
#endif

as it's 60 bytes of stack size for people w/o INET6 support (shame on
them;-)  Some applies for equivalent code further down.

Ideally we would also hide the INET things under INET but that's a
longer way to go...


/bz


> +#ifdef INET6
> +	if (IS_IP6_FLOW_ID(id)) {
> +		ip6_sprintf(src, &id->src_ip6);
> +		ip6_sprintf(dst, &id->dst_ip6);
> +	} else
> +#endif
> +	{
> +		da.s_addr = htonl(id->src_ip);
> +		inet_ntoa_r(da, src);
> +		da.s_addr = htonl(id->dst_ip);
> +		inet_ntoa_r(da, dst);
> +	}
> +	printf("ipfw: unlink entry %s %d -> %s %d, %d left\n",
> +	    src, id->src_port, dst, id->dst_port, V_dyn_count - 1);
> +}

-- 
Bjoern A. Zeeb         It will not break if you know what you are doing.



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