public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Mira Limbeck <m.limbeck@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>,
	Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH conntrack-tool v2 1/5] initial commit
Date: Thu, 4 Feb 2021 11:15:13 +0100	[thread overview]
Message-ID: <56f3e87a-27f8-6672-3fa3-fad3bd495e0a@proxmox.com> (raw)
In-Reply-To: <8bc0c730-c3e9-1395-a6af-1f1934840192@proxmox.com>

On 2/4/21 9:07 AM, Thomas Lamprecht wrote:
> On 03.02.21 15:25, Mira Limbeck wrote:
>> Dumping conntrack information and importing conntrack information works
>> for IPv4 and IPv6. No filtering is supported for now. pve-conntrack-tool
>> will always return both IPv4 and IPv6 conntracks together.
>>
>> Conntracks are serialized as JSON and printed on STDOUT line by line
>> with one line containing one conntrack. When inserting data is read
>> from STDIN line by line and expected to be one JSON object per line
>> representing the conntrack.
>>
>> Currently some conntrack attributes are not supported. These are
>> HELPER_INFO, CONNLABELS and CONNLABELS_MASK. The reason for this is that
>> handling of variable length attributes does not seem to be correctly
>> implemented in libnetfilter_conntrack. To fix this we would probably have
>> to use libmnl directly.
>>
>> Conntracks containing protonum 2 (IGMP) are ignored in the dump as
>> they can't be inserted using libnetfilter_conntrack (conntrack-tools'
>> conntrack also exhibits the same behavior).
>>
>> Expectation support, which is necessary for FTP and other protocols, is
>> not yet implemented.
>>
>> Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
>> ---
>> v2:
>>   - changed Conntracks to Socket
>>   - reworked a lot of the code for less code duplication
>>   - reduced usage of 'unsafe'
>>   - added/changed things based on @Wobu's suggestions (off-list)
>>
>>   Cargo.toml                 |  14 ++
>>   src/main.rs                | 488 +++++++++++++++++++++++++++++++++++++
>>   src/mnl.rs                 | 132 ++++++++++
>>   src/netfilter_conntrack.rs | 168 +++++++++++++
>>   4 files changed, 802 insertions(+)
>>   create mode 100644 Cargo.toml
>>   create mode 100644 src/main.rs
>>   create mode 100644 src/mnl.rs
>>   create mode 100644 src/netfilter_conntrack.rs
>>
> I take a (very) quick look at it and the code itself seems quite sensible.
>
> One higher level question though, would it makes sense do have the whole
> plumbing and general socket interfacing in it's own library crate (or sub
> workspace or something like that) and the binary here separate and as
> plain user of that create.
>
> That way we could additionally publish it on crates.io, could be helpful
> form some people (even if conntrack/nl is certainly a bit of a niche).
>
> What do you think about that?

The bindings are not complete, I only added what I needed during 
development and sometimes a bit more.

We would have to remove the query_(conntracks|expects) and 
insert_(conntrack|expect) functions from the Socket then.


For libmnl there are already 2 crates available which provide a wrapper 
around the low level bindings: https://github.com/mullvad/mnl-rs and 
https://crates.io/crates/crslmnl which are more complete.

For netlink itself there are also some crates: 
https://crates.io/keywords/netlink

But I could not find any bindings for libnetfilter_conntrack.






  reply	other threads:[~2021-02-04 10:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03 14:25 Mira Limbeck
2021-02-03 14:25 ` [pve-devel] [PATCH conntrack-tool v2 2/5] add packaging support Mira Limbeck
2021-02-04  7:08   ` Thomas Lamprecht
2021-02-04  9:55     ` Mira Limbeck
2021-02-03 14:25 ` [pve-devel] [PATCH conntrack-tool v2 3/5] add expectation support Mira Limbeck
2021-02-03 14:25 ` [pve-devel] [PATCH conntrack-tool v2 4/5] add additional bindings Mira Limbeck
2021-02-03 14:25 ` [pve-devel] [PATCH conntrack-tool v2 5/5] replace C callback with closures Mira Limbeck
2021-02-03 14:25 ` [pve-devel] [PATCH qemu-server v2] copy conntrack information on migration Mira Limbeck
2021-02-05  8:11   ` Fabian Ebner
2021-02-05  9:51     ` Mira Limbeck
2021-02-04  8:07 ` [pve-devel] [PATCH conntrack-tool v2 1/5] initial commit Thomas Lamprecht
2021-02-04 10:15   ` Mira Limbeck [this message]
2021-02-04 10:20     ` Thomas Lamprecht
2021-02-04 10:16 ` Mira Limbeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56f3e87a-27f8-6672-3fa3-fad3bd495e0a@proxmox.com \
    --to=m.limbeck@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=t.lamprecht@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal