urgent help on libiptc
Hi
I am working on a project to create a firewall using iptables. I am using ‘libiptc’ library. Now actually I am stucked with the iptc_commit,iptc_insert_entry functions.
There is no tutorial connecting those two topics. From net I got a document “querying libiptc” but in that file that do not tell how to implement the rules for a firewall with an example. So if u please can help me in this topic regarding the implementation of rules then that will be very grateful.
I am also stucked with how to specify target to the rule that I get from the user.
Please can u help me in specifying target to the rule and what are the uses of ipt_match and ipt_target structures?
Please contact me soon because it is an urgent task.
Awaiting u r reply
Vijay
---------------------------------
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, and more
Quoted 1 line
There is no tutorial connecting those two topics.
This is because libiptc is not really thought of as a useful library to develop other applications; it's an internal detail of the current iptables implementation.
If you need to integrate other applications with iptables, you are supposed to call the iptables, iptables-save, and iptables-restore programs, and let them worry about the details.
Any program you write now to work with libiptc, is bound to fail some time in the not so far future, when the next rewrite of firewalling happens. This is already in the works, and as far as I know, there will be no attempt at library backwards compatibility.
best regards
Patrick
Hello Patrick,
Humm, that doesn't sound too good.
libiptc would be a great thing for directly manipulating rules. if one has to use the command line tool, there's an annoying problem: you would have to parse the output, which is not really a way I would love to go (I am facing the same problem here). On the other hand, since the commandline tool always transfers all rules between kernel and userspace, it's awfully slow, if you have to update/modify approx 3000 rules.
The other question which remains then: Will the iptables commandline tool be stable in the sense of: will the output be the same and will the commandline switches stay ther same.
If any developer of iptables reads this, I'd appreciate any thoughts on that.
Thnx
-Sven
Quoted 1 line · you
Quoted 1 line
There is no tutorial connecting those two topics.
PS> This is because libiptc is not really thought of as a useful library PS> to develop other applications; it's an internal detail of the current PS> iptables implementation.
PS> If you need to integrate other applications with iptables, you are PS> supposed to call the iptables, iptables-save, and iptables-restore PS> programs, and let them worry about the details.
PS> Any program you write now to work with libiptc, is bound to fail PS> some time in the not so far future, when the next rewrite of firewalling PS> happens. This is already in the works, and as far as I know, there will PS> be no attempt at library backwards compatibility.
PS> best regards
PS> Patrick
Signature · 2 lines
Best regards, DarKRaveR mailto:[email protected]
Quoted 1 line
Humm, that doesn't sound too good.
Too bad.
Quoted 4 lines
libiptc would be a great thing for directly manipulating rules. if one has to use the command line tool, there's an annoying problem: you would have to parse the output, which is not really a way I would love to go (I am facing the same problem here).
This is true. Note that iptables-save format is designed to be a bit more sane to parse than 'iptables -L' output. Especially, there is already a working parser, called iptables-restore. Hope this helps some.
Quoted 4 lines
On the other hand, since
the commandline tool always transfers all rules between kernel and userspace, it's awfully slow, if you have to update/modify approx 3000 rules.
This will be exactly the same when you use libiptc - it is the (admittedly broken) way the kernel/user interface works, now. This is the main driver which pushes the rewrite that is currently happening.
Quoted 5 lines
The other question which remains then: Will the iptables commandline tool be stable in the sense of: will the output be the same and will the commandline switches stay ther same.
If any developer of iptables reads this, I'd appreciate any thoughts on that.
The 'iptables -L' output, and the 'iptables' commandline interface, will change, or so I've been told. Especially the commandline interface:
it is too flexible (permits you lots of variants in the order of options).
Things may be better with the iptables-save / iptables-restore file format, or so I hope.
Note that I'm not involved in those rewrite activities, so all this is second hand information. And I do think that the questions deserve a reliable answer, regarding IF, WHEN, and HOW such a committment CAN be made.
best regards
Patrick
Hello Patrick,
Thnx for the answer, but there's some things I'd like to add ...
Quoted 1 line · you
Quoted 1 line
Humm, that doesn't sound too good.
PS> Too bad.
Quoted 4 lines
Quoted 4 lines
libiptc would be a great thing for directly manipulating rules. if one has to use the command line tool, there's an annoying problem: you would have to parse the output, which is not really a way I would love to go (I am facing the same problem here).
PS> This is true. Note that iptables-save format is designed to be a bit more PS> sane to parse than 'iptables -L' output. Especially, there is already a PS> working parser, called iptables-restore. Hope this helps some.
This might be an interesting approach, I'll have to have a closer look on that ...
Quoted 4 lines
Quoted 4 lines
On the other hand, since
the commandline tool always transfers all rules between kernel and userspace, it's awfully slow, if you have to update/modify approx 3000 rules.
PS> This will be exactly the same when you use libiptc - it is the PS> (admittedly broken) way the kernel/user interface works, now. PS> This is the main driver which pushes the rewrite that is currently PS> happening.
Humm, not exactly, with the commandline tool I can alter one rule and it commits ... when I use libiptc this is only done after updating all the rules. In comparison to the load/save feature, of course, you are absolutely right, from what I understood.
Quoted 5 lines
Quoted 5 lines
The other question which remains then: Will the iptables commandline tool be stable in the sense of: will the output be the same and will the commandline switches stay ther same.
If any developer of iptables reads this, I'd appreciate any thoughts on that.
PS> The 'iptables -L' output, and the 'iptables' commandline interface, PS> will change, or so I've been told. Especially the commandline interface:
PS> it is too flexible (permits you lots of variants in the order of options).
PS> Things may be better with the iptables-save / iptables-restore file format, PS> or so I hope.
that all doesn't sound too promising, this really is a pitty :-(. An abstract Interface is always a thing one appreciates, at least if it's to some extend 'stable' ... but I guess this is just life ;-).
PS> Note that I'm not involved in those rewrite activities, so all this PS> is second hand information. And I do think that the questions deserve PS> a reliable answer, regarding IF, WHEN, and HOW such a committment CAN PS> be made.
I surely understand that, I really didn't expect an answer on that, I was rather interested in the future development and if there's plans to either keep command line switches, or maybe providing an abstract interface for heavywieght applications, that need to tweak a lot of rules. Thanx for that long and honest answer, it helped out on some further considerations concerning the software I am trying to write.
PS> best regards
PS> Patrick
Anyway, it would be nice if one of those folks rewriting/redesigning everything could drop a short note/comment on this ...
So long ...
Signature · 2 lines
Best regards, Sven mailto:[email protected]