svn commit: r200055 - head/sys/netinet/ipfw
Bjoern A. Zeeb
bz at FreeBSD.org
Thu Dec 3 19:45:08 UTC 2009
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.
More information about the svn-src-head
mailing list