Raw IP packets on Linux
mike.ayers at tumbleweed.com
Sun Aug 15 06:19:29 CEST 2004
I am trying to compose raw IP packets on Linux, then send them out a chosen
interface. So I do:
sock = socket.socket( socket.AF_PACKET, socket.SOCK_DGRAM )
sock.bind(( '192.168.1.3' ))
So far so good. I create a packet (pkt) which contains the complete IP
datagram. ID is set to 0 to tell the kernel to stamp it for me. However, I am
so far unable to send the packet (pretend ']' is '>'):
]]] sock.sendto( pkt, ('192.168.1.4', 0))
Traceback (most recent call last):
File "<stdin>", line 1, in ?
socket.error: (19, 'No such device')
What am I getting wrong here? What address type does this socket expect?
More information about the Python-list