tcpdump mailing list archives

Re: Obtaining MAC on OSX using AF_LINK


From: Guy Harris <guy () alum mit edu>
Date: Sun, 2 Jan 2011 14:55:33 -0800


On Jan 2, 2011, at 2:33 PM, Guy Harris wrote:

It seems that the pacap_addr.sa_data should be of type (struct sockaddr_dl*)

Yes.

As per later in my message, that's actually "No"; I missed the "sa_data" part.  *addr* should be cast to something of 
type (struct sockaddr_dl *); sa_data in a "struct sockaddr" corresponds to the stuff starting at sdl_index in

struct sockaddr_dl {
       u_char  sdl_len;        /* Total length of sockaddr */
       u_char  sdl_family;     /* AF_LINK */
       u_short sdl_index;      /* if != 0, system given index for interface */
       u_char  sdl_type;       /* interface type */
       u_char  sdl_nlen;       /* interface name length, no trailing 0 reqd. */
       u_char  sdl_alen;       /* link level address length */
       u_char  sdl_slen;       /* link layer selector length */
       char    sdl_data[12];   /* minimum work area, can be larger;
                                  contains both if name and ll address */
#ifndef __APPLE__
       /* For TokenRing */
       u_short sdl_rcf;        /* source routing control */
       u_short sdl_route[16];  /* source routing information */
#endif
};

-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: