Skip to content

Commit b14edd7

Browse files
committed
HSR/PRP: Add -P flag for dissecting PRP trailer
To avoid dissecting PRP trailer when we aren't using PRP.
1 parent fc5a43d commit b14edd7

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

netdissect.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ struct netdissect_options {
214214
int ndo_Aflag; /* print packet only in ASCII observing TAB,
215215
* LF, CR and SPACE as graphical chars
216216
*/
217+
int ndo_Pflag; /* print packet in hex/ASCII */
217218
int ndo_Hflag; /* dissect 802.11s draft mesh standard */
218219
const char *ndo_protocol; /* protocol */
219220
jmp_buf ndo_early_end; /* jmp_buf for setjmp()/longjmp() */

print-ether.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ ether_common_print(netdissect_options *ndo, const u_char *p, u_int length,
306306
hdrlen += 6;
307307
}
308308

309-
if (caplen >= 6) {
309+
if (ndo->ndo_Pflag && caplen >= 6) {
310310
prp_suffix = GET_BE_U_2(p + caplen - 2);
311311
if (prp_suffix == 0x88fb) {
312312
prp_print(ndo, p, caplen);

tcpdump.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ show_remote_devices_and_exit(void)
672672
#define U_FLAG
673673
#endif
674674

675-
#define SHORTOPTS "aAb" B_FLAG "c:C:d" D_FLAG "eE:fF:G:hHi:" I_FLAG j_FLAG J_FLAG "KlLm:M:nNOpq" Q_FLAG "r:s:StT:u" U_FLAG "vV:w:W:xXy:Yz:Z:#"
675+
#define SHORTOPTS "aAb" B_FLAG "c:C:d" D_FLAG "eE:fF:G:hHi:" I_FLAG j_FLAG J_FLAG "KlLm:M:nNOpPq" Q_FLAG "r:s:StT:u" U_FLAG "vV:w:W:xXy:Yz:Z:#"
676676

677677
/*
678678
* Long options.
@@ -1738,6 +1738,10 @@ main(int argc, char **argv)
17381738
++pflag;
17391739
break;
17401740

1741+
case 'P':
1742+
++ndo->ndo_Pflag;
1743+
break;
1744+
17411745
case 'q':
17421746
++ndo->ndo_qflag;
17431747
++ndo->ndo_suppress_default_print;

tests/TESTLIST

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,4 +839,4 @@ lsp-ping-timestamp lsp-ping-timestamp.pcap lsp-ping-timestamp.out -vv
839839

840840
# HSR/PRP tests
841841
hsr hsr.pcap hsr.out -e
842-
prp prp.pcap prp.out -e
842+
prp prp.pcap prp.out -e -P

0 commit comments

Comments
 (0)