netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* IPTables API (redux)
@ 2010-12-11 23:42 James Nurmi
  2010-12-12  4:17 ` Jan Engelhardt
  2010-12-14 14:41 ` Jesper Dangaard Brouer
  0 siblings, 2 replies; 3+ messages in thread
From: James Nurmi @ 2010-12-11 23:42 UTC (permalink / raw)
  To: netfilter-devel

I realize this has come up a few times, but I'd like to
programmatically be able to  query and modify IPTables rules, without
shelling out.

After digging, it would seem theres been some discussion around this
issue, but I was unable to find any resolution.

Background: the reason is was a hope to write native bindings for Go
for certain chain/table manipulation tasks.

For curiosities sake, I did a bit of reverse engineering and
discovered that the functionality I'm interested in appears to be
handled through set/getsockopt and requires a large amount of handling
for both COMPAT and not COMPAT kernel compilations, leading to
structures potentially being packed differently on the way in then on
the way out, so a "trivial" implementation was just out as far as I
could tell.

While I can successfully communicate with the  netlink (iptables and
not) modules via some custom work, I've been unable to find anything
but references to desires for an NL layer to communicate with IPtables
rather than the get/setsockopt channels, and the general opinion that
"you're doing it wrong if you want this", but just in case there were
hidden developments, I thought I'd poke.

And while it's unlikely I'd be the one to do it, is there a good
technical reason to not have netlink handling the table/chain
manipulation rather than opaque get/set sockopts?

Cheers,
James

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

* Re: IPTables API (redux)
  2010-12-11 23:42 IPTables API (redux) James Nurmi
@ 2010-12-12  4:17 ` Jan Engelhardt
  2010-12-14 14:41 ` Jesper Dangaard Brouer
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Engelhardt @ 2010-12-12  4:17 UTC (permalink / raw)
  To: James Nurmi; +Cc: netfilter-devel


On Sunday 2010-12-12 00:42, James Nurmi wrote:
>I realize this has come up a few times, but I'd like to
>programmatically be able to  query and modify IPTables rules, without
>shelling out.
>
>I've been unable to find anything
>but references to desires for an NL layer to communicate with IPtables

Not with iptables, but see
http://thread.gmane.org/gmane.comp.security.firewalls.netfilter.general/41195
for status on it.

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

* Re: IPTables API (redux)
  2010-12-11 23:42 IPTables API (redux) James Nurmi
  2010-12-12  4:17 ` Jan Engelhardt
@ 2010-12-14 14:41 ` Jesper Dangaard Brouer
  1 sibling, 0 replies; 3+ messages in thread
From: Jesper Dangaard Brouer @ 2010-12-14 14:41 UTC (permalink / raw)
  To: James Nurmi; +Cc: Netfilter Developers

On Sat, 11 Dec 2010, James Nurmi wrote:

> I realize this has come up a few times, but I'd like to
> programmatically be able to  query and modify IPTables rules, without
> shelling out.
>
> After digging, it would seem theres been some discussion around this
> issue, but I was unable to find any resolution.

I have created a Perl CPAN module named IPTables::libiptc, for doing 
iptables manipulation directly from Perl.

The only problem with this Perl module is I have not had time to update it 
to use the newer libiptc API introduced (by Jan) in 1.4.3.  Thus, its only 
compatible below version 1.4.3.


> For curiosities sake, I did a bit of reverse engineering and
> discovered that the functionality I'm interested in appears to be
> handled through set/getsockopt and requires a large amount of handling
> for both COMPAT and not COMPAT kernel compilations, leading to
> structures potentially being packed differently on the way in then on
> the way out, so a "trivial" implementation was just out as far as I
> could tell.

You should use the libiptc for parsing the "blob".

Cheers,
   Jesper Brouer

--
-------------------------------------------------------------------
MSc. Master of Computer Science
Dept. of Computer Science, University of Copenhagen
Author of http://www.adsl-optimizer.dk
-------------------------------------------------------------------

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

end of thread, other threads:[~2010-12-14 14:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-11 23:42 IPTables API (redux) James Nurmi
2010-12-12  4:17 ` Jan Engelhardt
2010-12-14 14:41 ` Jesper Dangaard Brouer

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