1ether_aton(3)              Library Functions 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

LIBRARY

10       Standard C library (libc, -lc)
11

SYNOPSIS

13       #include <netinet/ether.h>
14
15       char *ether_ntoa(const struct ether_addr *addr);
16       struct ether_addr *ether_aton(const char *asc);
17
18       int ether_ntohost(char *hostname, const struct ether_addr *addr);
19       int ether_hostton(const char *hostname, struct ether_addr *addr);
20
21       int ether_line(const char *line, struct ether_addr *addr,
22                      char *hostname);
23
24       /* GNU extensions */
25       char *ether_ntoa_r(const struct ether_addr *addr, char *buf);
26
27       struct ether_addr *ether_aton_r(const char *asc,
28                                       struct ether_addr *addr);
29

DESCRIPTION

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

ATTRIBUTES

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

STANDARDS

80       None.
81

HISTORY

83       4.3BSD, SunOS.
84

BUGS

86       In  glibc 2.2.5 and earlier, the implementation of ether_line() is bro‐
87       ken.
88

SEE ALSO

90       ethers(5)
91
92
93
94Linux man-pages 6.04              2023-03-30                     ether_aton(3)
Impressum