]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Flush remaining routes from the routing table during VNET shutdown.
authorAlexander V. Chernikov <melifaro@FreeBSD.org>
Mon, 8 Mar 2021 21:35:41 +0000 (21:35 +0000)
committerAlexander V. Chernikov <melifaro@FreeBSD.org>
Sun, 28 Mar 2021 20:40:48 +0000 (20:40 +0000)
commit6f4f8a441aaab2e23a8e70ed0689daa05cec3ef4
tree9a23cfb6308fb5283e59eae249d15a39daeadc3b
parent367fcd5bce34bcd9aff540443a0d2e7fa5dbe90a
Flush remaining routes from the routing table during VNET shutdown.

Summary:
This fixes rtentry leak for the cloned interfaces created inside the
 VNET.

Loopback teardown order is `SI_SUB_INIT_IF`, which happens after `SI_SUB_PROTO_DOMAIN` (route table teardown).
Thus, any route table operations are too late to schedule.
As the intent of the vnet teardown procedures to minimise the amount of effort by doing global cleanups instead of per-interface ones, address this by adding a relatively light-weight routing table cleanup function, `rib_flush_routes()`.
It removes all remaining routes from the routing table and schedules the deletion, which will happen later, when `rtables_destroy()` waits for the current epoch to finish.

Test Plan:
```
set_skip:set_skip_group_lo  ->  passed  [0.053s]
tail -n 200 /var/log/messages | grep rtentry
```

PR: 253998
Reported by: rashey at superbox.pl
Reviewed By: kp
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D29116

(cherry picked from commit 8aafa7a0276302a0dcc3d0bd78b4d3842dfd1640)
sys/net/route.c
sys/net/route.h
sys/net/route/route_ctl.c
sys/netinet/ip_input.c
sys/netinet6/ip6_input.c