1 .\" Copyright 2002 Ian Redfern (redferni@logica.com)
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\" References consulted:
6 .\" Linux libc source code
7 .\" FreeBSD 4.4 man pages
9 .\" Minor additions, aeb, 2013-06-21
11 .TH ETHER_ATON 3 2021-03-22 "Linux man-pages (unreleased)"
13 ether_aton, ether_ntoa, ether_ntohost, ether_hostton, ether_line,
14 ether_ntoa_r, ether_aton_r \- Ethernet address manipulation routines
17 .RI ( libc ", " \-lc )
20 .B #include <netinet/ether.h>
22 .BI "char *ether_ntoa(const struct ether_addr *" addr );
23 .BI "struct ether_addr *ether_aton(const char *" asc );
25 .BI "int ether_ntohost(char *" hostname ", const struct ether_addr *" addr );
26 .BI "int ether_hostton(const char *" hostname ", struct ether_addr *" addr );
28 .BI "int ether_line(const char *" line ", struct ether_addr *" addr ,
29 .BI " char *" hostname );
32 .BI "char *ether_ntoa_r(const struct ether_addr *" addr ", char *" buf );
34 .BI "struct ether_addr *ether_aton_r(const char *" asc ,
35 .BI " struct ether_addr *" addr );
39 converts the 48-bit Ethernet host address
41 from the standard hex-digits-and-colons notation into binary data in
42 network byte order and returns a pointer to it in a statically
43 allocated buffer, which subsequent calls will
46 returns NULL if the address is invalid.
50 function converts the Ethernet host address
52 given in network byte order to a string in standard
53 hex-digits-and-colons notation, omitting leading zeros.
54 The string is returned in a statically allocated buffer,
55 which subsequent calls will overwrite.
59 function maps an Ethernet address to the
60 corresponding hostname in
62 and returns nonzero if it cannot be found.
66 function maps a hostname to the
67 corresponding Ethernet address in
69 and returns nonzero if it cannot be found.
73 function parses a line in
75 format (ethernet address followed by whitespace followed by
76 hostname; \(aq#\(aq introduces a comment) and returns an address
77 and hostname pair, or nonzero if it cannot be parsed.
78 The buffer pointed to by
80 must be sufficiently long, for example, have the same length as
88 thread-safe versions of
92 respectively, and do not use static buffers.
103 uint8_t ether_addr_octet[6];
108 For an explanation of the terms used in this section, see
116 Interface Attribute Value
120 T} Thread safety MT-Unsafe
122 .BR ether_ntohost (),
123 .BR ether_hostton (),
127 T} Thread safety MT-Safe
135 In glibc 2.2.5 and earlier, the implementation of
137 .\" The fix was presumably commit c0a0f9a32c8baa6ab93d00eb42d92c02e9e146d7
138 .\" which was in glibc 2.3