Print this page
Clearview IPMP manpages
| Split |
Close |
| Expand all |
| Collapse all |
--- old/./route.7p.txt
+++ new/./route.7p.txt
1 1 Protocols route(7P)
2 2
3 3
4 4
5 5 NAME
6 6 route - kernel packet forwarding database
7 7
8 8 SYNOPSIS
9 9 #include <sys/types.h>
10 10 #include <sys/socket.h>
11 11 #include <net/if.h>
12 12 #include <net/route.h>
13 13
14 14 int socket(PF_ROUTE, SOCK_RAW, int protocol);
15 15
16 16
17 17 DESCRIPTION
18 18 UNIX provides some packet routing facilities. The kernel
19 19 maintains a routing information database, which is used in
20 20 selecting the appropriate network interface when transmit-
21 21 ting packets.
22 22
23 23
24 24 A user process (or possibly multiple co-operating processes)
25 25 maintains this database by sending messages over a special
26 26 kind of socket. This supplants fixed size ioctl(2)'s speci-
27 27 fied in routing(7P). Routing table changes may only be car-
28 28 ried out by the superuser.
29 29
30 30
31 31 The operating system may spontaneously emit routing messages
32 32 in response to external events, such as receipt of a re-
33 33 direct, or failure to locate a suitable route for a request.
34 34 The message types are described in greater detail below.
35 35
36 36
37 37 Routing database entries come in two flavors: entries for a
38 38 specific host, or entries for all hosts on a generic subnet-
39 39 work (as specified by a bit mask and value under the mask).
40 40 The effect of wildcard or default route may be achieved by
41 41 using a mask of all zeros, and there may be hierarchical
42 42 routes.
43 43
44 44
45 45 When the system is booted and addresses are assigned to the
46 46 network interfaces, the internet protocol family installs a
47 47 routing table entry for each interface when it is ready for
48 48 traffic. Normally the protocol specifies the route through
49 49 each interface as a direct connection to the destination
50 50 host or network. If the route is direct, the transport
51 51 layer of a protocol family usually requests the packet be
52 52 sent to the same host specified in the packet. Otherwise,
53 53 the interface is requested to address the packet to the
54 54 gateway listed in the routing entry, that is, the packet is
55 55 forwarded.
56 56
57 57
58 58
59 59
60 60 SunOS 5.11 Last change: 25 July 2006 1
61 61
62 62
63 63
64 64
65 65
66 66
67 67 Protocols route(7P)
68 68
69 69
70 70
71 71 When routing a packet, the kernel attempts to find the most
72 72 specific route matching the destination. If no entry is
73 73 found, the destination is declared to be unreachable, and a
74 74 routing-miss message is generated if there are any listeners
75 75 on the routing control socket (described below). If there
76 76 are two different mask and value-under-the-mask pairs that
77 77 match, the more specific is the one with more bits in the
78 78 mask. A route to a host is regarded as being supplied with a
79 79 mask of as many ones as there are bits in the destination.
80 80
81 81
82 82 A wildcard routing entry is specified with a zero destina-
83 83 tion address value, and a mask of all zeroes. Wildcard
84 84 routes are used when the system fails to find other routes
85 85 matching the destination. The combination of wildcard routes
86 86 and routing redirects can provide an economical mechanism
87 87 for routing traffic.
88 88
89 89
90 90 One opens the channel for passing routing control messages
91 91 by using the socket call shown in the section above. There
92 92 can be more than one routing socket open per system.
93 93
94 94
95 95 Messages are formed by a header followed by a small number
96 96 of sockaddrs, whose length depend on the address family.
97 97 sockaddrs are interpreted by position. An example of a type
98 98 of message with three addresses might be a CIDR prefix
99 99 route: Destination, Netmask, and Gateway. The interpretation
100 100 of which addresses are present is given by a bit mask within
101 101 the header, and the sequence is least significant to most
102 102 significant bit within the vector.
103 103
104 104
105 105 Any messages sent to the kernel are returned, and copies are
106 106 sent to all interested listeners. The kernel provides the
107 107 process ID of the sender, and the sender may use an addi-
108 108 tional sequence field to distinguish between outstanding
109 109 messages. However, message replies may be lost when kernel
110 110 buffers are exhausted.
111 111
112 112
113 113 The protocol parameter specifies which messages an applica-
114 114 tion listening on the routing socket is interested in see-
115 115 ing, based on the the address family of the sockaddrs
116 116 present. Currently, you can specify AF_INET and AF_INET6 to
117 117 filter the messages seen by the listener, or alternatively,
118 118 you can specify AF_UNSPEC to indicate that the listener is
119 119 interested in all routing messages.
120 120
121 121
122 122
123 123
124 124
125 125
126 126 SunOS 5.11 Last change: 25 July 2006 2
127 127
128 128
129 129
130 130
131 131
132 132
133 133 Protocols route(7P)
134 134
135 135
136 136
137 137 The kernel may reject certain messages, and will indicate
138 138 this by filling in the rtm_errno field of the rt_msghdr
139 139 struct (see below). The following codes may be returned:
140 140
141 141 EEXIST If requested to duplicate an existing entry
142 142
143 143
144 144 ESRCH If requested to delete a non-existent entry
145 145
146 146
147 147 ENOBUFS If insufficient resources were available to
148 148 install a new route.
149 149
150 150
151 151 EPERM If the calling process does not have appropriate
152 152 privileges to alter the routing table.
153 153
154 154
155 155
156 156 In the current implementation, all routing processes run
157 157 locally, and the values for rtm_errno are available through
158 158 the normal errno mechanism, even if the routing reply mes-
159 159 sage is lost.
|
↓ open down ↓ |
159 lines elided |
↑ open up ↑ |
160 160
161 161
162 162 A process may avoid the expense of reading replies to its
163 163 own messages by issuing a setsockopt(3SOCKET) call indicat-
164 164 ing that the SO_USELOOPBACK option at the SOL_SOCKET level
165 165 is to be turned off. A process may ignore all messages from
166 166 the routing socket by doing a shutdown(3SOCKET) system call
167 167 for further input.
168 168
169 169
170 + By default, underlying IP interfaces in an IPMP group are
171 + not visible to routing sockets. As such, routing sockets
172 + will not receive events related to underlying IP interfaces
173 + in an IPMP group. For consistency, when an IP interface is
174 + placed into an IPMP group, *RTM_DELADDR* messages will be
175 + generated for each of the *IFF_UP* addresses that are not
176 + migrated to the corresponding IPMP IP interface, and an
177 + *RTM_IFINFO* message will be sent indicating that the
178 + interface is now down. Similarly, when an underlying
179 + interface is removed from an IPMP group, an *RTM_IFINFO*
180 + message will be sent indicating that the interface is again
181 + up, and *RTM_NEWADDR* messages will be generated for each
182 + *IFF_UP* address found on the interface.
183 +
184 +
185 + The *RT_AWARE* socket option at the *SOL_ROUTE* level allows
186 + an application to indicate its awareness of certain
187 + features, which controls routing socket behavior. The
188 + supported values are:
189 +
190 + *RTAW_DEFAULT* Default awareness.
191 +
192 + *RTAW_UNDER_IPMP* IPMP underlying interface awareness.
193 + When this is enabled, underlying IP
194 + interfaces in an IPMP group will remain
195 + visible to the routing socket and
196 + events related to them will continue to
197 + be generated.
198 +
199 +
200 + An *RTM_ADD* request tied to an underlying IP interface in
201 + an IPMP group will be translated to an *RTM_ADD* request for
202 + its corresponding IPMP IP interface. All routing socket
203 + requests other than *RTM_ADD* and *RTM_GET* will fail when
204 + issued on an underlying IP interface in an IPMP group.
205 +
206 +
170 207 If a route is in use when it is deleted, the routing entry
171 208 is marked down and removed from the routing table, but the
172 209 resources associated with it are not reclaimed until all
173 210 references to it are released.
174 211
175 212
176 213 The RTM_IFINFO, RTM_NEWADDR, and RTM_ADD messages associated
177 214 with interface configuration (setting the IFF_UP bit) are
178 215 normally delayed until after Duplicate Address Detection
179 216 completes. Thus, applications that configure interfaces and
180 217 wish to wait until the interface is ready can wait until
181 218 RTM_IFINFO is returned and SIOCGLIFFLAGS shows that
182 219 IFF_DUPLICATE is not set.
183 220
184 221 Messages
185 222 User processes can obtain information about the routing
186 223 entry to a specific destination by using a RTM_GET message.
187 224
188 225
189 226
190 227
191 228
192 229 SunOS 5.11 Last change: 25 July 2006 3
193 230
194 231
195 232
196 233
197 234
198 235
199 236 Protocols route(7P)
200 237
201 238
202 239
203 240 Messages include:
204 241
205 242 #define RTM_ADD 0x1 /* Add Route */
206 243 #define RTM_DELETE 0x2 /* Delete Route */
207 244 #define RTM_CHANGE 0x3 /* Change Metrics, Flags, or Gateway */
208 245 #define RTM_GET 0x4 /* Report Information */
209 246 #define RTM_LOSING 0x5 /* Kernel Suspects Partitioning */
210 247 #define RTM_REDIRECT 0x6 /* Told to use different route */
211 248 #define RTM_MISS 0x7 /* Lookup failed on this address */
212 249 #define RTM_LOCK 0x8 /* fix specified metrics */
213 250 #define RTM_OLDADD 0x9 /* caused by SIOCADDRT */
214 251 #define RTM_OLDDEL 0xa /* caused by SIOCDELRT */
215 252 #define RTM_RESOLVE 0xb /* request to resolve dst to LL addr */
216 253 #define RTM_NEWADDR 0xc /* address being added to iface */
217 254 #define RTM_DELADDR 0xd /* address being removed from iface */
218 255 #define RTM_IFINFO 0xe /* iface going up/down etc. */
219 256
220 257
221 258
222 259 A message header consists of:
223 260
224 261 struct rt_msghdr {
225 262 ushort_t rtm_msglen; /* to skip over non-understood messages */
226 263 uchar_t rtm_version; /* future binary compatibility */
227 264 uchar_t rtm_type; /* message type */
228 265 ushort_t rtm_index; /* index for associated ifp */
229 266 pid_t rtm_pid; /* identify sender */
230 267 int rtm_addrs; /* bitmask identifying sockaddrs in msg */
231 268 int rtm_seq; /* for sender to identify action */
232 269 int rtm_errno; /* why failed */
233 270 int rtm_flags; /* flags, incl kern & message, e.g., DONE */
234 271 int rtm_use; /* from rtentry */
235 272 uint_t rtm_inits; /* which values we are initializing */
236 273
237 274 struct rt_metrics rtm_rmx; /* metrics themselves */
238 275 };
239 276
240 277
241 278
242 279 where
243 280
244 281 struct rt_metrics {
245 282 uint32_t rmx_locks; /* Kernel must leave these values alone */
246 283 uint32_t rmx_mtu; /* MTU for this path */
247 284 uint32_t rmx_hopcount; /* max hops expected */
248 285 uint32_t rmx_expire; /* lifetime for route, e.g., redirect */
249 286 uint32_t rmx_recvpipe; /* inbound delay-bandwidth product */
250 287 uint32_t rmx_sendpipe; /* outbound delay-bandwidth product */
251 288 uint32_t rmx_ssthresh; /* outbound gateway buffer limit */
252 289 uint32_t rmx_rtt; /* estimated round trip time */
253 290 uint32_t rmx_rttvar; /* estimated rtt variance */
254 291 uint32_t rmx_pksent; /* packets sent using this route */
255 292
256 293
257 294
258 295 SunOS 5.11 Last change: 25 July 2006 4
259 296
260 297
261 298
262 299
263 300
264 301
265 302 Protocols route(7P)
266 303
267 304
268 305
269 306 };
270 307
271 308 /* Flags include the values */
272 309
273 310
274 311 #define RTF_UP 0x1 /* route usable */
275 312 #define RTF_GATEWAY 0x2 /* destination is a gateway */
276 313 #define RTF_HOST 0x4 /* host entry (net otherwise) */
277 314 #define RTF_REJECT 0x8 /* host or net unreachable */
278 315 #define RTF_DYNAMIC 0x10 /* created dynamically(by redirect) */
279 316 #define RTF_MODIFIED 0x20 /* modified dynamically(by redirect) */
280 317 #define RTF_DONE 0x40 /* message confirmed */
281 318 #define RTF_MASK 0x80 /* subnet mask present */
282 319 #define RTF_CLONING 0x100 /* generate new routes on use */
283 320 #define RTF_XRESOLVE 0x200 /* external daemon resolves name */
284 321 #define RTF_LLINFO 0x400 /* generated by ARP */
285 322 #define RTF_STATIC 0x800 /* manually added */
286 323 #define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */
287 324 #define RTF_PRIVATE 0x2000 /* do not advertise this route */
288 325 #define RTF_PROTO2 0x4000 /* protocol specific routing flag #2 */
289 326 #define RTF_PROTO1 0x8000 /* protocol specific routing flag #1 */
290 327
291 328 /* Specifiers for metric values in rmx_locks and rtm_inits are */
292 329
293 330 #define RTV_MTU 0x1 /* init or lock _mtu */
294 331 #define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */
295 332 #define RTV_EXPIRE 0x4 /* init or lock _expire */
296 333 #define RTV_RPIPE 0x8 /* init or lock _recvpipe */
297 334 #define RTV_SPIPE 0x10 /* init or lock _sendpipe */
298 335 #define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */
299 336 #define RTV_RTT 0x40 /* init or lock _rtt */
300 337 #define RTV_RTTVAR 0x80 /* init or lock _rttvar */
301 338
302 339 /* Specifiers for which addresses are present in the messages are */
303 340
304 341 #define RTA_DST 0x1 /* destination sockaddr present */
305 342 #define RTA_GATEWAY 0x2 /* gateway sockaddr present */
306 343 #define RTA_NETMASK 0x4 /* netmask sockaddr present */
307 344 #define RTA_GENMASK 0x8 /* cloning mask sockaddr present */
308 345 #define RTA_IFP 0x10 /* interface name sockaddr present */
309 346 #define RTA_IFA 0x20 /* interface addr sockaddr present */
310 347 #define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */
311 348 #define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */
312 349
313 350
314 351 SEE ALSO
315 352 ioctl(2), setsockopt(3SOCKET), shutdown(3SOCKET),
316 353 routing(7P)
317 354
318 355 NOTES
319 356 Some of the metrics may not be implemented and return zero.
320 357 The implemented metrics are set in rtm_inits.
321 358
322 359
323 360
324 361 SunOS 5.11 Last change: 25 July 2006 5
325 362
326 363
327 364
|
↓ open down ↓ |
148 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX