LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Raw socket address filter (https://www.linuxquestions.org/questions/programming-9/raw-socket-address-filter-710505/)

kzsolt 03-10-2009 10:10 AM

Raw socket address filter
 
I try to develop IP router like application.
:cry: 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.
:confused: Any idea to solve this problem?

vkmgeek 03-11-2009 02:56 AM

enable packet forwading

kzsolt 03-11-2009 09:07 AM

Quote:

Originally Posted by vkmgeek (Post 3471539)
enable packet forwading

You mean ip_forward for the subject interface?

kzsolt 03-13-2009 06:51 AM

:cry: Setting the ip_forward and forwarding does not help (no firewall, restart, etc).

kzsolt 05-21-2009 12:14 PM

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...


All times are GMT -5. The time now is 05:28 AM.