Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys don't chase mbuf pointer when it is NULL.



details:   https://anonhg.NetBSD.org/src/rev/e77d6fe37e43
branches:  trunk
changeset: 481794:e77d6fe37e43
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sun Feb 06 08:06:43 2000 +0000

description:
don't chase mbuf pointer when it is NULL.

diffstat:

 sys/netinet/tcp_subr.c     |  12 ++++++------
 sys/netinet6/udp6_usrreq.c |   4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diffs (51 lines):

diff -r b6836b88ac5b -r e77d6fe37e43 sys/netinet/tcp_subr.c
--- a/sys/netinet/tcp_subr.c    Sun Feb 06 07:31:23 2000 +0000
+++ b/sys/netinet/tcp_subr.c    Sun Feb 06 08:06:43 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_subr.c,v 1.86 2000/01/31 14:18:57 itojun Exp $     */
+/*     $NetBSD: tcp_subr.c,v 1.87 2000/02/06 08:06:43 itojun Exp $     */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -1085,11 +1085,6 @@
        else if (inet6ctlerrmap[cmd] == 0)
                return;
 
-       /* translate addresses into internal form */
-       sa6 = *(struct sockaddr_in6 *)sa;
-       if (IN6_IS_ADDR_LINKLOCAL(&sa6.sin6_addr))
-               sa6.sin6_addr.s6_addr16[1] = htons(m->m_pkthdr.rcvif->if_index);
-
        /* if the parameter is from icmp6, decode it. */
        if (d != NULL) {
                struct ip6ctlparam *ip6cp = (struct ip6ctlparam *)d;
@@ -1101,6 +1096,11 @@
                ip6 = NULL;
        }
 
+       /* translate addresses into internal form */
+       sa6 = *(struct sockaddr_in6 *)sa;
+       if (IN6_IS_ADDR_LINKLOCAL(&sa6.sin6_addr) && m && m->m_pkthdr.rcvif)
+               sa6.sin6_addr.s6_addr16[1] = htons(m->m_pkthdr.rcvif->if_index);
+
        if (ip6) {
                /*
                 * XXX: We assume that when ip6 is non NULL,
diff -r b6836b88ac5b -r e77d6fe37e43 sys/netinet6/udp6_usrreq.c
--- a/sys/netinet6/udp6_usrreq.c        Sun Feb 06 07:31:23 2000 +0000
+++ b/sys/netinet6/udp6_usrreq.c        Sun Feb 06 08:06:43 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: udp6_usrreq.c,v 1.21 2000/02/02 23:28:10 thorpej Exp $ */
+/*     $NetBSD: udp6_usrreq.c,v 1.22 2000/02/06 08:06:45 itojun Exp $  */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -507,7 +507,7 @@
 
        /* translate addresses into internal form */
        sa6 = *(struct sockaddr_in6 *)sa;
-       if (IN6_IS_ADDR_LINKLOCAL(&sa6.sin6_addr))
+       if (IN6_IS_ADDR_LINKLOCAL(&sa6.sin6_addr) && m && m->m_pkthdr.rcvif)
                sa6.sin6_addr.s6_addr16[1] = htons(m->m_pkthdr.rcvif->if_index);
 
        if (ip6) {



Home | Main Index | Thread Index | Old Index