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

From: Tomas Lund (tlund@nxs.se)
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 0.0.0.0 and destination
255.255.255.255

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

s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
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,
Tomas

-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.rutgers.edu



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