Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add limit-capture-size option #781

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

DEADBEEFh
Copy link

Using --limit-capture-size, tcpdump can now exit after capturing
a specified amount of data. If used with -w, tcpdump will exit
after writing the specified limit to disk. Without -w, tcpdump
will exit reaching the limit based on packets*h->len.

Works with -C/-W/-G options.

The method for specifying file size for -C and
--limit-capture-size was updated to allow users to enter
num[k,m,g,ki,mi,gi]. Leaving off units will result in the current
behavior of an argument being multiplied by a default of 1000000.

This commit updates and improves upon work done by @stevekay for
feature request 97 and pull request 464.

Using --limit-capture-size, tcpdump can now exit after capturing
a specified amount of data.  If used with -w, tcpdump will exit
after writing the specified limit to disk.  Without -w, tcpdump
will exit reaching the limit based on packets*h->len.

Works with -C/-W/-G options.

The method for specifying file size for -C and
--limit-capture-size was updated to allow users to enter
num[k,m,g,ki,mi,gi].  Leaving off units will result in the current
behavior of an argument being multiplied by a default of 1000000.

This commit updates and improves upon work done by @stevekay for
feature request 97 and pull request 464.
@DEADBEEFh
Copy link
Author

Upon further review, there are a few minor cleanups I'd like to do:
-looks like I left an errant errno=0 in the case statement
-probably don't need the sizeflag and can replace checks with size_bytes != 0

I'll wait for other comments and include those before committing.

@DEADBEEFh
Copy link
Author

Closes #569 and closes #97

@systemcrash
Copy link

will this go in? @DEADBEEFh can you update the conflicts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants