• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: PF_PACKET
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PF_PACKET


  • Subject: Re: PF_PACKET
  • From: "Duane Murphy" <email@hidden>
  • Date: Fri, 23 Jul 2004 21:36:00 -0700

--- At Fri, 23 Jul 2004 16:45:26 -0700, Rich Kubota wrote:

>Enrico,
>
>You could use a bpf socket in order to send packets, as well as to
>receive packets. However, I don't have a sample of the use of a bpf
>sample for sending packets. The only sample which I have demonstrates
>how to receive packets.

There is really no point in using a BPF socket to _send_ anything. BPF is
meant to _receive_ datagrams that aren't usually available to other
processes. The canonical example for BPF is ARP because ARP packets are
eaten by the IP stack.

Sending a packet using a BPF socket is the same as sending a packet using
a raw ethernet socket. For sending, we use a raw socket.

>At 11:29 AM +0200 7/23/04, Enrico lupsyn Del Zotto wrote:
>>I see what you are taking about, but i understand (by my search on
>>google) that there is a method to build and send an arp packet + eth
>>header with bpf is it possible ?
>>thx
>>Il giorno 22/lug/04, alle 18:24, Rich Kubota ha scritto:
>>
>>> At 3:17 PM +0200 7/22/04, Enrico lupsyn Del Zotto wrote:
>>>> I must send a packet ( eth header, and arp packet ) over the en0.
>>>> In linux i use the sockaddr_ll struct and a PF_Packet. Now in bsd
>>>>i don't know how do it ,
>>>> can someone help me ?
>>>> thx,bye
>>>>
>>> Enrico,
>>>
>>> For this, you want to open a PF_NDRV socket to send out a raw
>>>ethernet packet. Take a look at the sample code BSDLLCTest
>>> <http://developer.apple.com/samplecode/BSDLLCTest/BSDLLCTest.html>
>>>
>>> This sample demonstrates the technique to open a PF_NDRV socket,
>>>which requires root access, then demonstrates both the send and
>>>receive of packets using this socket.
>>>
>>> Sending raw packets is straightforward, but the sample is designed
>>>to receive LLC Ethernet frames. You'll need to tweak the sample to
>>>receive a phase I Ethernet frame for a tcp packet, if this is
>>>within the scope of your project.

...Duane
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: PF_PACKET
      • From: Justin Walker <email@hidden>
References: 
 >Re: PF_PACKET (From: Rich Kubota <email@hidden>)

  • Prev by Date: Re: PF_PACKET
  • Next by Date: Re: Homepage
  • Previous by thread: Re: PF_PACKET
  • Next by thread: Re: PF_PACKET
  • Index(es):
    • Date
    • Thread