ok
Florian Obser([email protected]) on 2018.04.29 21:59:56 +0200:
>
> No need to get the whole routing table from the kernel if we are
> filtering by address family and / or priority; similar to what
> p_rttables() is doing.
>
> (On a router in the DFZ we need to copy 150+ MB)
>
> OK?
>
> diff --git route.c route.c
> index 031ae6c1b33..229cca1491d 100644
> --- route.c
> +++ route.c
> @@ -329,9 +329,9 @@ flushroutes(int argc, char **argv)
> mib[0] = CTL_NET;
> mib[1] = PF_ROUTE;
> mib[2] = 0; /* protocol */
> - mib[3] = 0; /* wildcard address family */
> + mib[3] = af;
> mib[4] = NET_RT_DUMP;
> - mib[5] = 0; /* no flags */
> + mib[5] = prio;
> mib[6] = tableid;
> while (1) {
> if (sysctl(mib, 7, NULL, &needed, NULL, 0) == -1)
> @@ -372,12 +372,8 @@ flushroutes(int argc, char **argv)
> if ((rtm->rtm_flags & (RTF_LOCAL|RTF_BROADCAST)) != 0)
> continue;
> sa = (struct sockaddr *)(next + rtm->rtm_hdrlen);
> - if (af && sa->sa_family != af)
> - continue;
> if (ifindex && rtm->rtm_index != ifindex)
> continue;
> - if (prio && rtm->rtm_priority != prio)
> - continue;
> if (sa->sa_family == AF_KEY)
> continue; /* Don't flush SPD */
> if (debugonly)
>
> --
> I'm not entirely sure you are real.
>