Skip to content

Commit

Permalink
do not touch struct ip6stat on non-INET6 compilation.
Browse files Browse the repository at this point in the history
From: Paul Goyette <paul@whooppee.com>
  • Loading branch information
itojun committed Jul 2, 2000
1 parent bb803c6 commit e2c731d
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions kame/sys/netinet/ip6.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $KAME: ip6.h,v 1.8 2000/07/02 13:58:29 itojun Exp $ */
/* $KAME: ip6.h,v 1.9 2000/07/02 21:01:32 itojun Exp $ */

/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
Expand Down Expand Up @@ -321,30 +321,36 @@ struct ip6_frag {
* supposed to never be matched but is prepared just in case.
*/

#ifdef INET6
#define IP6_EXTHDR_STAT(x) x
#else
#define IP6_EXTHDR_STAT(x)
#endif

#define IP6_EXTHDR_CHECK(m, off, hlen, ret) \
do { \
if ((m)->m_next != NULL) { \
if (((m)->m_flags & M_LOOP) && \
((m)->m_len < (off) + (hlen)) && \
(((m) = m_pullup((m), (off) + (hlen))) == NULL)) { \
ip6stat.ip6s_exthdrtoolong++; \
IP6_EXTHDR_STAT(ip6stat.ip6s_exthdrtoolong++; \
return ret; \
} else if ((m)->m_flags & M_EXT) { \
if ((m)->m_len < (off) + (hlen)) { \
ip6stat.ip6s_exthdrtoolong++; \
IP6_EXTHDR_STAT(ip6stat.ip6s_exthdrtoolong++); \
m_freem(m); \
return ret; \
} \
} else { \
if ((m)->m_len < (off) + (hlen)) { \
ip6stat.ip6s_exthdrtoolong++; \
IP6_EXTHDR_STAT(ip6stat.ip6s_exthdrtoolong++); \
m_freem(m); \
return ret; \
} \
} \
} else { \
if ((m)->m_len < (off) + (hlen)) { \
ip6stat.ip6s_tooshort++; \
IP6_EXTHDR_STAT(ip6stat.ip6s_tooshort++); \
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); \
m_freem(m); \
return ret; \
Expand All @@ -366,7 +372,7 @@ do { \
do { \
struct mbuf *t; \
int tmp; \
ip6stat.ip6s_exthdrget++; \
IP6_EXTHDR_STAT(ip6stat.ip6s_exthdrget++); \
if ((m)->m_len >= (off) + (len)) \
(val) = (typ)(mtod((m), caddr_t) + (off)); \
else { \
Expand All @@ -385,7 +391,7 @@ do { \
#define IP6_EXTHDR_GET0(val, typ, m, off, len) \
do { \
struct mbuf *t; \
ip6stat.ip6s_exthdrget0++; \
IP6_EXTHDR_STAT(ip6stat.ip6s_exthdrget0++); \
if ((off) == 0) \
(val) = (typ)mtod(m, caddr_t); \
else { \
Expand Down

0 comments on commit e2c731d

Please sign in to comment.