Log bogus NMRP responses
authorJoseph C. Lehner <joseph.c.lehner@gmail.com>
Thu, 23 Feb 2017 17:29:55 +0000 (18:29 +0100)
committerJoseph C. Lehner <joseph.c.lehner@gmail.com>
Thu, 23 Feb 2017 17:29:55 +0000 (18:29 +0100)
nmrp.c

diff --git a/nmrp.c b/nmrp.c
index 1f197eaf005455635c21b408d9d731eda11f7e5a..722fe752c7f720344c633985d353908c31348886 100644 (file)
--- a/nmrp.c
+++ b/nmrp.c
@@ -488,8 +488,14 @@ int nmrp_do(struct nmrpd_args *args)
                }
 
                status = pkt_recv(sock, &rx);
-               if (status == 0 && memcmp(rx.eh.ether_dhost, src, 6) == 0) {
-                       break;
+               if (status == 0) {
+                       if (memcmp(rx.eh.ether_dhost, src, 6) == 0) {
+                               break;
+                       } else if (verbosity) {
+                               printf("\nIgnoring bogus response: %s -> %s.\n",
+                                               mac_to_str(rx.eh.ether_shost),
+                                               mac_to_str(rx.eh.ether_dhost));
+                       }
                } else if (status == 1) {
                        goto out;
                } else {