ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
following situation:
there is a gateway between my LAN and the Internet, and now the programming part starts. :-)
I want to write a packetsniffer sitting on my Gateway. (shouldn't be the problem). The sniffer should have the opportunity to filter out disliked packets compared with a small rulebase. Wrong dest-address or whatever ...
Does anyone of you knows a way to drop these packets out of a given stream, so they dont reach their acutal destinations ?
I have read about BPF and the IPtables headers, but i havent found usefull documents :-(
edit: i forgot to say ... the programm should run in the userspace. // prefered language is C
Why re-invent the wheel?
IPTables does a pretty good job,
all you need is to make a set of rules?
And if you really want to program your own
filter, don't start out trying to understand
IPTables, rather grab a TCP/IP programming
primer ;) and start from scratch.
acutally my program should be a content-filter for http ... i don't think it is possible to set such rules with iptables.
i just want to run the sniffer, filtering the payload. This filter decide, whether there should be a full connection to the target host or not.
Maybe i can use iptables for dropping packets during the runtime ?!
If I would use just iptables doing this job, there is no dynamic effect. I dont have a real rulebase.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.