dhcp6.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. /* dhcp6.h
  2. DHCPv6 Protocol structures... */
  3. /*
  4. * Copyright (c) 2006-2009 by Internet Systems Consortium, Inc. ("ISC")
  5. *
  6. * Permission to use, copy, modify, and distribute this software for any
  7. * purpose with or without fee is hereby granted, provided that the above
  8. * copyright notice and this permission notice appear in all copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
  11. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
  13. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  15. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
  16. * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  17. *
  18. * Internet Systems Consortium, Inc.
  19. * 950 Charter Street
  20. * Redwood City, CA 94063
  21. * <info@isc.org>
  22. * https://www.isc.org/
  23. */
  24. /* DHCPv6 Option codes: */
  25. #define D6O_CLIENTID 1 /* RFC3315 */
  26. #define D6O_SERVERID 2
  27. #define D6O_IA_NA 3
  28. #define D6O_IA_TA 4
  29. #define D6O_IAADDR 5
  30. #define D6O_ORO 6
  31. #define D6O_PREFERENCE 7
  32. #define D6O_ELAPSED_TIME 8
  33. #define D6O_RELAY_MSG 9
  34. /* Option code 10 unassigned. */
  35. #define D6O_AUTH 11
  36. #define D6O_UNICAST 12
  37. #define D6O_STATUS_CODE 13
  38. #define D6O_RAPID_COMMIT 14
  39. #define D6O_USER_CLASS 15
  40. #define D6O_VENDOR_CLASS 16
  41. #define D6O_VENDOR_OPTS 17
  42. #define D6O_INTERFACE_ID 18
  43. #define D6O_RECONF_MSG 19
  44. #define D6O_RECONF_ACCEPT 20
  45. #define D6O_SIP_SERVERS_DNS 21 /* RFC3319 */
  46. #define D6O_SIP_SERVERS_ADDR 22 /* RFC3319 */
  47. #define D6O_NAME_SERVERS 23 /* RFC3646 */
  48. #define D6O_DOMAIN_SEARCH 24 /* RFC3646 */
  49. #define D6O_IA_PD 25 /* RFC3633 */
  50. #define D6O_IAPREFIX 26 /* RFC3633 */
  51. #define D6O_NIS_SERVERS 27 /* RFC3898 */
  52. #define D6O_NISP_SERVERS 28 /* RFC3898 */
  53. #define D6O_NIS_DOMAIN_NAME 29 /* RFC3898 */
  54. #define D6O_NISP_DOMAIN_NAME 30 /* RFC3898 */
  55. #define D6O_SNTP_SERVERS 31 /* RFC4075 */
  56. #define D6O_INFORMATION_REFRESH_TIME 32 /* RFC4242 */
  57. #define D6O_BCMCS_SERVER_D 33 /* RFC4280 */
  58. #define D6O_BCMCS_SERVER_A 34 /* RFC4280 */
  59. /* 35 is unassigned */
  60. #define D6O_GEOCONF_CIVIC 36 /* RFC4776 */
  61. #define D6O_REMOTE_ID 37 /* RFC4649 */
  62. #define D6O_SUBSCRIBER_ID 38 /* RFC4580 */
  63. #define D6O_CLIENT_FQDN 39 /* RFC4704 */
  64. #define D6O_PANA_AGENT 40 /* paa-option */
  65. #define D6O_NEW_POSIX_TIMEZONE 41 /* RFC4833 */
  66. #define D6O_NEW_TZDB_TIMEZONE 42 /* RFC4833 */
  67. #define D6O_ERO 43 /* RFC4994 */
  68. #define D6O_LQ_QUERY 44 /* RFC5007 */
  69. #define D6O_CLIENT_DATA 45 /* RFC5007 */
  70. #define D6O_CLT_TIME 46 /* RFC5007 */
  71. #define D6O_LQ_RELAY_DATA 47 /* RFC5007 */
  72. #define D6O_LQ_CLIENT_LINK 48 /* RFC5007 */
  73. /*
  74. * Status Codes, from RFC 3315 section 24.4, and RFC 3633, 5007.
  75. */
  76. #define STATUS_Success 0
  77. #define STATUS_UnspecFail 1
  78. #define STATUS_NoAddrsAvail 2
  79. #define STATUS_NoBinding 3
  80. #define STATUS_NotOnLink 4
  81. #define STATUS_UseMulticast 5
  82. #define STATUS_NoPrefixAvail 6
  83. #define STATUS_UnknownQueryType 7
  84. #define STATUS_MalformedQuery 8
  85. #define STATUS_NotConfigured 9
  86. #define STATUS_NotAllowed 10
  87. /*
  88. * DHCPv6 message types, defined in section 5.3 of RFC 3315
  89. */
  90. #define DHCPV6_SOLICIT 1
  91. #define DHCPV6_ADVERTISE 2
  92. #define DHCPV6_REQUEST 3
  93. #define DHCPV6_CONFIRM 4
  94. #define DHCPV6_RENEW 5
  95. #define DHCPV6_REBIND 6
  96. #define DHCPV6_REPLY 7
  97. #define DHCPV6_RELEASE 8
  98. #define DHCPV6_DECLINE 9
  99. #define DHCPV6_RECONFIGURE 10
  100. #define DHCPV6_INFORMATION_REQUEST 11
  101. #define DHCPV6_RELAY_FORW 12
  102. #define DHCPV6_RELAY_REPL 13
  103. #define DHCPV6_LEASEQUERY 14
  104. #define DHCPV6_LEASEQUERY_REPLY 15
  105. extern const char *dhcpv6_type_names[];
  106. extern const int dhcpv6_type_name_max;
  107. /* DUID type definitions (RFC3315 section 9).
  108. */
  109. #define DUID_LLT 1
  110. #define DUID_EN 2
  111. #define DUID_LL 3
  112. /* Offsets into IA_*'s where Option spaces commence. */
  113. #define IA_NA_OFFSET 12 /* IAID, T1, T2, all 4 octets each */
  114. #define IA_TA_OFFSET 4 /* IAID only, 4 octets */
  115. #define IA_PD_OFFSET 12 /* IAID, T1, T2, all 4 octets each */
  116. /* Offset into IAADDR's where Option spaces commence. */
  117. #define IAADDR_OFFSET 24
  118. /* Offset into IAPREFIX's where Option spaces commence. */
  119. #define IAPREFIX_OFFSET 25
  120. /* Offset into LQ_QUERY's where Option spaces commence. */
  121. #define LQ_QUERY_OFFSET 17
  122. /*
  123. * DHCPv6 well-known multicast addressess, from section 5.1 of RFC 3315
  124. */
  125. #define All_DHCP_Relay_Agents_and_Servers "FF02::1:2"
  126. #define All_DHCP_Servers "FF05::1:3"
  127. /*
  128. * DHCPv6 Retransmission Constants (RFC3315 section 5.5, RFC 5007)
  129. */
  130. #define SOL_MAX_DELAY 1
  131. #define SOL_TIMEOUT 1
  132. #define SOL_MAX_RT 120
  133. #define REQ_TIMEOUT 1
  134. #define REQ_MAX_RT 30
  135. #define REQ_MAX_RC 10
  136. #define CNF_MAX_DELAY 1
  137. #define CNF_TIMEOUT 1
  138. #define CNF_MAX_RT 4
  139. #define CNF_MAX_RD 10
  140. #define REN_TIMEOUT 10
  141. #define REN_MAX_RT 600
  142. #define REB_TIMEOUT 10
  143. #define REB_MAX_RT 600
  144. #define INF_MAX_DELAY 1
  145. #define INF_TIMEOUT 1
  146. #define INF_MAX_RT 120
  147. #define REL_TIMEOUT 1
  148. #define REL_MAX_RC 5
  149. #define DEC_TIMEOUT 1
  150. #define DEC_MAX_RC 5
  151. #define REC_TIMEOUT 2
  152. #define REC_MAX_RC 8
  153. #define HOP_COUNT_LIMIT 32
  154. #define LQ6_TIMEOUT 1
  155. #define LQ6_MAX_RT 10
  156. #define LQ6_MAX_RC 5
  157. /*
  158. * Normal packet format, defined in section 6 of RFC 3315
  159. */
  160. struct dhcpv6_packet {
  161. unsigned char msg_type;
  162. unsigned char transaction_id[3];
  163. unsigned char options[FLEXIBLE_ARRAY_MEMBER];
  164. };
  165. /* Offset into DHCPV6 Reply packets where Options spaces commence. */
  166. #define REPLY_OPTIONS_INDEX 4
  167. /*
  168. * Relay packet format, defined in section 7 of RFC 3315
  169. */
  170. struct dhcpv6_relay_packet {
  171. unsigned char msg_type;
  172. unsigned char hop_count;
  173. unsigned char link_address[16];
  174. unsigned char peer_address[16];
  175. unsigned char options[FLEXIBLE_ARRAY_MEMBER];
  176. };
  177. /* Leasequery query-types (RFC 5007) */
  178. #define LQ6QT_BY_ADDRESS 1
  179. #define LQ6QT_BY_CLIENTID 2
  180. /*
  181. * DUID time starts 2000-01-01.
  182. * This constant is the number of seconds since 1970-01-01,
  183. * when the Unix epoch began.
  184. */
  185. #define DUID_TIME_EPOCH 946684800
  186. /* Information-Request Time option (RFC 4242) */
  187. #define IRT_DEFAULT 86400
  188. #define IRT_MINIMUM 600