I'd like to write an application which have to send custom IP paquets
through a selected network interface. I've tried to use the socket
function with SOCK_RAW but it doesn't work because some fields are
rewritten by the send/write functions.

I know I can do that with the /dev/bpf* files, and/or with the libpcap.
However, I not found enought doentation to make them working. Does
anybody know how to use them for sending paquets?

Thank you for your answers.