ether_aton






ether_aton, ether_ntoa, ether_ntohost, ether_hostton,
ether_line, ether_ntoa_r, ether_aton_r − Ethernet address
manipulation routines


#include<netinet/ether.h>

     );char *ether_ntoa(const struct ether_addr *addr

     );struct ether_addr *ether_aton(const char *asc

     , const struct ether_addr *int ether_ntohost(char
*hostname

     , struct ether_addr *int ether_hostton(const char
*hostname

     , struct ether_addr *int ether_line(const char *line );
char *hostname

     /* GNU extensions */
, char *char *ether_ntoa_r(const struct ether_addr *addr

     ,struct ether_addr *ether_aton_r(const char *asc );
struct ether_addr *addr

converts the 48‐bit Ethernet host address asc from the
standard hex‐digits‐and‐colons notation into binary data in
network byte order and returns a pointer to it in a
statically allocated buffer, which subsequent calls will
overwrite.  returns NULL if the address is invalid.

     The function converts the Ethernet host address addr
given in network byte order to a string in standard hex‐
digits‐and‐colons notation, omitting leading zeros.  The
string is returned in a statically allocated buffer, which
subsequent calls will overwrite.

     The function maps an Ethernet address to the
corresponding hostname in /etc/ethers and returns nonzero if
it cannot be found.

     The function maps a hostname to the corresponding
Ethernet address in /etc/ethers and returns nonzero if it
cannot be found.

     The function parses a line in /etc/ethers format
(ethernet address followed by whitespace followed by
hostname; '#' introduces a comment) and returns an address
and hostname pair, or nonzero if it cannot be parsed.  The
buffer pointed to by hostname must be sufficiently long, for
example, have the same length as











                             ‐2‐


     The functions and are reentrant thread‐safe versions of
and respectively, and do not use static buffers.

     The structure ether_addr is defined in <net/ethernet.h>
as:

    struct ether_addr {
        uint8_t ether_addr_octet[6]; }

For an explanation of the terms used in this section, see

┌──────────────────────────────────┬───────────────┬───────────┐
│Interface                         Attribute     Value     │
├──────────────────────────────────┼───────────────┼───────────┤
│                                  │ Thread safety MT‐Unsafe │
├──────────────────────────────────┼───────────────┼───────────┤
│                                  │ Thread safety MT‐Safe   │
└──────────────────────────────────┴───────────────┴───────────┘

4.3BSD, SunOS.

In glibc 2.2.5 and earlier, the implementation of is broken.



This page is part of release 5.07 of the Linux man‐pages
project.  A description of the project, information about
reporting bugs, and the latest version of this page, can be
found at https://www.kernel.org/doc/man−pages/.