Ivo Vachkov wrote:
My lookup code looks like the following:

        struct sockaddr_in6 *dst = NULL;
        struct route_in6 out_rt;

        /* ... */

        dst = (struct sockaddr_in6 *)&out_rt.ro_dst;
        bzero(dst, sizeof(*dst));
        dst->sin6_len = sizeof(struct sockaddr_in6);
        dst->sin6_family = AF_INET6;
        dst->sin6_addr = ip6->ip6_dst;

        rtalloc((struct route *)&out_rt);

You need to remember to drop the lock which rtalloc() acquires on your behalf using RTFREE() before leaving the function or possibly calling a function which needs exclusive/write access to the rtentry.

If your code needs this rtentry to remain in the system, a call to RT_ADDREF() with the lock held may be necessary, although you should remember to RT_REMREF() with the lock held when done with the rtentry.

See «net/route.h» for more info.

regards,
BMS

_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to