Changing the source IP of outgoing UDP packets on a socket

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have a multi-homed host with two interfaces: eth0: 10.0.0.1 and a
virtual interface eth0:0 10.0.0.101. What I'm trying to do is send a
broadcast packet to 10.0.0.255 using the virtual IP as the source
address(since both IPs are on the same network).

Currently, when I create the destination broadcast socket and send some
data, tcpdump shows the source IP to be 10.0.0.1.  But I need the source
IP to be 10.0.0.101!  

Why I need to know: I'm writing a linux client app that updates
name-to-IP address mappings for a commercial server.  The problem is
that if the IP address encapsulated in the message doesn't match the src
ip address within the IP header, the packet is rejected(suspicion of
spoofing).

Now I know it's quite possible to change the src ip of an outgoing
packet in kernel space, but I'm perplexed on how to do this from user
space.

I've RTFM a lot, and the man pages, though If anyone can provide more
information or guidance, it'll be greatly appreciated.

Thanks,

Kashif Shaikh

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux