]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Update LS-Ack printing to not run off the end of the packet
authorBill Fenner <[email protected]>
Sat, 4 Nov 2023 15:25:25 +0000 (08:25 -0700)
committerFrancois-Xavier Le Bail <[email protected]>
Tue, 7 Nov 2023 08:38:17 +0000 (09:38 +0100)
(cherry picked from commit 4b4f7af5e8f3cbf06ffdefe8f24bcff089fd4ede)

print-ospf.c
tests/TESTLIST
tests/ospf-ack.out [new file with mode: 0644]
tests/ospf-ack.pcap [new file with mode: 0644]

index e6bebed374f820a1db57ba3bcd69b8c1ab4119a0..7aa00d397a7b3ea86770938bcdc26058c18dd982 100644 (file)
@@ -1067,7 +1067,8 @@ ospf_decode_v2(netdissect_options *ndo,
 
        case OSPF_TYPE_LS_ACK:
                 lshp = op->ospf_lsa.lsa_lshdr;
-                while (ospf_print_lshdr(ndo, lshp) != -1) {
+                while ((const u_char *)lshp < dataend) {
+                    ospf_print_lshdr(ndo, lshp);
                     ++lshp;
                 }
                 break;
index 1bd08d1e65fb5350d28079eadef6530fc5b197bf..c91e19048a4a1412c6dc6bbf7ad8ff288356a3ac 100644 (file)
@@ -95,6 +95,7 @@ mpls-over-udp-v  mpls-over-udp.pcap  mpls-over-udp-v.out -v
 # OSPF tests
 ospf-gmpls     ospf-gmpls.pcap                         ospf-gmpls.out          -v
 ospf-nssa-bitnt        ospf-nssa-bitnt.pcap                    ospf-nssa-bitnt.out     -v
+ospf-ack       ospf-ack.pcap                           ospf-ack.out            -v
 ospf3_ah-vv    OSPFv3_with_AH.pcap                     ospf3_ah-vv.out         -v -v
 ospf3_auth-vv  ospf3_auth.pcapng                       ospf3_auth-vv.out       -v -v
 ospf3_bc-vv    OSPFv3_broadcast_adjacency.pcap         ospf3_bc-vv.out         -v -v
diff --git a/tests/ospf-ack.out b/tests/ospf-ack.out
new file mode 100644 (file)
index 0000000..324b805
--- /dev/null
@@ -0,0 +1,9 @@
+    1  21:01:51.417510 IP (tos 0xc0, ttl 1, id 7082, offset 0, flags [DF], proto OSPF (89), length 84)
+    1.0.1.2 > 224.0.0.5: OSPFv2, LS-Ack, length 64
+       Router-ID 2.2.2.2, Area 0.0.0.1, Authentication Type: none (0)
+         Advertising Router 1.1.1.1, seq 0x80000002, age 46s, length 16
+           Router LSA (1), LSA-ID: 1.1.1.1
+           Options: [External, Demand Circuit]
+         Advertising Router 1.1.1.1, seq 0x80000001, age 43s, length 8
+           Summary LSA (3), LSA-ID: 1.0.0.0
+           Options: [External, Demand Circuit]
diff --git a/tests/ospf-ack.pcap b/tests/ospf-ack.pcap
new file mode 100644 (file)
index 0000000..87af347
Binary files /dev/null and b/tests/ospf-ack.pcap differ