----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, November 25, 2002 1:47 PM
Subject: [plug] pf_packet


> i'm using sockets with pf_packet
> at home on ethertaps and i can
> actually write() on the socket. here in school, with
> the (next) real thing, i can't.

you have to be as root user in order raw socket to work...

> i've followed packet(7) instructions on bind()-ing,
> still nothing: i get EINVAL error. i looked at
> raw(7), and IPPROTO_RAW can not send (haven't tried it
> though).
>
> anybody can help me on this? or perhaps suggestions on
> another way i can send raw ip packets, using only 1
> socket for any protocol above ip.

ok... ill give you a sample code and hoping that you will use it for good
intentions and for educational purposes only... remember you have to be as
root user in order raw socket to work...

rawsocket.c

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>

int main(void) {
    int sockd;

    sockd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);

    return (0);
}

gcc -O3 -ansi -pedantic -Wall -o rawsocket rawsocket.c

happy learning...

fooler.

_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

Fully Searchable Archives With Friendly Web Interface at http://marc.free.net.ph

To subscribe to the Linux Newbies' List: send "subscribe" in the body to 
[EMAIL PROTECTED]

Reply via email to