Sending RAW IP-Packets with "spoofed" source-addresses?

From: Tomas Lund (
Date: Tue Jun 06 2000 - 17:25:26 EST

I have been trying for a while now to write a program that sends out a
"spoofed" IP-packet, but I just canīt get it to work. Iīm writing a
program that looks for DHCP-servers on the local ethernet-segment, and i
want to send my packages with source-address and destination

The best way I can think of to do this is something like this:

set options IP_HDRINCL and SO_BROADCAST on the socket.
build my package, IP-header, UDP-header and DHCP-data
sendto(s, &buf, sizeof(buf), MSG_DONTROUTE, &sa, sizeof(sa));

As far as I can remember this used to work on older kernels, the only
thing the kernel modified was the IP checksum, but now it seems to change
the source IP also. Iīm currently running 2.3.99-pre3.

I have searched the net for some example code to do this, but I canīt find
anything :(

Could someone please point me in the right direction?

Best regards,

To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to

This archive was generated by hypermail 2b29 : Wed Jun 07 2000 - 21:00:33 EST