diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2001-06-04 23:21:11 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2001-06-04 23:21:11 +0000 |
commit | 53d05487f71f5b7935f0aa0f6eea1d503a3e920d (patch) | |
tree | ddc2f03ca8bfe494958a3013d9fbebd2795e3d79 | |
parent | 68326b0f89160cca96dd9338db891c843ae67c6b (diff) |
adjust routing socket message (kernel -> user) to the right size.
with old code we may see junk at the end. sync with kame, 4.4BSD bug.
-rw-r--r-- | sys/net/rtsock.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 81901fb7c92..b9c7b56eb81 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.14 2001/05/16 12:53:34 ho Exp $ */ +/* $OpenBSD: rtsock.c,v 1.15 2001/06/04 23:21:10 itojun Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -398,13 +398,19 @@ flush: } if (rtm) { m_copyback(m, 0, rtm->rtm_msglen, (caddr_t)rtm); + if (m->m_pkthdr.len < rtm->rtm_msglen) { + m_freem(m); + m = NULL; + } else if (m->m_pkthdr.len > rtm->rtm_msglen) + m_adj(m, rtm->rtm_msglen - m->m_pkthdr.len); Free(rtm); } if (rp) rp->rcb_proto.sp_family = 0; /* Avoid us */ if (dst) route_proto.sp_protocol = dst->sa_family; - raw_input(m, &route_proto, &route_src, &route_dst); + if (m) + raw_input(m, &route_proto, &route_src, &route_dst); if (rp) rp->rcb_proto.sp_family = PF_ROUTE; } |