tech-kern archive

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

Re: Stop using rt_gwroute



On Mon, Apr 25, 2016 at 1:05 PM, Ryota Ozaki <ozaki-r%netbsd.org@localhost> wrote:
> Hi,
>
> rt_gwroute of rtentry is a reference to a rtentry of the gateway
> for a rtentry with RTF_GATEWAY. That was used by L2 (arp and ndp)
> to look up L2 addresses. By separating L2 nexthop caches, we don't
> need a route for the purpose and we can stop using rt_gwroute.
> By doing so, we can reduce referencing and modifying rtentries,
> which makes it easy to applying a lock (and/or psref) to the
> routing table and rtentries.
>
> Here is a patch:
>   http://www.netbsd.org/~ozaki-r/no-rt_gwroute.diff

Oops. Exactly said, the patch stops using rt_gwroute *on packet
sending paths*. There remains places touching rt_gwroute but
they'll be removed in another step.

  ozaki-r

>
> One issue to do this is to keep RTF_REJECT behavior. It seems it
> was broken when we moved rtalloc1 things from L2 output routines
> (e.g., ether_output) to ip_hresolv_output, but (fortunately?)
> it works unexpectedly. What we mistook are:
> - RTF_REJECT was checked for any routes in L2 output routines,
>   but in ip_hresolv_output it is checked only when the route
>   is RTF_GATEWAY
> - The RTF_REJECT check wasn't moved to IPv6 (nd6_output)
>
> It seems that rt_gwroute checks hid the mistakes and it looked
> work (unexpectedly) and removing rt_gwroute checks unveil the
> issue. So we need to fix RTF_REJECT checks in ip_hresolv_output
> and also add them to nd6_output.
>
> One more point we have to care is returning an errno; we need
> to mimic looutput behavior. Originally RTF_REJECT check was
> done either in L2 output routines or in looutput. The latter is
> applied when a reject route directs to a loopback interface.
> However, now RTF_REJECT check is done before looutput so to keep
> the original behavior we need to return an errno which looutput
> chooses. Added rt_check_reject_route does such tweaks.
>
> Any comments or suggestions?
>
> Thanks,
>   ozaki-r


Home | Main Index | Thread Index | Old Index