From owner-freebsd-net Fri Nov 22 13:45:13 2002 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5413637B401 for ; Fri, 22 Nov 2002 13:45:12 -0800 (PST) Received: from InterJet.dellroad.org (adsl-63-194-81-26.dsl.snfc21.pacbell.net [63.194.81.26]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9839143EA3 for ; Fri, 22 Nov 2002 13:45:11 -0800 (PST) (envelope-from archie@dellroad.org) Received: from arch20m.dellroad.org (arch20m.dellroad.org [10.1.1.20]) by InterJet.dellroad.org (8.9.1a/8.9.1) with ESMTP id NAA92877; Fri, 22 Nov 2002 13:30:07 -0800 (PST) Received: from arch20m.dellroad.org (localhost [127.0.0.1]) by arch20m.dellroad.org (8.12.6/8.12.6) with ESMTP id gAMLU7OS072876; Fri, 22 Nov 2002 13:30:07 -0800 (PST) (envelope-from archie@arch20m.dellroad.org) Received: (from archie@localhost) by arch20m.dellroad.org (8.12.6/8.12.6/Submit) id gAMLU7qn072875; Fri, 22 Nov 2002 13:30:07 -0800 (PST) From: Archie Cobbs Message-Id: <200211222130.gAMLU7qn072875@arch20m.dellroad.org> Subject: Re: ip_forward() and ipforward_rt In-Reply-To: <000f01c2926d$250d14a0$e5e709d9@interbgc.com> To: Mihail Balikov Date: Fri, 22 Nov 2002 13:30:07 -0800 (PST) Cc: freebsd-net@FreeBSD.org X-Mailer: ELM [version 2.4ME+ PL99b (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Mihail Balikov wrote: > In -stable ip_input.c in_forward() we cache last used route in ipforward_rt. > > sin = (struct sockaddr_in *)&ipforward_rt.ro_dst; > if ((rt = ipforward_rt.ro_rt) == 0 || > pkt_dst.s_addr != sin->sin_addr.s_addr) { > if (ipforward_rt.ro_rt) { > RTFREE(ipforward_rt.ro_rt); > ipforward_rt.ro_rt = 0; > } > sin->sin_family = AF_INET; > sin->sin_len = sizeof(*sin); > sin->sin_addr = pkt_dst; > > rtalloc_ign(&ipforward_rt, RTF_PRCLONING); > if (ipforward_rt.ro_rt == 0) { > icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, dest, > 0); > return; > } > rt = ipforward_rt.ro_rt; > } > > In my opinion, we should verify that ipforward_rt is not last reference to > route and route is UP: > > sin = (struct sockaddr_in *)&ipforward_rt.ro_dst; > if ((rt = ipforward_rt.ro_rt) == 0 || > pkt_dst.s_addr != sin->sin_addr.s_addr || > rt->rt_refcnt <= 1 || > (rt->rt_flags & RTF_UP) == 0) { > .... > } Sounds like kern/10778... ? http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/10778 -Archie __________________________________________________________________________ Archie Cobbs * Packet Design * http://www.packetdesign.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message