Re: stopping the packets from getting to kernel
Graeme Connell <[email protected]> Thu, 08 Jul 2004 11:16:27 -0400
| Newsgroups | gmane.comp.security.libnet |
|---|---|
| Message-ID | <[email protected]> |
You could try a few things:
Since you're in Linux, you probably have IPTables. You could just
configure it to drop packets going to whatever port you're using. Check
out both the documentation on IPTables and linux/netfilter.h
Also, it sounds like you want to make a TCP connection, with your SYN ->
SYN/ACK -> ACK. Why not just use sockets like a normal connection
would, at least until the whole handshake thing is complete? You could
even just use sockets to open the S-SA-A connection, then never close it
and start using libnet to start sending packets.
--Graeme Connell
> Hi all,
> I want to write a program to capture and send some packets but I have
> a problem that the linux kernel responds to the packets that I capture
> and ruins the TCP sessions.
>
> For example.. I send a TCP SYN packet to some host X using
> libnet..then X replies with a SYN Ack...I capture this packet with
> libpcap and want to reply with a Ack but the kernel also gets a copy
> from it and immediately sends a reset because as for the kernel it is
> a Ack packet which he did not send the SYN for. So the TCP session
> gets destroyed..is there any way to hinder the packets captured by
> libpcap from reaching the kernel or is there any other idea on how to
> solve this issue???
>
> Thanks for your replies and best regards.
> Mustaffa Abu Sedira
>