Handle broadcast and multicast packets in router mode.
authorGuus Sliepen <guus@tinc-vpn.org>
Tue, 23 Dec 2008 22:31:38 +0000 (22:31 +0000)
committerGuus Sliepen <guus@tinc-vpn.org>
Tue, 23 Dec 2008 22:31:38 +0000 (22:31 +0000)
Multicast packets are treated as broadcast packets.
Based on a patch from Max Rijevski.

THANKS
src/route.c

diff --git a/THANKS b/THANKS
index cd99f2aa8ca5cb30be38f874ee32389f35441a9f..ce5ec13d6ba68894347b9c9b44fd4cec2fd6c961 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -21,6 +21,7 @@ We would like to thank the following people for their contributions to tinc:
 * Markus Goetz
 * Martin Kihlgren
 * Matias Carrasco
+* Max Rijevski
 * Miles Nordin
 * Nick Patavalis
 * Paul Littlefield
index 0123107e4acabc444efbc8767d07410a26939396..742fbc28dcf1bf29929414c83cca6417839e55e3 100644 (file)
@@ -376,7 +376,14 @@ static void route_ipv4(node_t *source, vpn_packet_t *packet)
        if(!checklength(source, packet, ether_size + ip_size))
                return;
 
-       route_ipv4_unicast(source, packet);
+       if(packet->data[30] & 0xf0 == 0xe0 ||
+                       packet->data[30] == 255 &&
+                       packet->data[31] == 255 &&
+                       packet->data[32] == 255 &&
+                       packet->data[33] == 255)
+               broadcast_packet(source, packet);
+       else
+               route_ipv4_unicast(source, packet);
 }
 
 /* RFC 2463 */
@@ -645,7 +652,10 @@ static void route_ipv6(node_t *source, vpn_packet_t *packet)
                return;
        }
 
-       route_ipv6_unicast(source, packet);
+       if(packet->data[38] == 255)
+               broadcast_packet(source, packet);
+       else
+               route_ipv6_unicast(source, packet);
 }
 
 /* RFC 826 */