netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [ULOGD2] UNIXSOCK plugin (v5b)
@ 2010-10-20 11:44 Pierre Chifflier
  2010-10-20 11:44 ` [PATCH 1/2] Add new input plugin UNIXSOCK Pierre Chifflier
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Pierre Chifflier @ 2010-10-20 11:44 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Eric Leblond


Hi,

First of all, sorry for the long time with no updates on this patch.
This is a resend of the patches for the UNIXSOCK input plugin for ulogd2.

Please let me know if there are any issues.

PS: hope you enjoyed the oowall presentation :)



Changes for v5:
- align all structures on 64 bits instead of 32
  This has been tested on a sparc64 (thanks to Jan)
- update pcap2ulog to handle different pcap formats

Changes for v4:
- use structures instead of reading integers directly
- all structures and fields are now aligned (4 bytes)
- update pcap2ulog script to use aligned data as well

Changes for v3:
- if the bufsize value (from conf) is 0, try to guess the buffer size
  using getsockopt(SOL_SOCKET, SO_RCVBUF ..)
- set default path to /var/run/ulogd/ulogd2.sock with mode 0600
- add new configuration options perms, owner and group to be able
  to set these parameters on the created socket
- change the input algorithm to make it more robust against junk data (which
  can happen if the client is desynchronized)
- fixed a few bugs

Description:

[1] add new input plugin UNISOCK, using a unix socket. This allows userspace
applications to send packets to ulogd, for example to send packets offline.
It uses a key-length-value protocol to handle optional fields or extensions.

[2] is a Perl script to load a PCAP file and send it to ulogd using the
UNIXSOCK plugin.

Pierre

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] Add new input plugin UNIXSOCK
@ 2010-03-01 19:33 Pablo Neira Ayuso
  2010-03-01 22:16 ` [PATCH 2/2] Add helper script pcap2ulog Pierre Chifflier
  0 siblings, 1 reply; 8+ messages in thread
From: Pablo Neira Ayuso @ 2010-03-01 19:33 UTC (permalink / raw)
  To: Pierre Chifflier; +Cc: netfilter-devel, eleblond, Jan Engelhardt

Pierre Chifflier wrote:
> On Sun, Feb 28, 2010 at 05:28:38PM +0100, Pablo Neira Ayuso wrote:
>>>>> +struct ulogd_unixsock_option_t  {
>>>>> +	uint16_t option_id;
>>>>> +	uint16_t option_length;
>>>>> +	char     option_value[0];
>>>>> +} __attribute__((packed));
>>>>> +
>>>>> +#define ALIGN_SIZE 8
>>>> Minor question: why align this to 64 bits?
>>> I originally used an alignment to 32 bits, but Jan noticed it would
>>> break if using options/values on 64 bits (and a test confirmed that). I
>>> took 64 bits as the biggest allowed value for integers.
>> I would need to look into this in more detail, not sure where the
>> problem is. I think that you can use something like `struct nlattr' (see
>> include/linux/netlink.h) and then nla_put() to add attributes in the TLV
>> format (see lib/nlattr.c). Those are align-safe. I'm using something
>> similar for conntrackd for the synchronization messages (src/build.c and
>> src/parse.c).
> 
> Yes, this is very similar though NLA_ALIGNTO is set to 4 which will
> cause problems with 64 bits integers.
> The other way to solve this would be to read integers byte per byte,
> like in [1], but I found this not very elegant (and is likely to be slow
> compared to aligned access).
> 
> Or do you have any preferred solution ? Maybe using nlattr + one special
> function for dealing with 64 bits variables ?

Aligning this to 8 bytes seems fine to me (messages would be bigger
though). I think that you can use something like:

struct ulogd_unixsock_option_t  {
	uint32_t option_id;
	uint32_t option_length;
	char     option_value[0];
} __attribute__((packed));

So you can benefit from the extra bytes that would be added as padding.

^ permalink raw reply	[flat|nested] 8+ messages in thread
* [ULOGD2] UNIXSOCK plugin (v5)
@ 2010-02-26 20:54 Pierre Chifflier
  2010-02-26 20:54 ` [PATCH 2/2] Add helper script pcap2ulog Pierre Chifflier
  0 siblings, 1 reply; 8+ messages in thread
From: Pierre Chifflier @ 2010-02-26 20:54 UTC (permalink / raw)
  To: netfilter-devel; +Cc: eleblond

Hi,

Here is an updated version of the UNIXSOCK plugin.

Changes for v5:
- align all structures on 64 bits instead of 32
  This has been tested on a sparc64 (thanks to Jan)
- update pcap2ulog to handle different pcap formats

Changes for v4:
- use structures instead of reading integers directly
- all structures and fields are now aligned (4 bytes)
- update pcap2ulog script to use aligned data as well

Changes for v3:
- if the bufsize value (from conf) is 0, try to guess the buffer size
  using getsockopt(SOL_SOCKET, SO_RCVBUF ..)
