Module Name: src
Committed By: christos
Date: Fri Aug 12 11:44:24 UTC 2016
Modified Files:
src/sys/netinet6: scope6.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/netinet6/scope6.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/netinet6/scope6.c
diff -u src/sys/netinet6/scope6.c:1.14 src/sys/netinet6/scope6.c:1.15
--- src/sys/netinet6/scope6.c:1.14 Wed Jun 15 02:01:21 2016
+++ src/sys/netinet6/scope6.c Fri Aug 12 07:44:24 2016
@@ -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 @@ int ip6_use_defzone = 0;
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 @@ scope6_set(struct ifnet *ifp, const stru
{
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 @@ in6_setscope(struct in6_addr *in6, const
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