Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 check result of setscope, from logan.
details: https://anonhg.NetBSD.org/src/rev/4b99ffc0dcdb
branches: trunk
changeset: 790355:4b99ffc0dcdb
user: christos <christos%NetBSD.org@localhost>
date: Fri Oct 04 14:23:14 2013 +0000
description:
check result of setscope, from logan.
diffstat:
sys/netinet6/ip6_input.c | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
diffs (47 lines):
diff -r 697bc03f3d86 -r 4b99ffc0dcdb sys/netinet6/ip6_input.c
--- a/sys/netinet6/ip6_input.c Fri Oct 04 13:04:00 2013 +0000
+++ b/sys/netinet6/ip6_input.c Fri Oct 04 14:23:14 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_input.c,v 1.143 2013/06/29 21:06:58 rmind Exp $ */
+/* $NetBSD: ip6_input.c,v 1.144 2013/10/04 14:23:14 christos Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.143 2013/06/29 21:06:58 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.144 2013/10/04 14:23:14 christos Exp $");
#include "opt_gateway.h"
#include "opt_inet.h"
@@ -806,17 +806,21 @@
ip6_setdstifaddr(struct mbuf *m, const struct in6_ifaddr *ia)
{
struct m_tag *mtag;
+ struct ip6aux *ip6a;
mtag = ip6_addaux(m);
- if (mtag != NULL) {
- struct ip6aux *ip6a;
+ if (mtag == NULL)
+ return NULL;
- ip6a = (struct ip6aux *)(mtag + 1);
- in6_setscope(&ip6a->ip6a_src, ia->ia_ifp, &ip6a->ip6a_scope_id);
- ip6a->ip6a_src = ia->ia_addr.sin6_addr;
- ip6a->ip6a_flags = ia->ia6_flags;
+ ip6a = (struct ip6aux *)(mtag + 1);
+ if (in6_setscope(&ip6a->ip6a_src, ia->ia_ifp, &ip6a->ip6a_scope_id)) {
+ IP6_STATINC(IP6_STAT_BADSCOPE);
+ return NULL;
}
- return mtag; /* NULL if failed to set */
+
+ ip6a->ip6a_src = ia->ia_addr.sin6_addr;
+ ip6a->ip6a_flags = ia->ia6_flags;
+ return mtag;
}
const struct ip6aux *
Home |
Main Index |
Thread Index |
Old Index