Hello,

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) {
                ....
        }

regards,
Mihail



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message

Reply via email to