mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 05:22:48 +07:00
This is a major redesign of the netlink plugin to be able to handle ENOBUFS¹ properly. Pending verification, this change replaces the patch to increase socket buffer size, which in real life turned out to be insufficient. When nl_callback() calls recv() and it fails with ENOBUFS, we consider our cache of the kernel state invalid and thus: 1. deassert all net/ conditions 2. open a new (temporary) netlink socket 3. send RTM_GETLINK and re-assert all interfaces using nl_link() 4. send RTM_GETROUTE and re-assert all routes with nl_route() Like before, the kernel will not send us a RTM_DELROUTE when it removes the default route, so we still have to track this ourselves. This patch also refactors that functionality to only resync routes when the ifindex associated previosly with the default route goes down or is removed. The previous change that added nl_default() to recheck, has been dropped to instead reuse the standard nl_route() callback. ___ ¹ see netlink(7) for details. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>