diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2007-09-08 16:55:06 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2007-09-08 16:55:06 +0000 |
commit | dc0ceca9187cac5e52e3cf0115b5b60caba6a998 (patch) | |
tree | 3bd0d039b75498f5d44f5b41ce70ef47184f20fc | |
parent | 2af88f774fc43e898292a33514a08b7313c8e183 (diff) |
Clear the message header (and only the message header) in rt_msg2.
By doing so we ensure that all the memory is initialised and we no longer
have to ensure that none of the structure elements is forgotten in
sysctl_iflist() and sysctl_dumpentry().
This solves the route flush issues seen by aanriot@
OK henning@
-rw-r--r-- | sys/net/rtsock.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 661192c0f9e..ae33fddc40c 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.65 2007/09/07 11:15:19 claudio Exp $ */ +/* $OpenBSD: rtsock.c,v 1.66 2007/09/08 16:55:05 claudio Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -691,6 +691,9 @@ again: rw->w_where = 0; } } + if (cp) /* clear the message header */ + bzero(cp0, hlen); + if (cp && vers != RTM_OVERSION) { struct rt_msghdr *rtm = (struct rt_msghdr *)cp0; @@ -906,11 +909,9 @@ sysctl_dumpentry(struct radix_node *rn, void *v) struct rt_msghdr *rtm = (struct rt_msghdr *)w->w_tmem; rtm->rtm_flags = rt->rt_flags; - rtm->rtm_use = 0; rt_getmetrics(&rt->rt_rmx, &rtm->rtm_rmx); rtm->rtm_rmx.rmx_refcnt = rt->rt_refcnt; rtm->rtm_index = rt->rt_ifp->if_index; - rtm->rtm_errno = rtm->rtm_pid = rtm->rtm_seq = 0; rtm->rtm_addrs = info.rti_addrs; if ((error = copyout(rtm, w->w_where, size)) != 0) w->w_where = NULL; @@ -923,11 +924,9 @@ sysctl_dumpentry(struct radix_node *rn, void *v) struct rt_omsghdr *rtm = (struct rt_omsghdr *)w->w_tmem; rtm->rtm_flags = rt->rt_flags; - rtm->rtm_use = 0; rtm->rtm_rmx.rmx_locks = rt->rt_rmx.rmx_locks; rtm->rtm_rmx.rmx_mtu = rt->rt_rmx.rmx_mtu; rtm->rtm_index = rt->rt_ifp->if_index; - rtm->rtm_errno = rtm->rtm_pid = rtm->rtm_seq = 0; rtm->rtm_addrs = info.rti_addrs; if ((error = copyout(rtm, w->w_where, size)) != 0) w->w_where = NULL; |