File iftop-multicast.patch of Package iftop

From 0c4d60de0626e97fcd965c67378379b5d7980264 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@linux-m68k.org>
Date: Sun, 25 Nov 2012 19:26:22 +0100
Subject: [PATCH] Handle incoming multicast packages
Upstream: http://lists.beasts.org/pipermail/iftop-users/2012-November/000381.html

---
 iftop.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/iftop.c b/iftop.c
index 06778d6..2805cd6 100644
--- a/iftop.c
+++ b/iftop.c
@@ -286,6 +286,14 @@ static void handle_ip_packet(struct ip* iptr, int hw_dir)
             assign_addr_pair(&ap, iptr, 1);
             direction = 0;
         }
+        else if (IP_V(iptr) == 4 && IN_MULTICAST(iptr->ip_dst.s_addr)) {
+            assign_addr_pair(&ap, iptr, 1);
+            direction = 0;
+        }
+        else if (IP_V(iptr) == 6 && IN6_IS_ADDR_MULTICAST(&ip6tr->ip6_dst)) {
+            assign_addr_pair(&ap, iptr, 1);
+            direction = 0;
+        }
         /*
          * Cannot determine direction from hardware or IP levels.  Therefore 
          * assume that it was a packet between two other machines, assign
@@ -304,6 +312,8 @@ static void handle_ip_packet(struct ip* iptr, int hw_dir)
             direction = 0;
         }
         /* Drop other uncertain packages. */
+        else
+            return;
     }
 
     if(IP_V(iptr) == 4 && options.netfilter != 0) {
-- 
1.8.0

openSUSE Build Service is sponsored by