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 <lug...@gmail.com> 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 (Macnetworkprog@lists.apple.com) > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/macnetworkprog/dieter%40apple.com > > This email sent to die...@apple.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (Macnetworkprog@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/macnetworkprog/archive%40mail-archive.com This email sent to arch...@mail-archive.com