All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Jan Engelhardt <jengelh@medozas.de>
Cc: Netfilter Developer Mailing List <netfilter-devel@vger.kernel.org>
Subject: Re: libiptc, arptables, ebtables plans or so - and header files
Date: Mon, 10 Nov 2008 19:07:30 +0100	[thread overview]
Message-ID: <49187862.50306@trash.net> (raw)
In-Reply-To: <alpine.LNX.1.10.0811101726310.23956@fbirervta.pbzchgretzou.qr>

Jan Engelhardt wrote:
> Hi Patrick and list,
> 
> 
> when Adam sent his xt_LED, I noticed that he avoided to create an 
> xt_LED.h and instead had the definition of the blob structs directly in 
> xt_LED.c and libxt_LED.c. It occurred to me that this has some 
> implications.
> 
> Theoretically, we could kill all {ipt,ip6t,xt}_*.h files in 
> <kernel>/include/linux/netfilter*/ -- since userspace, usually only 
> iptables, does not make use of them anyway, but has its own copies.
> 
> Yes, for simplicity, we let unifdef run over these headers before 
> copying them, but then again, when was the last time you had __KERNEL__ 
> in xt_*.h?
> 
> I really doubt there are any other userspace programs of these 
> files at this time. As I see it, these header files make only sense 
> when you are crafting blobs when interacting with libiptc. I am not 
> aware of any program making such extensive use of libiptc, probably due 
> to libiptc having been very closely kept in the iptables garden.
> 
> I would be tempted to suggest their removal from 
> <kernel>/include/linux/ and moving them into the code.
> 
> However... realistically you would need those files if you ever wanted 
> to interpret the blob when dealing with iptc.
> 
> Giving this some consideration, perhaps these header files should be 
> made available through iptables/a separate libiptc(-devel) package 
> instead of the kernel.

About moving the definitions - I don't see what this would buy us.
Besides that, the kernel defines these structures, so they really
belong there.

> All these philosophical questions lead to the question what should be 
> done about libiptc itself. It only looks bad because of the macro 
> substitution that is applied to produce a libip6tc... and this sort of 
> thing cannot really be resolved I figured. As in, using VFT tables to 
> dispatch for a given NFPROTO to get rid of the macro constructs is not 
> going to buy us anything - the code is so identical, it's really because 
> of miniscule differences between struct ipt_{internal_stuff} and struct 
> ip6t_{internal_stuff} that seem to make this an impossible undertaking. 
> Is it actually worth working on it?

Without having looked at it in much detail, I think it should
be pretty easy to define per-family functions to fill the
ipt_entry/ip6t_entry structs and a struct to describe the
length and offset differences. The remaining parts are invariant
across families, so the code should be easily unifiable.

> I have stopped my efforts to push arptables into iptables because 
> eventually I would have come to think about getting libiptc and libarptc 
> together, and I practically just did that with iptc and ip6tc (see 
> previous paragraph). Yeah I see it's SNAFU.
> 
> Possible exit? Clone iptables/libiptc/sonstwastables yet again into — 
> this time — an nfproto-agnostic table structure, but keep most other 
> pieces. No sample code yet, because I usually try to ask before going on 
> tasks like these.
> 
> Comments?

I think the best way is to abstract the very minor differences
using an af-specific callback for *_entry and some length information.
But I'm not familiar with libarptc, so this might not be enough.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2008-11-10 18:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-10 16:48 libiptc, arptables, ebtables plans or so - and header files Jan Engelhardt
2008-11-10 18:01 ` Rick Jones
2008-11-10 18:07 ` Patrick McHardy [this message]
2008-11-10 18:47   ` Jan Engelhardt
2008-11-12 11:13     ` Patrick McHardy
2008-11-10 18:53   ` Rick Jones
2008-11-10 19:09     ` Jan Engelhardt

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=49187862.50306@trash.net \
    --to=kaber@trash.net \
    --cc=jengelh@medozas.de \
    --cc=netfilter-devel@vger.kernel.org \
    /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 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.