Skip to content

Commit

Permalink
gre: fix hard header destination address checking
Browse files Browse the repository at this point in the history
ipgre_header() can be called with zero daddr when the gre device is
configured as multipoint tunnel and still has the NOARP flag set (which is
typically cleared by the userspace arp daemon).  If the NOARP packets are
not dropped, ipgre_tunnel_xmit() will take rt->rt_gateway (= NBMA IP) and
use that for route look up (and may lead to bogus xfrm acquires).

The multicast address check is removed as sending to multicast group should
be ok.  In fact, if gre device has a multicast address as destination
ipgre_header is always called with multicast address.

Signed-off-by: Timo Teras <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
fabled authored and davem330 committed Mar 4, 2010
1 parent c839d30 commit 6d55cb9
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions net/ipv4/ip_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -1144,12 +1144,9 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev,

if (saddr)
memcpy(&iph->saddr, saddr, 4);

if (daddr) {
if (daddr)
memcpy(&iph->daddr, daddr, 4);
return t->hlen;
}
if (iph->daddr && !ipv4_is_multicast(iph->daddr))
if (iph->daddr)
return t->hlen;

return -t->hlen;
Expand Down

0 comments on commit 6d55cb9

Please sign in to comment.