Date: Fri, 27 Aug 2010 09:59:51 +0000 (UTC) From: Andre Oppermann <andre@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r211869 - stable/7/sys/netinet Message-ID: <201008270959.o7R9xpBF071569@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: andre Date: Fri Aug 27 09:59:51 2010 New Revision: 211869 URL: http://svn.freebsd.org/changeset/base/211869 Log: MFC r211462: Untangle the net.inet.tcp.log_in_vain and net.inet.tcp.log_debug sysctl's and remove any side effects. Modified: stable/7/sys/netinet/tcp_input.c stable/7/sys/netinet/tcp_subr.c stable/7/sys/netinet/tcp_var.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/netinet/tcp_input.c ============================================================================== --- stable/7/sys/netinet/tcp_input.c Fri Aug 27 09:55:51 2010 (r211868) +++ stable/7/sys/netinet/tcp_input.c Fri Aug 27 09:59:51 2010 (r211869) @@ -462,7 +462,7 @@ findpcb: */ if ((tcp_log_in_vain == 1 && (thflags & TH_SYN)) || tcp_log_in_vain == 2) { - if ((s = tcp_log_addrs(NULL, th, (void *)ip, ip6))) + if ((s = tcp_log_vain(NULL, th, (void *)ip, ip6))) log(LOG_INFO, "%s; %s: Connection attempt " "to closed port\n", s, __func__); } Modified: stable/7/sys/netinet/tcp_subr.c ============================================================================== --- stable/7/sys/netinet/tcp_subr.c Fri Aug 27 09:55:51 2010 (r211868) +++ stable/7/sys/netinet/tcp_subr.c Fri Aug 27 09:59:51 2010 (r211869) @@ -235,6 +235,8 @@ uma_zone_t sack_hole_zone; static struct inpcb *tcp_notify(struct inpcb *, int); static void tcp_isn_tick(void *); +static char * tcp_log_addr(struct in_conninfo *inc, struct tcphdr *th, + void *ip4hdr, const void *ip6hdr); /* * Target size of TCP PCB hash tables. Must be a power of two. @@ -2120,9 +2122,33 @@ SYSCTL_PROC(_net_inet_tcp, TCPCTL_DROP, * and ip6_hdr pointers have to be passed as void pointers. */ char * +tcp_log_vain(struct in_conninfo *inc, struct tcphdr *th, void *ip4hdr, + const void *ip6hdr) +{ + + /* Is logging enabled? */ + if (tcp_log_in_vain == 0) + return (NULL); + + return (tcp_log_addr(inc, th, ip4hdr, ip6hdr)); +} + +char * tcp_log_addrs(struct in_conninfo *inc, struct tcphdr *th, void *ip4hdr, const void *ip6hdr) { + + /* Is logging enabled? */ + if (tcp_log_debug == 0) + return (NULL); + + return (tcp_log_addr(inc, th, ip4hdr, ip6hdr)); +} + +static char * +tcp_log_addr(struct in_conninfo *inc, struct tcphdr *th, void *ip4hdr, + const void *ip6hdr) +{ char *s, *sp; size_t size; struct ip *ip; @@ -2145,10 +2171,6 @@ tcp_log_addrs(struct in_conninfo *inc, s 2 * INET_ADDRSTRLEN; #endif /* INET6 */ - /* Is logging enabled? */ - if (tcp_log_debug == 0 && tcp_log_in_vain == 0) - return (NULL); - s = malloc(size, M_TCPLOG, M_ZERO|M_NOWAIT); if (s == NULL) return (NULL); Modified: stable/7/sys/netinet/tcp_var.h ============================================================================== --- stable/7/sys/netinet/tcp_var.h Fri Aug 27 09:55:51 2010 (r211868) +++ stable/7/sys/netinet/tcp_var.h Fri Aug 27 09:59:51 2010 (r211869) @@ -538,6 +538,8 @@ void tcp_init(void); void tcp_fini(void *); char *tcp_log_addrs(struct in_conninfo *, struct tcphdr *, void *, const void *); +char *tcp_log_vain(struct in_conninfo *, struct tcphdr *, void *, + const void *); int tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *); void tcp_reass_init(void); void tcp_input(struct mbuf *, int);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008270959.o7R9xpBF071569>