Add MRT6_DLOG() macro for debugging.
Reduce number of MRT6DEBUG ifdefs and fix some broken format strings. MFC after: 1 week Sponsored by: Yandex LLC
This commit is contained in:
parent
144cc340ac
commit
1e65346e1d
@ -221,6 +221,14 @@ static VNET_DEFINE(u_int, mrt6debug) = 0; /* debug level */
|
||||
#define DEBUG_XMIT 0x10
|
||||
#define DEBUG_REG 0x20
|
||||
#define DEBUG_PIM 0x40
|
||||
#define DEBUG_ERR 0x80
|
||||
#define DEBUG_ANY 0x7f
|
||||
#define MRT6_DLOG(m, fmt, ...) \
|
||||
if (V_mrt6debug & (m)) \
|
||||
log(((m) & DEBUG_ERR) ? LOG_ERR: LOG_DEBUG, \
|
||||
"%s: " fmt "\n", __func__, ##__VA_ARGS__)
|
||||
#else
|
||||
#define MRT6_DLOG(m, fmt, ...)
|
||||
#endif
|
||||
|
||||
static void expire_upcalls(void *);
|
||||
@ -526,12 +534,8 @@ static int
|
||||
ip6_mrouter_init(struct socket *so, int v, int cmd)
|
||||
{
|
||||
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug)
|
||||
log(LOG_DEBUG,
|
||||
"ip6_mrouter_init: so_type = %d, pr_protocol = %d\n",
|
||||
so->so_type, so->so_proto->pr_protocol);
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_ANY, "so_type = %d, pr_protocol = %d",
|
||||
so->so_type, so->so_proto->pr_protocol);
|
||||
|
||||
if (so->so_type != SOCK_RAW ||
|
||||
so->so_proto->pr_protocol != IPPROTO_ICMPV6)
|
||||
@ -560,11 +564,7 @@ ip6_mrouter_init(struct socket *so, int v, int cmd)
|
||||
expire_upcalls, NULL);
|
||||
|
||||
MROUTER6_UNLOCK();
|
||||
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug)
|
||||
log(LOG_DEBUG, "ip6_mrouter_init\n");
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_ANY, "finished");
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -642,11 +642,7 @@ X_ip6_mrouter_done(void)
|
||||
V_ip6_mrouter_ver = 0;
|
||||
|
||||
MROUTER6_UNLOCK();
|
||||
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug)
|
||||
log(LOG_DEBUG, "ip6_mrouter_done\n");
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_ANY, "finished");
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -727,14 +723,8 @@ add_m6if(struct mif6ctl *mifcp)
|
||||
nummifs = mifcp->mif6c_mifi + 1;
|
||||
|
||||
MIF6_UNLOCK();
|
||||
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug)
|
||||
log(LOG_DEBUG,
|
||||
"add_mif #%d, phyint %s\n",
|
||||
mifcp->mif6c_mifi,
|
||||
ifp->if_xname);
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_ANY, "mif #%d, phyint %s", mifcp->mif6c_mifi,
|
||||
if_name(ifp));
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -777,11 +767,7 @@ del_m6if_locked(mifi_t *mifip)
|
||||
if (mif6table[mifi - 1].m6_ifp)
|
||||
break;
|
||||
nummifs = mifi;
|
||||
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug)
|
||||
log(LOG_DEBUG, "del_m6if %d, nummifs %d\n", *mifip, nummifs);
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_ANY, "mif %d, nummifs %d", *mifip, nummifs);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -817,15 +803,10 @@ add_m6fc(struct mf6cctl *mfccp)
|
||||
|
||||
/* If an entry already exists, just update the fields */
|
||||
if (rt) {
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug & DEBUG_MFC) {
|
||||
log(LOG_DEBUG,
|
||||
"add_m6fc no upcall h %d o %s g %s p %x\n",
|
||||
ip6_sprintf(ip6bufo, &mfccp->mf6cc_origin.sin6_addr),
|
||||
ip6_sprintf(ip6bufg, &mfccp->mf6cc_mcastgrp.sin6_addr),
|
||||
mfccp->mf6cc_parent);
|
||||
}
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_MFC, "no upcall o %s g %s p %x",
|
||||
ip6_sprintf(ip6bufo, &mfccp->mf6cc_origin.sin6_addr),
|
||||
ip6_sprintf(ip6bufg, &mfccp->mf6cc_mcastgrp.sin6_addr),
|
||||
mfccp->mf6cc_parent);
|
||||
|
||||
rt->mf6c_parent = mfccp->mf6cc_parent;
|
||||
rt->mf6c_ifset = mfccp->mf6cc_ifset;
|
||||
@ -856,16 +837,12 @@ add_m6fc(struct mf6cctl *mfccp)
|
||||
&mfccp->mf6cc_mcastgrp.sin6_addr),
|
||||
mfccp->mf6cc_parent, rt->mf6c_stall);
|
||||
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug & DEBUG_MFC)
|
||||
log(LOG_DEBUG,
|
||||
"add_m6fc o %s g %s p %x dbg %x\n",
|
||||
ip6_sprintf(ip6bufo,
|
||||
&mfccp->mf6cc_origin.sin6_addr),
|
||||
ip6_sprintf(ip6bufg,
|
||||
&mfccp->mf6cc_mcastgrp.sin6_addr),
|
||||
mfccp->mf6cc_parent, rt->mf6c_stall);
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_MFC, "o %s g %s p %x dbg %p",
|
||||
ip6_sprintf(ip6bufo,
|
||||
&mfccp->mf6cc_origin.sin6_addr),
|
||||
ip6_sprintf(ip6bufg,
|
||||
&mfccp->mf6cc_mcastgrp.sin6_addr),
|
||||
mfccp->mf6cc_parent, rt->mf6c_stall);
|
||||
|
||||
rt->mf6c_origin = mfccp->mf6cc_origin;
|
||||
rt->mf6c_mcastgrp = mfccp->mf6cc_mcastgrp;
|
||||
@ -898,15 +875,10 @@ add_m6fc(struct mf6cctl *mfccp)
|
||||
* It is possible that an entry is being inserted without an upcall
|
||||
*/
|
||||
if (nstl == 0) {
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug & DEBUG_MFC)
|
||||
log(LOG_DEBUG,
|
||||
"add_mfc no upcall h %d o %s g %s p %x\n",
|
||||
hash,
|
||||
ip6_sprintf(ip6bufo, &mfccp->mf6cc_origin.sin6_addr),
|
||||
ip6_sprintf(ip6bufg, &mfccp->mf6cc_mcastgrp.sin6_addr),
|
||||
mfccp->mf6cc_parent);
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_MFC, "no upcall h %lu o %s g %s p %x", hash,
|
||||
ip6_sprintf(ip6bufo, &mfccp->mf6cc_origin.sin6_addr),
|
||||
ip6_sprintf(ip6bufg, &mfccp->mf6cc_mcastgrp.sin6_addr),
|
||||
mfccp->mf6cc_parent);
|
||||
|
||||
for (rt = mf6ctable[hash]; rt; rt = rt->mf6c_next) {
|
||||
|
||||
@ -992,6 +964,9 @@ collate(struct timeval *t)
|
||||
static int
|
||||
del_m6fc(struct mf6cctl *mfccp)
|
||||
{
|
||||
#ifdef MRT6DEBUG
|
||||
char ip6bufo[INET6_ADDRSTRLEN], ip6bufg[INET6_ADDRSTRLEN];
|
||||
#endif
|
||||
struct sockaddr_in6 origin;
|
||||
struct sockaddr_in6 mcastgrp;
|
||||
struct mf6c *rt;
|
||||
@ -1002,14 +977,9 @@ del_m6fc(struct mf6cctl *mfccp)
|
||||
mcastgrp = mfccp->mf6cc_mcastgrp;
|
||||
hash = MF6CHASH(origin.sin6_addr, mcastgrp.sin6_addr);
|
||||
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug & DEBUG_MFC) {
|
||||
char ip6bufo[INET6_ADDRSTRLEN], ip6bufg[INET6_ADDRSTRLEN];
|
||||
log(LOG_DEBUG,"del_m6fc orig %s mcastgrp %s\n",
|
||||
ip6_sprintf(ip6bufo, &origin.sin6_addr),
|
||||
ip6_sprintf(ip6bufg, &mcastgrp.sin6_addr));
|
||||
}
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_MFC, "orig %s mcastgrp %s",
|
||||
ip6_sprintf(ip6bufo, &origin.sin6_addr),
|
||||
ip6_sprintf(ip6bufg, &mcastgrp.sin6_addr));
|
||||
|
||||
MFC6_LOCK();
|
||||
|
||||
@ -1080,13 +1050,9 @@ X_ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m)
|
||||
mifi_t mifi;
|
||||
char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
|
||||
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug & DEBUG_FORWARD)
|
||||
log(LOG_DEBUG, "ip6_mforward: src %s, dst %s, ifindex %d\n",
|
||||
ip6_sprintf(ip6bufs, &ip6->ip6_src),
|
||||
ip6_sprintf(ip6bufd, &ip6->ip6_dst),
|
||||
ifp->if_index);
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_FORWARD, "src %s, dst %s, ifindex %d",
|
||||
ip6_sprintf(ip6bufs, &ip6->ip6_src),
|
||||
ip6_sprintf(ip6bufd, &ip6->ip6_dst), ifp->if_index);
|
||||
|
||||
/*
|
||||
* Don't forward a packet with Hop limit of zero or one,
|
||||
@ -1148,12 +1114,9 @@ X_ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m)
|
||||
#endif /* UPCALL_TIMING */
|
||||
|
||||
MRT6STAT_INC(mrt6s_no_route);
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug & (DEBUG_FORWARD | DEBUG_MFC))
|
||||
log(LOG_DEBUG, "ip6_mforward: no rte s %s g %s\n",
|
||||
ip6_sprintf(ip6bufs, &ip6->ip6_src),
|
||||
ip6_sprintf(ip6bufd, &ip6->ip6_dst));
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_FORWARD | DEBUG_MFC, "no rte s %s g %s",
|
||||
ip6_sprintf(ip6bufs, &ip6->ip6_src),
|
||||
ip6_sprintf(ip6bufd, &ip6->ip6_dst));
|
||||
|
||||
/*
|
||||
* Allocate mbufs early so that we don't do extra work if we
|
||||
@ -1249,11 +1212,8 @@ X_ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m)
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug & DEBUG_FORWARD)
|
||||
log(LOG_DEBUG,
|
||||
"getting the iif info in the kernel\n");
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_FORWARD,
|
||||
"getting the iif info in the kernel");
|
||||
|
||||
for (mifp = mif6table, mifi = 0;
|
||||
mifi < nummifs && mifp->m6_ifp != ifp;
|
||||
@ -1339,6 +1299,9 @@ X_ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m)
|
||||
static void
|
||||
expire_upcalls(void *unused)
|
||||
{
|
||||
#ifdef MRT6DEBUG
|
||||
char ip6bufo[INET6_ADDRSTRLEN], ip6bufg[INET6_ADDRSTRLEN];
|
||||
#endif
|
||||
struct rtdetq *rte;
|
||||
struct mf6c *mfc, **nptr;
|
||||
u_long i;
|
||||
@ -1358,15 +1321,9 @@ expire_upcalls(void *unused)
|
||||
if (rte != NULL &&
|
||||
mfc->mf6c_expire != 0 &&
|
||||
--mfc->mf6c_expire == 0) {
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug & DEBUG_EXPIRE) {
|
||||
char ip6bufo[INET6_ADDRSTRLEN];
|
||||
char ip6bufg[INET6_ADDRSTRLEN];
|
||||
log(LOG_DEBUG, "expire_upcalls: expiring (%s %s)\n",
|
||||
ip6_sprintf(ip6bufo, &mfc->mf6c_origin.sin6_addr),
|
||||
ip6_sprintf(ip6bufg, &mfc->mf6c_mcastgrp.sin6_addr));
|
||||
}
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_EXPIRE, "expiring (%s %s)",
|
||||
ip6_sprintf(ip6bufo, &mfc->mf6c_origin.sin6_addr),
|
||||
ip6_sprintf(ip6bufg, &mfc->mf6c_mcastgrp.sin6_addr));
|
||||
/*
|
||||
* drop all the packets
|
||||
* free the mbuf with the pkt, if, timing info
|
||||
@ -1426,13 +1383,9 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt)
|
||||
mifi = rt->mf6c_parent;
|
||||
if ((mifi >= nummifs) || (mif6table[mifi].m6_ifp != ifp)) {
|
||||
/* came in the wrong interface */
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug & DEBUG_FORWARD)
|
||||
log(LOG_DEBUG,
|
||||
"wrong if: ifid %d mifi %d mififid %x\n",
|
||||
ifp->if_index, mifi,
|
||||
mif6table[mifi].m6_ifp->if_index);
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_FORWARD,
|
||||
"wrong if: ifid %d mifi %d mififid %x", ifp->if_index,
|
||||
mifi, mif6table[mifi].m6_ifp->if_index);
|
||||
MRT6STAT_INC(mrt6s_wrong_if);
|
||||
rt->mf6c_wrong_if++;
|
||||
/*
|
||||
@ -1509,10 +1462,8 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt)
|
||||
MRT6STAT_INC(mrt6s_upcalls);
|
||||
|
||||
if (socket_send(V_ip6_mrouter, mm, &sin6) < 0) {
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug)
|
||||
log(LOG_WARNING, "mdq, ip6_mrouter socket queue full\n");
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_ANY,
|
||||
"ip6_mrouter socket queue full");
|
||||
MRT6STAT_INC(mrt6s_upq_sockfull);
|
||||
return (ENOBUFS);
|
||||
} /* if socket Q full */
|
||||
@ -1576,6 +1527,9 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt)
|
||||
static void
|
||||
phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m)
|
||||
{
|
||||
#ifdef MRT6DEBUG
|
||||
char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
|
||||
#endif
|
||||
struct mbuf *mb_copy;
|
||||
struct ifnet *ifp = mifp->m6_ifp;
|
||||
int error = 0;
|
||||
@ -1613,11 +1567,8 @@ phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m)
|
||||
error = ip6_output(mb_copy, NULL, NULL, IPV6_FORWARDING, &im6o,
|
||||
NULL, NULL);
|
||||
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug & DEBUG_XMIT)
|
||||
log(LOG_DEBUG, "phyint_send on mif %d err %d\n",
|
||||
mifp - mif6table, error);
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_XMIT, "mif %u err %d",
|
||||
(uint16_t)(mifp - mif6table), error);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1656,11 +1607,8 @@ phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m)
|
||||
m_clrprotoflags(m); /* Avoid confusing lower layers. */
|
||||
error = (*ifp->if_output)(ifp, mb_copy,
|
||||
(struct sockaddr *)&dst6, NULL);
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug & DEBUG_XMIT)
|
||||
log(LOG_DEBUG, "phyint_send on mif %d err %d\n",
|
||||
mifp - mif6table, error);
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_XMIT, "mif %u err %d",
|
||||
(uint16_t)(mifp - mif6table), error);
|
||||
} else {
|
||||
/*
|
||||
* pMTU discovery is intentionally disabled by default, since
|
||||
@ -1670,19 +1618,11 @@ phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m)
|
||||
if (V_ip6_mcast_pmtu)
|
||||
icmp6_error(mb_copy, ICMP6_PACKET_TOO_BIG, 0, linkmtu);
|
||||
else {
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug & DEBUG_XMIT) {
|
||||
char ip6bufs[INET6_ADDRSTRLEN];
|
||||
char ip6bufd[INET6_ADDRSTRLEN];
|
||||
log(LOG_DEBUG,
|
||||
"phyint_send: packet too big on %s o %s "
|
||||
"g %s size %d(discarded)\n",
|
||||
if_name(ifp),
|
||||
ip6_sprintf(ip6bufs, &ip6->ip6_src),
|
||||
ip6_sprintf(ip6bufd, &ip6->ip6_dst),
|
||||
mb_copy->m_pkthdr.len);
|
||||
}
|
||||
#endif /* MRT6DEBUG */
|
||||
MRT6_DLOG(DEBUG_XMIT, " packet too big on %s o %s "
|
||||
"g %s size %d (discarded)", if_name(ifp),
|
||||
ip6_sprintf(ip6bufs, &ip6->ip6_src),
|
||||
ip6_sprintf(ip6bufd, &ip6->ip6_dst),
|
||||
mb_copy->m_pkthdr.len);
|
||||
m_freem(mb_copy); /* simply discard the packet */
|
||||
}
|
||||
}
|
||||
@ -1691,19 +1631,17 @@ phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m)
|
||||
static int
|
||||
register_send(struct ip6_hdr *ip6, struct mif6 *mif, struct mbuf *m)
|
||||
{
|
||||
#ifdef MRT6DEBUG
|
||||
char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
|
||||
#endif
|
||||
struct mbuf *mm;
|
||||
int i, len = m->m_pkthdr.len;
|
||||
static struct sockaddr_in6 sin6 = { sizeof(sin6), AF_INET6 };
|
||||
struct mrt6msg *im6;
|
||||
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug) {
|
||||
char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
|
||||
log(LOG_DEBUG, "** IPv6 register_send **\n src %s dst %s\n",
|
||||
ip6_sprintf(ip6bufs, &ip6->ip6_src),
|
||||
ip6_sprintf(ip6bufd, &ip6->ip6_dst));
|
||||
}
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_ANY, "src %s dst %s",
|
||||
ip6_sprintf(ip6bufs, &ip6->ip6_src),
|
||||
ip6_sprintf(ip6bufd, &ip6->ip6_dst));
|
||||
PIM6STAT_INC(pim6s_snd_registers);
|
||||
|
||||
/* Make a copy of the packet to send to the user level process. */
|
||||
@ -1741,11 +1679,7 @@ register_send(struct ip6_hdr *ip6, struct mif6 *mif, struct mbuf *m)
|
||||
MRT6STAT_INC(mrt6s_upcalls);
|
||||
|
||||
if (socket_send(V_ip6_mrouter, mm, &sin6) < 0) {
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug)
|
||||
log(LOG_WARNING,
|
||||
"register_send: ip6_mrouter socket queue full\n");
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_ANY, "ip6_mrouter socket queue full");
|
||||
MRT6STAT_INC(mrt6s_upq_sockfull);
|
||||
return (ENOBUFS);
|
||||
}
|
||||
@ -1797,10 +1731,7 @@ pim6_input(struct mbuf **mp, int *offp, int proto)
|
||||
*/
|
||||
if (pimlen < PIM_MINLEN) {
|
||||
PIM6STAT_INC(pim6s_rcv_tooshort);
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug & DEBUG_PIM)
|
||||
log(LOG_DEBUG,"pim6_input: PIM packet too short\n");
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_PIM, "PIM packet too short");
|
||||
m_freem(m);
|
||||
return (IPPROTO_DONE);
|
||||
}
|
||||
@ -1850,11 +1781,7 @@ pim6_input(struct mbuf **mp, int *offp, int proto)
|
||||
|
||||
if (in6_cksum(m, IPPROTO_PIM, off, cksumlen)) {
|
||||
PIM6STAT_INC(pim6s_rcv_badsum);
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug & DEBUG_PIM)
|
||||
log(LOG_DEBUG,
|
||||
"pim6_input: invalid checksum\n");
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_PIM, "invalid checksum");
|
||||
m_freem(m);
|
||||
return (IPPROTO_DONE);
|
||||
}
|
||||
@ -1864,11 +1791,9 @@ pim6_input(struct mbuf **mp, int *offp, int proto)
|
||||
/* PIM version check */
|
||||
if (pim->pim_ver != PIM_VERSION) {
|
||||
PIM6STAT_INC(pim6s_rcv_badversion);
|
||||
#ifdef MRT6DEBUG
|
||||
log(LOG_ERR,
|
||||
"pim6_input: incorrect version %d, expecting %d\n",
|
||||
MRT6_DLOG(DEBUG_ANY | DEBUG_ERR,
|
||||
"incorrect version %d, expecting %d",
|
||||
pim->pim_ver, PIM_VERSION);
|
||||
#endif
|
||||
m_freem(m);
|
||||
return (IPPROTO_DONE);
|
||||
}
|
||||
@ -1892,12 +1817,8 @@ pim6_input(struct mbuf **mp, int *offp, int proto)
|
||||
PIM6STAT_INC(pim6s_rcv_registers);
|
||||
|
||||
if ((reg_mif_num >= nummifs) || (reg_mif_num == (mifi_t) -1)) {
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug & DEBUG_PIM)
|
||||
log(LOG_DEBUG,
|
||||
"pim6_input: register mif not set: %d\n",
|
||||
reg_mif_num);
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_PIM, "register mif not set: %d",
|
||||
reg_mif_num);
|
||||
m_freem(m);
|
||||
return (IPPROTO_DONE);
|
||||
}
|
||||
@ -1913,35 +1834,25 @@ pim6_input(struct mbuf **mp, int *offp, int proto)
|
||||
if (pimlen < PIM6_REG_MINLEN) {
|
||||
PIM6STAT_INC(pim6s_rcv_tooshort);
|
||||
PIM6STAT_INC(pim6s_rcv_badregisters);
|
||||
#ifdef MRT6DEBUG
|
||||
log(LOG_ERR,
|
||||
"pim6_input: register packet size too "
|
||||
"small %d from %s\n",
|
||||
MRT6_DLOG(DEBUG_ANY | DEBUG_ERR, "register packet "
|
||||
"size too small %d from %s",
|
||||
pimlen, ip6_sprintf(ip6bufs, &ip6->ip6_src));
|
||||
#endif
|
||||
m_freem(m);
|
||||
return (IPPROTO_DONE);
|
||||
}
|
||||
|
||||
eip6 = (struct ip6_hdr *) (reghdr + 1);
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug & DEBUG_PIM)
|
||||
log(LOG_DEBUG,
|
||||
"pim6_input[register], eip6: %s -> %s, "
|
||||
"eip6 plen %d\n",
|
||||
ip6_sprintf(ip6bufs, &eip6->ip6_src),
|
||||
ip6_sprintf(ip6bufd, &eip6->ip6_dst),
|
||||
ntohs(eip6->ip6_plen));
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_PIM, "eip6: %s -> %s, eip6 plen %d",
|
||||
ip6_sprintf(ip6bufs, &eip6->ip6_src),
|
||||
ip6_sprintf(ip6bufd, &eip6->ip6_dst),
|
||||
ntohs(eip6->ip6_plen));
|
||||
|
||||
/* verify the version number of the inner packet */
|
||||
if ((eip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) {
|
||||
PIM6STAT_INC(pim6s_rcv_badregisters);
|
||||
#ifdef MRT6DEBUG
|
||||
log(LOG_DEBUG, "pim6_input: invalid IP version (%d) "
|
||||
"of the inner packet\n",
|
||||
MRT6_DLOG(DEBUG_ANY, "invalid IP version (%d) "
|
||||
"of the inner packet",
|
||||
(eip6->ip6_vfc & IPV6_VERSION));
|
||||
#endif
|
||||
m_freem(m);
|
||||
return (IPPROTO_NONE);
|
||||
}
|
||||
@ -1949,13 +1860,9 @@ pim6_input(struct mbuf **mp, int *offp, int proto)
|
||||
/* verify the inner packet is destined to a mcast group */
|
||||
if (!IN6_IS_ADDR_MULTICAST(&eip6->ip6_dst)) {
|
||||
PIM6STAT_INC(pim6s_rcv_badregisters);
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug & DEBUG_PIM)
|
||||
log(LOG_DEBUG,
|
||||
"pim6_input: inner packet of register "
|
||||
"is not multicast %s\n",
|
||||
ip6_sprintf(ip6bufd, &eip6->ip6_dst));
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_PIM, "inner packet of register "
|
||||
"is not multicast %s",
|
||||
ip6_sprintf(ip6bufd, &eip6->ip6_dst));
|
||||
m_freem(m);
|
||||
return (IPPROTO_DONE);
|
||||
}
|
||||
@ -1965,11 +1872,8 @@ pim6_input(struct mbuf **mp, int *offp, int proto)
|
||||
*/
|
||||
mcp = m_copy(m, 0, off + PIM6_REG_MINLEN);
|
||||
if (mcp == NULL) {
|
||||
#ifdef MRT6DEBUG
|
||||
log(LOG_ERR,
|
||||
"pim6_input: pim register: "
|
||||
"could not copy register head\n");
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_ANY | DEBUG_ERR, "pim register: "
|
||||
"could not copy register head");
|
||||
m_freem(m);
|
||||
return (IPPROTO_DONE);
|
||||
}
|
||||
@ -1978,16 +1882,10 @@ pim6_input(struct mbuf **mp, int *offp, int proto)
|
||||
* forward the inner ip6 packet; point m_data at the inner ip6.
|
||||
*/
|
||||
m_adj(m, off + PIM_MINLEN);
|
||||
#ifdef MRT6DEBUG
|
||||
if (V_mrt6debug & DEBUG_PIM) {
|
||||
log(LOG_DEBUG,
|
||||
"pim6_input: forwarding decapsulated register: "
|
||||
"src %s, dst %s, mif %d\n",
|
||||
ip6_sprintf(ip6bufs, &eip6->ip6_src),
|
||||
ip6_sprintf(ip6bufd, &eip6->ip6_dst),
|
||||
reg_mif_num);
|
||||
}
|
||||
#endif
|
||||
MRT6_DLOG(DEBUG_PIM, "forwarding decapsulated register: "
|
||||
"src %s, dst %s, mif %d",
|
||||
ip6_sprintf(ip6bufs, &eip6->ip6_src),
|
||||
ip6_sprintf(ip6bufd, &eip6->ip6_dst), reg_mif_num);
|
||||
|
||||
rc = if_simloop(mif6table[reg_mif_num].m6_ifp, m,
|
||||
dst.sin6_family, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user