diff options
author | ume <ume@FreeBSD.org> | 2009-12-04 15:39:37 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2009-12-04 15:39:37 +0000 |
commit | 193fb81f202743d57ae61928b845cdbf780c67c1 (patch) | |
tree | fb8975265c784757316f9bab934a9d94997a0d7a /sys | |
parent | 62461e96f52cd992a2d5410217b16f5373da2e42 (diff) | |
download | FreeBSD-src-193fb81f202743d57ae61928b845cdbf780c67c1.zip FreeBSD-src-193fb81f202743d57ae61928b845cdbf780c67c1.tar.gz |
Use INET_ADDRSTRLEN and INET6_ADDRSTRLEN rather than hard
coded number.
Spotted by: bz
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet/ipfw/ip_fw2.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/sys/netinet/ipfw/ip_fw2.c b/sys/netinet/ipfw/ip_fw2.c index b452872..54cf817 100644 --- a/sys/netinet/ipfw/ip_fw2.c +++ b/sys/netinet/ipfw/ip_fw2.c @@ -899,7 +899,11 @@ ipfw_log(struct ip_fw *f, u_int hlen, struct ip_fw_args *args, } 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_int8_t dyn_type, struct ip_fw *rule) 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_insn_limit *cmd, 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'; |