1ETHER_ATON(3)              Linux Programmer's Manual             ETHER_ATON(3)
2
3
4

NAME

6       ether_aton,   ether_ntoa,   ether_ntohost,  ether_hostton,  ether_line,
7       ether_ntoa_r, ether_aton_r - Ethernet address manipulation routines
8

SYNOPSIS

10       #include <netinet/ether.h>
11
12       char *ether_ntoa(const struct ether_addr *addr);
13
14       struct ether_addr *ether_aton(const char *asc);
15
16       int ether_ntohost(char *hostname, const struct ether_addr *addr);
17
18       int ether_hostton(const char *hostname, struct ether_addr *addr);
19
20       int ether_line(const char *line, struct ether_addr *addr,
21                      char *hostname);
22
23       /* GNU extensions */
24       char *ether_ntoa_r(const struct ether_addr *addr, char *buf);
25
26       struct ether_addr *ether_aton_r(const char *asc,
27                                       struct ether_addr *addr);
28

DESCRIPTION

30       ether_aton() converts the 48-bit Ethernet host  address  asc  from  the
31       standard  hex-digits-and-colons  notation  into  binary data in network
32       byte order and returns a pointer to it in a statically  allocated  buf‐
33       fer,  which subsequent calls will overwrite.  ether_aton() returns NULL
34       if the address is invalid.
35
36       The ether_ntoa() function converts the Ethernet host address addr given
37       in  network  byte  order  to a string in standard hex-digits-and-colons
38       notation, omitting leading zeros.  The string is returned in  a  stati‐
39       cally allocated buffer, which subsequent calls will overwrite.
40
41       The  ether_ntohost()  function  maps  an Ethernet address to the corre‐
42       sponding hostname in /etc/ethers and returns non-zero if it  cannot  be
43       found.
44
45       The  ether_hostton() function maps a hostname to the corresponding Eth‐
46       ernet address in /etc/ethers and  returns  non-zero  if  it  cannot  be
47       found.
48
49       The ether_line() function parses a line in /etc/ethers format (ethernet
50       address followed by whitespace followed by hostname; '#'  introduces  a
51       comment)  and  returns  an address and hostname pair, or non-zero if it
52       cannot be parsed.  The buffer pointed to by  hostname  must  be  suffi‐
53       ciently long, for example, have the same length as line.
54
55       The  functions  ether_ntoa_r() and ether_aton_r() are reentrant thread-
56       safe versions of ether_ntoa() and ether_aton() respectively, and do not
57       use static buffers.
58
59       The structure ether_addr is defined in <net/ethernet.h> as:
60
61           struct ether_addr {
62               uint8_t ether_addr_octet[6];
63           }
64

CONFORMING TO

66       4.3BSD, SunOS.
67

BUGS

69       The glibc 2.2.5 implementation of ether_line() is broken.
70

SEE ALSO

72       ethers(5)
73

COLOPHON

75       This  page  is  part of release 3.22 of the Linux man-pages project.  A
76       description of the project, and information about reporting  bugs,  can
77       be found at http://www.kernel.org/doc/man-pages/.
78
79
80
81GNU                               2002-07-20                     ETHER_ATON(3)
Impressum