- set default path to /var/run/ulogd/ulogd2.sock with mode 0600
- add new configuration options perms, owner and group to be able
  to set these parameters on the created socket
- change the input algorithm to make it more robust against junk data (which
  can happen if the client is desynchronized)
- fixed a few bugs

Description:

[1] add new input plugin UNISOCK, using a unix socket. This allows userspace
applications to send packets to ulogd, for example to send packets offline.
It uses a key-length-value protocol to handle optional fields or extensions.

[2] is a Perl script to load a PCAP file and send it to ulogd using the
UNIXSOCK plugin.

Pierre


^ permalink raw reply	[flat|nested] 8+ messages in thread
* [ULOGD2] UNIXSOCK plugin (v4)
@ 2010-01-14 19:41 Pierre Chifflier
  2010-01-14 19:41 ` [PATCH 2/2] Add helper script pcap2ulog Pierre Chifflier
  0 siblings, 1 reply; 8+ messages in thread
From: Pierre Chifflier @ 2010-01-14 19:41 UTC (permalink / raw)
  To: netfilter-devel; +Cc: eleblond


Hi,

Here is an updated version of the UNIXSOCK plugin.

Changes for v4:
- use structures instead of reading integers directly
- all structures and fields are now aligned (4 bytes)
- update pcap2ulog script to use aligned data as well

Changes for v3:
- if the bufsize value (from conf) is 0, try to guess the buffer size
  using getsockopt(SOL_SOCKET, SO_RCVBUF ..)
- set default path to /var/run/ulogd/ulogd2.sock with mode 0600
- add new configuration options perms, owner and group to be able
  to set these parameters on the created socket
- change the input algorithm to make it more robust against junk data (which
  can happen if the client is desynchronized)
- fixed a few bugs

Description:

[1] add new input plugin UNISOCK, using a unix socket. This allows userspace
applications to send packets to ulogd, for example to send packets offline.
It uses a key-length-value protocol to handle optional fields or extensions.

[2] is a Perl script to load a PCAP file and send it to ulogd using the
UNIXSOCK plugin.

Pierre


^ permalink raw reply	[flat|nested] 8+ messages in thread
* [ULOGD2] UNIXSOCK plugin (v3)
@ 2009-11-01 10:53 Pierre Chifflier
  2009-11-01 10:53 ` [PATCH 2/2] Add helper script pcap2ulog Pierre Chifflier
  0 siblings, 1 reply; 8+ messages in thread
From: Pierre Chifflier @ 2009-11-01 10:53 UTC (permalink / raw)
  To: netfilter-devel; +Cc: eleblond


Hi,

Here is an updated version of the UNIXSOCK plugin.

Changes since last version:
- if the bufsize value (from conf) is 0, try to guess the buffer size
  using getsockopt(SOL_SOCKET, SO_RCVBUF ..)
- set default path to /var/run/ulogd/ulogd2.sock with mode 0600
- add new configuration options perms, owner and group to be able
  to set these parameters on the created socket
- change the input algorithm to make it more robust against junk data (which
  can happen if the client is desynchronized)
- fixed a few bugs

Description:

[1] add new input plugin UNISOCK, using a unix socket. This allows userspace
applications to send packets to ulogd, for example to send packets offline.
It uses a key-length-value protocol to handle optional fields or extensions.

[2] is a Perl script to load a PCAP file and send it to ulogd using the
UNIXSOCK plugin.

Pierre


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

end of thread, other threads:[~2010-10-26 14:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-20 11:44 [ULOGD2] UNIXSOCK plugin (v5b) Pierre Chifflier
2010-10-20 11:44 ` [PATCH 1/2] Add new input plugin UNIXSOCK Pierre Chifflier
2010-10-20 11:44 ` [PATCH 2/2] Add helper script pcap2ulog Pierre Chifflier
2010-10-23  9:54 ` [ULOGD2] UNIXSOCK plugin (v5b) Eric Leblond
  -- strict thread matches above, loose matches on Subject: below --
2010-03-01 19:33 [PATCH 1/2] Add new input plugin UNIXSOCK Pablo Neira Ayuso
2010-03-01 22:16 ` [PATCH 2/2] Add helper script pcap2ulog Pierre Chifflier
2010-02-26 20:54 [ULOGD2] UNIXSOCK plugin (v5) Pierre Chifflier
2010-02-26 20:54 ` [PATCH 2/2] Add helper script pcap2ulog Pierre Chifflier
2010-01-14 19:41 [ULOGD2] UNIXSOCK plugin (v4) Pierre Chifflier
2010-01-14 19:41 ` [PATCH 2/2] Add helper script pcap2ulog Pierre Chifflier
2009-11-01 10:53 [ULOGD2] UNIXSOCK plugin (v3) Pierre Chifflier
2009-11-01 10:53 ` [PATCH 2/2] Add helper script pcap2ulog Pierre Chifflier

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