Re: Reinjecting IP Packets

From: Richard B. Johnson
Date: Fri Aug 22 2003 - 12:00:27 EST


On Fri, 22 Aug 2003, Patrick Sodre Carlos wrote:

>
> My mistake... I forgot to mention that the packet will be coming from
> user-space.
>
> Patrick

Then just use raw packets. Find the source of 'ping' and send
packets just like it does...

ld->icp.net.icmp_id = ld->ident;
ld->icp.net.icmp_cksum = 0;
ld->icp.net.icmp_cksum = chksum(&ld->icp, len);
if(sendto(ld->s, &ld->icp, len, 0, &ld->where, sizeof(ld->where)) != len)
perror("ping: sendto");
}


Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
Note 96.31% of all statistics are fiction.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/