From owner-p4-projects@FreeBSD.ORG Fri Oct 24 10:54:31 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3967116A4C0; Fri, 24 Oct 2003 10:54:31 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1383616A4B3 for ; Fri, 24 Oct 2003 10:54:31 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8ACF943FB1 for ; Fri, 24 Oct 2003 10:54:30 -0700 (PDT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h9OHsUXJ006373 for ; Fri, 24 Oct 2003 10:54:30 -0700 (PDT) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h9OHsUkY006370 for perforce@freebsd.org; Fri, 24 Oct 2003 10:54:30 -0700 (PDT) (envelope-from sam@freebsd.org) Date: Fri, 24 Oct 2003 10:54:30 -0700 (PDT) Message-Id: <200310241754.h9OHsUkY006370@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 40409 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2003 17:54:31 -0000 http://perforce.freebsd.org/chv.cgi?CH=40409 Change 40409 by sam@sam_ebb on 2003/10/24 10:53:49 o add locking around changes to the routing table reference count o dump routing table entry when hitting a reference with a bad reference count o fix comments that still talk about spl's o remove duplicate DUMMYNET_DEBUG define Affected files ... .. //depot/projects/netperf/sys/netinet/ip_dummynet.c#12 edit Differences ... ==== //depot/projects/netperf/sys/netinet/ip_dummynet.c#12 (text+ko) ==== @@ -39,10 +39,7 @@ * + scheduler and dummynet functions; * + configuration and initialization. * - * NOTA BENE: critical sections are protected by splimp()/splx() - * pairs. One would think that splnet() is enough as for most of - * the netinet code, but it is not so because when used with - * bridging, dummynet is invoked at splimp(). + * NOTA BENE: critical sections are protected by the "dummynet lock". * * Most important Changes: * @@ -152,7 +149,6 @@ CTLFLAG_RD, &red_max_pkt_size, 0, "RED Max packet size"); #endif -#define DUMMYNET_DEBUG #ifdef DUMMYNET_DEBUG int dummynet_debug = 0; #ifdef SYSCTL_NODE @@ -194,10 +190,13 @@ { if (rt == NULL) return ; - if (rt->rt_refcnt <= 0) + RT_LOCK(rt); + if (rt->rt_refcnt <= 0) { printf("dummynet: warning, refcnt now %ld, decreasing\n", rt->rt_refcnt); - RTFREE(rt); + rt_print(rt); /* XXX */ + } + RTFREE_LOCKED(rt); } /* @@ -1198,11 +1197,13 @@ * a pointer into *ro so it needs to be updated. */ pkt->ro = *(fwa->ro); - if (fwa->ro->ro_rt) + if (fwa->ro->ro_rt) { + RT_LOCK(fwa->ro->ro_rt); fwa->ro->ro_rt->rt_refcnt++ ; + RT_UNLOCK(fwa->ro->ro_rt); + } if (fwa->dst == (struct sockaddr_in *)&fwa->ro->ro_dst) /* dst points into ro */ fwa->dst = (struct sockaddr_in *)&(pkt->ro.ro_dst) ; - pkt->dn_dst = fwa->dst; pkt->flags = fwa->flags; }