Date: Fri, 22 Nov 2002 13:30:07 -0800 (PST) From: Archie Cobbs <archie@dellroad.org> To: Mihail Balikov <misho@interbgc.com> Cc: freebsd-net@FreeBSD.org Subject: Re: ip_forward() and ipforward_rt Message-ID: <200211222130.gAMLU7qn072875@arch20m.dellroad.org> In-Reply-To: <000f01c2926d$250d14a0$e5e709d9@interbgc.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200211222130.gAMLU7qn072875>
