m->m_pkthdr.rcvif = NULL;
icmp6stat.icp6s_outhist[type]++;
- icmp6_reflect(m, sizeof(struct ip6_hdr)); /*header order: IPv6 - ICMPv6*/
+ icmp6_reflect(m, sizeof(struct ip6_hdr)); /* header order: IPv6 - ICMPv6 */
return;
* Process a received ICMP6 message.
*/
int
-icmp6_input(mp, offp, proto)
+icmp6_input(mp, offp)
struct mbuf **mp;
- int *offp, proto;
+ int *offp;
{
struct mbuf *m = *mp, *n;
struct ip6_hdr *ip6, *nip6;
#ifndef PULLDOWN_TEST
IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_hdr), IPPROTO_DONE);
- /* m might change if M_LOOP. So, call mtod after this */
+ /* m might change if M_LOOP. So, call mtod after this */
#endif
/*
bcopy(icmp6, nicmp6, sizeof(struct icmp6_hdr));
p = (u_char *)(nicmp6 + 1);
bzero(p, 4);
- bcopy(hostname, p + 4, maxhlen); /*meaningless TTL*/
+ bcopy(hostname, p + 4, maxhlen); /* meaningless TTL */
noff = sizeof(struct ip6_hdr);
- M_COPY_PKTHDR(n, m); /* just for recvif */
+ M_COPY_PKTHDR(n, m); /* just for rcvif */
n->m_pkthdr.len = n->m_len = sizeof(struct ip6_hdr) +
sizeof(struct icmp6_hdr) + 4 + maxhlen;
nicmp6->icmp6_type = ICMP6_WRUREPLY;
static int
icmp6_notify_error(m, off, icmp6len, code)
struct mbuf *m;
- int off, icmp6len;
+ int off, icmp6len, code;
{
struct icmp6_hdr *icmp6;
struct ip6_hdr *eip6;
struct ip6_rthdr0 *rth0;
int rthlen;
- while (1) { /* XXX: should avoid inf. loop explicitly? */
+ while (1) { /* XXX: should avoid infinite loop explicitly? */
struct ip6_ext *eh;
switch (nxt) {
default:
/*
* This case includes ESP and the No Next
- * Header. In such cases going to the notify
+ * Header. In such cases going to the notify
* label does not have any meaning
* (i.e. ctlfunc will be NULL), but we go
* anyway since we might have to update
}
panic("should not reach here");
- /*NOTREACHED*/
+ /* NOTREACHED */
fail:
if (m)
/*
* check if anycast is okay.
- * XXX: just experimental. not in the spec.
+ * XXX: just experimental. not in the spec.
*/
if ((ifa6->ia6_flags & IN6_IFF_ANYCAST) != 0 &&
(niflags & NI_NODEADDR_FLAG_ANYCAST) == 0)
if (ia == NULL && IN6_IS_ADDR_LINKLOCAL(&t) && (m->m_flags & M_LOOP)) {
/*
* This is the case if the dst is our link-local address
- * and the sender is also ourseleves.
+ * and the sender is also ourselves.
*/
src = &t;
}
/*
* This case matches to multicasts, our anycast, or unicasts
- * that we do not own. Select a source address based on the
+ * that we do not own. Select a source address based on the
* source address of the erroneous packet.
*/
bzero(&ro, sizeof(ro));
nd6_cache_lladdr(ifp, &redtgt6, lladdr, lladdrlen, ND_REDIRECT,
is_onlink ? ND_REDIRECT_ONLINK : ND_REDIRECT_ROUTER);
- if (!is_onlink) { /* better router case. perform rtredirect. */
+ if (!is_onlink) { /* better router case. perform rtredirect. */
/* perform rtredirect */
struct sockaddr_in6 sdst;
struct sockaddr_in6 sgw;
icmp6_errcount(&icmp6stat.icp6s_outerrhist, ND_REDIRECT, 0);
- /* if we are not router, we don't send icmp6 redirect */
- if (!ip6_forwarding || ip6_accept_rtadv)
- goto fail;
-
/* sanity check */
if (!m0 || !rt || !(rt->rt_flags & RTF_UP) || !(ifp = rt->rt_ifp))
goto fail;
+ /* if we are not router, we don't send icmp6 redirect */
+ if (!ip6_forwarding || ip6_accept_rtadv || (ifp->if_eflags & IFEF_ACCEPT_RTADVD))
+ goto fail;
+
/*
* Address check:
* the source address must identify a neighbor, and
if (!rt_router)
goto nolladdropt;
len = sizeof(*nd_opt) + ifp->if_addrlen;
- len = (len + 7) & ~7; /*round by 8*/
+ len = (len + 7) & ~7; /* round by 8 */
/* safety check */
if (len + (p - (u_char *)ip6) > maxlen)
goto nolladdropt;
timersub(&tv, lasttime, &delta);
/*
- * check for 0,0 is so that the message will be seen at least once.
- * if more than one second have passed since the last update of
+ * Check for 0,0 so that the message will be seen at least once.
+ * If more than one second has passed since the last update of
* lasttime, reset the counter.
*
* we do increment *curpps even in *curpps < maxpps case, as some may
else
rv = 0;
-#if 1 /*DIAGNOSTIC?*/
+#if 1 /* DIAGNOSTIC? */
/* be careful about wrap-around */
if (*curpps + 1 > *curpps)
*curpps = *curpps + 1;
{
int ret;
- ret = 0; /*okay to send*/
+ ret = 0; /* okay to send */
/* PPS limit */
if (!ppsratecheck(&icmp6errppslim_last, &icmp6errpps_count,