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 2017-09-15 "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 );
41 .BI "struct ether_addr *ether_aton(const char *" asc );
43 .BI "int ether_ntohost(char *" hostname ", const struct ether_addr *" addr );
45 .BI "int ether_hostton(const char *" hostname ", struct ether_addr *" addr );
47 .BI "int ether_line(const char *" line ", struct ether_addr *" addr ,
48 .BI " char *" hostname );
52 .BI "char *ether_ntoa_r(const struct ether_addr *" addr ", char *" buf );
54 .BI "struct ether_addr *ether_aton_r(const char *" asc ,
55 .BI " struct ether_addr *" addr );
59 converts the 48-bit Ethernet host address
61 from the standard hex-digits-and-colons notation into binary data in
62 network byte order and returns a pointer to it in a statically
63 allocated buffer, which subsequent calls will
66 returns NULL if the address is invalid.
70 function converts the Ethernet host address
72 given in network byte order to a string in standard
73 hex-digits-and-colons notation, omitting leading zeros.
74 The string is returned in a statically allocated buffer,
75 which subsequent calls will overwrite.
79 function maps an Ethernet address to the
80 corresponding hostname in
82 and returns nonzero if it cannot be found.
86 function maps a hostname to the
87 corresponding Ethernet address in
89 and returns nonzero if it cannot be found.
93 function parses a line in
95 format (ethernet address followed by whitespace followed by
96 hostname; \(aq#\(aq introduces a comment) and returns an address
97 and hostname pair, or nonzero if it cannot be parsed.
98 The buffer pointed to by
100 must be sufficiently long, for example, have the same length as
108 thread-safe versions of
112 respectively, and do not use static buffers.
123 uint8_t ether_addr_octet[6];
128 For an explanation of the terms used in this section, see
135 Interface Attribute Value
139 T} Thread safety MT-Unsafe
141 .BR ether_ntohost (),
142 .BR ether_hostton (),
146 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