Subject: Re: checking M_MCAST in ip_forward?
To: Bill Sommerfeld <>
From: Ignatios Souvatzis <>
List: tech-net
Date: 10/17/1999 20:43:59
On Sun, Oct 17, 1999 at 10:03:55AM -0400, Bill Sommerfeld wrote:
> Most importantly:
> Currently, ip_forward() contains the following:
> 	if (m->m_flags & M_BCAST || in_canforward(ip->ip_dst) == 0) {
> 		ipstat.ips_cantforward++;
> 		m_freem(m);
> 		return;
> 	}
> I'm pretty sure that this check should be:
> 	if (m->m_flags & (M_BCAST|M_MCAST) || in_canforward(ip->ip_dst) == 0) 
> i'll commit this if i don't hear any objections soon..
This sounds good to me. Also, check the equivalent IPv6 code.

> A second "belt and suspenders" check would be to allow
> MAP_IP_MULTICAST to fail, causing if_ethersubr to drop the packet, if
> M_MCAST is set but the the next-hop address isn't a multicast address.

Well, I guess, the original reason to switch on the bit, rather than to 
test the address is performance. This is more important for long 
addresses like in IPv6.

I think adding this inside options DEBUG (or DIAGNOSTIC?), and complain 
if it was inconsistently used, would be ok.