* Using libnetfilter_queue
@ 2007-03-16 19:50 Rennie deGraaf
2007-03-16 21:25 ` SHA-2 HMAC support in linux kernel Chinh Nguyen
0 siblings, 1 reply; 7+ messages in thread
From: Rennie deGraaf @ 2007-03-16 19:50 UTC (permalink / raw)
To: Netfilter Developer Mailing List
[-- Attachment #1: Type: text/plain, Size: 2507 bytes --]
Hello all,
I am trying to write an application that uses libnetfilter_queue, and
have a few questions about its API.
If I understand correctly from the example program supplied with
libnetfilter_queue, the user is responsible for reading messages from
kernelspace with a recv() call. At this point, the messages are still
opaque nfnetlink messages, which must be passed to nfq_handle_packet()
for parsing. This function never returns a parsed message; the caller
only gets access to the message fields inside the callback that was
provided to nfq_create_queue(). The callback is expected to call either
nfq_set_verdict() or nfq_set_verdict_mark() before returning.
My questions follow:
1. How is the caller supposed to correctly read the message from
kernelspace, when the caller doesn't know the message size? The caller
should know an upper bound on the size of the packet contents being
returned, but doesn't know the size of the metadata fields or the
netlink header. The only ways that I have found to safely read messages
are to either allocate large buffers that *should* be able to fit
everything (this is the approach taken by the example program -- except
that the buffer that it allocates is too small for large packets) or to
first read a struct nlmsghdr using MSG_PEEK, decode the total message
size, allocate a buffer of appropriate size, and then read the whole
message (this breaks encapulation). It seems to me that the better way
to do this would be for the libnetfilter_queue API to provide a function
that safely reads packets from kernelspace without exposing
implementation details to the caller. If the callback architecture is
preserved, this could be done inside nfq_handle_packet().
2. What is the point of the callback? It seems to me that it would be
much simpler to have nfq_handle_packet() (or better yet, a function that
reads a packet) return a parsed packet to the caller and let it handle
it as it wishes. The only good reason that I can see for having a
callback is to require that nfq_set_verdict() gets called at some point,
but the callback doesn't actually enforce this. I don't see what
advantage this architecture has over a simpler socket-like API where
programs can open a connection, read a packet, analyze its contents, set
a verdict, and close the connection all from the same logical block.
If I'm misunderstanding how the libnetfilter_queue API works, please let
me know.
Thanks,
Rennie deGraaf
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* SHA-2 HMAC support in linux kernel
2007-03-16 19:50 Using libnetfilter_queue Rennie deGraaf
@ 2007-03-16 21:25 ` Chinh Nguyen
2007-03-16 20:31 ` YOSHIFUJI Hideaki / 吉藤英明
0 siblings, 1 reply; 7+ messages in thread
From: Chinh Nguyen @ 2007-03-16 21:25 UTC (permalink / raw)
To: Netfilter Developer Mailing List
Hi,
I believe that this is the right list for my question. I'm trying to get
SHA-2 HMAC support working ipsec in linux kernel (I'm configuring via
pfkey).
First, sha-384 and sha-512 as authentication algorithm always return
function not support. But I noted that my linux kernel has a sha512
kernel module (with alias for sha384). Second, sha-256 uses a 12-byte
hmac (96 bits).
Looking at the source http://lxr.linux.no/source/net/xfrm/xfrm_algo.c,
it seems to confirm that this is true. In fact, sha-384 and sha-512 are
not supported at this time and sha-256 is truncated to 96-bit.
However, the following ietf draft, which I believe is very closed to
ratification (it has already been assigned iana numbers), specifies
sha-256 to use 128-bits as hmac (page 18):
http://www.ietf.org/internet-drafts/draft-kelly-ipsec-ciph-sha2-01.txt
sha-384 is 192 bits, and sha-512 is 256 bits.
1. Is adding sha-384 and sha-512 as simple as adding to the aalg_list
structure? Can this be done for some subsequent kernel release in the
future?
2. Can the sha-256 be changed to use 128 bits? Or in order to not break
backward compatibility, another sha-256 hmac algorithm id be used for
128 bits?
Thanks,
Chinh
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: SHA-2 HMAC support in linux kernel
2007-03-16 21:25 ` SHA-2 HMAC support in linux kernel Chinh Nguyen
@ 2007-03-16 20:31 ` YOSHIFUJI Hideaki / 吉藤英明
2007-03-16 20:32 ` Jan Engelhardt
0 siblings, 1 reply; 7+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2007-03-16 20:31 UTC (permalink / raw)
To: cnguyen; +Cc: netfilter-devel
In article <45FB0B61.8060809@certicom.com> (at Fri, 16 Mar 2007 16:25:53 -0500), Chinh Nguyen <cnguyen@certicom.com> says:
> I believe that this is the right list for my question. I'm trying to get
> SHA-2 HMAC support working ipsec in linux kernel (I'm configuring via
> pfkey).
I don't think so.
Use linux-crypto@vger.kernel.org instead.
--yoshfuji
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: SHA-2 HMAC support in linux kernel
2007-03-16 20:31 ` YOSHIFUJI Hideaki / 吉藤英明
@ 2007-03-16 20:32 ` Jan Engelhardt
2007-03-16 21:42 ` Chinh Nguyen
0 siblings, 1 reply; 7+ messages in thread
From: Jan Engelhardt @ 2007-03-16 20:32 UTC (permalink / raw)
To: YOSHIFUJI Hideaki / 吉藤英明
Cc: cnguyen, netfilter-devel
On Mar 17 2007 05:31, YOSHIFUJI Hideaki / 吉藤英明 wrote:
>In article <45FB0B61.8060809@certicom.com> (at Fri, 16 Mar 2007 16:25:53 -0500), Chinh Nguyen <cnguyen@certicom.com> says:
>
>> I believe that this is the right list for my question. I'm trying to get
>> SHA-2 HMAC support working ipsec in linux kernel (I'm configuring via
>> pfkey).
>
>I don't think so.
>Use linux-crypto@vger.kernel.org instead.
(And don't hijack threads.)
Jan
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: SHA-2 HMAC support in linux kernel
2007-03-16 20:32 ` Jan Engelhardt
@ 2007-03-16 21:42 ` Chinh Nguyen
0 siblings, 0 replies; 7+ messages in thread
From: Chinh Nguyen @ 2007-03-16 21:42 UTC (permalink / raw)
To: netfilter-devel
My apologies to both.
Chinh
--
http://www.certicom.com
Jan Engelhardt wrote:
> On Mar 17 2007 05:31, YOSHIFUJI Hideaki / 吉藤英明 wrote:
>> In article <45FB0B61.8060809@certicom.com> (at Fri, 16 Mar 2007 16:25:53 -0500), Chinh Nguyen <cnguyen@certicom.com> says:
>>
>>> I believe that this is the right list for my question. I'm trying to get
>>> SHA-2 HMAC support working ipsec in linux kernel (I'm configuring via
>>> pfkey).
>> I don't think so.
>> Use linux-crypto@vger.kernel.org instead.
>
> (And don't hijack threads.)
>
>
> Jan
^ permalink raw reply [flat|nested] 7+ messages in thread
* using libnetfilter_queue
@ 2007-11-16 21:02 Abhijit Menon-Sen
2007-11-16 22:14 ` Eric Leblond
0 siblings, 1 reply; 7+ messages in thread
From: Abhijit Menon-Sen @ 2007-11-16 21:02 UTC (permalink / raw)
To: netfilter-devel
(I posted to the lartc mailing list, and received no responses, so I'm
posting here too.)
Hi.
Has anyone written or used, or does anyone know of, applications that
use libnetfilter_queue to mangle packets in userspace before letting
them proceed on their way?
I'm wondering if it's possible to write a not-quite-transparent proxy
that way, and looking for documentation, examples, and inspiration.
Thanks.
-- ams
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-11-16 22:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-16 19:50 Using libnetfilter_queue Rennie deGraaf
2007-03-16 21:25 ` SHA-2 HMAC support in linux kernel Chinh Nguyen
2007-03-16 20:31 ` YOSHIFUJI Hideaki / 吉藤英明
2007-03-16 20:32 ` Jan Engelhardt
2007-03-16 21:42 ` Chinh Nguyen
-- strict thread matches above, loose matches on Subject: below --
2007-11-16 21:02 using libnetfilter_queue Abhijit Menon-Sen
2007-11-16 22:14 ` Eric Leblond
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).