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       struct ether_addr *ether_aton(const char *asc);
14
15       int ether_ntohost(char *hostname, const struct ether_addr *addr);
16       int ether_hostton(const char *hostname, struct ether_addr *addr);
17
18       int ether_line(const char *line, struct ether_addr *addr,
19                      char *hostname);
20
21       /* GNU extensions */
22       char *ether_ntoa_r(const struct ether_addr *addr, char *buf);
23
24       struct ether_addr *ether_aton_r(const char *asc,
25                                       struct ether_addr *addr);
26

DESCRIPTION

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

ATTRIBUTES

63       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
64       tributes(7).
65
66       ┌──────────────────────────────────────────┬───────────────┬───────────┐
67Interface                                 Attribute     Value     
68       ├──────────────────────────────────────────┼───────────────┼───────────┤
69ether_aton(), ether_ntoa()                │ Thread safety │ MT-Unsafe │
70       ├──────────────────────────────────────────┼───────────────┼───────────┤
71ether_ntohost(), ether_hostton(),         │ Thread safety │ MT-Safe   │
72ether_line(), ether_ntoa_r(),             │               │           │
73ether_aton_r()                            │               │           │
74       └──────────────────────────────────────────┴───────────────┴───────────┘
75

CONFORMING TO

77       4.3BSD, SunOS.
78

BUGS

80       In  glibc 2.2.5 and earlier, the implementation of ether_line() is bro‐
81       ken.
82

SEE ALSO

84       ethers(5)
85

COLOPHON

87       This page is part of release 5.12 of the Linux  man-pages  project.   A
88       description  of  the project, information about reporting bugs, and the
89       latest    version    of    this    page,    can     be     found     at
90       https://www.kernel.org/doc/man-pages/.
91
92
93
94GNU                               2021-03-22                     ETHER_ATON(3)
Impressum