Skip to content

Commit 366fe53

Browse files
Merge pull request #9 from legrand-home-systems-mdt/dmc-ignore-unknown-ethertype
Ignore unknown ethertype
2 parents b480f48 + 4e7c5e2 commit 366fe53

File tree

5 files changed

+8
-15
lines changed

5 files changed

+8
-15
lines changed

netdissect.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ struct netdissect_options {
239239
const u_char *ndo_snapend;
240240

241241
int ndo_dlt; /* datalink type */
242+
int ndo_length_type; /* */
242243

243244
/* stack of saved packet boundary and buffer information */
244245
struct netdissect_saved_packet_info *ndo_packet_info_stack;

print-ether.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ ether_common_print(netdissect_options *ndo, const u_char *p, u_int length,
193193
*/
194194
recurse:
195195
length_type = GET_BE_U_2(p);
196+
ndo->ndo_length_type = length_type;
196197

197198
length -= 2;
198199
caplen -= 2;
@@ -230,6 +231,7 @@ ether_common_print(netdissect_options *ndo, const u_char *p, u_int length,
230231
* Keep processing type/length fields.
231232
*/
232233
length_type = GET_BE_U_2(p);
234+
ndo->ndo_length_type = length_type;
233235

234236
ND_ICHECK_U(caplen, <, 2);
235237
length -= 2;
@@ -274,6 +276,8 @@ ether_common_print(netdissect_options *ndo, const u_char *p, u_int length,
274276
}
275277

276278
length_type = GET_BE_U_2(p + 2);
279+
ndo->ndo_length_type = length_type;
280+
277281
p += 4;
278282
length -= 4;
279283
caplen -= 4;

tcpdump.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3256,7 +3256,7 @@ print_packet(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
32563256

32573257
ndo = (netdissect_options*)user;
32583258

3259-
if (ndo->ndo_dlt == DLT_EN10MB) {
3259+
if (ndo->ndo_dlt == DLT_EN10MB && ndo->ndo_length_type == 0x800) {
32603260

32613261
if (capture_start_time.tv_sec == 0)
32623262
capture_start_time.tv_sec = h->ts.tv_sec;

tests/overview1.out

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
OVERVIEW
33
--------
44
packets_captured: 331
5-
bytes_captured: 132951
5+
bytes_captured: 131903
66
seconds: 7
77
hours: 0.00
88

@@ -15,7 +15,6 @@ SRC DST PACKETS BYTES
1515
192.168.1.75 239.255.133.141 13 1615
1616
192.168.1.112 34.160.144.191 2 178
1717
34.160.144.191 192.168.1.112 2 178
18-
63.254.192.168 1.122.0.0 6 360
1918
192.168.1.142 224.0.0.251 2 140
2019
192.168.1.116 224.0.0.251 8 712
2120
192.168.1.112 192.168.100.1 2 200
@@ -26,13 +25,10 @@ SRC DST PACKETS BYTES
2625
192.168.1.71 239.255.255.250 9 3309
2726
192.168.1.76 239.255.255.250 9 3309
2827
192.168.1.70 239.255.133.141 5 430
29-
1.0.3.0 12.244.31.84 1 60
3028
192.168.1.72 239.255.133.141 6 1022
31-
78.11.192.168 1.73.255.255 1 60
3229
192.168.1.75 239.255.255.250 9 3309
3330
192.168.1.122 255.255.255.255 2 120
3431
192.168.1.104 224.0.0.251 7 535
35-
0.0.0.0 255.157.127.146 1 151
3632
192.168.1.71 224.0.0.251 1 80
3733
192.168.1.100 224.0.0.251 1 394
3834
192.168.1.74 224.0.0.251 1 80
@@ -43,7 +39,6 @@ SRC DST PACKETS BYTES
4339
192.168.1.73 224.0.0.251 1 80
4440
192.168.1.70 224.0.0.251 1 80
4541
192.168.1.16 192.168.1.255 3 189
46-
32.0.0.0 0.128.0.164 3 357
4742
192.168.1.72 224.0.0.251 1 80
4843
192.168.1.71 224.0.0.147 1 236
4944
192.168.1.112 72.21.91.29 5 330
@@ -68,7 +63,6 @@ SRC DST PACKETS BYTES
6863
192.168.1.70 224.0.0.147 1 236
6964
192.168.1.70 239.255.255.250 9 3309
7065
192.168.1.72 224.0.0.147 1 235
71-
1.0.3.0 55.47.89.35 1 60
7266
192.168.1.112 104.18.32.68 5 270
7367
104.18.32.68 192.168.1.112 5 300
7468
192.168.1.112 172.253.115.94 1 66

tests/overview2.out

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@
339339
OVERVIEW
340340
--------
341341
packets_captured: 331
342-
bytes_captured: 132951
342+
bytes_captured: 131903
343343
seconds: 7
344344
hours: 0.00
345345

@@ -352,7 +352,6 @@ SRC DST PACKETS BYTES
352352
192.168.1.75 239.255.133.141 13 1615
353353
192.168.1.112 34.160.144.191 2 178
354354
34.160.144.191 192.168.1.112 2 178
355-
63.254.192.168 1.122.0.0 6 360
356355
192.168.1.142 224.0.0.251 2 140
357356
192.168.1.116 224.0.0.251 8 712
358357
192.168.1.112 192.168.100.1 2 200
@@ -363,13 +362,10 @@ SRC DST PACKETS BYTES
363362
192.168.1.71 239.255.255.250 9 3309
364363
192.168.1.76 239.255.255.250 9 3309
365364
192.168.1.70 239.255.133.141 5 430
366-
1.0.3.0 12.244.31.84 1 60
367365
192.168.1.72 239.255.133.141 6 1022
368-
78.11.192.168 1.73.255.255 1 60
369366
192.168.1.75 239.255.255.250 9 3309
370367
192.168.1.122 255.255.255.255 2 120
371368
192.168.1.104 224.0.0.251 7 535
372-
0.0.0.0 255.157.127.146 1 151
373369
192.168.1.71 224.0.0.251 1 80
374370
192.168.1.100 224.0.0.251 1 394
375371
192.168.1.74 224.0.0.251 1 80
@@ -380,7 +376,6 @@ SRC DST PACKETS BYTES
380376
192.168.1.73 224.0.0.251 1 80
381377
192.168.1.70 224.0.0.251 1 80
382378
192.168.1.16 192.168.1.255 3 189
383-
32.0.0.0 0.128.0.164 3 357
384379
192.168.1.72 224.0.0.251 1 80
385380
192.168.1.71 224.0.0.147 1 236
386381
192.168.1.112 72.21.91.29 5 330
@@ -405,7 +400,6 @@ SRC DST PACKETS BYTES
405400
192.168.1.70 224.0.0.147 1 236
406401
192.168.1.70 239.255.255.250 9 3309
407402
192.168.1.72 224.0.0.147 1 235
408-
1.0.3.0 55.47.89.35 1 60
409403
192.168.1.112 104.18.32.68 5 270
410404
104.18.32.68 192.168.1.112 5 300
411405
192.168.1.112 172.253.115.94 1 66

0 commit comments

Comments
 (0)