Mark routes sent via sysctl(2) with RTF_DONE like it is done on the
authorclaudio <claudio@openbsd.org>
Thu, 16 Jun 2022 10:35:45 +0000 (10:35 +0000)
committerclaudio <claudio@openbsd.org>
Thu, 16 Jun 2022 10:35:45 +0000 (10:35 +0000)
route socket. All messages passed are by definition done. This may
allow to share more code between sysctl and route socket parsers.
OK mpi@

sys/net/rtsock.c

index bb2c122..741d660 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: rtsock.c,v 1.328 2022/06/06 14:45:41 claudio Exp $    */
+/*     $OpenBSD: rtsock.c,v 1.329 2022/06/16 10:35:45 claudio Exp $    */
 /*     $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $  */
 
 /*
@@ -1987,7 +1987,7 @@ sysctl_dumpentry(struct rtentry *rt, void *v, unsigned int id)
                struct rt_msghdr *rtm = (struct rt_msghdr *)w->w_tmem;
 
                rtm->rtm_pid = curproc->p_p->ps_pid;
-               rtm->rtm_flags = rt->rt_flags;
+               rtm->rtm_flags = RTF_DONE | rt->rt_flags;
                rtm->rtm_priority = rt->rt_priority & RTP_MASK;
                rtm_getmetrics(&rt->rt_rmx, &rtm->rtm_rmx);
                /* Do not account the routing table's reference. */