Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-17-2007, 12:20 AM   #1
LQ Newbie
Registered: Jan 2007
Posts: 1

Rep: Reputation: 0
Source code to block Specific Network protocols/ports


I require C Language Source Code to block Specific Network protocols and ports which can be used on LINUX with some documentation

Old 01-17-2007, 01:22 AM   #2
Registered: Jul 2003
Location: NY
Distribution: Slackware64, LFS
Posts: 312

Rep: Reputation: 53

The C Programming Language (2nd Edition)

Or, you may want to utilize's work and use the Iptables framework for building firewalls, which is already in place in the Linux kernel and various related user-land tools, instead of writing your own.
Old 01-17-2007, 02:27 AM   #3
Senior Member
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 64
Linux contains a mechanism for doing this and a lot more called netfilter. When building the kernel, it can be excluded, but it is present is kernels which ship with most mainstrean distros.

iptables is a tool used to configure netfilter. There are other tools to do the same thing, which may be more user-friendly. You don't need to write a C program to configure netfilter - just to use one of these tools.

If you're looking for a nice GUI which provides basic personal firewall type configuration options, take a look at firestarter. There are plenty of others too - you're sure to find something which fits your needs.
Old 01-17-2007, 08:43 PM   #4
Senior Member
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
Just thought I should mention that best practice is to block all ports/protocols/traffic with a firewall, and then open up only that which you need to.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
why we can't change the block size in ext2 filesystem in source code nagesh20k Linux - General 3 08-23-2006 05:47 PM
How to block specific IPs? cranium2004 Linux - Networking 3 04-01-2005 10:02 AM
Compiling source code for a network card module WindowsBurner Linux - General 12 02-16-2005 05:22 PM
Compile a source code for FastEthernet Network Card-Please assist badger311 Linux - Networking 4 07-17-2004 03:17 PM
specific source code and RPM for distro bshelton Linux - General 2 09-15-2003 09:54 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:51 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration