Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 In rump (ifp)->if_afdata[AF_INET6] == NULL if w...
details: https://anonhg.NetBSD.org/src/rev/1421ce74a50b
branches: trunk
changeset: 347074:1421ce74a50b
user: christos <christos%NetBSD.org@localhost>
date: Fri Aug 12 11:44:24 2016 +0000
description:
In rump (ifp)->if_afdata[AF_INET6] == NULL if we did not register netinet6
yet. Treat this like we don't have a scope, and make the sid tests consistent.
diffstat:
sys/netinet6/scope6.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diffs (49 lines):
diff -r 924dcc9fd693 -r 1421ce74a50b sys/netinet6/scope6.c
--- a/sys/netinet6/scope6.c Fri Aug 12 11:43:04 2016 +0000
+++ b/sys/netinet6/scope6.c Fri Aug 12 11:44:24 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scope6.c,v 1.14 2016/06/15 06:01:21 ozaki-r Exp $ */
+/* $NetBSD: scope6.c,v 1.15 2016/08/12 11:44:24 christos Exp $ */
/* $KAME$ */
/*-
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scope6.c,v 1.14 2016/06/15 06:01:21 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scope6.c,v 1.15 2016/08/12 11:44:24 christos Exp $");
#include <sys/param.h>
#include <sys/malloc.h>
@@ -56,7 +56,8 @@
static struct scope6_id sid_default;
#define SID(ifp) \
- (((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->scope6_id)
+ ((ifp)->if_afdata[AF_INET6] == NULL ? NULL : \
+ ((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->scope6_id)
void
scope6_init(void)
@@ -100,9 +101,7 @@
{
int i;
int error = 0;
- struct scope6_id *sid = NULL;
-
- sid = SID(ifp);
+ struct scope6_id *sid = SID(ifp);
if (!sid) /* paranoid? */
return (EINVAL);
@@ -393,7 +392,8 @@
uint32_t zoneid = 0;
const struct scope6_id *sid = SID(ifp);
- KASSERT(sid != NULL);
+ if (sid == NULL)
+ return EINVAL;
/*
* special case: the loopback address can only belong to a loopback
Home |
Main Index |
Thread Index |
Old Index