tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: refactoring ip_output() and the L2 _output()

David Young wrote:

It's funny that we get into ether_output() with an rtentry that's
not even usable.  I'm not sure how that happens.  I will have to
look more carefully at what ip_output() is doing.

                        if ((rt0 = rt = rtalloc1(dst, 1)) != NULL) {
                                if (rt->rt_ifp != ifp)
                                        return (*rt->rt_ifp->if_output)
                                                        (ifp, m0, dst, rt);
} else senderr(EHOSTUNREACH);

Yikes!  To call rt->rt_ifp's output routine with a different ifp is not
advisable, is it?  ISTR finding a bug in carp(4) involving a similar
pattern, ifpX->if_output(ifqY, ...).

If both bge0 and bge1 are on the same subnet then a route out
of either can be used to transmit out either.

So if bge0's IP is and bge1 is and I want to
reach, a cached route might point to bge0 however the
kernel could just as easily decide to use bge1 (maybe bge0 is

So in places where you have, for example:
+            return ip_hresolv_output(rt->rt_ifp, m, dst, rt);

you should replace the "rt->rt_ifp" with just "ifp".

For the purposes of research, you may want to add a statistic
that is bumped whenever "rt->rt_ifp != ifp" when ip_output()
is called.


Home | Main Index | Thread Index | Old Index