• 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: Source Mac address on PF_NDRV
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Source Mac address on PF_NDRV


  • Subject: Re: Source Mac address on PF_NDRV
  • From: Peter schoenmaker <email@hidden>
  • Date: Thu, 30 Oct 2014 16:56:56 -0700

Hi

The buf gets populated starting with the dsap/ssap skipping the src/dst mac addresses.

it does not make a difference with recv or recvfrom or recvmsg.

Peter



On Oct 30, 2014, at 4:03 PM, Dieter Siegmund <email@hidden> wrote:


Your receive buffer ‘buf’ should get populated with the entire frame starting with the link-layer (ethernet) header.

Is that not the case?  Does it make any difference if you use recv() instead of recvfrom()?

Dieter

On Oct 30, 2014, at 3:48 PM, Peter Schoenmaker <email@hidden> wrote:

hello,

I am creating a socket connection to receive ethernet SAP frames.  I am correctly receiving the frame, but it starts at the 802.2 header (DSAP/SSAP/Control.) I a receiving ethernet multicast packets.  When i use the recvfrom() call, i get the destination mac address, but i want the source mac address.

Short socket code:
so = socket(PF_NDRV, SOCK_RAW, 0);
...
        struct sockaddr sa;
        memset(&sa, 0, sizeof(sa));
        sa.sa_family = AF_NDRV;
        strcpy(sa.sa_data, interfacename);

        // Bind socket to interface
        int res = bind(so, (struct sockaddr *)&sa, sizeof(sa)); 
...
        if (setsockopt(so, SOL_NDRVPROTO, NDRV_SETDMXSPEC, &pdesc, sizeof(struct ndrv_protocol_desc)) == -1) {
...
        if (setsockopt(so, SOL_NDRVPROTO, NDRV_ADDMULTICAST, dlp, sizeof(struct sockaddr_dl)) == -1) {
...

recvfrom(so, buf, 65535, 0, addr_dl, sizeof(struct sockaddr_dl));
...

The data in the addr_dl contains the destination mac address, but no where can i find the source mac address.

Thanks

Peter

Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Source Mac address on PF_NDRV (From: Peter Schoenmaker <email@hidden>)
 >Re: Source Mac address on PF_NDRV (From: Dieter Siegmund <email@hidden>)

  • Prev by Date: Re: Source Mac address on PF_NDRV
  • Next by Date: Implementing an SSL server on Snow Leopard
  • Previous by thread: Re: Source Mac address on PF_NDRV
  • Next by thread: Implementing an SSL server on Snow Leopard
  • Index(es):
    • Date
    • Thread