All of lore.kernel.org
 help / color / mirror / Atom feed
* problem with libipq and userprocess and 'clean' exit
@ 2002-06-13 10:19 Tassilo Schütz
  2002-06-13 11:50 ` James Morris
  0 siblings, 1 reply; 5+ messages in thread
From: Tassilo Schütz @ 2002-06-13 10:19 UTC (permalink / raw)
  To: netfilter-devel

Hello list,

I have a userprocess using libipq. It stores packets comming in through 
traget -j QUEUE,
delay them for a while, and send them out via verdict NF_ACCEPT. That 
works fine.
But when I quit the process normaly (use ipq_destroy_handle()) and not 
all packets have
been send out again, I see sometimes in /proc/net/ip_queue, that the 
values are not set back.
It is the same, when the userprocess starts, calls irq_read() and before 
a packet arrives, I quit
the process normaly. In /proc/net/ip_queue you can see that Peer pid, 
Peer copy mode and
Peer copy range are not set back.

I would like to know, if I have to do anything else, before quit my 
userprocess? Is there
maybe a flush_queue() call or term_queue() call? I thought about, 
because of Queue flushing
and Queue terminate in /proc/net/ip_queue.

Looking through the source of ip_queue.c I found some similar calls and 
a comment :
 * Packets arrive here from netfilter for queuing to userspace. *
 * All of them must be fed back via nf_reinject() or Alexey will kill 
Rusty. *

Can someone give me a guidance how to quit my process without the above 
effets :-)  ?

Thanks in advance

Tassilo

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

* Re: problem with libipq and userprocess and 'clean' exit
  2002-06-13 10:19 problem with libipq and userprocess and 'clean' exit Tassilo Schütz
@ 2002-06-13 11:50 ` James Morris
  2002-06-13 11:56   ` Henrik Nordstrom
  2002-06-14 13:40   ` Tassilo Schütz
  0 siblings, 2 replies; 5+ messages in thread
From: James Morris @ 2002-06-13 11:50 UTC (permalink / raw)
  To: Tassilo Schütz; +Cc: netfilter-devel

On Thu, 13 Jun 2002, [ISO-8859-15] Tassilo Schütz wrote:

> Hello list,
> 
> 
> I would like to know, if I have to do anything else, before quit my 
> userprocess? Is there
> maybe a flush_queue() call or term_queue() call? I thought about, 
> because of Queue flushing
> and Queue terminate in /proc/net/ip_queue.

Nothing to worry about, there is currentl no way for the ip_queue module 
to know that the user process has exited (unless another process starts 
using the queue).

The kernel module also ensures that all packets are fed back into the 
stack, no matter what the userspace application does.


- James
-- 
James Morris
<jmorris@intercode.com.au>

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

* Re: problem with libipq and userprocess and 'clean' exit
  2002-06-13 11:50 ` James Morris
@ 2002-06-13 11:56   ` Henrik Nordstrom
  2002-06-13 13:07     ` James Morris
  2002-06-14 13:40   ` Tassilo Schütz
  1 sibling, 1 reply; 5+ messages in thread
From: Henrik Nordstrom @ 2002-06-13 11:56 UTC (permalink / raw)
  To: James Morris; +Cc: netfilter-devel

On Thursday 13 June 2002 13:50, James Morris wrote:

> Nothing to worry about, there is currentl no way for the ip_queue
> module to know that the user process has exited (unless another
> process starts using the queue).
>
> The kernel module also ensures that all packets are fed back into
> the stack, no matter what the userspace application does.

So one way to get out of the situation is to remove the QUEUE target 
to stop new packets from being queued, and then start a dummy program 
that attaches to the queue? This should both stop new packets from 
being queued and release any pending packets, right?

Regards
Henrik

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

* Re: problem with libipq and userprocess and 'clean' exit
  2002-06-13 11:56   ` Henrik Nordstrom
@ 2002-06-13 13:07     ` James Morris
  0 siblings, 0 replies; 5+ messages in thread
From: James Morris @ 2002-06-13 13:07 UTC (permalink / raw)
  To: Henrik Nordstrom; +Cc: netfilter-devel

On Thu, 13 Jun 2002, Henrik Nordstrom wrote:

> On Thursday 13 June 2002 13:50, James Morris wrote:
> 
> > Nothing to worry about, there is currentl no way for the ip_queue
> > module to know that the user process has exited (unless another
> > process starts using the queue).
> >
> > The kernel module also ensures that all packets are fed back into
> > the stack, no matter what the userspace application does.
> 

Actually, the module does detect that the process has exited if it tries  
to send a packet to userspace.  At this point, it will flush the queue and 
not queue any more packets unless another process sends a queue mode
message.
  
If the user process exits and no new packets arrive, any queued packets   
will stay queued until the module is removed or any associated device is  
downed.  This is what is meant by the kernel module ensuring that all 
queued packets make it back to the stack.

> So one way to get out of the situation is to remove the QUEUE target 
> to stop new packets from being queued, and then start a dummy program 
> that attaches to the queue? This should both stop new packets from 
> being queued and release any pending packets, right?
> 

Yes, although, it would be better to get a notifcation from Netlink when 
the process closes the socket -- the kernel code and userspace semantics 
could be then made much cleaner.


- James
-- 
James Morris
<jmorris@intercode.com.au>

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

* Re: problem with libipq and userprocess and 'clean' exit
  2002-06-13 11:50 ` James Morris
  2002-06-13 11:56   ` Henrik Nordstrom
@ 2002-06-14 13:40   ` Tassilo Schütz
  1 sibling, 0 replies; 5+ messages in thread
From: Tassilo Schütz @ 2002-06-14 13:40 UTC (permalink / raw)
  To: James Morris; +Cc: netfilter-devel

James Morris schrieb:

>Nothing to worry about, there is currentl no way for the ip_queue module 
>to know that the user process has exited (unless another process starts 
>using the queue).
>
>The kernel module also ensures that all packets are fed back into the 
>stack, no matter what the userspace application does.
>
>
>- James
>  
>
Thank you for the information.

best regards

Tassilo

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

end of thread, other threads:[~2002-06-14 13:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-13 10:19 problem with libipq and userprocess and 'clean' exit Tassilo Schütz
2002-06-13 11:50 ` James Morris
2002-06-13 11:56   ` Henrik Nordstrom
2002-06-13 13:07     ` James Morris
2002-06-14 13:40   ` Tassilo Schütz

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.