Skip to contentSkip to conversation

Basic API Question

DISCUSSION Paul J. Caritj 2 participants 2 messages Jun 26, 2003 netfilter

lore
Share & tools
lore
#0 lore raw

Geetings,
I am trying to accomplish a very simple task: the addition, removal, etc of iptables rules through C. I have found ample documentation on developing modules, etc, but nothing to answer this basic question.

Does such an interface exist or will I basically have to pipe out shell commands (eew)?

For the sake of illustration, lets say I wanted to mark all packets bound to IP [IP] with fw-mark [mark] on the PREROUTING chain.

Thanks all,
Paul

#1 lore raw
Quoted 3 lines · Paul J. Caritj

Geetings,
I am trying to accomplish a very simple task: the addition, removal, etc of iptables rules through C.

unfortunately due to the current iptables architecture this is not an easy task :(

Quoted 5 lines

I have found ample documentation on developing modules, etc, but nothing to answer this basic question.

Does such an interface exist or will I basically have to pipe out shell commands (eew)?

no, unfortunately not. You will have to execute shell commands. If you have lots of changes, you might want to try piping into stdin of 'iptables-restore --noflush'

Quoted 2 lines

Thanks all,
Paul

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie