Re: Getting MAC address?

From: Ivan Voras (ivoras_at_fer.hr)
Date: 06/26/04

  • Next message: Joe Schmoe: "Re: A few technical items on UFS2 and snapshots..."
    Date: Sat, 26 Jun 2004 11:15:45 +0200
    To: Dmitry Morozovsky <marck@rinet.ru>
    
    

    Dmitry Morozovsky wrote:
    > On Sat, 26 Jun 2004, Ivan Voras wrote:
    >
    > IV> How to get the MAC address for an (ethernet) interface? The linux code
    > IV> does this:
    > IV> retval = ioctl(thisint->sockInt, SIOCGIFHWADDR, &ifr);
    > IV>
    > IV> After some searching, I found SIOCSIFLLADDR ioctl, but it appears there
    > IV> isn't a "GET" counterpart.
    > IV>
    > IV> (I've got interface name & index available...)
    >
    > Take a look at ifconfig(8) source.
    >
    > getifaddrs(3), case when sa_family == AF_LINK

    I was looking at it and came across getifaddrs(). This function does not
    depend on a open socket (yes, mine is AF_LINK, sockaddr_dl), and
    apparently returns a list of all interfaces. Is there really no other
    way than to traverse this list?

    -- 
    What part of "Ph'nglui mglw'nath Cthulhu R'lyeh wgah'nagl fhtagn" don't
    you understand?
    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
    

  • Next message: Joe Schmoe: "Re: A few technical items on UFS2 and snapshots..."

    Relevant Pages

    • Getting MAC address?
      ... How to get the MAC address for an interface? ... The linux code ... After some searching, I found SIOCSIFLLADDR ioctl, but it appears there ...
      (freebsd-hackers)
    • Re: Getting MAC address?
      ... IV> How to get the MAC address for an (ethernet) interface? ... The linux code ...
      (freebsd-hackers)
    • kgdb 2.0.5
      ... When using the ethernet interface, ... KGDB: Linux Kernel Source Level Debugger ... the questions about Ethernet network cards. ... +static int xlockholdcount = 0; ...
      (Linux-Kernel)
    • Re: kgdb 2.0.5
      ... When using the ethernet interface, ... ++static int bufnum; ... ++static void kgdbeth_holdxlock ...
      (Linux-Kernel)
    • Re: Newbie trying to setup the Ethernet Connection...
      ... > Text says Ethernet Port. ... Above this in the list was resource LIN02 ... > step was to configure an interface, which I did by adding one under ... > option 1 of the TCP/IP menu and entered ...
      (comp.sys.ibm.as400.misc)