-
Notifications
You must be signed in to change notification settings - Fork 851
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
Allow -w to take paths containing date/time components when using -G #936
Comments
Alternatively, it would not be difficult to have a shell script that creates the directories before running tcpdump and makes sure the ownership and permissions are correct. Or a script that moves complete .pcap files to such directories when tcpdump is running (and maybe compresses them). |
What would be the advantages of implementing this in the C code solution space instead of a shell script solution space? |
Convenience. |
Without With Bear in mind that this would be a continuously-running tcpdump, so it can run across a day, month, or even year boundary. (The original comment in the issue mentions that this is with |
Well, then someone would need to make sure it works well with Capsicum, privileges dropping, signal handlers and whatever else happens to be involved. |
Actually the only thing needed is to call that
|
As an example here is a tool I use to record multicast UDP streams: https://rigtorp.se/udpcap.cpp (or in case first one is down https://gist.github.com/rigtorp/9544c98119b56d68814eb7b45758eb7a). It has this behavior of automatically creating missing directories. |
I wonder why you did not make this a pull request. |
I think it's important to first sell the idea to the decision makers. As
you know I already have some outstanding PRs to improve the libpcap API.
…On Fri, Dec 10, 2021, 20:59 Denis Ovsienko ***@***.***> wrote:
I wonder why you did not make this a pull request.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#936 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABLO25KGP6UC4NHFNHGDWDUQJL27ANCNFSM5CXXTVZA>
.
|
When using the -G option it can be useful to organize files by year/month/day by setting
-w %Y/%m/%d/%Y%%m%dT%H%M%SZ.pcap
. This will fail if any of the parent directories are missing.We can add an option to make tcpdump create the parent directories as if
mkdir -p $(dirname $file)
is invoked before opening the file.I have adapted the code from OpenBSD mkdir to do exactly this. It would need to be updated to use
mkdirat
instead if we want to support the tcpdump privilege separation.The text was updated successfully, but these errors were encountered: