| 1 |
.\" Copyright 1998, Alan Cox <[email protected]> |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.TH ddp 7 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
ddp \- Linux AppleTalk protocol implementation |
| 9 |
.SH SYNOPSIS |
| 10 |
.nf |
| 11 |
.B #include <sys/socket.h> |
| 12 |
.B #include <netatalk/at.h> |
| 13 |
.P |
| 14 |
.IB ddp_socket " = socket(AF_APPLETALK, SOCK_DGRAM, 0);" |
| 15 |
.IB raw_socket " = socket(AF_APPLETALK, SOCK_RAW, " protocol ");" |
| 16 |
.fi |
| 17 |
.SH DESCRIPTION |
| 18 |
Linux implements the AppleTalk protocols described in |
| 19 |
.IR "Inside AppleTalk" . |
| 20 |
Only the DDP layer and AARP are present in |
| 21 |
the kernel. |
| 22 |
They are designed to be used via the |
| 23 |
.B netatalk |
| 24 |
protocol |
| 25 |
libraries. |
| 26 |
This page documents the interface for those who wish or need to |
| 27 |
use the DDP layer directly. |
| 28 |
.P |
| 29 |
The communication between AppleTalk and the user program works using a |
| 30 |
BSD-compatible socket interface. |
| 31 |
For more information on sockets, see |
| 32 |
.BR socket (7). |
| 33 |
.P |
| 34 |
An AppleTalk socket is created by calling the |
| 35 |
.BR socket (2) |
| 36 |
function with a |
| 37 |
.B AF_APPLETALK |
| 38 |
socket family argument. |
| 39 |
Valid socket types are |
| 40 |
.B SOCK_DGRAM |
| 41 |
to open a |
| 42 |
.B ddp |
| 43 |
socket or |
| 44 |
.B SOCK_RAW |
| 45 |
to open a |
| 46 |
.B raw |
| 47 |
socket. |
| 48 |
.I protocol |
| 49 |
is the AppleTalk protocol to be received or sent. |
| 50 |
For |
| 51 |
.B SOCK_RAW |
| 52 |
you must specify |
| 53 |
.BR ATPROTO_DDP . |
| 54 |
.P |
| 55 |
Raw sockets may be opened only by a process with effective user ID 0 |
| 56 |
or when the process has the |
| 57 |
.B CAP_NET_RAW |
| 58 |
capability. |
| 59 |
.SS Address format |
| 60 |
An AppleTalk socket address is defined as a combination of a network number, |
| 61 |
a node number, and a port number. |
| 62 |
.P |
| 63 |
.in +4n |
| 64 |
.EX |
| 65 |
struct at_addr { |
| 66 |
unsigned short s_net; |
| 67 |
unsigned char s_node; |
| 68 |
}; |
| 69 |
\& |
| 70 |
struct sockaddr_atalk { |
| 71 |
sa_family_t sat_family; /* address family */ |
| 72 |
unsigned char sat_port; /* port */ |
| 73 |
struct at_addr sat_addr; /* net/node */ |
| 74 |
}; |
| 75 |
.EE |
| 76 |
.in |
| 77 |
.P |
| 78 |
.I sat_family |
| 79 |
is always set to |
| 80 |
.BR AF_APPLETALK . |
| 81 |
.I sat_port |
| 82 |
contains the port. |
| 83 |
The port numbers below 129 are known as |
| 84 |
.IR "reserved ports" . |
| 85 |
Only processes with the effective user ID 0 or the |
| 86 |
.B CAP_NET_BIND_SERVICE |
| 87 |
capability may |
| 88 |
.BR bind (2) |
| 89 |
to these sockets. |
| 90 |
.I sat_addr |
| 91 |
is the host address. |
| 92 |
The |
| 93 |
.I net |
| 94 |
member of |
| 95 |
.I struct at_addr |
| 96 |
contains the host network in network byte order. |
| 97 |
The value of |
| 98 |
.B AT_ANYNET |
| 99 |
is a |
| 100 |
wildcard and also implies \[lq]this network.\[rq] |
| 101 |
The |
| 102 |
.I node |
| 103 |
member of |
| 104 |
.I struct at_addr |
| 105 |
contains the host node number. |
| 106 |
The value of |
| 107 |
.B AT_ANYNODE |
| 108 |
is a |
| 109 |
wildcard and also implies \[lq]this node.\[rq] The value of |
| 110 |
.B ATADDR_BCAST |
| 111 |
is a link |
| 112 |
local broadcast address. |
| 113 |
.\" FIXME . this doesn't make sense [johnl] |
| 114 |
.SS Socket options |
| 115 |
No protocol-specific socket options are supported. |
| 116 |
.SS /proc interfaces |
| 117 |
IP supports a set of |
| 118 |
.I /proc |
| 119 |
interfaces to configure some global AppleTalk parameters. |
| 120 |
The parameters can be accessed by reading or writing files in the directory |
| 121 |
.IR /proc/sys/net/atalk/ . |
| 122 |
.TP |
| 123 |
.I aarp\-expiry\-time |
| 124 |
The time interval (in seconds) before an AARP cache entry expires. |
| 125 |
.TP |
| 126 |
.I aarp\-resolve\-time |
| 127 |
The time interval (in seconds) before an AARP cache entry is resolved. |
| 128 |
.TP |
| 129 |
.I aarp\-retransmit\-limit |
| 130 |
The number of retransmissions of an AARP query before the node is declared |
| 131 |
dead. |
| 132 |
.TP |
| 133 |
.I aarp\-tick\-time |
| 134 |
The timer rate (in seconds) for the timer driving AARP. |
| 135 |
.P |
| 136 |
The default values match the specification and should never need to be |
| 137 |
changed. |
| 138 |
.SS Ioctls |
| 139 |
All ioctls described in |
| 140 |
.BR socket (7) |
| 141 |
apply to DDP. |
| 142 |
.\" FIXME . Add a section about multicasting |
| 143 |
.SH ERRORS |
| 144 |
.TP |
| 145 |
.B EACCES |
| 146 |
The user tried to execute an operation without the necessary permissions. |
| 147 |
These include sending to a broadcast address without |
| 148 |
having the broadcast flag set, |
| 149 |
and trying to bind to a reserved port without effective user ID 0 or |
| 150 |
.BR CAP_NET_BIND_SERVICE . |
| 151 |
.TP |
| 152 |
.B EADDRINUSE |
| 153 |
Tried to bind to an address already in use. |
| 154 |
.TP |
| 155 |
.B EADDRNOTAVAIL |
| 156 |
A nonexistent interface was requested or the requested source address was |
| 157 |
not local. |
| 158 |
.TP |
| 159 |
.B EAGAIN |
| 160 |
Operation on a nonblocking socket would block. |
| 161 |
.TP |
| 162 |
.B EALREADY |
| 163 |
A connection operation on a nonblocking socket is already in progress. |
| 164 |
.TP |
| 165 |
.B ECONNABORTED |
| 166 |
A connection was closed during an |
| 167 |
.BR accept (2). |
| 168 |
.TP |
| 169 |
.B EHOSTUNREACH |
| 170 |
No routing table entry matches the destination address. |
| 171 |
.TP |
| 172 |
.B EINVAL |
| 173 |
Invalid argument passed. |
| 174 |
.TP |
| 175 |
.B EISCONN |
| 176 |
.BR connect (2) |
| 177 |
was called on an already connected socket. |
| 178 |
.TP |
| 179 |
.B EMSGSIZE |
| 180 |
Datagram is bigger than the DDP MTU. |
| 181 |
.TP |
| 182 |
.B ENODEV |
| 183 |
Network device not available or not capable of sending IP. |
| 184 |
.TP |
| 185 |
.B ENOENT |
| 186 |
.B SIOCGSTAMP |
| 187 |
was called on a socket where no packet arrived. |
| 188 |
.TP |
| 189 |
.B ENOMEM |
| 190 |
.TQ |
| 191 |
.B ENOBUFS |
| 192 |
Not enough memory available. |
| 193 |
.TP |
| 194 |
.B ENOPKG |
| 195 |
A kernel subsystem was not configured. |
| 196 |
.TP |
| 197 |
.B ENOPROTOOPT |
| 198 |
.TQ |
| 199 |
.B EOPNOTSUPP |
| 200 |
Invalid socket option passed. |
| 201 |
.TP |
| 202 |
.B ENOTCONN |
| 203 |
The operation is defined only on a connected socket, but the socket wasn't |
| 204 |
connected. |
| 205 |
.TP |
| 206 |
.B EPERM |
| 207 |
User doesn't have permission to set high priority, |
| 208 |
make a configuration change, |
| 209 |
or send signals to the requested process or group. |
| 210 |
.TP |
| 211 |
.B EPIPE |
| 212 |
The connection was unexpectedly closed or shut down by the other end. |
| 213 |
.TP |
| 214 |
.B ESOCKTNOSUPPORT |
| 215 |
The socket was unconfigured, or an unknown socket type was requested. |
| 216 |
.SH VERSIONS |
| 217 |
AppleTalk is supported by Linux 2.0 or higher. |
| 218 |
The |
| 219 |
.I /proc |
| 220 |
interfaces exist since Linux 2.2. |
| 221 |
.SH NOTES |
| 222 |
Be very careful with the |
| 223 |
.B SO_BROADCAST |
| 224 |
option; |
| 225 |
it is not privileged in Linux. |
| 226 |
It is easy to overload the network |
| 227 |
with careless sending to broadcast addresses. |
| 228 |
.SS Compatibility |
| 229 |
The basic AppleTalk socket interface is compatible with |
| 230 |
.B netatalk |
| 231 |
on BSD-derived systems. |
| 232 |
Many BSD systems fail to check |
| 233 |
.B SO_BROADCAST |
| 234 |
when sending broadcast frames; |
| 235 |
this can lead to compatibility problems. |
| 236 |
.P |
| 237 |
The |
| 238 |
raw |
| 239 |
socket mode is unique to Linux and exists to support the alternative CAP |
| 240 |
package and AppleTalk monitoring tools more easily. |
| 241 |
.SH BUGS |
| 242 |
There are too many inconsistent error values. |
| 243 |
.P |
| 244 |
The ioctls used to configure routing tables, devices, |
| 245 |
AARP tables, and other devices are not yet described. |
| 246 |
.SH SEE ALSO |
| 247 |
.BR recvmsg (2), |
| 248 |
.BR sendmsg (2), |
| 249 |
.BR capabilities (7), |
| 250 |
.BR socket (7) |