* Question about nfnl_handle_packet/nfnl_process error handling
@ 2012-02-16 14:15 Florian Westphal
2012-02-16 17:41 ` Pablo Neira Ayuso
0 siblings, 1 reply; 3+ messages in thread
From: Florian Westphal @ 2012-02-16 14:15 UTC (permalink / raw)
To: netfilter-devel
libnetfilter_queue has:
int nfq_handle_packet(struct nfq_handle *h, char *buf, int len)
{
return nfnl_handle_packet(h->nfnlh, buf, len);
}
When an error occurs, for example because a verdict for a bogus packet id was
sent, nfq_handle_packet/nfnl_handle_packet returns -1 with errno == 0.
Using nfnl_process() instead of nfq_handle_packet() sets errno to the expected
ENOENT.
Does anyone know if nfq_handle_packet() "errno 0" behaviour is intentional?
Should I just ignore nfq_handle_packet() return value?
What about deprecating nfnl_handle_packet() and using nfnl_process()
instead?
Thanks,
Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Question about nfnl_handle_packet/nfnl_process error handling
2012-02-16 14:15 Question about nfnl_handle_packet/nfnl_process error handling Florian Westphal
@ 2012-02-16 17:41 ` Pablo Neira Ayuso
2012-02-16 21:41 ` Florian Westphal
0 siblings, 1 reply; 3+ messages in thread
From: Pablo Neira Ayuso @ 2012-02-16 17:41 UTC (permalink / raw)
To: Florian Westphal; +Cc: netfilter-devel
Hi Florian,
On Thu, Feb 16, 2012 at 03:15:46PM +0100, Florian Westphal wrote:
> libnetfilter_queue has:
>
> int nfq_handle_packet(struct nfq_handle *h, char *buf, int len)
> {
> return nfnl_handle_packet(h->nfnlh, buf, len);
> }
>
> When an error occurs, for example because a verdict for a bogus packet id was
> sent, nfq_handle_packet/nfnl_handle_packet returns -1 with errno == 0.
>
> Using nfnl_process() instead of nfq_handle_packet() sets errno to the expected
> ENOENT.
>
> Does anyone know if nfq_handle_packet() "errno 0" behaviour is intentional?
The initial libnfnetlink API did not set errno, nfnl_handle_packet is
part of that old API.
nfnl_process was added later to try to resolve some limitations by
2006 IIRC.
libmnl provide a neat new API. We have to move to it.
> Should I just ignore nfq_handle_packet() return value?
> What about deprecating nfnl_handle_packet() and using nfnl_process()
> instead?
I have ported libnetfilter_queue to libmnl, I need some spare time to
push the new API to the repository. I'll be happy if you spend some
time looking at it to find some possible issues, the idea is that the
new API resolves the existing API limitations.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Question about nfnl_handle_packet/nfnl_process error handling
2012-02-16 17:41 ` Pablo Neira Ayuso
@ 2012-02-16 21:41 ` Florian Westphal
0 siblings, 0 replies; 3+ messages in thread
From: Florian Westphal @ 2012-02-16 21:41 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: Florian Westphal, netfilter-devel
Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > When an error occurs, for example because a verdict for a bogus packet id was
> > sent, nfq_handle_packet/nfnl_handle_packet returns -1 with errno == 0.
> >
> > Using nfnl_process() instead of nfq_handle_packet() sets errno to the expected
> > ENOENT.
> >
> > Does anyone know if nfq_handle_packet() "errno 0" behaviour is intentional?
>
> The initial libnfnetlink API did not set errno, nfnl_handle_packet is
> part of that old API.
>
> nfnl_process was added later to try to resolve some limitations by
> 2006 IIRC.
Ah. That explains it, thanks.
> > Should I just ignore nfq_handle_packet() return value?
> > What about deprecating nfnl_handle_packet() and using nfnl_process()
> > instead?
>
> I have ported libnetfilter_queue to libmnl, I need some spare time to
> push the new API to the repository. I'll be happy if you spend some
> time looking at it to find some possible issues, the idea is that the
> new API resolves the existing API limitations.
Nice work. I'd be happy to test and review it.
Thanks, Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-02-16 21:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-16 14:15 Question about nfnl_handle_packet/nfnl_process error handling Florian Westphal
2012-02-16 17:41 ` Pablo Neira Ayuso
2012-02-16 21:41 ` Florian Westphal
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.