> > At different points in the code, we use a different chain of pointers
 > > to get an ill_t...
 > > 
 > > Are there any occasions when ire->ire_stq->q_ptr (when ire_stq is
 > > non-null) is going to be different to ire->ire_ipif->ipif_ill?
 > 
 > Yes.  ire_ipif is the cached source address to be used when using this 
 > ire, which may not be assigned to the same interface as the output 
 > interface (which is (ill_t *)ire_stq->q_ptr).  This is often true when 
 > using IPMP, or when using vni (or even lo) to host source addresses, or 
 > with IPv6 when the best choice of source address when doing source 
 > address selection belongs to an interface other than the output interface 
 > (if candidate addresses on the output interface are deprecated, for example).

Indeed.  The IPMP Rearchitecture work makes this especially common --
e.g., the IRE_CACHE entries have an ire_ipif that refers to the IPMP ill
and an ire_stq that refers to an underlying interface in the group.

BTW, there are a number of bits of code that get this wrong.  For
instance, a number of calls to ipif_select_source() pass dst_ill when they
should instead pass ipif->ipif_ill.  This is why ipif_select_source() has
to do silly things like:

        if (ill->ill_usesrc_ifindex != 0) {
                usill = ill_lookup_on_ifindex(ill->ill_usesrc_ifindex,
                    B_FALSE, NULL, NULL, NULL, NULL, ipst);
                if (usill != NULL)
                        ill = usill;    /* Select source from usesrc ILL */
                else
                        return (NULL);
        }

The above code would be needless if ipif->ipif_ill was properly passed in.

--
meem
_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to