1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
LINK_ADDR(3) BSD Library Functions Manual LINK_ADDR(3)
NAME
link_addr, link_ntoa -- elementary address specification routines for link level access
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if_dl.h>
void
link_addr(const char *addr, struct sockaddr_dl *sdl);
char *
link_ntoa(const struct sockaddr_dl *sdl);
DESCRIPTION
The routine link_addr() interprets character strings representing link-level addresses, re-
turning binary information suitable for use in system calls. The routine link_ntoa() takes
a link-level address and returns an ASCII string representing some of the information
present, including the link level address itself, and the interface name or number, if
present. This facility is experimental and is still subject to change.
For link_addr(), the string addr may contain an optional network interface identifier of the
form "name unit-number", suitable for the first argument to ifconfig(8), followed in all
cases by a colon and an interface address in the form of groups of hexadecimal digits sepa-
rated by periods. Each group represents a byte of address; address bytes are filled left to
right from low order bytes through high order bytes.
Thus le0:8.0.9.13.d.30 represents an ethernet address to be transmitted on the first Lance
ethernet interface.
The direct use of these functions is deprecated in favor of the addr2ascii(3) interface;
however, portable programs cannot rely on the latter as it is not yet widely implemented.
RETURN VALUES
link_ntoa() always returns a null terminated string. link_addr() has no return value. (See
BUGS.)
SEE ALSO
addr2ascii(3)
HISTORY
The link_addr() and link_ntoa() functions appeared in 4.3BSD-Reno.
BUGS
The returned values for link_ntoa reside in a static memory area.
The function link_addr() should diagnose improperly formed input, and there should be an un-
ambiguous way to recognize this.
If the sdl_len field of the link socket address sdl is 0, link_ntoa() will not insert a
colon before the interface address bytes. If this translated address is given to
link_addr() without inserting an initial colon, the latter will not interpret it correctly.
BSD June 17, 1996 BSD
|