diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-05-30 04:40:03 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-05-30 04:40:03 +0000 |
commit | c7c9a27065006a60c8aa30e8b45663e0cb2cf3a1 (patch) | |
tree | a8b9536ddb7d866082a0a5a14ece5ce0d6a42fa7 | |
parent | a8e0f4b7bc04bb2d98282b5d2767492e01e8b2a0 (diff) |
use M_READONLY where possible. minor cleanup/sync with kame.
-rw-r--r-- | sys/netinet6/ip6_mroute.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index ac621860dc3..4bd6d350d21 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_mroute.c,v 1.21 2002/05/29 07:54:59 itojun Exp $ */ +/* $OpenBSD: ip6_mroute.c,v 1.22 2002/05/30 04:40:02 itojun Exp $ */ /* $KAME: ip6_mroute.c,v 1.45 2001/03/25 08:38:51 itojun Exp $ */ /* @@ -79,8 +79,6 @@ #include <netinet6/pim6_var.h> #include <netinet6/nd6.h> -#define M_HASCL(m) ((m)->m_flags & M_EXT) - static int ip6_mdq(struct mbuf *, struct ifnet *, struct mf6c *); static void phyint_send(struct ip6_hdr *, struct mif6 *, struct mbuf *); @@ -95,7 +93,7 @@ static int register_send(struct ip6_hdr *, struct mif6 *, * Globals. All but ip6_mrouter, ip6_mrtproto and mrt6stat could be static, * except for netstat or debugging purposes. */ -struct socket *ip6_mrouter = NULL; +struct socket *ip6_mrouter = NULL; int ip6_mrouter_ver = 0; int ip6_mrtproto = IPPROTO_PIM; /* for netstat only */ struct mrt6stat mrt6stat; @@ -104,7 +102,7 @@ struct mrt6stat mrt6stat; #define RTE_FOUND 0x2 struct mf6c *mf6ctable[MF6CTBLSIZ]; -u_char nexpire[MF6CTBLSIZ]; +u_char n6expire[MF6CTBLSIZ]; struct mif6 mif6table[MAXMIFS]; #ifdef MRT6DEBUG u_int mrt6debug = 0; /* debug level */ @@ -404,7 +402,7 @@ ip6_mrouter_init(so, m, cmd) ip6_mrouter_ver = cmd; bzero((caddr_t)mf6ctable, sizeof(mf6ctable)); - bzero((caddr_t)nexpire, sizeof(nexpire)); + bzero((caddr_t)n6expire, sizeof(n6expire)); pim6 = 0;/* used for stubbing out/in pim stuff */ @@ -731,7 +729,7 @@ add_m6fc(mfccp) rt->mf6c_wrong_if = 0; rt->mf6c_expire = 0; /* Don't clean this guy up */ - nexpire[hash]--; + n6expire[hash]--; /* free packets Qed at the end of this entry */ for (rte = rt->mf6c_stall; rte != NULL; ) { @@ -779,7 +777,7 @@ add_m6fc(mfccp) rt->mf6c_wrong_if = 0; if (rt->mf6c_expire) - nexpire[hash]--; + n6expire[hash]--; rt->mf6c_expire = 0; } } @@ -1022,7 +1020,7 @@ ip6_mforward(ip6, ifp, m) * as other references may modify it in the meantime. */ if (mb0 && - (M_HASCL(mb0) || mb0->m_len < sizeof(struct ip6_hdr))) + (M_READONLY(mb0) || mb0->m_len < sizeof(struct ip6_hdr))) mb0 = m_pullup(mb0, sizeof(struct ip6_hdr)); if (mb0 == NULL) { free(rte, M_MRTABLE); @@ -1144,7 +1142,7 @@ ip6_mforward(ip6, ifp, m) rt->mf6c_mcastgrp.sin6_len = sizeof(struct sockaddr_in6); rt->mf6c_mcastgrp.sin6_addr = ip6->ip6_dst; rt->mf6c_expire = UPCALL_EXPIRE; - nexpire[hash]++; + n6expire[hash]++; rt->mf6c_parent = MF6C_INCOMPLETE_PARENT; /* link into table */ @@ -1199,7 +1197,7 @@ expire_upcalls(unused) s = splnet(); for (i = 0; i < MF6CTBLSIZ; i++) { - if (nexpire[i] == 0) + if (n6expire[i] == 0) continue; nptr = &mf6ctable[i]; while ((mfc = *nptr) != NULL) { @@ -1229,7 +1227,7 @@ expire_upcalls(unused) rte = n; } while (rte != NULL); mrt6stat.mrt6s_cache_cleanups++; - nexpire[i]--; + n6expire[i]--; *nptr = mfc->mf6c_next; free(mfc, M_MRTABLE); @@ -1310,7 +1308,7 @@ ip6_mdq(m, ifp, rt) mm = m_copy(m, 0, sizeof(struct ip6_hdr)); if (mm && - (M_HASCL(mm) || + (M_READONLY(mm) || mm->m_len < sizeof(struct ip6_hdr))) mm = m_pullup(mm, sizeof(struct ip6_hdr)); if (mm == NULL) @@ -1437,7 +1435,7 @@ phyint_send(ip6, mifp, m) */ mb_copy = m_copy(m, 0, M_COPYALL); if (mb_copy && - (M_HASCL(mb_copy) || mb_copy->m_len < sizeof(struct ip6_hdr))) + (M_READONLY(mb_copy) || mb_copy->m_len < sizeof(struct ip6_hdr))) mb_copy = m_pullup(mb_copy, sizeof(struct ip6_hdr)); if (mb_copy == NULL) { splx(s); |