netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* searching tuples in conntrack
@ 2012-09-26 17:29 Miguel Alejandro González
  2012-09-26 20:32 ` Jan Engelhardt
  0 siblings, 1 reply; 4+ messages in thread
From: Miguel Alejandro González @ 2012-09-26 17:29 UTC (permalink / raw)
  To: netfilter-devel

Hello,

I have been reading some kernel code trying to find a function that
searches the conntrack hash table for a transport address and returns
the given tuple. Is there any way to do this? I found a function in
the nat code called find_appropriate_src but i think it only works for
the nat table...

Regards

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: searching tuples in conntrack
  2012-09-26 17:29 searching tuples in conntrack Miguel Alejandro González
@ 2012-09-26 20:32 ` Jan Engelhardt
  2012-10-07  7:31   ` Miguel Alejandro González
       [not found]   ` <CA+Z0r8P6zFL0jE3soO+OubGg0buzRE7ZiHAMxXZPMNrJH6tiig@mail.gmail.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Engelhardt @ 2012-09-26 20:32 UTC (permalink / raw)
  To: Miguel Alejandro González; +Cc: netfilter-devel

On Wednesday 2012-09-26 19:29, Miguel Alejandro González wrote:

>Hello,
>
>I have been reading some kernel code trying to find a function that
>searches the conntrack hash table for a transport address and returns
>the given tuple. Is there any way to do this? I found a function in
>the nat code called find_appropriate_src but i think it only works for
>the nat table...

nf_conntrack_find_get(...) is the one to use for CT lookup.
(Cf. xt_connlimit.c)

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: searching tuples in conntrack
  2012-09-26 20:32 ` Jan Engelhardt
@ 2012-10-07  7:31   ` Miguel Alejandro González
       [not found]   ` <CA+Z0r8P6zFL0jE3soO+OubGg0buzRE7ZiHAMxXZPMNrJH6tiig@mail.gmail.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Miguel Alejandro González @ 2012-10-07  7:31 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: netfilter-devel

Hello

I'm having some problems creating a function like count_them and the
hash table it uses. My module is a target extension and connlimit is a
match extension.

So correct me if I'm wrong... basically connlimit creates an extra
hash table with struct xt_connlimit_info *info = par->matchinfo as a
parameter to save conntracks and tuples, but I don't have such info
because i'm making a target extension... Can't I do a lookup directly
to the NFCT list?

How can I initialize the hash table like in connlimit_mt_check() if I
don't work with const struct xt_mtchk_param *par?

Can you point in the right direction? I'm really new to kernel dev.. I
hope I'm not asking too much of you

Regards


On Wed, Sep 26, 2012 at 3:32 PM, Jan Engelhardt <jengelh@inai.de> wrote:
> On Wednesday 2012-09-26 19:29, Miguel Alejandro González wrote:
>
>>Hello,
>>
>>I have been reading some kernel code trying to find a function that
>>searches the conntrack hash table for a transport address and returns
>>the given tuple. Is there any way to do this? I found a function in
>>the nat code called find_appropriate_src but i think it only works for
>>the nat table...
>
> nf_conntrack_find_get(...) is the one to use for CT lookup.
> (Cf. xt_connlimit.c)
>
> --
> To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: searching tuples in conntrack
       [not found]   ` <CA+Z0r8P6zFL0jE3soO+OubGg0buzRE7ZiHAMxXZPMNrJH6tiig@mail.gmail.com>
@ 2012-10-07 11:44     ` Jan Engelhardt
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Engelhardt @ 2012-10-07 11:44 UTC (permalink / raw)
  To: Miguel Alejandro González; +Cc: netfilter-devel


On Sunday 2012-10-07 07:51, Miguel Alejandro González wrote:
>
>I'm having some problems creating a function like count_them and the hash
>table it uses. My module is a target extension and connlimit is a match
>extension.

And why would that be a problem?

>So correct me if I'm wrong... basically connlimit creates the hash table
>with struct xt_connlimit_info *info = par->matchinfo as a parameter, but I
>don't have such info because i'm making a target extension...

par->targinfo is the block of parameters received from userspace
for targets.

>How can I initialize the hash table like in connlimit_mt_check() if I don't
>work with const struct xt_mtchk_param *par?

    →   info->data = kmalloc(sizeof(myprivatestuff), GFP_KERNEL);     

Note how this does not have much to do with matchinfo.
It's simply an assignment.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-07 11:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-26 17:29 searching tuples in conntrack Miguel Alejandro González
2012-09-26 20:32 ` Jan Engelhardt
2012-10-07  7:31   ` Miguel Alejandro González
     [not found]   ` <CA+Z0r8P6zFL0jE3soO+OubGg0buzRE7ZiHAMxXZPMNrJH6tiig@mail.gmail.com>
2012-10-07 11:44     ` Jan Engelhardt

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).