Networking Forums

Networking Forums > Computer Networking > Linux Networking > Re: Question on sendto with PF_PACKET and SOCK_RAW.

Reply
Thread Tools Display Modes

Re: Question on sendto with PF_PACKET and SOCK_RAW.

 
 
nehavrce@yahoo.co.in
Guest
Posts: n/a

 
      01-06-2005, 07:09 AM

Andi Kleen wrote:
> On Sat, Apr 08, 2000 at 12:32:35PM -0700, Ben Greear wrote:
> > One thing that bothers me a little bit. I have 2 4-port NICs and a
> > single... The single is the one I'm trying to send messages over.
> > No matter which slot I put it in (there are only 3 PCI slots in the

MB),
> > that interface shows up as eth8. Is that normal? I thought they

probed
> > based on PCI slots, so that changing the slot would change the

ifname it
> > showed up on...

>
> It depends on the driver.
>
> >
> > One final question.. If I create the socket like:
> > int s = socket(PF_PACKET, SOCK_RAW, htons(ether_type));
> >
> > bind like this:
> > struct sockaddr_ll myaddr;
> >
> > memset(&myaddr, '\0', sizeof(myaddr));
> > myaddr.sll_family = AF_PACKET;
> > myaddr.sll_protocol = htons(ether_type);
> > myaddr.sll_ifindex = dev_idx;
> >
> > r = bind(s, (struct sockaddr*)(&myaddr), sizeof(myaddr));
> >
> > and send like this:
> > r = sendto(dev_socket, msg, msg_len, 0, NULL, 0);
> >
> > Should I expect to see this method in af_packet.cc called?
> > static int packet_sendmsg(struct socket *sock, struct msghdr *msg,

int len,
> > struct scm_cookie *scm)

>
> Yes.
>
> >
> > I was expecting to see packet_sendmsg_spkt, but it is using the one

above...
>
> This one is called for (PF_INET, SOCK_PACKET) sockets
>
>
> -Andi
> -
> To unsubscribe from this list: send the line "unsubscribe linux-net"

in
> the body of a message to (E-Mail Removed)


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stumped on IPv6 ping in c language with PF_PACKET/SOCK_DGRAM pdbuchan@yahoo.com Linux Networking 10 11-03-2011 03:00 PM
SOCK_RAW error in Windows 98 when trying to connect Wade Wireless Networks 0 03-08-2007 11:02 PM
Raw socket PF_PACKET questions manolinux Linux Networking 1 09-08-2006 05:54 PM
send and receive raw packets with PF_PACKET and bypassing the kernel nehavrce@yahoo.co.in Linux Networking 0 01-06-2005 07:37 AM
PF_INET,SOCK_RAW - obsolete? Michal Wojciechowski Linux Networking 0 07-09-2004 02:03 AM



1 2 3 4 5 6 7 8 9 10 11