linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: Jan Engelhardt <jengelh@linux01.gwdg.de>
Cc: Mikado <mikado4vn@yahoo.com>,
	linux-kernel@vger.kernel.org,
	linux-c-programming@vger.kernel.org
Subject: Re: How to obtain process ID that created a packet
Date: Tue, 27 Dec 2005 13:55:24 +0300	[thread overview]
Message-ID: <43B11D9C.6000601@tls.msk.ru> (raw)
In-Reply-To: <Pine.LNX.4.61.0512270925020.10069@yvahk01.tjqt.qr>

Jan Engelhardt wrote:
>>>The question is: when do you test for the PID? You would have to do it 
>>>within send(), because anywhere else, you do not know. A socket may be 
>>>shared among multiple processes (most simple way: fork()).
>>
>>I'm hooking in NF_IP_LOCAL_OUT of netfilter code using nf_register_hook() function.
> 
> 
> In sys_send(), I would have said you could use "current", but in netfilter 
> I can't tell exactly whether it is going to work on SMP.
> 
> Check net/ipv4/netfilter/ipt_owner.c, it provides a way to match packets vs 
> pids, but it's not easy to find out.

In current 2.6 kernel, net/ipv4/netfilter/ipt_owner.c:checkentry() :

        if (info->match & (IPT_OWNER_PID|IPT_OWNER_SID|IPT_OWNER_COMM)) {
                printk("ipt_owner: pid, sid and command matching "
                       "not supported anymore\n");
                return 0;
        }

So... even netfilter, breaking backward compatibility, does not support
pid match anymore...

/mjt

  reply	other threads:[~2005-12-27 10:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-26 16:22 How to obtain process ID that created a packet Mikado
2005-12-26 22:36 ` Jan Engelhardt
2005-12-27  1:47   ` Mikado
2005-12-27  8:26     ` Jan Engelhardt
2005-12-27 10:55       ` Michael Tokarev [this message]
2005-12-27 18:03         ` Jan Engelhardt

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=43B11D9C.6000601@tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=jengelh@linux01.gwdg.de \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikado4vn@yahoo.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).