/share/doc/IPv6/IMPLEMENTATION

https://bitbucket.org/freebsd/freebsd-head/ · #! · 2392 lines · 2005 code · 387 blank · 0 comment · 0 complexity · 0bd9aeb31d0e58ddba98bbdb1a5ebaa7 MD5 · raw file

Large files are truncated click here to view the full file

  1. Implementation Note
  2. KAME Project
  3. http://www.kame.net/
  4. $KAME: IMPLEMENTATION,v 1.216 2001/05/25 07:43:01 jinmei Exp $
  5. $FreeBSD$
  6. NOTE: The document tries to describe behaviors/implementation choices
  7. of the latest KAME/*BSD stack. The description here may not be
  8. applicable to KAME-integrated *BSD releases, as we have certain amount
  9. of changes between them. Still, some of the content can be useful for
  10. KAME-integrated *BSD releases.
  11. Table of Contents
  12. 1. IPv6
  13. 1.1 Conformance
  14. 1.2 Neighbor Discovery
  15. 1.3 Scope Zone Index
  16. 1.3.1 Kernel internal
  17. 1.3.2 Interaction with API
  18. 1.3.3 Interaction with users (command line)
  19. 1.4 Plug and Play
  20. 1.4.1 Assignment of link-local, and special addresses
  21. 1.4.2 Stateless address autoconfiguration on hosts
  22. 1.4.3 DHCPv6
  23. 1.5 Generic tunnel interface
  24. 1.6 Address Selection
  25. 1.6.1 Source Address Selection
  26. 1.6.2 Destination Address Ordering
  27. 1.7 Jumbo Payload
  28. 1.8 Loop prevention in header processing
  29. 1.9 ICMPv6
  30. 1.10 Applications
  31. 1.11 Kernel Internals
  32. 1.12 IPv4 mapped address and IPv6 wildcard socket
  33. 1.12.1 KAME/BSDI3 and KAME/FreeBSD228
  34. 1.12.2 KAME/FreeBSD[34]x
  35. 1.12.2.1 KAME/FreeBSD[34]x, listening side
  36. 1.12.2.2 KAME/FreeBSD[34]x, initiating side
  37. 1.12.3 KAME/NetBSD
  38. 1.12.3.1 KAME/NetBSD, listening side
  39. 1.12.3.2 KAME/NetBSD, initiating side
  40. 1.12.4 KAME/BSDI4
  41. 1.12.4.1 KAME/BSDI4, listening side
  42. 1.12.4.2 KAME/BSDI4, initiating side
  43. 1.12.5 KAME/OpenBSD
  44. 1.12.5.1 KAME/OpenBSD, listening side
  45. 1.12.5.2 KAME/OpenBSD, initiating side
  46. 1.12.6 More issues
  47. 1.12.7 Interaction with SIIT translator
  48. 1.13 sockaddr_storage
  49. 1.14 Invalid addresses on the wire
  50. 1.15 Node's required addresses
  51. 1.15.1 Host case
  52. 1.15.2 Router case
  53. 1.16 Advanced API
  54. 1.17 DNS resolver
  55. 2. Network Drivers
  56. 2.1 FreeBSD 2.2.x-RELEASE
  57. 2.2 BSD/OS 3.x
  58. 2.3 NetBSD
  59. 2.4 FreeBSD 3.x-RELEASE
  60. 2.5 FreeBSD 4.x-RELEASE
  61. 2.6 OpenBSD 2.x
  62. 2.7 BSD/OS 4.x
  63. 3. Translator
  64. 3.1 FAITH TCP relay translator
  65. 3.2 IPv6-to-IPv4 header translator
  66. 4. IPsec
  67. 4.1 Policy Management
  68. 4.2 Key Management
  69. 4.3 AH and ESP handling
  70. 4.4 IPComp handling
  71. 4.5 Conformance to RFCs and IDs
  72. 4.6 ECN consideration on IPsec tunnels
  73. 4.7 Interoperability
  74. 4.8 Operations with IPsec tunnel mode
  75. 4.8.1 RFC2401 IPsec tunnel mode approach
  76. 4.8.2 draft-touch-ipsec-vpn approach
  77. 5. ALTQ
  78. 6. Mobile IPv6
  79. 6.1 KAME node as correspondent node
  80. 6.2 KAME node as home agent/mobile node
  81. 6.3 Old Mobile IPv6 code
  82. 7. Coding style
  83. 8. Policy on technology with intellectual property right restriction
  84. 1. IPv6
  85. 1.1 Conformance
  86. The KAME kit conforms, or tries to conform, to the latest set of IPv6
  87. specifications. For future reference we list some of the relevant documents
  88. below (NOTE: this is not a complete list - this is too hard to maintain...).
  89. For details please refer to specific chapter in the document, RFCs, manpages
  90. come with KAME, or comments in the source code.
  91. Conformance tests have been performed on past and latest KAME STABLE kit,
  92. at TAHI project. Results can be viewed at http://www.tahi.org/report/KAME/.
  93. We also attended Univ. of New Hampshire IOL tests (http://www.iol.unh.edu/)
  94. in the past, with our past snapshots.
  95. RFC1639: FTP Operation Over Big Address Records (FOOBAR)
  96. * RFC2428 is preferred over RFC1639. ftp clients will first try RFC2428,
  97. then RFC1639 if failed.
  98. RFC1886: DNS Extensions to support IPv6
  99. RFC1933: (see RFC2893)
  100. RFC1981: Path MTU Discovery for IPv6
  101. RFC2080: RIPng for IPv6
  102. * KAME-supplied route6d, bgpd and hroute6d support this.
  103. RFC2283: Multiprotocol Extensions for BGP-4
  104. * so-called "BGP4+".
  105. * KAME-supplied bgpd supports this.
  106. RFC2292: Advanced Sockets API for IPv6
  107. * see RFC3542
  108. RFC2362: Protocol Independent Multicast-Sparse Mode (PIM-SM)
  109. * RFC2362 defines the packet formats and the protcol of PIM-SM.
  110. RFC2373: IPv6 Addressing Architecture
  111. * KAME supports node required addresses, and conforms to the scope
  112. requirement.
  113. RFC2374: An IPv6 Aggregatable Global Unicast Address Format
  114. * KAME supports 64-bit length of Interface ID.
  115. RFC2375: IPv6 Multicast Address Assignments
  116. * Userland applications use the well-known addresses assigned in the RFC.
  117. RFC2428: FTP Extensions for IPv6 and NATs
  118. * RFC2428 is preferred over RFC1639. ftp clients will first try RFC2428,
  119. then RFC1639 if failed.
  120. RFC2460: IPv6 specification
  121. RFC2461: Neighbor discovery for IPv6
  122. * See 1.2 in this document for details.
  123. RFC2462: IPv6 Stateless Address Autoconfiguration
  124. * See 1.4 in this document for details.
  125. RFC2463: ICMPv6 for IPv6 specification
  126. * See 1.9 in this document for details.
  127. RFC2464: Transmission of IPv6 Packets over Ethernet Networks
  128. RFC2465: MIB for IPv6: Textual Conventions and General Group
  129. * Necessary statistics are gathered by the kernel. Actual IPv6 MIB
  130. support is provided as patchkit for ucd-snmp.
  131. RFC2466: MIB for IPv6: ICMPv6 group
  132. * Necessary statistics are gathered by the kernel. Actual IPv6 MIB
  133. support is provided as patchkit for ucd-snmp.
  134. RFC2467: Transmission of IPv6 Packets over FDDI Networks
  135. RFC2472: IPv6 over PPP
  136. RFC2492: IPv6 over ATM Networks
  137. * only PVC is supported.
  138. RFC2497: Transmission of IPv6 packet over ARCnet Networks
  139. RFC2545: Use of BGP-4 Multiprotocol Extensions for IPv6 Inter-Domain Routing
  140. RFC2553: (see RFC3493)
  141. RFC2671: Extension Mechanisms for DNS (EDNS0)
  142. * see USAGE for how to use it.
  143. * not supported on kame/freebsd4 and kame/bsdi4.
  144. RFC2673: Binary Labels in the Domain Name System
  145. * KAME/bsdi4 supports A6, DNAME and binary label to some extent.
  146. * KAME apps/bind8 repository has resolver library with partial A6, DNAME
  147. and binary label support.
  148. RFC2675: IPv6 Jumbograms
  149. * See 1.7 in this document for details.
  150. RFC2710: Multicast Listener Discovery for IPv6
  151. RFC2711: IPv6 router alert option
  152. RFC2732: Format for Literal IPv6 Addresses in URL's
  153. * The spec is implemented in programs that handle URLs
  154. (like freebsd ftpio(3) and fetch(1), or netbsd ftp(1))
  155. RFC2874: DNS Extensions to Support IPv6 Address Aggregation and Renumbering
  156. * KAME/bsdi4 supports A6, DNAME and binary label to some extent.
  157. * KAME apps/bind8 repository has resolver library with partial A6, DNAME
  158. and binary label support.
  159. RFC2893: Transition Mechanisms for IPv6 Hosts and Routers
  160. * IPv4 compatible address is not supported.
  161. * automatic tunneling (4.3) is not supported.
  162. * "gif" interface implements IPv[46]-over-IPv[46] tunnel in a generic way,
  163. and it covers "configured tunnel" described in the spec.
  164. See 1.5 in this document for details.
  165. RFC2894: Router renumbering for IPv6
  166. RFC3041: Privacy Extensions for Stateless Address Autoconfiguration in IPv6
  167. RFC3056: Connection of IPv6 Domains via IPv4 Clouds
  168. * So-called "6to4".
  169. * "stf" interface implements it. Be sure to read
  170. draft-itojun-ipv6-transition-abuse-01.txt
  171. below before configuring it, there can be security issues.
  172. RFC3142: An IPv6-to-IPv4 transport relay translator
  173. * FAITH tcp relay translator (faithd) implements this. See 3.1 for more
  174. details.
  175. RFC3152: Delegation of IP6.ARPA
  176. * libinet6 resolvers contained in the KAME snaps support to use
  177. the ip6.arpa domain (with the nibble format) for IPv6 reverse
  178. lookups.
  179. RFC3484: Default Address Selection for IPv6
  180. * the selection algorithm for both source and destination addresses
  181. is implemented based on the RFC, though some rules are still omitted.
  182. RFC3493: Basic Socket Interface Extensions for IPv6
  183. * IPv4 mapped address (3.7) and special behavior of IPv6 wildcard bind
  184. socket (3.8) are,
  185. - supported and turned on by default on KAME/FreeBSD[34]
  186. and KAME/BSDI4,
  187. - supported but turned off by default on KAME/NetBSD and KAME/FreeBSD5,
  188. - not supported on KAME/FreeBSD228, KAME/OpenBSD and KAME/BSDI3.
  189. see 1.12 in this document for details.
  190. * The AI_ALL and AI_V4MAPPED flags are not supported.
  191. RFC3542: Advanced Sockets API for IPv6 (revised)
  192. * For supported library functions/kernel APIs, see sys/netinet6/ADVAPI.
  193. * Some of the updates in the draft are not implemented yet. See
  194. TODO.2292bis for more details.
  195. RFC4007: IPv6 Scoped Address Architecture
  196. * some part of the documentation (especially about the routing
  197. model) is not supported yet.
  198. * zone indices that contain scope types have not been supported yet.
  199. draft-ietf-ipngwg-icmp-name-lookups-09: IPv6 Name Lookups Through ICMP
  200. draft-ietf-ipv6-router-selection-07.txt:
  201. Default Router Preferences and More-Specific Routes
  202. * router-side: both router preference and specific routes are supported.
  203. * host-side: only router preference is supported.
  204. draft-ietf-pim-sm-v2-new-02.txt
  205. A revised version of RFC2362, which includes the IPv6 specific
  206. packet format and protocol descriptions.
  207. draft-ietf-dnsext-mdns-00.txt: Multicast DNS
  208. * kame/mdnsd has test implementation, which will not be built in
  209. default compilation. The draft will experience a major change in the
  210. near future, so don't rely upon it.
  211. draft-ietf-ipngwg-icmp-v3-02.txt: ICMPv6 for IPv6 specification (revised)
  212. * See 1.9 in this document for details.
  213. draft-itojun-ipv6-tcp-to-anycast-01.txt:
  214. Disconnecting TCP connection toward IPv6 anycast address
  215. draft-ietf-ipv6-rfc2462bis-06.txt: IPv6 Stateless Address
  216. Autoconfiguration (revised)
  217. draft-itojun-ipv6-transition-abuse-01.txt:
  218. Possible abuse against IPv6 transition technologies (expired)
  219. * KAME does not implement RFC1933/2893 automatic tunnel.
  220. * "stf" interface implements some address filters. Refer to stf(4)
  221. for details. Since there's no way to make 6to4 interface 100% secure,
  222. we do not include "stf" interface into GENERIC.v6 compilation.
  223. * kame/openbsd completely disables IPv4 mapped address support.
  224. * kame/netbsd makes IPv4 mapped address support off by default.
  225. * See section 1.12.6 and 1.14 for more details.
  226. draft-itojun-ipv6-flowlabel-api-01.txt: Socket API for IPv6 flow label field
  227. * no consideration is made against the use of routing headers and such.
  228. 1.2 Neighbor Discovery
  229. Our implementation of Neighbor Discovery is fairly stable. Currently
  230. Address Resolution, Duplicated Address Detection, and Neighbor
  231. Unreachability Detection are supported. In the near future we will be
  232. adding an Unsolicited Neighbor Advertisement transmission command as
  233. an administration tool.
  234. Duplicated Address Detection (DAD) will be performed when an IPv6 address
  235. is assigned to a network interface, or the network interface is enabled
  236. (ifconfig up). It is documented in RFC2462 5.4.
  237. If DAD fails, the address will be marked "duplicated" and message will be
  238. generated to syslog (and usually to console). The "duplicated" mark
  239. can be checked with ifconfig. It is administrators' responsibility to check
  240. for and recover from DAD failures. We may try to improve failure recovery
  241. in future KAME code.
  242. A successor version of RFC2462 (called rfc2462bis) clarifies the
  243. behavior when DAD fails (i.e., duplicate is detected): if the
  244. duplicate address is a link-local address formed from an interface
  245. identifier based on the hardware address which is supposed to be
  246. uniquely assigned (e.g., EUI-64 for an Ethernet interface), IPv6
  247. operation on the interface should be disabled. The KAME
  248. implementation supports this as follows: if this type of duplicate is
  249. detected, the kernel marks "disabled" in the ND specific data
  250. structure for the interface. Every IPv6 I/O operation in the kernel
  251. checks this mark, and the kernel will drop packets received on or
  252. being sent to the "disabled" interface. Whether the IPv6 operation is
  253. disabled or not can be confirmed by the ndp(8) command. See the man
  254. page for more details.
  255. DAD procedure may not be effective on certain network interfaces/drivers.
  256. If a network driver needs long initialization time (with wireless network
  257. interfaces this situation is popular), and the driver mistakingly raises
  258. IFF_RUNNING before the driver becomes ready, DAD code will try to transmit
  259. DAD probes to not-really-ready network driver and the packet will not go out
  260. from the interface. In such cases, network drivers should be corrected.
  261. Some of network drivers loop multicast packets back to themselves,
  262. even if instructed not to do so (especially in promiscuous mode). In
  263. such cases DAD may fail, because the DAD engine sees inbound NS packet
  264. (actually from the node itself) and considers it as a sign of
  265. duplicate. In this case, drivers should be corrected to honor
  266. IFF_SIMPLEX behavior. For example, you may need to check source MAC
  267. address on an inbound packet, and reject it if it is from the node
  268. itself.
  269. Neighbor Discovery specification (RFC2461) does not talk about neighbor
  270. cache handling in the following cases:
  271. (1) when there was no neighbor cache entry, node received unsolicited
  272. RS/NS/NA/redirect packet without link-layer address
  273. (2) neighbor cache handling on medium without link-layer address
  274. (we need a neighbor cache entry for IsRouter bit)
  275. For (1), we implemented workaround based on discussions on IETF ipngwg mailing
  276. list. For more details, see the comments in the source code and email
  277. thread started from (IPng 7155), dated Feb 6 1999.
  278. IPv6 on-link determination rule (RFC2461) is quite different from
  279. assumptions in BSD IPv4 network code. To implement the behavior in
  280. RFC2461 section 6.3.6 (3), the kernel needs to know the default
  281. outgoing interface. To configure the default outgoing interface, use
  282. commands like "ndp -I de0" as root. Then the kernel will have a
  283. "default" route to the interface with the cloning "C" bit being on.
  284. This default route will cause to make a neighbor cache entry for every
  285. destination that does not match an explicit route entry.
  286. Note that we intentionally disable configuring the default interface
  287. by default. This is because we found it sometimes caused inconvenient
  288. situation while it was rarely useful in practical usage. For example,
  289. consider a destination that has both IPv4 and IPv6 addresses but is
  290. only reachable via IPv4. Since our getaddrinfo(3) prefers IPv6 by
  291. default, an (TCP) application using the library with PF_UNSPEC first
  292. tries to connect to the IPv6 address. If we turn on RFC 2461 6.3.6
  293. (3), we have to wait for quite a long period before the first attempt
  294. to make a connection fails. If we turn it off, the first attempt will
  295. immediately fail with EHOSTUNREACH, and then the application can try
  296. the next, reachable address.
  297. The notion of the default interface is also disabled when the node is
  298. acting as a router. The reason is that routers tend to control all
  299. routes stored in the kernel and the default route automatically
  300. installed would rather confuse the routers. Note that the spec misuse
  301. the word "host" and "node" in several places in Section 5.2 of RFC
  302. 2461. We basically read the word "node" in this section as "host,"
  303. and thus believe the implementation policy does not break the
  304. specification.
  305. To avoid possible DoS attacks and infinite loops, KAME stack will accept
  306. only 10 options on ND packet. Therefore, if you have 20 prefix options
  307. attached to RA, only the first 10 prefixes will be recognized.
  308. If this troubles you, please contact the KAME team and/or modify
  309. nd6_maxndopt in sys/netinet6/nd6.c. If there are high demands we may
  310. provide a sysctl knob for the variable.
  311. Proxy Neighbor Advertisement support is implemented in the kernel.
  312. For instance, you can configure it by using the following command:
  313. # ndp -s fe80::1234%ne0 0:1:2:3:4:5 proxy
  314. where ne0 is the interface which attaches to the same link as the
  315. proxy target.
  316. There are certain limitations, though:
  317. - It does not send unsolicited multicast NA on configuration. This is MAY
  318. behavior in RFC2461.
  319. - It does not add random delay before transmission of solicited NA. This is
  320. SHOULD behavior in RFC2461.
  321. - We cannot configure proxy NDP for off-link address. The target address for
  322. proxying must be link-local address, or must be in prefixes configured to
  323. node which does proxy NDP.
  324. - RFC2461 is unclear about if it is legal for a host to perform proxy ND.
  325. We do not prohibit hosts from doing proxy ND, but there will be very limited
  326. use in it.
  327. Starting mid March 2000, we support Neighbor Unreachability Detection
  328. (NUD) on p2p interfaces, including tunnel interfaces (gif). NUD is
  329. turned on by default. Before March 2000 the KAME stack did not
  330. perform NUD on p2p interfaces. If the change raises any
  331. interoperability issues, you can turn off/on NUD by per-interface
  332. basis. Use "ndp -i interface -nud" to turn it off. Consult ndp(8)
  333. for details.
  334. RFC2461 specifies upper-layer reachability confirmation hint. Whenever
  335. upper-layer reachability confirmation hint comes, ND process can use it
  336. to optimize neighbor discovery process - ND process can omit real ND exchange
  337. and keep the neighbor cache state in REACHABLE.
  338. We currently have two sources for hints: (1) setsockopt(IPV6_REACHCONF)
  339. defined by the RFC3542 API, and (2) hints from tcp(6)_input.
  340. It is questionable if they are really trustworthy. For example, a
  341. rogue userland program can use IPV6_REACHCONF to confuse the ND
  342. process. Neighbor cache is a system-wide information pool, and it is
  343. bad to allow a single process to affect others. Also, tcp(6)_input
  344. can be hosed by hijack attempts. It is wrong to allow hijack attempts
  345. to affect the ND process.
  346. Starting June 2000, the ND code has a protection mechanism against
  347. incorrect upper-layer reachability confirmation. The ND code counts
  348. subsequent upper-layer hints. If the number of hints reaches the
  349. maximum, the ND code will ignore further upper-layer hints and run
  350. real ND process to confirm reachability to the peer. sysctl
  351. net.inet6.icmp6.nd6_maxnudhint defines the maximum # of subsequent
  352. upper-layer hints to be accepted.
  353. (from April 2000 to June 2000, we rejected setsockopt(IPV6_REACHCONF) from
  354. non-root process - after a local discussion, it looks that hints are not
  355. that trustworthy even if they are from privileged processes)
  356. If inbound ND packets carry invalid values, the KAME kernel will
  357. drop these packet and increment statistics variable. See
  358. "netstat -sn", icmp6 section. For detailed debugging session, you can
  359. turn on syslog output from the kernel on errors, by turning on sysctl MIB
  360. net.inet6.icmp6.nd6_debug. nd6_debug can be turned on at bootstrap
  361. time, by defining ND6_DEBUG kernel compilation option (so you can
  362. debug behavior during bootstrap). nd6_debug configuration should
  363. only be used for test/debug purposes - for a production environment,
  364. nd6_debug must be set to 0. If you leave it to 1, malicious parties
  365. can inject broken packet and fill up /var/log partition.
  366. 1.3 Scope Zone Index
  367. IPv6 uses scoped addresses. It is therefore very important to
  368. specify the scope zone index (link index for a link-local address, or
  369. site index for a site-local address) with an IPv6 address. Without a
  370. zone index, a scoped IPv6 address is ambiguous to the kernel, and
  371. the kernel would not be able to determine the outbound zone for a
  372. packet to the scoped address. KAME code tries to address the issue in
  373. several ways.
  374. The entire architecture of scoped addresses is documented in RFC4007.
  375. One non-trivial point of the architecture is that the link scope is
  376. (theoretically) larger than the interface scope. That is, two
  377. different interfaces can belong to a same single link. However, in a
  378. normal operation, we can assume that there is 1-to-1 relationship
  379. between links and interfaces. In other words, we can usually put
  380. links and interfaces in the same scope type. The current KAME
  381. implementation assumes the 1-to-1 relationship. In particular, we use
  382. interface names such as "ne1" as unique link identifiers. This would
  383. be much more human-readable and intuitive than numeric identifiers,
  384. but please keep your mind on the theoretical difference between links
  385. and interfaces.
  386. Site-local addresses are very vaguely defined in the specs, and both
  387. the specification and the KAME code need tons of improvements to
  388. enable its actual use. For example, it is still very unclear how we
  389. define a site, or how we resolve host names in a site. There is work
  390. underway to define behavior of routers at site border, but, we have
  391. almost no code for site boundary node support (neither forwarding nor
  392. routing) and we bet almost noone has. We recommend, at this moment,
  393. you to use global addresses for experiments - there are way too many
  394. pitfalls if you use site-local addresses.
  395. 1.3.1 Kernel internal
  396. In the kernel, the link index for a link-local scope address is
  397. embedded into the 2nd 16bit-word (the 3rd and 4th bytes) in the IPv6
  398. address.
  399. For example, you may see something like:
  400. fe80:1::200:f8ff:fe01:6317
  401. in the routing table and the interface address structure (struct
  402. in6_ifaddr). The address above is a link-local unicast address which
  403. belongs to a network link whose link identifier is 1 (note that it
  404. eqauls to the interface index by the assumption of our
  405. implementation). The embedded index enables us to identify IPv6
  406. link-local addresses over multiple links effectively and with only a
  407. little code change.
  408. The use of the internal format must be limited inside the kernel. In
  409. particular, addresses sent by an application should not contain the
  410. embedded index (except via some very special APIs such as routing
  411. sockets). Instead, the index should be specified in the sin6_scope_id
  412. field of a sockaddr_in6 structure. Obviously, packets sent to or
  413. received from must not contain the embedded index either, since the
  414. index is meaningful only within the sending/receiving node.
  415. In order to deal with the differences, several kernel routines are
  416. provided. These are available by including <netinet6/scope_var.h>.
  417. Typically, the following functions will be most generally used:
  418. - int sa6_embedscope(struct sockaddr_in6 *sa6, int defaultok);
  419. Embed sa6->sin6_scope_id into sa6->sin6_addr. If sin6_scope_id is
  420. 0, defaultok is non-0, and the default zone ID (see RFC4007) is
  421. configured, the default ID will be used instead of the value of the
  422. sin6_scope_id field. On success, sa6->sin6_scope_id will be reset
  423. to 0.
  424. This function returns 0 on success, or a non-0 error code otherwise.
  425. - int sa6_recoverscope(struct sockaddr_in6 *sa6);
  426. Extract embedded zone ID in sa6->sin6_addr and set
  427. sa6->sin6_scope_id to that ID. The embedded ID will be cleared with
  428. 0.
  429. This function returns 0 on success, or a non-0 error code otherwise.
  430. - int in6_clearscope(struct in6_addr *in6);
  431. Reset the embedded zone ID in 'in6' to 0. This function never fails, and
  432. returns 0 if the original address is intact or non 0 if the address is
  433. modified. The return value doesn't matter in most cases; currently, the
  434. only point where we care about the return value is ip6_input() for checking
  435. whether the source or destination addresses of the incoming packet is in
  436. the embedded form.
  437. - int in6_setscope(struct in6_addr *in6, struct ifnet *ifp,
  438. u_int32_t *zoneidp);
  439. Embed zone ID determined by the address scope type for 'in6' and the
  440. interface 'ifp' into 'in6'. If zoneidp is non NULL, *zoneidp will
  441. also have the zone ID.
  442. This function returns 0 on success, or a non-0 error code otherwise.
  443. The typical usage of these functions is as follows:
  444. sa6_embedscope() will be used at the socket or transport layer to
  445. convert a sockaddr_in6 structure passed by an application into the
  446. kernel-internal form. In this usage, the second argument is often the
  447. 'ip6_use_defzone' global variable.
  448. sa6_recoverscope() will also be used at the socket or transport layer
  449. to convert an in6_addr structure with the embedded zone ID into a
  450. sockaddr_in6 structure with the corresponding ID in the sin6_scope_id
  451. field (and without the embedded ID in sin6_addr).
  452. in6_clearscope() will be used just before sending a packet to the wire
  453. to remove the embedded ID. In general, this must be done at the last
  454. stage of an output path, since otherwise the address would lose the ID
  455. and could be ambiguous with regard to scope.
  456. in6_setscope() will be used when the kernel receives a packet from the
  457. wire to construct the kernel internal form for each address field in
  458. the packet (typical examples are the source and destination addresses
  459. of the packet). In the typical usage, the third argument 'zoneidp'
  460. will be NULL. A non-NULL value will be used when the validity of the
  461. zone ID must be checked, e.g., when forwarding a packet to another
  462. link (see ip6_forward() for this usage).
  463. An application, when sending a packet, is basically assumed to specify
  464. the appropriate scope zone of the destination address by the
  465. sin6_scope_id field (this might be done transparently from the
  466. application with getaddrinfo() and the extended textual format - see
  467. below), or at least the default scope zone(s) must be configured as a
  468. last resort. In some cases, however, an application could specify an
  469. ambiguous address with regard to scope, expecting it is disambiguated
  470. in the kernel by some other means. A typical usage is to specify the
  471. outgoing interface through another API, which can disambiguate the
  472. unspecified scope zone. Such a usage is not recommended, but the
  473. kernel implements some trick to deal with even this case.
  474. A rough sketch of the trick can be summarized as the following
  475. sequence.
  476. sa6_embedscope(dst, ip6_use_defzone);
  477. in6_selectsrc(dst, ..., &ifp, ...);
  478. in6_setscope(&dst->sin6_addr, ifp, NULL);
  479. sa6_embedscope() first tries to convert sin6_scope_id (or the default
  480. zone ID) into the kernel-internal form. This can fail with an
  481. ambiguous destination, but it still tries to get the outgoing
  482. interface (ifp) in the attempt of determining the source address of
  483. the outgoing packet using in6_selectsrc(). If the interface is
  484. detected, and the scope zone was originally ambiguous, in6_setscope()
  485. can finally determine the appropriate ID with the address itself and
  486. the interface, and construct the kernel-internal form. See, for
  487. example, comments in udp6_output() for more concrete example.
  488. In any case, kernel routines except ones in netinet6/scope6.c MUST NOT
  489. directly refer to the embedded form. They MUST use the above
  490. interface functions. In particular, kernel routines MUST NOT have the
  491. following code fragment:
  492. /* This is a bad practice. Don't do this */
  493. if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr))
  494. sin6->sin6_addr.s6_addr16[1] = htons(ifp->if_index);
  495. This is bad for several reasons. First, address ambiguity is not
  496. specific to link-local addresses (any non-global multicast addresses
  497. are inherently ambiguous, and this is particularly true for
  498. interface-local addresses). Secondly, this is vulnerable to future
  499. changes of the embedded form (the embedded position may change, or the
  500. zone ID may not actually be the interface index). Only scope6.c
  501. routines should know the details.
  502. The above code fragment should thus actually be as follows:
  503. /* This is correct. */
  504. in6_setscope(&sin6->sin6_addr, ifp, NULL);
  505. (and catch errors if possible and necessary)
  506. 1.3.2 Interaction with API
  507. There are several candidates of API to deal with scoped addresses
  508. without ambiguity.
  509. The IPV6_PKTINFO ancillary data type or socket option defined in the
  510. advanced API (RFC2292 or RFC3542) can specify
  511. the outgoing interface of a packet. Similarly, the IPV6_PKTINFO or
  512. IPV6_RECVPKTINFO socket options tell kernel to pass the incoming
  513. interface to user applications.
  514. These options are enough to disambiguate scoped addresses of an
  515. incoming packet, because we can uniquely identify the corresponding
  516. zone of the scoped address(es) by the incoming interface. However,
  517. they are too strong for outgoing packets. For example, consider a
  518. multi-sited node and suppose that more than one interface of the node
  519. belongs to a same site. When we want to send a packet to the site,
  520. we can only specify one of the interfaces for the outgoing packet with
  521. these options; we cannot just say "send the packet to (one of the
  522. interfaces of) the site."
  523. Another kind of candidates is to use the sin6_scope_id member in the
  524. sockaddr_in6 structure, defined in RFC2553. The KAME kernel
  525. interprets the sin6_scope_id field properly in order to disambiguate scoped
  526. addresses. For example, if an application passes a sockaddr_in6
  527. structure that has a non-zero sin6_scope_id value to the sendto(2)
  528. system call, the kernel should send the packet to the appropriate zone
  529. according to the sin6_scope_id field. Similarly, when the source or
  530. the destination address of an incoming packet is a scoped one, the
  531. kernel should detect the correct zone identifier based on the address
  532. and the receiving interface, fill the identifier in the sin6_scope_id
  533. field of a sockaddr_in6 structure, and then pass the packet to an
  534. application via the recvfrom(2) system call, etc.
  535. However, the semantics of the sin6_scope_id is still vague and on the
  536. way to standardization. Additionally, not so many operating systems
  537. support the behavior above at this moment.
  538. In summary,
  539. - If your target system is limited to KAME based ones (i.e. BSD
  540. variants and KAME snaps), use the sin6_scope_id field assuming the
  541. kernel behavior described above.
  542. - Otherwise, (i.e. if your program should be portable on other systems
  543. than BSDs)
  544. + Use the advanced API to disambiguate scoped addresses of incoming
  545. packets.
  546. + To disambiguate scoped addresses of outgoing packets,
  547. * if it is okay to just specify the outgoing interface, use the
  548. advanced API. This would be the case, for example, when you
  549. should only consider link-local addresses and your system
  550. assumes 1-to-1 relationship between links and interfaces.
  551. * otherwise, sorry but you lose. Please rush the IETF IPv6
  552. community into standardizing the semantics of the sin6_scope_id
  553. field.
  554. Routing daemons and configuration programs, like route6d and ifconfig,
  555. will need to manipulate the "embedded" zone index. These programs use
  556. routing sockets and ioctls (like SIOCGIFADDR_IN6) and the kernel API
  557. will return IPv6 addresses with the 2nd 16bit-word filled in. The
  558. APIs are for manipulating kernel internal structure. Programs that
  559. use these APIs have to be prepared about differences in kernels
  560. anyway.
  561. getaddrinfo(3) and getnameinfo(3) support an extended numeric IPv6
  562. syntax, as documented in RFC4007. You can specify the outgoing link,
  563. by using the name of the outgoing interface as the link, like
  564. "fe80::1%ne0" (again, note that we assume there is 1-to-1 relationship
  565. between links and interfaces.) This way you will be able to specify a
  566. link-local scoped address without much trouble.
  567. Other APIs like inet_pton(3) and inet_ntop(3) are inherently
  568. unfriendly with scoped addresses, since they are unable to annotate
  569. addresses with zone identifier.
  570. 1.3.3 Interaction with users (command line)
  571. Most of user applications now support the extended numeric IPv6
  572. syntax. In this case, you can specify outgoing link, by using the name
  573. of the outgoing interface like "fe80::1%ne0" (sorry for the duplicated
  574. notice, but please recall again that we assume 1-to-1 relationship
  575. between links and interfaces). This is even the case for some
  576. management tools such as route(8) or ndp(8). For example, to install
  577. the IPv6 default route by hand, you can type like
  578. # route add -inet6 default fe80::9876:5432:1234:abcd%ne0
  579. (Although we suggest you to run dynamic routing instead of static
  580. routes, in order to avoid configuration mistakes.)
  581. Some applications have command line options for specifying an
  582. appropriate zone of a scoped address (like "ping6 -I ne0 ff02::1" to
  583. specify the outgoing interface). However, you can't always expect such
  584. options. Additionally, specifying the outgoing "interface" is in
  585. theory an overspecification as a way to specify the outgoing "link"
  586. (see above). Thus, we recommend you to use the extended format
  587. described above. This should apply to the case where the outgoing
  588. interface is specified.
  589. In any case, when you specify a scoped address to the command line,
  590. NEVER write the embedded form (such as ff02:1::1 or fe80:2::fedc),
  591. which should only be used inside the kernel (see Section 1.3.1), and
  592. is not supposed to work.
  593. 1.4 Plug and Play
  594. The KAME kit implements most of the IPv6 stateless address
  595. autoconfiguration in the kernel.
  596. Neighbor Discovery functions are implemented in the kernel as a whole.
  597. Router Advertisement (RA) input for hosts is implemented in the
  598. kernel. Router Solicitation (RS) output for endhosts, RS input
  599. for routers, and RA output for routers are implemented in the
  600. userland.
  601. 1.4.1 Assignment of link-local, and special addresses
  602. IPv6 link-local address is generated from IEEE802 address (ethernet MAC
  603. address). Each of interface is assigned an IPv6 link-local address
  604. automatically, when the interface becomes up (IFF_UP). Also, direct route
  605. for the link-local address is added to routing table.
  606. Here is an output of netstat command:
  607. Internet6:
  608. Destination Gateway Flags Netif Expire
  609. fe80::%ed0/64 link#1 UC ed0
  610. fe80::%ep0/64 link#2 UC ep0
  611. Interfaces that has no IEEE802 address (pseudo interfaces like tunnel
  612. interfaces, or ppp interfaces) will borrow IEEE802 address from other
  613. interfaces, such as ethernet interfaces, whenever possible.
  614. If there is no IEEE802 hardware attached, last-resort pseudorandom value,
  615. which is from MD5(hostname), will be used as source of link-local address.
  616. If it is not suitable for your usage, you will need to configure the
  617. link-local address manually.
  618. If an interface is not capable of handling IPv6 (such as lack of multicast
  619. support), link-local address will not be assigned to that interface.
  620. See section 2 for details.
  621. Each interface joins the solicited multicast address and the
  622. link-local all-nodes multicast addresses (e.g. fe80::1:ff01:6317
  623. and ff02::1, respectively, on the link the interface is attached).
  624. In addition to a link-local address, the loopback address (::1) will be
  625. assigned to the loopback interface. Also, ::1/128 and ff01::/32 are
  626. automatically added to routing table, and loopback interface joins
  627. node-local multicast group ff01::1.
  628. 1.4.2 Stateless address autoconfiguration on hosts
  629. In IPv6 specification, nodes are separated into two categories:
  630. routers and hosts. Routers forward packets addressed to others, hosts does
  631. not forward the packets. net.inet6.ip6.forwarding defines whether this
  632. node is a router or a host (router if it is 1, host if it is 0).
  633. It is NOT recommended to change net.inet6.ip6.forwarding while the node
  634. is in operation. IPv6 specification defines behavior for "host" and "router"
  635. quite differently, and switching from one to another can cause serious
  636. troubles. It is recommended to configure the variable at bootstrap time only.
  637. The first step in stateless address configuration is Duplicated Address
  638. Detection (DAD). See 1.2 for more detail on DAD.
  639. When a host hears Router Advertisement from the router, a host may
  640. autoconfigure itself by stateless address autoconfiguration. This
  641. behavior can be controlled by the net.inet6.ip6.accept_rtadv sysctl
  642. variable and a per-interface flag managed in the kernel. The latter,
  643. which we call "if_accept_rtadv" here, can be changed by the ndp(8)
  644. command (see the manpage for more details). When the sysctl variable
  645. is set to 1, and the flag is set, the host autoconfigures itself. By
  646. autoconfiguration, network address prefixes for the receiving
  647. interface (usually global address prefix) are added. The default
  648. route is also configured.
  649. Routers periodically generate Router Advertisement packets. To
  650. request an adjacent router to generate RA packet, a host can transmit
  651. Router Solicitation. To generate an RS packet at any time, use the
  652. "rtsol" command. The "rtsold" daemon is also available. "rtsold"
  653. generates Router Solicitation whenever necessary, and it works greatly
  654. for nomadic usage (notebooks/laptops). If one wishes to ignore Router
  655. Advertisements, use sysctl to set net.inet6.ip6.accept_rtadv to 0.
  656. Additionally, ndp(8) command can be used to control the behavior
  657. per-interface basis.
  658. To generate Router Advertisement from a router, use the "rtadvd" daemon.
  659. Note that the IPv6 specification assumes the following items and that
  660. nonconforming cases are left unspecified:
  661. - Only hosts will listen to router advertisements
  662. - Hosts have a single network interface (except loopback)
  663. This is therefore unwise to enable net.inet6.ip6.accept_rtadv on routers,
  664. or multi-interface hosts. A misconfigured node can behave strange
  665. (KAME code allows nonconforming configuration, for those who would like
  666. to do some experiments).
  667. To summarize the sysctl knob:
  668. accept_rtadv forwarding role of the node
  669. --- --- ---
  670. 0 0 host (to be manually configured)
  671. 0 1 router
  672. 1 0 autoconfigured host
  673. (spec assumes that hosts have a single
  674. interface only, autoconfigred hosts
  675. with multiple interfaces are
  676. out-of-scope)
  677. 1 1 invalid, or experimental
  678. (out-of-scope of spec)
  679. The if_accept_rtadv flag is referred only when accept_rtadv is 1 (the
  680. latter two cases). The flag does not have any effects when the sysctl
  681. variable is 0.
  682. See 1.2 in the document for relationship between DAD and autoconfiguration.
  683. 1.4.3 DHCPv6
  684. We supply a tiny DHCPv6 server/client in kame/dhcp6. However, the
  685. implementation is premature (for example, this does NOT implement
  686. address lease/release), and it is not in default compilation tree on
  687. some platforms. If you want to do some experiment, compile it on your
  688. own.
  689. DHCPv6 and autoconfiguration also needs more work. "Managed" and "Other"
  690. bits in RA have no special effect to stateful autoconfiguration procedure
  691. in DHCPv6 client program ("Managed" bit actually prevents stateless
  692. autoconfiguration, but no special action will be taken for DHCPv6 client).
  693. 1.5 Generic tunnel interface
  694. GIF (Generic InterFace) is a pseudo interface for configured tunnel.
  695. Details are described in gif(4) manpage.
  696. Currently
  697. v6 in v6
  698. v6 in v4
  699. v4 in v6
  700. v4 in v4
  701. are available. Use "gifconfig" to assign physical (outer) source
  702. and destination address to gif interfaces.
  703. Configuration that uses same address family for inner and outer IP
  704. header (v4 in v4, or v6 in v6) is dangerous. It is very easy to
  705. configure interfaces and routing tables to perform infinite level
  706. of tunneling. Please be warned.
  707. gif can be configured to be ECN-friendly. See 4.5 for ECN-friendliness
  708. of tunnels, and gif(4) manpage for how to configure.
  709. If you would like to configure an IPv4-in-IPv6 tunnel with gif interface,
  710. read gif(4) carefully. You may need to remove IPv6 link-local address
  711. automatically assigned to the gif interface.
  712. 1.6 Address Selection
  713. 1.6.1 Source Address Selection
  714. The KAME kernel chooses the source address for an outgoing packet
  715. sent from a user application as follows:
  716. 1. if the source address is explicitly specified via an IPV6_PKTINFO
  717. ancillary data item or the socket option of that name, just use it.
  718. Note that this item/option overrides the bound address of the
  719. corresponding (datagram) socket.
  720. 2. if the corresponding socket is bound, use the bound address.
  721. 3. otherwise, the kernel first tries to find the outgoing interface of
  722. the packet. If it fails, the source address selection also fails.
  723. If the kernel can find an interface, choose the most appropriate
  724. address based on the algorithm described in RFC3484.
  725. The policy table used in this algorithm is stored in the kernel.
  726. To install or view the policy, use the ip6addrctl(8) command. The
  727. kernel does not have pre-installed policy. It is expected that the
  728. default policy described in the draft should be installed at the
  729. bootstrap time using this command.
  730. This draft allows an implementation to add implementation-specific
  731. rules with higher precedence than the rule "Use longest matching
  732. prefix." KAME's implementation has the following additional rules
  733. (that apply in the appeared order):
  734. - prefer addresses on alive interfaces, that is, interfaces with
  735. the UP flag being on. This rule is particularly useful for
  736. routers, since some routing daemons stop advertising prefixes
  737. (addresses) on interfaces that have become down.
  738. - prefer addresses on "preferred" interfaces. "Preferred"
  739. interfaces can be specified by the ndp(8) command. By default,
  740. no interface is preferred, that is, this rule does not apply.
  741. Again, this rule is particularly useful for routers, since there
  742. is a convention, among router administrators, of assigning
  743. "stable" addresses on a particular interface (typically a
  744. loopback interface).
  745. In any case, addresses that break the scope zone of the
  746. destination, or addresses whose zone do not contain the outgoing
  747. interface are never chosen.
  748. When the procedure above fails, the kernel usually returns
  749. EADDRNOTAVAIL to the application.
  750. In some cases, the specification explicitly requires the
  751. implementation to choose a particular source address. The source
  752. address for a Neighbor Advertisement (NA) message is an example.
  753. Under the spec (RFC2461 7.2.2) NA's source should be the target
  754. address of the corresponding NS's target. In this case we follow the
  755. spec rather than the above rule.
  756. If you would like to prohibit the use of deprecated address for some
  757. reason, configure net.inet6.ip6.use_deprecated to 0. The issue
  758. related to deprecated address is described in RFC2462 5.5.4 (NOTE:
  759. there is some debate underway in IETF ipngwg on how to use
  760. "deprecated" address).
  761. As documented in the source address selection document, temporary
  762. addresses for privacy extension are less preferred to public addresses
  763. by default. However, for administrators who are particularly aware of
  764. the privacy, there is a system-wide sysctl(3) variable
  765. "net.inet6.ip6.prefer_tempaddr". When the variable is set to
  766. non-zero, the kernel will rather prefer temporary addresses. The
  767. default value of this variable is 0.
  768. 1.6.2 Destination Address Ordering
  769. KAME's getaddrinfo(3) supports the destination address ordering
  770. algorithm described in RFC3484. Getaddrinfo(3) needs to know the
  771. source address for each destination address and policy entries
  772. (described in the previous section) for the source and destination
  773. addresses. To get the source address, the library function opens a
  774. UDP socket and tries to connect(2) for the destination. To get the
  775. policy entry, the function issues sysctl(3).
  776. 1.7 Jumbo Payload
  777. KAME supports the Jumbo Payload hop-by-hop option used to send IPv6
  778. packets with payloads longer than 65,535 octets. But since currently
  779. KAME does not support any physical interface whose MTU is more than
  780. 65,535, such payloads can be seen only on the loopback interface(i.e.
  781. lo0).
  782. If you want to try jumbo payloads, you first have to reconfigure the
  783. kernel so that the MTU of the loopback interface is more than 65,535
  784. bytes; add the following to the kernel configuration file:
  785. options "LARGE_LOMTU" #To test jumbo payload
  786. and recompile the new kernel.
  787. Then you can test jumbo payloads by the ping6 command with -b and -s
  788. options. The -b option must be specified to enlarge the size of the
  789. socket buffer and the -s option specifies the length of the packet,
  790. which should be more than 65,535. For example, type as follows;
  791. % ping6 -b 70000 -s 68000 ::1
  792. The IPv6 specification requires that the Jumbo Payload option must not
  793. be used in a packet that carries a fragment header. If this condition
  794. is broken, an ICMPv6 Parameter Problem message must be sent to the
  795. sender. KAME kernel follows the specification, but you cannot usually
  796. see an ICMPv6 error caused by this requirement.
  797. If KAME kernel receives an IPv6 packet, it checks the frame length of
  798. the packet and compares it to the length specified in the payload
  799. length field of the IPv6 header or in the value of the Jumbo Payload
  800. option, if any. If the former is shorter than the latter, KAME kernel
  801. discards the packet and increments the statistics. You can see the
  802. statistics as output of netstat command with `-s -p ip6' option:
  803. % netstat -s -p ip6
  804. ip6:
  805. (snip)
  806. 1 with data size < data length
  807. So, KAME kernel does not send an ICMPv6 error unless the erroneous
  808. packet is an actual Jumbo Payload, that is, its packet size is more
  809. than 65,535 bytes. As described above, KAME kernel currently does not
  810. support physical interface with such a huge MTU, so it rarely returns an
  811. ICMPv6 error.
  812. TCP/UDP over jumbogram is not supported at this moment. This is because
  813. we have no medium (other than loopback) to test this. Contact us if you
  814. need this.
  815. IPsec does not work on jumbograms. This is due to some specification twists
  816. in supporting AH with jumbograms (AH header size influences payload length,
  817. and this makes it real hard to authenticate inbound packet with jumbo payload
  818. option as well as AH).
  819. There are fundamental issues in *BSD support for jumbograms. We would like to
  820. address those, but we need more time to finalize the task. To name a few:
  821. - mbuf pkthdr.len field is typed as "int" in 4.4BSD, so it cannot hold
  822. jumbogram with len > 2G on 32bit architecture CPUs. If we would like to
  823. support jumbogram properly, the field must be expanded to hold 4G +
  824. IPv6 header + link-layer header. Therefore, it must be expanded to at least
  825. int64_t (u_int32_t is NOT enough).
  826. - We mistakingly use "int" to hold packet length in many places. We need
  827. to convert them into larger numeric type. It needs a great care, as we may
  828. experience overflow during packet length computation.
  829. - We mistakingly check for ip6_plen field of IPv6 header for packet payload
  830. length in various places. We should be checking mbuf pkthdr.len instead.
  831. ip6_input() will perform sanity check on jumbo payload option on input,
  832. and we can safely use mbuf pkthdr.len afterwards.
  833. - TCP code needs careful updates in bunch of places, of course.
  834. 1.8 Loop prevention in header processing
  835. IPv6 specification allows arbitrary number of extension headers to
  836. be placed onto packets. If we implement IPv6 packet processing
  837. code in the way BSD IPv4 code is implemented, kernel stack may
  838. overflow due to long function call chain. KAME sys/netinet6 code
  839. is carefully designed to avoid kernel stack overflow. Because of
  840. this, KAME sys/netinet6 code defines its own protocol switch
  841. structure, as "struct ip6protosw" (see netinet6/ip6protosw.h).
  842. In addition to this, we restrict the number of extension headers
  843. (including the IPv6 header) in each incoming packet, in order to
  844. prevent a DoS attack that tries to send packets with a massive number
  845. of extension headers. The upper limit can be configured by the sysctl
  846. value net.inet6.ip6.hdrnestlimit. In particular, if the value is 0,
  847. the node will allow an arbitrary number of headers. As of writing this
  848. document, the default value is 50.
  849. IPv4 part (sys/netinet) remains untouched for compatibility.
  850. Because of this, if you receive IPsec-over-IPv4 packet with massive
  851. number of IPsec headers, kernel stack may blow up. IPsec-over-IPv6 is okay.
  852. 1.9 ICMPv6
  853. After RFC2463 was published, IETF ipngwg has decided to disallow ICMPv6 error
  854. packet against ICMPv6 redirect, to prevent ICMPv6 storm on a network medium.
  855. KAME already implements this into the kernel.
  856. RFC2463 requires rate limitation for ICMPv6 error packets generated by a
  857. node, to avoid possible DoS attacks. KAME kernel implements two rate-
  858. limitation mechanisms, tunable via sysctl:
  859. - Minimum time interval between ICMPv6 error packets
  860. KAME kernel will generate no more than one ICMPv6 error packet,
  861. during configured time interval. net.inet6.icmp6.errratelimit
  862. controls the interval (default: disabled).
  863. - Maximum ICMPv6 error packet-per-second
  864. KAME kernel will generate no more than the configured number of
  865. packets in one second. net.inet6.icmp6.errppslimit controls the
  866. maximum packet-per-second value (default: 200pps)
  867. Basically, we need to pick values that are suitable against the bandwidth
  868. of link layer devices directly attached to the node. In some cases the
  869. default values may not fit well. We are still unsure if the default value
  870. is sane or not. Comments are welcome.
  871. 1.10 Applications
  872. For userland programming, we support IPv6 socket API as specified in
  873. RFC2553/3493, RFC3542 and upcoming internet drafts.
  874. TCP/UDP over IPv6 is available and quite stable. You can enjoy "telnet",
  875. "ftp", "rlogin", "rsh", "ssh", etc. These applications are protocol
  876. independent. That is, they automatically chooses IPv4 or IPv6
  877. according to DNS.
  878. 1.11 Kernel Internals
  879. (*) TCP/UDP part is handled differently between operating system platforms.
  880. See 1.12 for details.
  881. The current KAME has escaped from the IPv4 netinet logic. While
  882. ip_forward() calls ip_output(), ip6_forward() directly calls
  883. if_output() since routers must not divide IPv6 packets into fragments.
  884. ICMPv6 should contain the original packet as long as possible up to
  885. 1280. UDP6/IP6 port unreach, for instance, should contain all
  886. extension headers and the *unchanged* UDP6 and IP6 headers.
  887. So, all IP6 functions except TCP6 never convert network byte
  888. order into host byte order, to save the original packet.
  889. tcp6_input(), udp6_input() and icmp6_input() can't assume that IP6
  890. header is preceding the transport headers due to extension
  891. headers. So, in6_cksum() was implemented to handle packets whose IP6
  892. header and transport header is not continuous. TCP/IP6 nor UDP/IP6
  893. header structure don't exist for checksum calculation.
  894. To process IP6 header, extension headers and transport headers easily,
  895. KAME requires network drivers to store packets in one internal mbuf or
  896. one or more external mbufs. A typical old driver prepares two
  897. internal mbufs for 100 - 208 bytes data, however, KAME's reference
  898. implementation stores it in one external mbuf.
  899. "netstat -s -p ip6" tells you whether or not your driver conforms
  900. KAME's requirement. In the following example, "cce0" violates the
  901. requirement. (For more information, refer to Section 2.)
  902. M…