diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-09-25 19:26:09 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-09-26 02:26:42 +0000 |
commit | 7e928c8a51ebf53c6c27108c2968bdfe51eb65e0 (patch) | |
tree | 0ee3c6ad97e855f258580fc73032de1c07b990cf /wiretap/pcap-common.c | |
parent | 80160d6181c393380198fedef3065d1cbde72e6e (diff) |
In LINKTYPE_PPP_WITH_DIR files, any non-zero direction value means "sent".
It's not as if 0 means received, 1 means sent, and anything else is
invalid; treat all non-zero values as meaning "sent" when reading, and
write out 1 for "sent".
Change-Id: Iaf5eb327a6b87b893a203475c8730452c51a38e9
Reviewed-on: https://code.wireshark.org/review/29839
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/pcap-common.c')
-rw-r--r-- | wiretap/pcap-common.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/wiretap/pcap-common.c b/wiretap/pcap-common.c index 5a0560c035..cc42e0ea2e 100644 --- a/wiretap/pcap-common.c +++ b/wiretap/pcap-common.c @@ -1594,9 +1594,6 @@ struct pcap_ppp_phdr { /* * Pseudo-header at the beginning of DLT_PPP_WITH_DIR frames. */ -#define LIBPCAP_PPP_PHDR_RECV 0 -#define LIBPCAP_PPP_PHDR_SENT 1 - static int pcap_read_ppp_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, guint packet_size, int *err, gchar **err_info) @@ -1616,7 +1613,8 @@ pcap_read_ppp_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, if (!wtap_read_bytes(fh, &phdr, sizeof (struct pcap_ppp_phdr), err, err_info)) return -1; - pseudo_header->p2p.sent = (phdr.direction == LIBPCAP_PPP_PHDR_SENT) ? TRUE: FALSE; + /* Any non-zero value means "sent" */ + pseudo_header->p2p.sent = (phdr.direction != 0) ? TRUE: FALSE; return (int)sizeof (struct pcap_ppp_phdr); } @@ -2355,7 +2353,8 @@ pcap_write_phdr(wtap_dumper *wdh, int encap, const union wtap_pseudo_header *pse break; case WTAP_ENCAP_PPP_WITH_PHDR: - ppp_hdr.direction = (pseudo_header->p2p.sent ? LIBPCAP_PPP_PHDR_SENT : LIBPCAP_PPP_PHDR_RECV); + /* Any non-zero value means "sent" */ + ppp_hdr.direction = (pseudo_header->p2p.sent ? 1 : 0); if (!wtap_dump_file_write(wdh, &ppp_hdr, sizeof ppp_hdr, err)) return FALSE; wdh->bytes_dumped += sizeof ppp_hdr; |