Module Name: src Committed By: ozaki-r Date: Tue Apr 26 09:30:01 UTC 2016
Modified Files: src/sys/net: if_mpls.c route.c route.h src/sys/netinet: in_offload.c ip_output.c ip_var.h src/sys/netinet6: nd6.c Log Message: Stop using rt_gwroute on packet sending paths 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 apply a lock (and/or psref) to the routing table and rtentries. 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 copied 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. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/net/if_mpls.c cvs rdiff -u -r1.164 -r1.165 src/sys/net/route.c cvs rdiff -u -r1.99 -r1.100 src/sys/net/route.h cvs rdiff -u -r1.6 -r1.7 src/sys/netinet/in_offload.c cvs rdiff -u -r1.251 -r1.252 src/sys/netinet/ip_output.c cvs rdiff -u -r1.110 -r1.111 src/sys/netinet/ip_var.h cvs rdiff -u -r1.192 -r1.193 src/sys/netinet6/nd6.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.