LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 03-10-2009, 10:10 AM   #1
kzsolt
LQ Newbie
 
Registered: Mar 2009
Location: Budapest, Hungary
Distribution: OpenSuse
Posts: 10

Rep: Reputation: 0
Raw socket address filter


I try to develop IP router like application.
The problem is if the RAW IP socket binded to interface with bind() the received packet filtered with IP address of interface.
For example we have client and route like application in a same subnet 192.168.1.0/255.255.225.0. The default route for the client is the router like application (address of). The client send ip packet with destination 10.11.12.13 to router like application. The router like application binded to interface 192.168.1.254/255.255.225.0 and the socket discard it because not in the address range of the interface. But the router normally receive and forward this packet.
Any idea to solve this problem?
 
Old 03-11-2009, 02:56 AM   #2
vkmgeek
Member
 
Registered: Feb 2006
Location: Ahmedabad
Distribution: rhel5
Posts: 185
Blog Entries: 2

Rep: Reputation: 31
enable packet forwading
 
Old 03-11-2009, 09:07 AM   #3
kzsolt
LQ Newbie
 
Registered: Mar 2009
Location: Budapest, Hungary
Distribution: OpenSuse
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by vkmgeek View Post
enable packet forwading
You mean ip_forward for the subject interface?
 
Old 03-13-2009, 06:51 AM   #4
kzsolt
LQ Newbie
 
Registered: Mar 2009
Location: Budapest, Hungary
Distribution: OpenSuse
Posts: 10

Original Poster
Rep: Reputation: 0
Setting the ip_forward and forwarding does not help (no firewall, restart, etc).
 
Old 05-21-2009, 12:14 PM   #5
kzsolt
LQ Newbie
 
Registered: Mar 2009
Location: Budapest, Hungary
Distribution: OpenSuse
Posts: 10

Original Poster
Rep: Reputation: 0
I found two solution:

1). Add ip route to local table refer to interface required destination address range and host/local qalifyers. And bind socket to INADDR_ANY address. Then filter incoming packets with the required destination address range.

2). If the source not interesting use NAPT at PREROUTING/POSTROUTING point...
 
  


Reply

Tags
filter, raw, socket


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
Raw socket programming homePBX Linux - Networking 6 05-02-2008 12:25 PM
Help with raw socket programming tuxfood Programming 2 07-25-2005 01:17 PM
Raw Socket Programing djgerbavore Programming 2 08-18-2004 12:58 PM
Socket Raw linuxanswer Programming 1 04-01-2004 09:43 PM
raw socket permition moonloader Linux - Networking 2 12-08-2003 09:20 AM


All times are GMT -5. The time now is 12:47 AM.

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