The list_routes() function uses sysctl to query all the routes on the system. First it learns the size of the buffer it needs, allocates that buffer, and then it requests the routes with sysctl. However, it is possible that not the whole buffer is used. In that case we need to use/check the length returned by sysctl and not use the length of the original buffer.
The
list_routes()
function usessysctl
to query all the routes on the system. First it learns the size of the buffer it needs, allocates that buffer, and then it requests the routes withsysctl
. However, it is possible that not the whole buffer is used. In that case we need to use/check the length returned bysysctl
and not use the length of the original buffer.