Fix reference count leak with L2 caching.

Authored by karels on Mar 20 2017, 12:27 AM.



ip_forward, TCP/IPv6, and probably SCTP leaked references to L2 cache
entry because they used their own routes on the stack, not in_pcb routes.
The original model for route caching was callers that provided a route
structure to ip{,6}input() would keep the route, and this model was used
for L2 caching as well. Instead, change L2 caching to be done by default
only when using a route structure in the in_pcb; the pcb deallocation
code frees L2 as well as L3 cacches. A separate change will add route
caching to TCP/IPv6.

Another suggestion was to have the transport protocols indicate willingness
to use L2 caching, but this approach keeps the changes in the network

Test Plan

Tested with kgdb to verify cache operation and proper freeing of lle's.
Will ask original reporter to confirm.

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
karels created this revision.Mar 20 2017, 12:27 AM
ae accepted this revision.Mar 20 2017, 8:05 AM

This is something that I mean when said about setting RT_LLE_CACHE flags in the TCP/UDP code. This even looks better.

This revision is now accepted and ready to land.Mar 20 2017, 8:05 AM
gnn accepted this revision.Mar 25 2017, 2:07 PM
This revision was automatically updated to reflect the committed changes.