From: Daniele Iamartino <danieleiamartino@gmail.com>
To: netfilter@vger.kernel.org
Subject: Source process (PID) of a packet
Date: Wed, 03 Apr 2013 18:09:10 +0200 [thread overview]
Message-ID: <515C5426.3050909@gmail.com> (raw)
Hello,
I've got a problem on my server and I had to find out which process was
sending UDP packets to a specified host opening and closing the socket
fastly.
I can see the UDP requests using
$ netstat -unap
or
$ ss -uap
I was finally able to catch the request running netstat in a fast loop
and catching it.
I was now wandering if it was possibile to do that in another way.
Something like log the source PID using -j LOG.
But I saw that LOG target just support the uid/gid.
Reading the sources of netfilter I saw that's not possibile and I think
that's because one socket could be used by several processes (I think
about the case of a process with a socket using a fork).
So is it not technically possible?
Is it the only way writing an xtables target doing somethin like this:
# for any fd on the system:
# if fd == skb->sk->..->file
# match...
# ...
Is this the only way?
That's looks a bit heavy for the system to process.
I wander also about the outgoing traffic:
Is it not possible to match any packet coming from a certain PID using a
match module? I saw the xt_owner and how was the old --pid-owner match
(I've also fixed it for the new kernel to try it)
Is it the only way to check for every fd open by that PID and than match
against the socket related to the packet coming?
Thanks!
--
Daniele Iamartino
Computer engineering student at Politecnico di Milano, Italy
reply other threads:[~2013-04-03 16:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=515C5426.3050909@gmail.com \
--to=danieleiamartino@gmail.com \
--cc=netfilter@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.