diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2019-01-29 23:36:36 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2019-01-29 23:36:36 +0000 |
commit | 5755b9bd4d7b0c8b5757904449fa086835c35e16 (patch) | |
tree | 6cac1dba88c958701e8292e161695d62195fd8a5 /sys/netmpls | |
parent | a232ab5318a6be13f12dd02e075cbea862d1aac2 (diff) |
check the result of rtalloc with rtisvalid instead of a compare with NULL
based on advice seen from mpi@
Diffstat (limited to 'sys/netmpls')
-rw-r--r-- | sys/netmpls/mpls_input.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/netmpls/mpls_input.c b/sys/netmpls/mpls_input.c index 093d662246e..4dac4616ed4 100644 --- a/sys/netmpls/mpls_input.c +++ b/sys/netmpls/mpls_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpls_input.c,v 1.73 2019/01/27 05:13:04 dlg Exp $ */ +/* $OpenBSD: mpls_input.c,v 1.74 2019/01/29 23:36:35 dlg Exp $ */ /* * Copyright (c) 2008 Claudio Jeker <claudio@openbsd.org> @@ -167,7 +167,7 @@ do_v6: ifp = NULL; rt = rtalloc(smplstosa(smpls), RT_RESOLVE, m->m_pkthdr.ph_rtableid); - if (rt == NULL) { + if (!rtisvalid(rt)) { /* no entry for this label */ #ifdef MPLS_DEBUG printf("MPLS_DEBUG: label not found\n"); @@ -389,7 +389,8 @@ mpls_do_error(struct mbuf *m, int type, int code, int destmtu) smpls->smpls_label = shim->shim_label & MPLS_LABEL_MASK; rt = rtalloc(smplstosa(smpls), RT_RESOLVE, 0); - if (rt == NULL) { + if (!rtisvalid(rt)) { + rtfree(rt); /* no entry for this label */ m_freem(m); return (NULL); |