diff options
author | 2009-06-25 15:59:28 +0000 | |
---|---|---|
committer | 2009-06-25 15:59:28 +0000 | |
commit | 58d4bca2183c3e1033e812d57dc51d1350117978 (patch) | |
tree | 9b0b34cbc740c9495b8a3dc0608094eeaea8a40e | |
parent | Another kroute.c code with missing RTM_VERSION checks. (diff) | |
download | wireguard-openbsd-58d4bca2183c3e1033e812d57dc51d1350117978.tar.xz wireguard-openbsd-58d4bca2183c3e1033e812d57dc51d1350117978.zip |
At least try to check for the RTM_VERSION here even so part of this code
escaped from a horror story and robs you're sanity. This needs major cleanup.
OK sthen@, OK henning@
-rw-r--r-- | usr.sbin/ppp/ppp/iface.c | 6 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/route.c | 12 |
2 files changed, 16 insertions, 2 deletions
diff --git a/usr.sbin/ppp/ppp/iface.c b/usr.sbin/ppp/ppp/iface.c index d56afb5ae88..9d332d48e17 100644 --- a/usr.sbin/ppp/ppp/iface.c +++ b/usr.sbin/ppp/ppp/iface.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: iface.c,v 1.27 2005/07/17 19:13:24 brad Exp $ + * $OpenBSD: iface.c,v 1.28 2009/06/25 15:59:28 claudio Exp $ */ #include <sys/param.h> @@ -140,6 +140,8 @@ iface_Create(const char *name) while (ptr < end && iface == NULL) { ifm = (struct if_msghdr *)ptr; /* On if_msghdr */ + if (ifm->ifm_version != RTM_VERSION) + continue; if (ifm->ifm_type != RTM_IFINFO) break; dl = (struct sockaddr_dl *)(ifm + 1); /* Single _dl at end */ @@ -162,6 +164,8 @@ iface_Create(const char *name) if (ifam->ifam_type != RTM_NEWADDR) /* finished this if */ break; + if (ifm->ifm_version != RTM_VERSION) + continue; if (iface != NULL && ifam->ifam_addrs & RTA_IFA) { /* Found a configured interface ! */ diff --git a/usr.sbin/ppp/ppp/route.c b/usr.sbin/ppp/ppp/route.c index f66b6dad2d2..5b644de9028 100644 --- a/usr.sbin/ppp/ppp/route.c +++ b/usr.sbin/ppp/ppp/route.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: route.c,v 1.36 2009/06/05 22:40:24 chris Exp $ + * $OpenBSD: route.c,v 1.37 2009/06/25 15:59:28 claudio Exp $ */ #include <sys/param.h> @@ -250,6 +250,8 @@ Index2Nam(int idx) have = 0; for (ptr = buf; ptr < end; ptr += ifm->ifm_msglen) { ifm = (struct if_msghdr *)ptr; + if (ifm->ifm_version != RTM_VERSION) + continue; if (ifm->ifm_type != RTM_IFINFO) continue; dl = (struct sockaddr_dl *)(ifm + 1); @@ -363,6 +365,9 @@ route_Show(struct cmdargs const *arg) for (cp = sp; cp < ep; cp += rtm->rtm_msglen) { rtm = (struct rt_msghdr *)cp; + if (rtm->rtm_version != RTM_VERSION) + continue; + route_ParseHdr(rtm, sa); if (sa[RTAX_DST] && sa[RTAX_GATEWAY]) { @@ -431,6 +436,9 @@ route_IfDelete(struct bundle *bundle, int all) continue; for (cp = sp; cp < ep; cp += rtm->rtm_msglen) { rtm = (struct rt_msghdr *)cp; + if (rtm->rtm_version != RTM_VERSION) + continue; + route_ParseHdr(rtm, sa); if (rtm->rtm_index == bundle->iface->index && sa[RTAX_DST] && sa[RTAX_GATEWAY] && @@ -511,6 +519,8 @@ route_UpdateMTU(struct bundle *bundle) for (cp = sp; cp < ep; cp += rtm->rtm_msglen) { rtm = (struct rt_msghdr *)cp; + if (rtm->rtm_version != RTM_VERSION) + continue; route_ParseHdr(rtm, sa); if (sa[RTAX_DST] && (sa[RTAX_DST]->sa_family == AF_INET #ifndef NOINET6 |