>
> The roadmap for locking up the IP stack looks like roughly like ifaddr
> ref counts, ifnet list, routing radix tree, ARP, ifaddr uses, and rtentry.

However, it seems that the rtentries' rt_refcnt are not used like ifaddr, 
ifnet, ... It looks like something dirty has been done a long time ago.
For example, the following lines:

        rt = rtalloc1((struct sockaddr *)&sin, create, 0UL);
        if (rt == 0)
                return (0);
        rt->rt_refcnt--;

        if (rt->rt_flags & RTF_GATEWAY)
                why = "host is not on local network";
        else if ((rt->rt_flags & RTF_LLINFO) == 0)
                why = "could not allocate llinfo";
        else if (rt->rt_gateway->sa_family != AF_LINK)
                why = "gateway route is not ours";
   [...]
        return ((struct llinfo_arp *)rt->rt_llinfo);

Why is rt_refnt decreased so early and not later ?

I would think that it would be more correct to have:
        rt = rtalloc1((struct sockaddr *)&sin, create, 0UL);
        if (rt == 0)
                return (0);

        if (rt->rt_flags & RTF_GATEWAY)
                why = "host is not on local network";
        else if ((rt->rt_flags & RTF_LLINFO) == 0)
                why = "could not allocate llinfo";
        else if (rt->rt_gateway->sa_family != AF_LINK)
                why = "gateway route is not ours";
   [...]
        rt->rt_refcnt--;

        return ((struct llinfo_arp *)rt->rt_llinfo);

It looks like rt_refcnt is decreased just after many rtalloc() in order just 
to be sure that it won't be forgotten later, doesn'it ?

> I'm a little over 3/5 of the way done along this path.

Good luck,
  Vincent

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

Reply via email to