the-tcpdump-group / tcpdump

the TCPdump network dissector
https://www.tcpdump.org/
Other
2.74k stars 852 forks source link

Unable to change the default unit for the "-C file_size" option. #927

Closed cjmaynard closed 3 years ago

cjmaynard commented 3 years ago

tcpdump --version tcpdump version 4.99.0 libpcap version 1.10.0 (with TPACKET_V3)

The tcpdump man page documents the -C file_size option as follows:

-C file_size Before writing a raw packet to a savefile, check whether the file is currently larger than file_size and, if so, close the current savefile and open a new one. Savefiles after the first savefile will have the name specified with the -w flag, with a number after it, starting at 1 and continuing upward. The default unit of file_size is millions of bytes (1,000,000 bytes, not 1,048,576 bytes). By adding a suffix of k/K, m/M or g/G to the value, the unit can be changed to 1,024 (KiB), 1,048,576 (MiB), or 1,073,741,824 (GiB) respectively.

Unfortunately, attempting to change the default unit of file_size from millions of bytes to something else using the k/K, m/M or g/G suffixes fails. For example:

tcpdump -C 10K
tcpdump: invalid file size 10K
guyharris commented 3 years ago

The man page is generated from the tip of the main branch.

Change #916 is only in the main branch; it's not in 4.99, so that feature isn't in 4.99.

cjmaynard commented 3 years ago

The man page is generated from the tip of the main branch.

Shouldn't the online man page reflect the most recent release version and not the tip of the main branch?

Change #916 is only in the main branch; it's not in 4.99, so that feature isn't in 4.99.

OK, thanks.

infrastation commented 3 years ago

Would it help to have at the top of each online man page a banner that would say the page applies to the master branch?

cjmaynard commented 3 years ago

Would it help to have at the top of each online man page a banner that would say the page applies to the master branch?

It might help, yes. It does indicate the last updated date, in this case "Updated: 10 July 2021", but it's not obvious which version that pertains to. Once you check https://www.tcpdump.org/index.html#latest-releases and see that 4.99.1 was released on June 9, 2021, it becomes clear that this version of the man page can't be the one associated with 4.99.1.

Overall, I think it would be better to provide the man page associated with the latest released version though as I suspect most people are not running "tip of master" versions but officially released versions, and it is that man page that's going to be most useful to them. For example, this is exactly what Wireshark provides even if their man page doesn't display the version anywhere on the page, but you can see it if you view the page source, e.g., view-source:https://www.wireshark.org/docs/man-pages/wireshark.html.

Maybe an even better solution would be to make man pages available for every released version, that way users can read the relevant man page regardless of what version they're running. It is often the case that packages don't get immediately updated when new releases are made, and certainly there are Linux distributions that distribute much older versions. For example:

cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.4 (Maipo)

tcpdump --version tcpdump version 4.9.0 libpcap version 1.5.3

guyharris commented 3 years ago

1) Yes, the libpcap and tcpdump should be labeled with the release, if we can arrange that in a fashion that works with multiple versions of the -man package.

2) Yes, we should probably have the www.tcpdump.org online man pages built from the current libpcap and tcpdump releases.

3) "certainly there are Linux distributions that distribute much older versions" They also distribute man pages, so "man tcpdump" should work on RHEL 7.4. The best way to "read the relevant man page regardless of what version they're running" is probably to run the "man" command on that version, rather than running "tcpdump -v" and look for those man pages at www.tcpdump.org.

cjmaynard commented 3 years ago
  1. "certainly there are Linux distributions that distribute much older versions" They also distribute man pages, so "man tcpdump" should work on RHEL 7.4. The best way to "read the relevant man page regardless of what version they're running" is probably to run the "man" command on that version, rather than running "tcpdump -v" and look for those man pages at www.tcpdump.org.

Agreed. It wasn't a very good example. But tcpdump is deployed on many embedded platforms, some w/out man pages available, and it is on one such system that I was running tcpdump, so having the ability to view it online is particularly useful in such cases.

man tcpdump -sh: man: not found

infrastation commented 3 years ago

The banner should be easy. Providing multiple sets of man pages seems a better idea than having one set and arguing where it should come from — in any case there always be readers that assume a specific branch/release and then realize the online page describes something else.

Regarding possible ways to implement this. For example, Python documentation has a drop-down for the release/branch, whilst Buildbot documentation uses a purely static menu. Both approaches rely on URL path taxonomy, which in this case could be extended this way:

Would it make enough sense?

Regarding the man page that comes from the same package as the binary. On one hand, it does not exist in every case (e.g. OpenWrt), but on the other hand it is often the only place that describes the changes a specific distribution had applied to the binary (e.g. RedHat). So the user might end up looking into multiple versions, in which case it would help to indicate explicitly what a specific page is supposed to describe.

cjmaynard commented 3 years ago

Would it make enough sense?

Yes, this seems very sensible to me.

infrastation commented 3 years ago

Alternatively, the above layout could provide the latest release sets in the traditional location and the master branch sets in tcpdump-master, libpcap-master etc., although this feels more cumbersome to generate/maintain. Let's think about it.

infrastation commented 3 years ago

Alright, the first revision of this structure is at https://www.tcpdump.org/manpages/

guyharris commented 3 years ago

the first revision of this structure is at https://www.tcpdump.org/manpages/

"403 Forbidden"

fxlb commented 3 years ago

On 25/07/2021 20:40, Guy Harris wrote:

the first revision of this structure is at https://www.tcpdump.org/manpages/ <https://www.tcpdump.org/manpages/>

"403 Forbidden"

Try: https://www.ca.tcpdump.org/manpages/

fxlb commented 3 years ago

On 25/07/2021 20:40, Guy Harris wrote: the first revision of this structure is at https://www.tcpdump.org/manpages/ https://www.tcpdump.org/manpages/ "403 Forbidden"

Try: https://www.ca.tcpdump.org/manpages/

I thought it was only a rsync problem, but perhaps not...

mcr commented 3 years ago

I think that different servers have different rules about whether or not they will do a directory index. So, we should add a generated index.html to the directory. https://github.com/the-tcpdump-group/tcpdump-htdocs/issues/22

infrastation commented 3 years ago

Since commit the-tcpdump-group/tcpdump-htdocs@f0f58fb every man page on the web site has a version banner at the top.

The only way to switch between the versions right now is using the online directory listings. As suggested above, it would be nice to have a convenient (1 or 2 clicks) means to switch, I might be able to look into that later if nobody else does it first. That and other possible improvements would be separate rounds of work.

The problem identified in this issue has been addressed and the issue is now resolved (not just closed). Thanks to everyone for providing their input.