1 .\" Copyright 2002 Ian Redfern (redferni@logica.com)
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" References consulted:
26 .\" Linux libc source code
27 .\" FreeBSD 4.4 man pages
29 .\" Minor additions, aeb, 2013-06-21
31 .TH ETHER_ATON 3 2021-03-22 "GNU" "Linux Programmer's Manual"
33 ether_aton, ether_ntoa, ether_ntohost, ether_hostton, ether_line,
34 ether_ntoa_r, ether_aton_r \- Ethernet address manipulation routines
37 .B #include <netinet/ether.h>
39 .BI "char *ether_ntoa(const struct ether_addr *" addr );
40 .BI "struct ether_addr *ether_aton(const char *" asc );
42 .BI "int ether_ntohost(char *" hostname ", const struct ether_addr *" addr );
43 .BI "int ether_hostton(const char *" hostname ", struct ether_addr *" addr );
45 .BI "int ether_line(const char *" line ", struct ether_addr *" addr ,
46 .BI " char *" hostname );
49 .BI "char *ether_ntoa_r(const struct ether_addr *" addr ", char *" buf );
51 .BI "struct ether_addr *ether_aton_r(const char *" asc ,
52 .BI " struct ether_addr *" addr );
56 converts the 48-bit Ethernet host address
58 from the standard hex-digits-and-colons notation into binary data in
59 network byte order and returns a pointer to it in a statically
60 allocated buffer, which subsequent calls will
63 returns NULL if the address is invalid.
67 function converts the Ethernet host address
69 given in network byte order to a string in standard
70 hex-digits-and-colons notation, omitting leading zeros.
71 The string is returned in a statically allocated buffer,
72 which subsequent calls will overwrite.
76 function maps an Ethernet address to the
77 corresponding hostname in
79 and returns nonzero if it cannot be found.
83 function maps a hostname to the
84 corresponding Ethernet address in
86 and returns nonzero if it cannot be found.
90 function parses a line in
92 format (ethernet address followed by whitespace followed by
93 hostname; \(aq#\(aq introduces a comment) and returns an address
94 and hostname pair, or nonzero if it cannot be parsed.
95 The buffer pointed to by
97 must be sufficiently long, for example, have the same length as
105 thread-safe versions of
109 respectively, and do not use static buffers.
120 uint8_t ether_addr_octet[6];
125 For an explanation of the terms used in this section, see
133 Interface Attribute Value
137 T} Thread safety MT-Unsafe
139 .BR ether_ntohost (),
140 .BR ether_hostton (),
144 T} Thread safety MT-Safe
152 In glibc 2.2.5 and earlier, the implementation of
154 .\" The fix was presumably commit c0a0f9a32c8baa6ab93d00eb42d92c02e9e146d7
155 .\" which was in glibc 2.3