PERFORCE change 124306 for review
Peter Wemm
peter at FreeBSD.org
Sun Jul 29 10:57:07 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=124306
Change 124306 by peter at peter_overcee on 2007/07/29 10:56:36
IFC @124303
Affected files ...
.. //depot/projects/hammer/lib/libelf/elf_begin.3#2 integrate
.. //depot/projects/hammer/lib/libelf/elf_memory.3#2 integrate
.. //depot/projects/hammer/sys/contrib/pf/net/if_pfsync.c#27 integrate
.. //depot/projects/hammer/sys/dev/pci/pci.c#62 integrate
.. //depot/projects/hammer/sys/net/bpf.c#49 integrate
.. //depot/projects/hammer/sys/netgraph/netgraph.h#29 integrate
.. //depot/projects/hammer/sys/netinet/ip_carp.c#25 integrate
.. //depot/projects/hammer/sys/netinet/ip_dummynet.c#41 integrate
.. //depot/projects/hammer/sys/netinet/ip_fw2.c#84 integrate
.. //depot/projects/hammer/sys/netinet/ip_mroute.c#39 integrate
.. //depot/projects/hammer/sys/netinet/tcp_input.c#77 integrate
.. //depot/projects/hammer/sys/netinet/tcp_subr.c#69 integrate
.. //depot/projects/hammer/sys/netinet/tcp_syncache.c#46 integrate
.. //depot/projects/hammer/sys/netinet/tcp_usrreq.c#47 integrate
.. //depot/projects/hammer/sys/netinet/tcp_var.h#46 integrate
.. //depot/projects/hammer/sys/sys/mutex.h#32 integrate
.. //depot/projects/hammer/tools/tools/net80211/Makefile#3 integrate
.. //depot/projects/hammer/tools/tools/net80211/README#2 integrate
.. //depot/projects/hammer/tools/tools/net80211/wlandebug/Makefile#4 delete
.. //depot/projects/hammer/tools/tools/net80211/wlandebug/wlandebug.8#2 delete
.. //depot/projects/hammer/tools/tools/net80211/wlandebug/wlandebug.c#5 delete
.. //depot/projects/hammer/usr.bin/truss/i386-fbsd.c#13 integrate
.. //depot/projects/hammer/usr.bin/truss/main.c#14 integrate
.. //depot/projects/hammer/usr.bin/truss/powerpc-fbsd.c#4 integrate
.. //depot/projects/hammer/usr.bin/truss/syscalls.c#23 integrate
.. //depot/projects/hammer/usr.sbin/Makefile#80 integrate
.. //depot/projects/hammer/usr.sbin/acpi/acpidump/acpi_user.c#9 integrate
.. //depot/projects/hammer/usr.sbin/wlandebug/Makefile#1 branch
.. //depot/projects/hammer/usr.sbin/wlandebug/wlandebug.8#1 branch
.. //depot/projects/hammer/usr.sbin/wlandebug/wlandebug.c#1 branch
Differences ...
==== //depot/projects/hammer/lib/libelf/elf_begin.3#2 (text+ko) ====
@@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
-.\" $FreeBSD: src/lib/libelf/elf_begin.3,v 1.2 2006/11/13 09:46:15 ru Exp $
+.\" $FreeBSD: src/lib/libelf/elf_begin.3,v 1.3 2007/07/28 15:35:03 jkoshy Exp $
.\"
.Dd June 21, 2006
.Os
@@ -273,7 +273,7 @@
.Sh SEE ALSO
.Xr elf 3 ,
.Xr elf_end 3 ,
-.Xr elf_error 3 ,
+.Xr elf_errno 3 ,
.Xr elf_memory 3 ,
.Xr elf_next 3 ,
.Xr elf_rand 3 ,
==== //depot/projects/hammer/lib/libelf/elf_memory.3#2 (text+ko) ====
@@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
-.\" $FreeBSD: src/lib/libelf/elf_memory.3,v 1.2 2006/11/13 09:46:15 ru Exp $
+.\" $FreeBSD: src/lib/libelf/elf_memory.3,v 1.3 2007/07/28 15:35:03 jkoshy Exp $
.\"
.Dd June 28, 2006
.Os
@@ -117,6 +117,6 @@
.Xr elf 3 ,
.Xr elf_begin 3 ,
.Xr elf_end 3 ,
-.Xr elf_error 3 ,
+.Xr elf_errno 3 ,
.Xr elf_kind 3 ,
.Xr gelf 3
==== //depot/projects/hammer/sys/contrib/pf/net/if_pfsync.c#27 (text+ko) ====
@@ -34,7 +34,7 @@
#include "opt_pf.h"
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/contrib/pf/net/if_pfsync.c,v 1.35 2007/07/03 12:16:07 mlaier Exp $");
+__FBSDID("$FreeBSD: src/sys/contrib/pf/net/if_pfsync.c,v 1.36 2007/07/28 07:31:29 rwatson Exp $");
#ifdef DEV_BPF
#define NBPFILTER DEV_BPF
@@ -282,12 +282,12 @@
ifp->if_hdrlen = PFSYNC_HDRLEN;
pfsync_setmtu(pfsyncif, ETHERMTU);
#ifdef __FreeBSD__
- callout_init(&pfsyncif->sc_tmo, NET_CALLOUT_MPSAFE);
+ callout_init(&pfsyncif->sc_tmo, CALLOUT_MPSAFE);
#ifdef PFSYNC_TDB
- callout_init(&pfsyncif->sc_tdb_tmo, NET_CALLOUT_MPSAFE);
+ callout_init(&pfsyncif->sc_tdb_tmo, CALLOUT_MPSAFE);
#endif
- callout_init(&pfsyncif->sc_bulk_tmo, NET_CALLOUT_MPSAFE);
- callout_init(&pfsyncif->sc_bulkfail_tmo, NET_CALLOUT_MPSAFE);
+ callout_init(&pfsyncif->sc_bulk_tmo, CALLOUT_MPSAFE);
+ callout_init(&pfsyncif->sc_bulkfail_tmo, CALLOUT_MPSAFE);
#else
timeout_set(&pfsyncif->sc_tmo, pfsync_timeout, pfsyncif);
timeout_set(&pfsyncif->sc_tdb_tmo, pfsync_tdb_timeout, pfsyncif);
==== //depot/projects/hammer/sys/dev/pci/pci.c#62 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/pci/pci.c,v 1.353 2007/05/16 23:42:04 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/pci/pci.c,v 1.354 2007/07/29 02:44:41 marcel Exp $");
#include "opt_bus.h"
@@ -3265,6 +3265,14 @@
map |= (pci_addr_t)pci_read_config(child, *rid + 4, 4) << 32;
if (pci_mapbase(testval) == 0)
goto out;
+
+ /*
+ * Restore the original value of the BAR. We may have reprogrammed
+ * the BAR of the low-level console device and when booting verbose,
+ * we need the console device addressable.
+ */
+ pci_write_config(child, *rid, map, 4);
+
if (PCI_BAR_MEM(testval)) {
if (type != SYS_RES_MEMORY) {
if (bootverbose)
==== //depot/projects/hammer/sys/net/bpf.c#49 (text+ko) ====
@@ -33,7 +33,7 @@
*
* @(#)bpf.c 8.4 (Berkeley) 1/9/95
*
- * $FreeBSD: src/sys/net/bpf.c,v 1.178 2007/06/17 21:51:43 csjp Exp $
+ * $FreeBSD: src/sys/net/bpf.c,v 1.179 2007/07/28 07:31:29 rwatson Exp $
*/
#include "opt_bpf.h"
@@ -405,7 +405,7 @@
mac_create_bpfdesc(td->td_ucred, d);
#endif
mtx_init(&d->bd_mtx, devtoname(dev), "bpf cdev lock", MTX_DEF);
- callout_init(&d->bd_callout, NET_CALLOUT_MPSAFE);
+ callout_init(&d->bd_callout, CALLOUT_MPSAFE);
knlist_init(&d->bd_sel.si_note, &d->bd_mtx, NULL, NULL, NULL);
return (0);
==== //depot/projects/hammer/sys/netgraph/netgraph.h#29 (text+ko) ====
@@ -37,7 +37,7 @@
*
* Author: Julian Elischer <julian at freebsd.org>
*
- * $FreeBSD: src/sys/netgraph/netgraph.h,v 1.67 2006/10/17 10:59:39 glebius Exp $
+ * $FreeBSD: src/sys/netgraph/netgraph.h,v 1.68 2007/07/28 07:31:30 rwatson Exp $
* $Whistle: netgraph.h,v 1.29 1999/11/01 07:56:13 julian Exp $
*/
@@ -1097,7 +1097,7 @@
int ng_uncallout(struct callout *c, node_p node);
int ng_callout(struct callout *c, node_p node, hook_p hook, int ticks,
ng_item_fn *fn, void * arg1, int arg2);
-#define ng_callout_init(c) callout_init(c, NET_CALLOUT_MPSAFE)
+#define ng_callout_init(c) callout_init(c, CALLOUT_MPSAFE)
/* Flags for netgraph functions. */
#define NG_NOFLAGS 0x00000000 /* no special options */
==== //depot/projects/hammer/sys/netinet/ip_carp.c#25 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/netinet/ip_carp.c,v 1.50 2007/06/12 16:24:53 bms Exp $ */
+/* $FreeBSD: src/sys/netinet/ip_carp.c,v 1.51 2007/07/28 07:31:30 rwatson Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -384,9 +384,9 @@
sc->sc_imo.imo_max_memberships = IP_MIN_MEMBERSHIPS;
sc->sc_imo.imo_multicast_vif = -1;
- callout_init(&sc->sc_ad_tmo, NET_CALLOUT_MPSAFE);
- callout_init(&sc->sc_md_tmo, NET_CALLOUT_MPSAFE);
- callout_init(&sc->sc_md6_tmo, NET_CALLOUT_MPSAFE);
+ callout_init(&sc->sc_ad_tmo, CALLOUT_MPSAFE);
+ callout_init(&sc->sc_md_tmo, CALLOUT_MPSAFE);
+ callout_init(&sc->sc_md6_tmo, CALLOUT_MPSAFE);
ifp->if_softc = sc;
if_initname(ifp, CARP_IFNAME, unit);
==== //depot/projects/hammer/sys/netinet/ip_dummynet.c#41 (text+ko) ====
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/netinet/ip_dummynet.c,v 1.107 2007/06/17 00:33:34 mjacob Exp $
+ * $FreeBSD: src/sys/netinet/ip_dummynet.c,v 1.108 2007/07/28 07:31:30 rwatson Exp $
*/
#define DUMMYNET_DEBUG
@@ -2141,7 +2141,7 @@
taskqueue_thread_enqueue, &dn_tq);
taskqueue_start_threads(&dn_tq, 1, PI_NET, "dummynet");
- callout_init(&dn_timeout, NET_CALLOUT_MPSAFE);
+ callout_init(&dn_timeout, CALLOUT_MPSAFE);
callout_reset(&dn_timeout, 1, dummynet, NULL);
/* Initialize curr_time adjustment mechanics. */
==== //depot/projects/hammer/sys/netinet/ip_fw2.c#84 (text+ko) ====
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/netinet/ip_fw2.c,v 1.169 2007/07/03 12:46:06 mlaier Exp $
+ * $FreeBSD: src/sys/netinet/ip_fw2.c,v 1.170 2007/07/28 07:31:30 rwatson Exp $
*/
#define DEB(x)
@@ -4937,7 +4937,7 @@
sizeof(ipfw_dyn_rule), NULL, NULL, NULL, NULL,
UMA_ALIGN_PTR, 0);
IPFW_DYN_LOCK_INIT();
- callout_init(&ipfw_timeout, NET_CALLOUT_MPSAFE);
+ callout_init(&ipfw_timeout, CALLOUT_MPSAFE);
bzero(&default_rule, sizeof default_rule);
==== //depot/projects/hammer/sys/netinet/ip_mroute.c#39 (text+ko) ====
@@ -52,7 +52,7 @@
* and PIM-SMv2 and PIM-DM support, advanced API support,
* bandwidth metering and signaling
*
- * $FreeBSD: src/sys/netinet/ip_mroute.c,v 1.135 2007/05/10 15:58:47 rwatson Exp $
+ * $FreeBSD: src/sys/netinet/ip_mroute.c,v 1.136 2007/07/28 07:31:30 rwatson Exp $
*/
#include "opt_inet.h"
@@ -639,12 +639,12 @@
pim_assert = 0;
mrt_api_config = 0;
- callout_init(&expire_upcalls_ch, NET_CALLOUT_MPSAFE);
+ callout_init(&expire_upcalls_ch, CALLOUT_MPSAFE);
bw_upcalls_n = 0;
bzero((caddr_t)bw_meter_timers, sizeof(bw_meter_timers));
- callout_init(&bw_upcalls_ch, NET_CALLOUT_MPSAFE);
- callout_init(&bw_meter_ch, NET_CALLOUT_MPSAFE);
+ callout_init(&bw_upcalls_ch, CALLOUT_MPSAFE);
+ callout_init(&bw_meter_ch, CALLOUT_MPSAFE);
}
static void
==== //depot/projects/hammer/sys/netinet/tcp_input.c#77 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_input.c 8.12 (Berkeley) 5/24/95
- * $FreeBSD: src/sys/netinet/tcp_input.c,v 1.363 2007/07/27 00:57:06 silby Exp $
+ * $FreeBSD: src/sys/netinet/tcp_input.c,v 1.366 2007/07/29 01:31:33 mjacob Exp $
*/
#include "opt_ipfw.h" /* for ipfw_fwd */
@@ -57,6 +57,8 @@
#include <net/if.h>
#include <net/route.h>
+#define TCPSTATES /* for logging */
+
#include <netinet/in.h>
#include <netinet/in_pcb.h>
#include <netinet/in_systm.h>
@@ -98,7 +100,7 @@
SYSCTL_STRUCT(_net_inet_tcp, TCPCTL_STATS, stats, CTLFLAG_RW,
&tcpstat , tcpstat, "TCP statistics (struct tcpstat, netinet/tcp_var.h)");
-static int tcp_log_in_vain = 0;
+int tcp_log_in_vain = 0;
SYSCTL_INT(_net_inet_tcp, OID_AUTO, log_in_vain, CTLFLAG_RW,
&tcp_log_in_vain, 0, "Log all incoming TCP segments to closed ports");
@@ -648,33 +650,21 @@
* Our (SYN|ACK) response was rejected.
* Check with syncache and remove entry to prevent
* retransmits.
+ *
+ * NB: syncache_chkrst does its own logging of failure
+ * causes.
*/
- if ((thflags & (TH_ACK|TH_RST)) == (TH_ACK|TH_RST)) {
- if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
- log(LOG_DEBUG, "%s; %s: Listen socket: "
- "Our SYN|ACK was rejected, connection "
- "attempt aborted by remote endpoint\n",
- s, __func__);
+ if (thflags & TH_RST) {
syncache_chkrst(&inc, th);
goto dropunlock;
}
/*
- * Spurious RST. Ignore.
- */
- if (thflags & TH_RST) {
- if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
- log(LOG_DEBUG, "%s; %s: Listen socket: "
- "Spurious RST, segment rejected\n",
- s, __func__);
- goto dropunlock;
- }
- /*
* We can't do anything without SYN.
*/
if ((thflags & TH_SYN) == 0) {
if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
log(LOG_DEBUG, "%s; %s: Listen socket: "
- "SYN is missing, segment rejected\n",
+ "SYN is missing, segment ignored\n",
s, __func__);
tcpstat.tcps_badsyn++;
goto dropunlock;
@@ -706,7 +696,7 @@
if ((thflags & TH_FIN) && drop_synfin) {
if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
log(LOG_DEBUG, "%s; %s: Listen socket: "
- "SYN|FIN segment rejected (based on "
+ "SYN|FIN segment ignored (based on "
"sysctl setting)\n", s, __func__);
tcpstat.tcps_badsyn++;
goto dropunlock;
@@ -783,7 +773,7 @@
if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
log(LOG_DEBUG, "%s; %s: Listen socket: "
"Connection attempt from broad- or multicast "
- "link layer address rejected\n", s, __func__);
+ "link layer address ignored\n", s, __func__);
goto dropunlock;
}
if (isipv6) {
@@ -793,7 +783,7 @@
if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
log(LOG_DEBUG, "%s; %s: Listen socket: "
"Connection attempt to/from self "
- "rejected\n", s, __func__);
+ "ignored\n", s, __func__);
goto dropunlock;
}
if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) ||
@@ -801,7 +791,7 @@
if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
log(LOG_DEBUG, "%s; %s: Listen socket: "
"Connection attempt from/to multicast "
- "address rejected\n", s, __func__);
+ "address ignored\n", s, __func__);
goto dropunlock;
}
#endif
@@ -811,7 +801,7 @@
if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
log(LOG_DEBUG, "%s; %s: Listen socket: "
"Connection attempt from/to self "
- "rejected\n", s, __func__);
+ "ignored\n", s, __func__);
goto dropunlock;
}
if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) ||
@@ -821,7 +811,7 @@
if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
log(LOG_DEBUG, "%s; %s: Listen socket: "
"Connection attempt from/to broad- "
- "or multicast address rejected\n",
+ "or multicast address ignored\n",
s, __func__);
goto dropunlock;
}
@@ -1578,8 +1568,22 @@
*/
if ((so->so_state & SS_NOFDREF) &&
tp->t_state > TCPS_CLOSE_WAIT && tlen) {
+ char *s;
+
KASSERT(headlocked, ("%s: trimthenstep6: tcp_close.3: head "
"not locked", __func__));
+ if ((s = tcp_log_addrs(&tp->t_inpcb->inp_inc, th, NULL, NULL))) {
+#ifdef TCPDEBUG
+ log(LOG_DEBUG, "%s; %s: %s: Received data after socket "
+ "was closed, sending RST and removing tcpcb\n",
+ s, __func__, tcpstates[tp->t_state]);
+#else
+ log(LOG_DEBUG, "%s; %s: Received data after socket "
+ "was closed, sending RST and removing tcpcb\n",
+ s, __func__);
+#endif
+ free(s, M_TCPLOG);
+ }
tp = tcp_close(tp);
tcpstat.tcps_rcvafterclose++;
rstreason = BANDLIM_UNLIMITED;
==== //depot/projects/hammer/sys/netinet/tcp_subr.c#69 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_subr.c 8.2 (Berkeley) 5/24/95
- * $FreeBSD: src/sys/netinet/tcp_subr.c,v 1.292 2007/07/27 00:57:06 silby Exp $
+ * $FreeBSD: src/sys/netinet/tcp_subr.c,v 1.294 2007/07/28 12:20:39 andre Exp $
*/
#include "opt_compat.h"
@@ -133,6 +133,10 @@
SYSCTL_INT(_net_inet_tcp, TCPCTL_DO_RFC1323, rfc1323, CTLFLAG_RW,
&tcp_do_rfc1323, 0, "Enable rfc1323 (high performance TCP) extensions");
+static int tcp_log_debug = 1;
+SYSCTL_INT(_net_inet_tcp, OID_AUTO, log_debug, CTLFLAG_RW,
+ &tcp_log_debug, 0, "Log errors caused by incoming TCP segments");
+
static int tcp_tcbhashsize = 0;
SYSCTL_INT(_net_inet_tcp, OID_AUTO, tcbhashsize, CTLFLAG_RDTUN,
&tcp_tcbhashsize, 0, "Size of TCP control-block hashtable");
@@ -592,12 +596,8 @@
tcp_mssdflt;
/* Set up our timeouts. */
- if (NET_CALLOUT_MPSAFE)
- callout_init_mtx(&tp->t_timers->tt_timer, &inp->inp_mtx,
- CALLOUT_RETURNUNLOCKED);
- else
- callout_init_mtx(&tp->t_timers->tt_timer, &inp->inp_mtx,
- (CALLOUT_RETURNUNLOCKED|CALLOUT_NETGIANT));
+ callout_init_mtx(&tp->t_timers->tt_timer, &inp->inp_mtx,
+ CALLOUT_RETURNUNLOCKED);
if (tcp_do_rfc1323)
tp->t_flags = (TF_REQ_SCALE|TF_REQ_TSTMP);
@@ -2098,6 +2098,10 @@
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);
==== //depot/projects/hammer/sys/netinet/tcp_syncache.c#46 (text+ko) ====
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/netinet/tcp_syncache.c,v 1.124 2007/07/27 00:57:06 silby Exp $
+ * $FreeBSD: src/sys/netinet/tcp_syncache.c,v 1.127 2007/07/28 20:13:40 silby Exp $
*/
#include "opt_inet.h"
@@ -143,6 +143,7 @@
struct mtx sch_mtx;
TAILQ_HEAD(sch_head, syncache) sch_bucket;
struct callout sch_timer;
+ int sch_nextc;
u_int sch_length;
u_int sch_oddeven;
u_int32_t sch_secbits_odd[SYNCOOKIE_SECRET_SIZE];
@@ -157,6 +158,8 @@
static int syncache_respond(struct syncache *);
static struct socket *syncache_socket(struct syncache *, struct socket *,
struct mbuf *m);
+static void syncache_timeout(struct syncache *sc, struct syncache_head *sch,
+ int docallout);
static void syncache_timer(void *);
static void syncookie_generate(struct syncache_head *, struct syncache *,
u_int32_t *);
@@ -233,12 +236,6 @@
#define ENDPTS6_EQ(a, b) (memcmp(a, b, sizeof(*a)) == 0)
-#define SYNCACHE_TIMEOUT(sc) do { \
- (sc)->sc_rxmits++; \
- (sc)->sc_rxttime = ticks + \
- TCPTV_RTOBASE * tcp_backoff[(sc)->sc_rxmits - 1]; \
-} while (0)
-
#define SCH_LOCK(sch) mtx_lock(&(sch)->sch_mtx)
#define SCH_UNLOCK(sch) mtx_unlock(&(sch)->sch_mtx)
#define SCH_LOCK_ASSERT(sch) mtx_assert(&(sch)->sch_mtx, MA_OWNED)
@@ -262,7 +259,6 @@
syncache_init(void)
{
int i;
- struct syncache_head *sch;
tcp_syncache.cache_count = 0;
tcp_syncache.hashsize = TCP_SYNCACHE_HASHSIZE;
@@ -305,17 +301,6 @@
tcp_syncache.zone = uma_zcreate("syncache", sizeof(struct syncache),
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
uma_zone_set_max(tcp_syncache.zone, tcp_syncache.cache_limit);
-
- /*
- * Start the syncache head timers running. They each run ten times
- * a second, and are spread out so that they are not all running on
- * the same clock tick.
- */
- for (i = 0; i < tcp_syncache.hashsize; i++) {
- sch = &tcp_syncache.hashbase[i];
- callout_reset(&(sch)->sch_timer, i * (hz / 10),
- syncache_timer, (void *)(sch));
- }
}
/*
@@ -345,8 +330,8 @@
TAILQ_INSERT_HEAD(&sch->sch_bucket, sc, sc_hash);
sch->sch_length++;
- /* Set the retransmit timer for this socket. */
- SYNCACHE_TIMEOUT(sc);
+ /* Reinitialize the bucket row's timer. */
+ syncache_timeout(sc, sch, 1);
SCH_UNLOCK(sch);
@@ -372,6 +357,22 @@
}
/*
+ * Engage/reengage time on bucket row.
+ */
+static void
+syncache_timeout(struct syncache *sc, struct syncache_head *sch, int docallout)
+{
+ sc->sc_rxttime = ticks +
+ TCPTV_RTOBASE * (tcp_backoff[sc->sc_rxmits]);
+ sc->sc_rxmits++;
+ if (sch->sch_nextc > sc->sc_rxttime)
+ sch->sch_nextc = sc->sc_rxttime;
+ if (!TAILQ_EMPTY(&sch->sch_bucket) && docallout)
+ callout_reset(&sch->sch_timer, sch->sch_nextc - ticks,
+ syncache_timer, (void *)sch);
+}
+
+/*
* Walk the timer queues, looking for SYN,ACKs that need to be retransmitted.
* If we have retransmitted an entry the maximum number of times, expire it.
* One separate timer for each bucket row.
@@ -396,13 +397,16 @@
* then the RST will be sent by the time the remote
* host does the SYN/ACK->ACK.
*/
- if (sc->sc_rxttime >= tick) {
+ if (sc->sc_rxttime > tick) {
+ if (sc->sc_rxttime < sch->sch_nextc)
+ sch->sch_nextc = sc->sc_rxttime;
continue;
}
if (sc->sc_rxmits > tcp_syncache.rexmt_limit) {
if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
- log(LOG_DEBUG, "%s; %s: Response timeout\n",
+ log(LOG_DEBUG, "%s; %s: Retransmits exhausted, "
+ "giving up and removing syncache entry\n",
s, __func__);
free(s, M_TCPLOG);
}
@@ -410,13 +414,20 @@
tcpstat.tcps_sc_stale++;
continue;
}
+ if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
+ log(LOG_DEBUG, "%s; %s: Response timeout, "
+ "retransmitting (%u) SYN|ACK\n",
+ s, __func__, sc->sc_rxmits);
+ free(s, M_TCPLOG);
+ }
(void) syncache_respond(sc);
tcpstat.tcps_sc_retransmitted++;
- SYNCACHE_TIMEOUT(sc);
+ syncache_timeout(sc, sch, 0);
}
- callout_reset(&(sch)->sch_timer, hz / 10,
- syncache_timer, (void *)(sch));
+ if (!TAILQ_EMPTY(&(sch)->sch_bucket))
+ callout_reset(&(sch)->sch_timer, (sch)->sch_nextc - tick,
+ syncache_timer, (void *)(sch));
}
/*
@@ -475,11 +486,39 @@
{
struct syncache *sc;
struct syncache_head *sch;
+ char *s = NULL;
sc = syncache_lookup(inc, &sch); /* returns locked sch */
SCH_LOCK_ASSERT(sch);
- if (sc == NULL)
+
+ /*
+ * Any RST to our SYN|ACK must not carry ACK, SYN or FIN flags.
+ * See RFC 793 page 65, section SEGMENT ARRIVES.
+ */
+ if (th->th_flags & (TH_ACK|TH_SYN|TH_FIN)) {
+ if ((s = tcp_log_addrs(inc, th, NULL, NULL)))
+ log(LOG_DEBUG, "%s; %s: Spurious RST with ACK, SYN or "
+ "FIN flag set, segment ignored\n", s, __func__);
+ tcpstat.tcps_badrst++;
+ goto done;
+ }
+
+ /*
+ * No corresponding connection was found in syncache.
+ * If syncookies are enabled and possibly exclusively
+ * used, or we are under memory pressure, a valid RST
+ * may not find a syncache entry. In that case we're
+ * done and no SYN|ACK retransmissions will happen.
+ * Otherwise the the RST was misdirected or spoofed.
+ */
+ if (sc == NULL) {
+ if ((s = tcp_log_addrs(inc, th, NULL, NULL)))
+ log(LOG_DEBUG, "%s; %s: Spurious RST without matching "
+ "syncache entry (possibly syncookie only), "
+ "segment ignored\n", s, __func__);
+ tcpstat.tcps_badrst++;
goto done;
+ }
/*
* If the RST bit is set, check the sequence number to see
@@ -497,9 +536,21 @@
if (SEQ_GEQ(th->th_seq, sc->sc_irs) &&
SEQ_LEQ(th->th_seq, sc->sc_irs + sc->sc_wnd)) {
syncache_drop(sc, sch);
+ if ((s = tcp_log_addrs(inc, th, NULL, NULL)))
+ log(LOG_DEBUG, "%s; %s: Our SYN|ACK was rejected, "
+ "connection attempt aborted by remote endpoint\n",
+ s, __func__);
tcpstat.tcps_sc_reset++;
+ } else if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
+ log(LOG_DEBUG, "%s; %s: RST with invalid SEQ %u != IRS %u "
+ "(+WND %u), segment ignored\n",
+ s, __func__, th->th_seq, sc->sc_irs, sc->sc_wnd);
+ tcpstat.tcps_badrst++;
}
+
done:
+ if (s != NULL)
+ free(s, M_TCPLOG);
SCH_UNLOCK(sch);
}
@@ -736,7 +787,7 @@
/*
* If the SYN,ACK was retransmitted, reset cwnd to 1 segment.
*/
- if (sc->sc_rxmits > 1)
+ if (sc->sc_rxmits)
tp->snd_cwnd = tp->t_maxseg;
tcp_timer_activate(tp, TT_KEEP, tcp_keepinit);
@@ -807,7 +858,6 @@
"(probably spoofed)\n", s, __func__);
goto failed;
}
- tcpstat.tcps_sc_recvcookie++;
} else {
/* Pull out the entry to unlock the bucket row. */
TAILQ_REMOVE(&sch->sch_bucket, sc, sc_hash);
@@ -909,6 +959,7 @@
struct mbuf *ipopts = NULL;
u_int32_t flowtmp;
int win, sb_hiwat, ip_ttl, ip_tos, noopt;
+ char *s;
#ifdef INET6
int autoflowlabel = 0;
#endif
@@ -919,6 +970,8 @@
INP_INFO_WLOCK_ASSERT(&tcbinfo);
INP_LOCK_ASSERT(inp); /* listen socket */
+ KASSERT((th->th_flags & (TH_RST|TH_ACK|TH_SYN)) == TH_SYN,
+ ("%s: unexpected tcp flags", __func__));
/*
* Combine all so/tp operations very early to drop the INP lock as
@@ -966,6 +1019,11 @@
*
* XXX: should the syncache be re-initialized with the contents
* of the new SYN here (which may have different options?)
+ *
+ * XXX: We do not check the sequence number to see if this is a
+ * real retransmit or a new connection attempt. The question is
+ * how to handle such a case; either ignore it as spoofed, or
+ * drop the current entry and create a new one?
*/
sc = syncache_lookup(inc, &sch); /* returns locked entry */
SCH_LOCK_ASSERT(sch);
@@ -997,8 +1055,16 @@
KASSERT(sc->sc_label != NULL,
("%s: label not initialized", __func__));
#endif
+ /* Retransmit SYN|ACK and reset retransmit count. */
+ if ((s = tcp_log_addrs(&sc->sc_inc, th, NULL, NULL))) {
+ log(LOG_DEBUG, "%s; %s: Reveived duplicate SYN, "
+ "resetting timer and retransmitting SYN|ACK\n",
+ s, __func__);
+ free(s, M_TCPLOG);
+ }
if (syncache_respond(sc) == 0) {
- SYNCACHE_TIMEOUT(sc);
+ sc->sc_rxmits = 0;
+ syncache_timeout(sc, sch, 1);
tcpstat.tcps_sndacks++;
tcpstat.tcps_sndtotal++;
}
@@ -1450,6 +1516,7 @@
sc->sc_tsoff = data - ticks; /* after XOR */
}
+ tcpstat.tcps_sc_sendcookie++;
return;
}
@@ -1552,6 +1619,7 @@
sc->sc_rxmits = 0;
sc->sc_peer_mss = tcp_sc_msstab[mss];
+ tcpstat.tcps_sc_recvcookie++;
return (sc);
}
==== //depot/projects/hammer/sys/netinet/tcp_usrreq.c#47 (text+ko) ====
@@ -29,7 +29,7 @@
* SUCH DAMAGE.
*
* From: @(#)tcp_usrreq.c 8.2 (Berkeley) 1/3/94
- * $FreeBSD: src/sys/netinet/tcp_usrreq.c,v 1.158 2007/06/15 22:54:11 mjacob Exp $
+ * $FreeBSD: src/sys/netinet/tcp_usrreq.c,v 1.159 2007/07/29 01:31:33 mjacob Exp $
*/
#include "opt_ddb.h"
@@ -87,7 +87,9 @@
/*
* TCP protocol interface to socket abstraction.
*/
-extern char *tcpstates[]; /* XXX ??? */
+#ifdef TCPDEBUG
+extern const char *tcpstates[];
+#endif
static int tcp_attach(struct socket *);
static int tcp_connect(struct tcpcb *, struct sockaddr *,
==== //depot/projects/hammer/sys/netinet/tcp_var.h#46 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_var.h 8.4 (Berkeley) 5/24/95
- * $FreeBSD: src/sys/netinet/tcp_var.h,v 1.154 2007/07/27 00:57:06 silby Exp $
+ * $FreeBSD: src/sys/netinet/tcp_var.h,v 1.155 2007/07/28 12:20:39 andre Exp $
*/
#ifndef _NETINET_TCP_VAR_H_
@@ -494,6 +494,7 @@
extern struct inpcbhead tcb; /* head of queue of active tcpcb's */
extern struct inpcbinfo tcbinfo;
extern struct tcpstat tcpstat; /* tcp statistics */
+extern int tcp_log_in_vain;
extern int tcp_mssdflt; /* XXX */
extern int tcp_minmss;
extern int tcp_delack_enabled;
==== //depot/projects/hammer/sys/sys/mutex.h#32 (text+ko) ====
@@ -26,7 +26,7 @@
* SUCH DAMAGE.
*
* from BSDI $Id: mutex.h,v 2.7.2.35 2000/04/27 03:10:26 cp Exp $
- * $FreeBSD: src/sys/sys/mutex.h,v 1.99 2007/07/27 11:59:57 rwatson Exp $
+ * $FreeBSD: src/sys/sys/mutex.h,v 1.100 2007/07/28 07:31:30 rwatson Exp $
*/
#ifndef _SYS_MUTEX_H_
@@ -408,7 +408,6 @@
} while (0)
#define NET_ASSERT_GIANT() do { \
} while (0)
-#define NET_CALLOUT_MPSAFE CALLOUT_MPSAFE
struct mtx_args {
struct mtx *ma_mtx;
==== //depot/projects/hammer/tools/tools/net80211/Makefile#3 (text+ko) ====
@@ -1,5 +1,5 @@
-# $FreeBSD: src/tools/tools/net80211/Makefile,v 1.3 2006/08/07 00:05:32 sam Exp $
+# $FreeBSD: src/tools/tools/net80211/Makefile,v 1.4 2007/07/28 00:18:23 thompsa Exp $
-SUBDIR= stumbler w00t wlandebug wesside wlaninject wlanstats wlanwatch
+SUBDIR= stumbler w00t wesside wlaninject wlanstats wlanwatch
.include <bsd.subdir.mk>
==== //depot/projects/hammer/tools/tools/net80211/README#2 (text+ko) ====
@@ -1,4 +1,4 @@
-$FreeBSD: src/tools/tools/net80211/README,v 1.2 2006/08/07 00:05:32 sam Exp $
+$FreeBSD: src/tools/tools/net80211/README,v 1.3 2007/07/28 00:18:23 thompsa Exp $
This directory has various tools for use with the net80211 layer.
Some may not work depending on the capabilities of the underyling
@@ -7,7 +7,6 @@
stumbler view nearby networks using raw packet interface
w00t variety of programs that use the raw packet interface
wesside WEP frag attack tool using raw packet interface
-wlandebug manipulate net80211 debug flags symbolically
wlaninject inject 802.11 packets using the raw packet interface
wlanstats dump net80211 statistics
wlanwatch monitor net80211 events via the routing socket
==== //depot/projects/hammer/usr.bin/truss/i386-fbsd.c#13 (text+ko) ====
@@ -31,7 +31,7 @@
#ifndef lint
static const char rcsid[] =
- "$FreeBSD: src/usr.bin/truss/i386-fbsd.c,v 1.28 2007/06/26 22:42:37 delphij Exp $";
+ "$FreeBSD: src/usr.bin/truss/i386-fbsd.c,v 1.29 2007/07/28 23:15:04 marcel Exp $";
#endif /* not lint */
/*
@@ -167,7 +167,7 @@
iorequest.piod_op = PIOD_READ_D;
iorequest.piod_offs = (void *)parm_offset;
iorequest.piod_addr = fsc.args;
- iorequest.piod_len = nargs * sizeof(unsigned long);
+ iorequest.piod_len = (1+nargs) * sizeof(unsigned long);
ptrace(PT_IO, cpid, (caddr_t)&iorequest, 0);
if (iorequest.piod_len == 0)
return;
==== //depot/projects/hammer/usr.bin/truss/main.c#14 (text+ko) ====
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/usr.bin/truss/main.c,v 1.45 2007/06/26 22:42:37 delphij Exp $");
+__FBSDID("$FreeBSD: src/usr.bin/truss/main.c,v 1.46 2007/07/28 23:00:42 marcel Exp $");
/*
* The main module for truss. Suprisingly simple, but, then, the other
@@ -58,7 +58,7 @@
#include "truss.h"
#include "extern.h"
-#define MAXARGS 5
+#define MAXARGS 6
static void
usage(void)
==== //depot/projects/hammer/usr.bin/truss/powerpc-fbsd.c#4 (text+ko) ====
@@ -27,7 +27,7 @@
#ifndef lint
static const char rcsid[] =
- "$FreeBSD: src/usr.bin/truss/powerpc-fbsd.c,v 1.3 2007/06/26 22:42:37 delphij Exp $";
+ "$FreeBSD: src/usr.bin/truss/powerpc-fbsd.c,v 1.4 2007/07/28 23:15:04 marcel Exp $";
#endif /* not lint */
/*
@@ -118,6 +118,9 @@
unsigned int regargs;
struct syscall *sc;
+ /* Account for a 64-bit argument with corresponding alignment. */
+ nargs += 2;
+
cpid = trussinfo->curthread->tid;
clear_fsc();
==== //depot/projects/hammer/usr.bin/truss/syscalls.c#23 (text+ko) ====
@@ -31,7 +31,7 @@
#ifndef lint
static const char rcsid[] =
- "$FreeBSD: src/usr.bin/truss/syscalls.c,v 1.53 2007/04/10 04:03:34 delphij Exp $";
+ "$FreeBSD: src/usr.bin/truss/syscalls.c,v 1.55 2007/07/28 23:18:39 marcel Exp $";
#endif /* not lint */
/*
@@ -72,6 +72,20 @@
#include "extern.h"
#include "syscall.h"
+/* 64-bit alignment on 32-bit platforms. */
+#ifdef __powerpc__
+#define QUAD_ALIGN 1
+#else
+#define QUAD_ALIGN 0
+#endif
+
+/* Number of slots needed for a 64-bit argument. */
+#ifdef __LP64__
+#define QUAD_SLOTS 1
+#else
+#define QUAD_SLOTS 2
+#endif
+
/*
* This should probably be in its own file, sorted alphabetically.
*/
@@ -82,19 +96,13 @@
{ "readlink", 1, 3,
{ { Name, 0 } , { Readlinkres | OUT, 1 }, { Int, 2 }}},
{ "lseek", 2, 3,
-#ifdef __LP64__
- { { Int, 0 }, {Quad, 2 }, { Whence, 3 }}},
-#else
- { { Int, 0 }, {Quad, 2 }, { Whence, 4 }}},
-#endif
+ { {Int, 0}, {Quad, 1 + QUAD_ALIGN},
+ {Whence, 1 + QUAD_SLOTS + QUAD_ALIGN}}},
{ "linux_lseek", 2, 3,
{ { Int, 0 }, {Int, 1 }, { Whence, 2 }}},
{ "mmap", 2, 6,
-#ifdef __LP64__
- { { Ptr, 0 }, {Int, 1}, {Mprot, 2}, {Mmapflags, 3}, {Int, 4}, {Quad, 5}}},
-#else
- { { Ptr, 0 }, {Int, 1}, {Mprot, 2}, {Mmapflags, 3}, {Int, 4}, {Quad, 6}}},
-#endif
+ { {Ptr, 0}, {Int, 1}, {Mprot, 2}, {Mmapflags, 3}, {Int, 4},
+ {Quad, 5 + QUAD_ALIGN}}},
{ "mprotect", 1, 3,
{ { Ptr, 0 }, {Int, 1}, {Mprot, 2}}},
{ "open", 1, 3,
@@ -488,13 +496,13 @@
int pid = trussinfo->pid;
switch (sc->type & ARG_MASK) {
case Hex:
- asprintf(&tmp, "0x%lx", args[sc->offset]);
+ asprintf(&tmp, "0x%x", (int)args[sc->offset]);
break;
case Octal:
- asprintf(&tmp, "0%lo", args[sc->offset]);
+ asprintf(&tmp, "0%o", (int)args[sc->offset]);
break;
case Int:
- asprintf(&tmp, "%ld", args[sc->offset]);
+ asprintf(&tmp, "%d", (int)args[sc->offset]);
break;
case Name:
{
==== //depot/projects/hammer/usr.sbin/Makefile#80 (text+ko) ====
@@ -1,5 +1,5 @@
# From: @(#)Makefile 5.20 (Berkeley) 6/12/93
-# $FreeBSD: src/usr.sbin/Makefile,v 1.370 2007/07/14 21:49:24 rwatson Exp $
+# $FreeBSD: src/usr.sbin/Makefile,v 1.371 2007/07/28 00:12:21 thompsa Exp $
.include <bsd.own.mk>
@@ -182,6 +182,7 @@
vipw \
watch \
watchdogd \
+ wlandebug \
${_wlconfig} \
wpa \
${_ypbind} \
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list