From 4e051c06e53f9a350390ea893bc0c5362f37358e Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Thu, 6 Jan 2011 14:50:12 +0000 Subject: dst my point to memory inside rt so move the check up before the rtfree(rt). Without this the sp_protocol on RTM_DELETE is garbage and rtsocket user that restrict the AF of the socket (like ospfd) will not see a single one of the RTM_DELETE. OK henning@, dlg@ --- sys/net/rtsock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/net/rtsock.c') diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index f42e786297b..ee882ac2b24 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.112 2011/01/06 14:45:07 claudio Exp $ */ +/* $OpenBSD: rtsock.c,v 1.113 2011/01/06 14:50:11 claudio Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -874,6 +874,8 @@ flush: rtm->rtm_flags |= RTF_DONE; } } + if (dst) + route_proto.sp_protocol = dst->sa_family; if (rt) rtfree(rt); @@ -893,8 +895,6 @@ fail: } if (rp) rp->rcb_proto.sp_family = 0; /* Avoid us */ - if (dst) - route_proto.sp_protocol = dst->sa_family; if (rtm) { m_copyback(m, 0, rtm->rtm_msglen, rtm, M_NOWAIT); if (m->m_pkthdr.len < rtm->rtm_msglen) { -- cgit v1.2.3