[Iftop-users] [PATCH] Support passively sniffing IPv6

Bill Nickless bill at nonick.org
Sun Feb 7 17:16:33 GMT 2021


Support passively sniffing and displaying IPv6 traffic, previously silently
ignored.

Also submitted: https://github.com/gdm85/iftop/pull/1

Signed-off-by: Bill Nickless <bill at nonick.org>
---
 iftop.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/iftop.c b/iftop.c
index 311401e..5e829f9 100644
--- a/iftop.c
+++ b/iftop.c
@@ -352,6 +352,13 @@ static void handle_ip_packet(struct ip* iptr, int
hw_dir, int pld_len)
             assign_addr_pair(&ap, iptr, 0);
             direction = 0;
         }
+        else if(IP_V(iptr) == 6 && memcmp(&ip6tr->ip6_src,
+                                          &ip6tr->ip6_dst,
+                                          sizeof(struct in6_addr)) < 0) {
+                assign_addr_pair(&ap, iptr, 1);
+        } else if(IP_V(iptr) == 6) {
+                assign_addr_pair(&ap, iptr, 0);
+        }
         /* Drop other uncertain packages. */
         else
             return;
--
2.25.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.beasts.org/pipermail/iftop-users/attachments/20210207/92eb9c84/attachment.html>


More information about the iftop-users mailing list