LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-09-2007, 02:13 AM   #1
vakulgarg
LQ Newbie
 
Registered: Nov 2007
Posts: 1

Rep: Reputation: 0
Iptables not allowing raw sockets to send IP packets with non local IP


Hi

I need to generate UDP packets with non-local source IP address in IP header. These UDP packets have destination UDP port as 5060. For this I am using raw sockets with IP_HDRINCL option. I am running my program with root previledges and it runs fine.

However, I also need to route those packets differently. For this
I have inserted an iptables rule in mangle table output chain so as to
mark all these UDP packets with dst UDP port 5060 with mark 2.

The command used is:

iptables -t mangle -A OUTPUT -p UDP --dport 5060 -j MARK --set-mark 2

The moment I insert this rule, the sendto() call in my program starts
returning failure with error code "Operation not permitted".

I have ip_forwarding ON in kernel.

One other observation is that if I put local IP address in source IP in
IP header of the packet, then the program starts working fine even
with iptables rule inserted.

I feel iptables rule is somehow not allowing to send packet with non-local
source IP address.

Can someone help in this?

Thanks in advance

Vakul
 
  


Reply



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 sockets in c wee-face Programming 1 02-01-2007 09:35 AM
Packets gets repeated in raw sockets??????? fpfernando Programming 5 03-08-2006 02:20 AM
Raw Sockets Srikanth0210 Programming 2 12-05-2005 03:22 AM
raw sockets and C wrongman Programming 3 05-04-2004 02:17 PM
raw sockets BashTin Programming 1 06-07-2003 06:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:16 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration