summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2022-06-06 16:36:57 +0200
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2022-06-06 17:15:26 +0200
commit26231dad8b681c1b62d16a57aa5a4e28afb04b59 (patch)
tree13d6633711e46e8338cd9f791c655bdd287f2466
parent80f4fbf961e4dd58d71f68277ad54230ae040fa7 (diff)
downloadtcpdump-26231dad8b681c1b62d16a57aa5a4e28afb04b59.tar.gz
PPP: Add tests to avoid incorrectly re-entering ppp_hdlc()
-rw-r--r--print-ppp.c10
-rw-r--r--tests/of10_inv_QUEUE_GET_CONFIG_REPLY-vv.out9
2 files changed, 9 insertions, 10 deletions
diff --git a/print-ppp.c b/print-ppp.c
index 76494410..8e63b4a1 100644
--- a/print-ppp.c
+++ b/print-ppp.c
@@ -1428,10 +1428,16 @@ ppp_hdlc(netdissect_options *ndo,
if (length < 4)
goto trunc;
proto = GET_BE_U_2(b + 2); /* load the PPP proto-id */
- handle_ppp(ndo, proto, b + 4, length - 4);
+ if ((proto & 0xff00) == 0x7e00)
+ ND_PRINT("(protocol 0x%04x invalid)", proto);
+ else
+ handle_ppp(ndo, proto, b + 4, length - 4);
break;
default: /* last guess - proto must be a PPP proto-id */
- handle_ppp(ndo, proto, b + 2, length - 2);
+ if ((proto & 0xff00) == 0x7e00)
+ ND_PRINT("(protocol 0x%04x invalid)", proto);
+ else
+ handle_ppp(ndo, proto, b + 2, length - 2);
break;
}
diff --git a/tests/of10_inv_QUEUE_GET_CONFIG_REPLY-vv.out b/tests/of10_inv_QUEUE_GET_CONFIG_REPLY-vv.out
index 60bc83e9..f9f4b6e2 100644
--- a/tests/of10_inv_QUEUE_GET_CONFIG_REPLY-vv.out
+++ b/tests/of10_inv_QUEUE_GET_CONFIG_REPLY-vv.out
@@ -1,8 +1 @@
- 1 06:10:40.134396994 : IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 1540, bad cksum 11ce (->4fbd)!)
- 109.74.202.0.6653 > 4.184.169.52.4708: Flags [P.], cksum 0x8000 (incorrect -> 0x4d3b), seq 3422244149:3422245637, ack 774246557, win 0, options [nop,nop,unknown-16 0x112e355c0302fa3b], length 1488: OpenFlow
- version 1.0, type QUEUE_GET_CONFIG_REPLY, length 278, xid 0xc7ffffff
- port 64773
- queue_id 0, len 255
- property NONE, len 0 [property length 0 < 8] (invalid)
- [remaining length 7 < 8] (invalid)
- version unknown (0x12), type unknown (0x12), length 4626, xid 0x12121212 [|openflow]
+ 1 06:10:40.134396994 : (protocol 0x7e7e invalid)