Module Name: src
Committed By: christos
Date: Thu Mar 12 19:36:33 UTC 2020
Modified Files:
src/sys/net: rtsock_shared.c
Log Message:
move debugging code after the NULL check.
To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/net/rtsock_shared.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/net/rtsock_shared.c
diff -u src/sys/net/rtsock_shared.c:1.15 src/sys/net/rtsock_shared.c:1.16
--- src/sys/net/rtsock_shared.c:1.15 Sat Feb 22 04:30:42 2020
+++ src/sys/net/rtsock_shared.c Thu Mar 12 15:36:33 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: rtsock_shared.c,v 1.15 2020/02/22 09:30:42 maxv Exp $ */
+/* $NetBSD: rtsock_shared.c,v 1.16 2020/03/12 19:36:33 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.15 2020/02/22 09:30:42 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.16 2020/03/12 19:36:33 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -686,6 +686,10 @@ COMPATNAME(route_output)(struct mbuf *m,
senderr(EINVAL);
}
info.rti_flags = rtm->rtm_flags;
+ if (info.rti_info[RTAX_DST] == NULL ||
+ (info.rti_info[RTAX_DST]->sa_family >= AF_MAX)) {
+ senderr(EINVAL);
+ }
#ifdef RTSOCK_DEBUG
if (info.rti_info[RTAX_DST]->sa_family == AF_INET) {
char abuf[INET_ADDRSTRLEN];
@@ -693,10 +697,6 @@ COMPATNAME(route_output)(struct mbuf *m,
RT_IN_PRINT(&info, abuf, RTAX_DST));
}
#endif /* RTSOCK_DEBUG */
- if (info.rti_info[RTAX_DST] == NULL ||
- (info.rti_info[RTAX_DST]->sa_family >= AF_MAX)) {
- senderr(EINVAL);
- }
if (info.rti_info[RTAX_GATEWAY] != NULL &&
(info.rti_info[RTAX_GATEWAY]->sa_family >= AF_MAX)) {
senderr(EINVAL);