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 nonzero 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 nonzero if it cannot be found.
47
48       The ether_line() function parses a line in /etc/ethers format (ethernet
49       address  followed  by whitespace followed by hostname; '#' introduces a
50       comment) and returns an address and hostname pair,  or  nonzero  if  it
51       cannot  be  parsed.   The  buffer pointed to by hostname must be suffi‐
52       ciently long, for example, have the same length as line.
53
54       The functions ether_ntoa_r() and ether_aton_r() are  reentrant  thread-
55       safe versions of ether_ntoa() and ether_aton() respectively, and do not
56       use static buffers.
57
58       The structure ether_addr is defined in <net/ethernet.h> as:
59
60           struct ether_addr {
61               uint8_t ether_addr_octet[6];
62           }
63

ATTRIBUTES

65   Multithreading (see pthreads(7))
66       The ether_aton() and ether_ntoa() functions are not thread-safe.
67
68       The ether_ntohost(), ether_hostton(), ether_line(), ether_ntoa_r()  and
69       ether_aton_r() functions are thread-safe.
70

CONFORMING TO

72       4.3BSD, SunOS.
73

BUGS

75       The glibc 2.2.5 implementation of ether_line() is broken.
76

SEE ALSO

78       ethers(5)
79

COLOPHON

81       This  page  is  part of release 3.53 of the Linux man-pages project.  A
82       description of the project, and information about reporting  bugs,  can
83       be found at http://www.kernel.org/doc/man-pages/.
84
85
86
87GNU                               2013-07-04                     ETHER_ATON(3)
Impressum