]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Babel: amend the previous change
authorDenis Ovsienko <[email protected]>
Thu, 1 Feb 2018 19:51:50 +0000 (19:51 +0000)
committerDenis Ovsienko <[email protected]>
Thu, 1 Feb 2018 20:14:07 +0000 (20:14 +0000)
Clarify the "invalid" string in MESSAGE_MH_REQUEST and add a similar
check for MESSAGE_NH.

print-babel.c

index dd976bb62eb934a0d4ab219c57798a87ee705eb2..fdba430757768225ae47f85e780338acb1bfe0ee 100644 (file)
@@ -476,13 +476,15 @@ babel_print_v2(netdissect_options *ndo,
                 ND_PRINT(" nh");
             else {
                 int rc;
+                u_char ae;
                 u_char nh[16];
                 ND_PRINT("\n\tNext Hop");
                 if(len < 2) goto invalid;
-                rc = network_address(EXTRACT_U_1(message + 2), message + 4,
+                ae = EXTRACT_U_1(message + 2);
+                rc = network_address(ae, message + 4,
                                      len - 2, nh);
                 if(rc < 0) goto invalid;
-                ND_PRINT(" %s", format_address(ndo, nh));
+                ND_PRINT(" %s", ae == 0 ? "invalid AE 0" : format_address(ndo, nh));
             }
         }
             break;
@@ -573,7 +575,7 @@ babel_print_v2(netdissect_options *ndo,
                 plen = EXTRACT_U_1(message + 3) + (EXTRACT_U_1(message + 2) == 1 ? 96 : 0);
                 ND_PRINT("(%u hops) for %s seqno %u id %s",
                        EXTRACT_U_1(message + 6),
-                       ae == 0 ? "invalid" : format_prefix(ndo, prefix, plen),
+                       ae == 0 ? "invalid AE 0" : format_prefix(ndo, prefix, plen),
                        seqno, format_id(message + 8));
             }
         }