From 3a99a76fa56bef8e1698c205b2d47902af4104d9 Mon Sep 17 00:00:00 2001 From: thorkill Date: Tue, 14 Jul 2015 12:12:19 +0200 Subject: [PATCH] Do not forward multicast packets to prevent packet loops --- src/route.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/route.c b/src/route.c index 2b78a57a..0d5bce4f 100644 --- a/src/route.c +++ b/src/route.c @@ -399,6 +399,15 @@ static void route_ipv4(node_t *source, vpn_packet_t *packet) { return; } + if (subnet->multicast) { + logger(DEBUG_TRAFFIC, LOG_WARNING, "Ignore multicast from %s (%s) to %d.%d.%d.%d !", source->name, source->hostname, + dest.x[0], + dest.x[1], + dest.x[2], + dest.x[3]); + return; + } + if (!subnet->owner) { broadcast_packet(source, packet); return; @@ -567,6 +576,22 @@ static void route_ipv6(node_t *source, vpn_packet_t *packet) { return; } + if (subnet->multicast) { + // Prevent loops + logger(DEBUG_ALWAYS, LOG_WARNING, "Ignore multicast from %s (%s) to IPv6 source address %hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx", + source->name, source->hostname, + ntohs(dest.x[0]), + ntohs(dest.x[1]), + ntohs(dest.x[2]), + ntohs(dest.x[3]), + ntohs(dest.x[4]), + ntohs(dest.x[5]), + ntohs(dest.x[6]), + ntohs(dest.x[7])); + return; + } + + if (!subnet->owner) { // Prevent loops if (strictsubnets && !subnet_src) {