Do not require radix write lock to be held while dumping route table

via sysctl(4) interface. This permits router not to stop forwarding
packets while route table is being written to user-supplied buffer.

Reported by:        Pawel Tyll <ptyll@nitronet.pl>
Approved by:        kib(mentor)

MFC after:          1 week
This commit is contained in:
Alexander V. Chernikov 2012-04-22 16:13:23 +00:00
parent 4bcb1430a8
commit c2508034a2

View File

@ -1884,10 +1884,10 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS)
for (error = 0; error == 0 && i <= lim; i++) {
rnh = rt_tables_get_rnh(req->td->td_proc->p_fibnum, i);
if (rnh != NULL) {
RADIX_NODE_HEAD_LOCK(rnh);
RADIX_NODE_HEAD_RLOCK(rnh);
error = rnh->rnh_walktree(rnh,
sysctl_dumpentry, &w);
RADIX_NODE_HEAD_UNLOCK(rnh);
RADIX_NODE_HEAD_RUNLOCK(rnh);
} else if (af != 0)
error = EAFNOSUPPORT;
}