diff options
author | Guy Harris <gharris@sonic.net> | 2020-05-21 03:05:39 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2020-05-21 03:05:39 -0700 |
commit | 965ca53edd66e139a40d7e4ec5c9f529b4d80d07 (patch) | |
tree | 07a6c2bcced1c4bed17b6e2b0d46e3c974b0bb7a | |
parent | 36112291b60444f6b19a4e2e09a241ffda4bd483 (diff) |
pcapng: save a per-interface snapshot length.
We don't currently use it, but 1) we would do so in the future if we
ever fully support pcapng and 2) Apple will do so if they pick up the
patch I'll provide once I file the bug originally reported as
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=16573
as an Apple bug, so this makes one less place where Apple's libpcap fork
would differ from our libpcap if they pick up 1.10 when it's released.
(This also keeps them from claiming that change is licensed under the
APSL, as we got it first, and none of *our* code is licensed under the
APSL.)
-rw-r--r-- | sf-pcapng.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sf-pcapng.c b/sf-pcapng.c index cb97f785..24eb5f73 100644 --- a/sf-pcapng.c +++ b/sf-pcapng.c @@ -197,6 +197,7 @@ typedef enum { * Per-interface information. */ struct pcap_ng_if { + uint32_t snaplen; /* snapshot length */ uint64_t tsresol; /* time stamp resolution */ tstamp_scale_type_t scale_type; /* how to scale */ uint64_t scale_factor; /* time stamp scale factor for power-of-10 tsresol */ @@ -587,7 +588,8 @@ done: } static int -add_interface(pcap_t *p, struct block_cursor *cursor, char *errbuf) +add_interface(pcap_t *p, struct interface_description_block *idbp, + struct block_cursor *cursor, char *errbuf) { struct pcap_ng_sf *ps; uint64_t tsresol; @@ -696,6 +698,8 @@ add_interface(pcap_t *p, struct block_cursor *cursor, char *errbuf) ps->ifaces = new_ifaces; } + ps->ifaces[ps->ifcount - 1].snaplen = idbp->snaplen; + /* * Set the default time stamp resolution and offset. */ @@ -1013,7 +1017,7 @@ pcap_ng_check_header(const uint8_t *magic, FILE *fp, u_int precision, /* * Try to add this interface. */ - if (!add_interface(p, &cursor, errbuf)) + if (!add_interface(p, idbp, &cursor, errbuf)) goto fail; goto done; @@ -1251,7 +1255,7 @@ pcap_ng_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data) /* * Try to add this interface. */ - if (!add_interface(p, &cursor, p->errbuf)) + if (!add_interface(p, idbp, &cursor, p->errbuf)) return (-1); break; |