[388] | 1 | /*
|
---|
| 2 | * Copyright (c) 2004-2011 by Internet Systems Consortium, Inc. ("ISC")
|
---|
| 3 | * Copyright (c) 1995-2003 by Internet Software Consortium
|
---|
| 4 | *
|
---|
| 5 | * Permission to use, copy, modify, and distribute this software for any
|
---|
| 6 | * purpose with or without fee is hereby granted, provided that the above
|
---|
| 7 | * copyright notice and this permission notice appear in all copies.
|
---|
| 8 | *
|
---|
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
---|
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
---|
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
---|
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
---|
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
---|
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
---|
| 15 | * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
---|
| 16 | *
|
---|
| 17 | * Internet Systems Consortium, Inc.
|
---|
| 18 | * 950 Charter Street
|
---|
| 19 | * Redwood City, CA 94063
|
---|
| 20 | * <info@isc.org>
|
---|
| 21 | * https://www.isc.org/
|
---|
| 22 | *
|
---|
| 23 | * This code is based on the original client state machine that was
|
---|
| 24 | * written by Elliot Poger. The code has been extensively hacked on
|
---|
| 25 | * by Ted Lemon since then, so any mistakes you find are probably his
|
---|
| 26 | * fault and not Elliot's.
|
---|
| 27 | */
|
---|
| 28 | /*
|
---|
| 29 | * WIDE Project DHCP Implementation
|
---|
| 30 | * Copyright (c) 1995-1997 Akihiro Tominaga
|
---|
| 31 | * Copyright (c) 1995-1997 WIDE Project
|
---|
| 32 | * All rights reserved.
|
---|
| 33 | *
|
---|
| 34 | * Permission to use, copy, modify and distribute this software and its
|
---|
| 35 | * documentation is hereby granted, provided the following conditions
|
---|
| 36 | * are satisfied,
|
---|
| 37 | *
|
---|
| 38 | * 1. Both the copyright notice and this permission notice appear in
|
---|
| 39 | * all copies of the software, derivative works or modified versions,
|
---|
| 40 | * and any portions thereof, and that both notices appear in
|
---|
| 41 | * supporting documentation.
|
---|
| 42 | * 2. All advertising materials mentioning features or use of this software
|
---|
| 43 | * must display the following acknowledgement:
|
---|
| 44 | * This product includes software developed by WIDE Project and
|
---|
| 45 | * its contributors.
|
---|
| 46 | * 3. Neither the name of WIDE Project nor the names of its contributors
|
---|
| 47 | * may be used to endorse or promote products derived from this software
|
---|
| 48 | * without specific prior written permission.
|
---|
| 49 | *
|
---|
| 50 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND WIDE
|
---|
| 51 | * PROJECT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
|
---|
| 52 | * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ALSO, THERE
|
---|
| 53 | * IS NO WARRANTY IMPLIED OR OTHERWISE, NOR IS SUPPORT PROVIDED.
|
---|
| 54 | *
|
---|
| 55 | * Feedback of the results generated from any improvements or
|
---|
| 56 | * extensions made to this software would be much appreciated.
|
---|
| 57 | * Any such feedback should be sent to:
|
---|
| 58 | *
|
---|
| 59 | * Akihiro Tominaga
|
---|
| 60 | * WIDE Project
|
---|
| 61 | * Keio University, Endo 5322, Kanagawa, Japan
|
---|
| 62 | * (E-mail: dhcp-dist@wide.ad.jp)
|
---|
| 63 | *
|
---|
| 64 | * WIDE project has the rights to redistribute these changes.
|
---|
| 65 | */
|
---|
| 66 | /*
|
---|
| 67 | * TINET (TCP/IP Protocol Stack)
|
---|
| 68 | *
|
---|
| 69 | * Copyright (C) 2011 by Dep. of Computer Science and Engineering
|
---|
| 70 | * Tomakomai National College of Technology, JAPAN
|
---|
| 71 | *
|
---|
| 72 | * ä¸è¨èä½æ¨©è
|
---|
| 73 | ã¯ï¼ä»¥ä¸ã® (1)ï½(4) ã®æ¡ä»¶ãï¼Free Software Foundation
|
---|
| 74 | * ã«ãã£ã¦å
|
---|
| 75 | ¬è¡¨ããã¦ãã GNU General Public License ã® Version 2 ã«è¨
|
---|
| 76 | * è¿°ããã¦ããæ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§ã¢ï¼æ¬ã½ããã¦ã§ã¢
|
---|
| 77 | * ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹å¤ã»åé
|
---|
| 78 | å¸ï¼ä»¥ä¸ï¼
|
---|
| 79 | * å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
| 80 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
| 81 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
| 82 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
| 83 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 84 | * ç¨ã§ããå½¢ã§åé
|
---|
| 85 | å¸ããå ´åã«ã¯ï¼åé
|
---|
| 86 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
| 87 | * è
|
---|
| 88 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
| 89 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 90 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 91 | * ç¨ã§ããªãå½¢ã§åé
|
---|
| 92 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
|
---|
| 93 | * ã¨ï¼
|
---|
| 94 | * (a) åé
|
---|
| 95 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
| 96 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
| 97 | * ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 98 | * (b) åé
|
---|
| 99 | å¸ã®å½¢æ
|
---|
| 100 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«
|
---|
| 101 | * å ±åãããã¨ï¼
|
---|
| 102 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
| 103 | * 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 104 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
| 105 | 責ãããã¨ï¼
|
---|
| 106 | *
|
---|
| 107 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
| 108 | ã
|
---|
| 109 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ãã®é©ç¨å¯è½æ§ã
|
---|
| 110 | * å«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´
|
---|
| 111 | * æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ãã®è²¬ä»»ãè² ããªãï¼
|
---|
| 112 | *
|
---|
| 113 | * @(#) $Id: dhcp6_cli.h 388 2019-05-22 11:25:18Z coas-nagasima $
|
---|
| 114 | */
|
---|
| 115 |
|
---|
| 116 | #ifndef DHCP6_CLI_H
|
---|
| 117 | #define DHCP6_CLI_H
|
---|
| 118 |
|
---|
| 119 | #ifdef DHCP6_CLI_CFG
|
---|
| 120 |
|
---|
| 121 | #include <netinet/in.h>
|
---|
| 122 | #include <netapp/dhcp6.h>
|
---|
| 123 |
|
---|
| 124 | /*
|
---|
| 125 | * DHCP ã¯ã©ã¤ã¢ã³ãã®ã¹ã¿ãã¯ãµã¤ãº
|
---|
| 126 | */
|
---|
| 127 |
|
---|
| 128 | #define DHCP6_CLI_STACK_SIZE 1024 /* DHCP ã¯ã©ã¤ã¢ã³ãã¿ã¹ã¯ã®ã¹ã¿ãã¯ãµã¤ãº */
|
---|
| 129 |
|
---|
| 130 | /*
|
---|
| 131 | * DHCP ã¯ã©ã¤ã¢ã³ãã®åªå
|
---|
| 132 | 度
|
---|
| 133 | */
|
---|
| 134 |
|
---|
| 135 | #define DHCP6_CLI_MAIN_PRIORITY 5 /* DHCP ã¯ã©ã¤ã¢ã³ãã¿ã¹ã¯ã®åªå
|
---|
| 136 | 度 */
|
---|
| 137 |
|
---|
| 138 | /*
|
---|
| 139 | * ã³ã³ãã¤ã«æã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³
|
---|
| 140 | */
|
---|
| 141 |
|
---|
| 142 | /*
|
---|
| 143 | * DHCPv6 åä½ã¢ã¼ã
|
---|
| 144 | *
|
---|
| 145 | * #define DHCP6_CLI_CFG_MODE ã§æå®ããã
|
---|
| 146 | * æå®ããã¦ããªããã°ãã¹ãã¼ãã¬ã¹ã«è¨å®ããã
|
---|
| 147 | *
|
---|
| 148 | */
|
---|
| 149 |
|
---|
| 150 | #define DHCP6_CLI_CFG_STATELESS 0 /* ã¹ãã¼ãã¬ã¹ã«è¨å®ããã */
|
---|
| 151 | #define DHCP6_CLI_CFG_STATEFULL 1 /* ã¹ãã¼ããã«ã«è¨å®ããã */
|
---|
| 152 | #define DHCP6_CLI_CFG_RA 2 /* RA ã® M/O ãããã«ããè¨å®ããã */
|
---|
| 153 | #define DHCP6_CLI_CFG_MODE_DEFAULT DHCP6_CLI_CFG_STATELESS
|
---|
| 154 |
|
---|
| 155 | /* IA ã®è¨å® */
|
---|
| 156 | #define DHCP6_CLI_CFG_IA_NA 1
|
---|
| 157 | //#define DHCP6_CLI_CFG_IA_TA 1
|
---|
| 158 | //#define DHCP6_CLI_CFG_IA_PD 1
|
---|
| 159 |
|
---|
| 160 | /* Rapid-commit ã®æå® */
|
---|
| 161 | //#define DHCP6_CLI_CFG_RAPID_COMMIT 1
|
---|
| 162 |
|
---|
| 163 | /* æ¨å¥¨åº¦ã®å®ç¾© */
|
---|
| 164 | #define DHCP6_CLI_CFG_PREFER_IA 50 /* IA_NA/TA/PD å½ããã®æ¨å¥¨åº¦ */
|
---|
| 165 | #define DHCP6_CLI_CFG_PREFER_IAADDR 100 /* ã¢ãã¬ã¹å½ããã®æ¨å¥¨åº¦ */
|
---|
| 166 |
|
---|
| 167 | /* DHCPv6 ã¯ã©ã¤ã¢ã³ãã¡ãã»ã¼ã¸ã®åä¿¡ãªã¹ããµã¤ãºï¼2以ä¸æå®ãããã¨ï¼ */
|
---|
| 168 | #define NUM_DHCP6_CLI_MSG_LIST 3
|
---|
| 169 |
|
---|
| 170 | /*
|
---|
| 171 | * DHCPv6 ã¯ã©ã¤ã¢ã³ãã¡ãã»ã¼ã¸æ§é ä½æ°ãå¤æ´ç¦æ¢ã
|
---|
| 172 | * +1 ã¯éä¿¡ç¨
|
---|
| 173 | */
|
---|
| 174 | #define NUM_MPF_DHCP6_CLI_MSG (NUM_DHCP6_CLI_MSG_LIST+1)
|
---|
| 175 |
|
---|
| 176 | /* DHCP å¿
|
---|
| 177 | é ãªãã·ã§ã³ãªã¹ã */
|
---|
| 178 |
|
---|
| 179 | #ifndef DHCP6_CLI_CFG_REQUIRED_OLIST
|
---|
| 180 |
|
---|
| 181 | #if defined(USE_RESOLVER)
|
---|
| 182 |
|
---|
| 183 | #define DHCP6_CLI_CFG_REQUIRED_OLIST { \
|
---|
| 184 | DHCP6_OPT_NAME_SERVERS, \
|
---|
| 185 | }
|
---|
| 186 |
|
---|
| 187 | #else /* of #if defined(USE_RESOLVER) */
|
---|
| 188 |
|
---|
| 189 | #endif /* of #if defined(USE_RESOLVER) */
|
---|
| 190 |
|
---|
| 191 | #endif /* of #ifndef DHCP6_CLI_CFG_REQUIRED_OLIST */
|
---|
| 192 |
|
---|
| 193 | /* DHCP è¦æ±ãªãã·ã§ã³ãªã¹ã */
|
---|
| 194 |
|
---|
| 195 | #ifndef DHCP6_CLI_CFG_REQUEST_OLIST
|
---|
| 196 |
|
---|
| 197 | #if defined(USE_RESOLVER)
|
---|
| 198 |
|
---|
| 199 | #define DHCP6_CLI_CFG_REQUEST_OLIST { \
|
---|
| 200 | DHCP6_OPT_DOMAIN_SEARCH, \
|
---|
| 201 | }
|
---|
| 202 |
|
---|
| 203 | #else /* of #if defined(USE_RESOLVER) */
|
---|
| 204 |
|
---|
| 205 | #endif /* of #if defined(USE_RESOLVER) */
|
---|
| 206 |
|
---|
| 207 | #endif /* of #ifndef DHCP6_CLI_CFG_REQUEST_OLIST */
|
---|
| 208 |
|
---|
| 209 | /*
|
---|
| 210 | * ã¿ã¤ã ã¢ã¦ãå®æ°
|
---|
| 211 | * RFC3315 ã«è¦å®ãããã¿ã¤ãã³ã°å®æ°ã¯ dhcp6.h åç
|
---|
| 212 | §
|
---|
| 213 | */
|
---|
| 214 |
|
---|
| 215 | /* æ¨æºã¡ãã»ã¼ã¸ã®åéä¿¡ã¿ã¤ã ã¢ã¦ã */
|
---|
| 216 | #define TMO_DHCP6C_NORMAL ULONG_C(60*1000)
|
---|
| 217 |
|
---|
| 218 | /* æ¨æºè¦æ±ãªã¼ã¹æé */
|
---|
| 219 | #define TMO_DHCP6C_REQ_LEASE ULONG_C(7200*1000)
|
---|
| 220 |
|
---|
| 221 | /* ã¡ãã»ã¼ã¸æ§é ä½ç²å¾ã¿ã¤ã ã¢ã¦ã */
|
---|
| 222 | #define TMO_DHCP6C_MPF_GET ULONG_C(1000)
|
---|
| 223 |
|
---|
| 224 | /* ã¡ãã»ã¼ã¸åä¿¡ã¿ã¤ã ã¢ã¦ã */
|
---|
| 225 | #define TMO_DHCP6C_RCV_DAT ULONG_C(1000)
|
---|
| 226 |
|
---|
| 227 | /*
|
---|
| 228 | * DHCPv6 ã¯ã©ã¤ã¢ã³ãã¡ãã»ã¼ã¸æ§é ä½
|
---|
| 229 | */
|
---|
| 230 |
|
---|
| 231 | typedef struct dhcp6_cli_msg {
|
---|
| 232 | /* 4ãã¤ãå¢çã«ã¢ã©ã¤ã³ããã*/
|
---|
| 233 | T_DHCP6_MSG msg; /* DHCPv6 ã¡ãã»ã¼ã¸æ§é ä½ */
|
---|
| 234 | struct dhcp6_cli_msg *next; /* ãªã¹ãã®æ¬¡ã®ã¡ãã»ã¼ã¸æ§é ä½ */
|
---|
| 235 | SYSTIM rcv_time; /* åä¿¡ããæé */
|
---|
| 236 | T_IPV6EP srv; /* ãµã¼ãã®IPv6ã¢ãã¬ã¹/ãã¼ãçªå· */
|
---|
| 237 | uint16_t len; /* msg ã®æå¹é· */
|
---|
| 238 | uint16_t prefer; /* msg ã®æ¨å¥¨åº¦ */
|
---|
| 239 | uint16_t status; /* STATUS CODE ãªãã·ã§ã³ã® status */
|
---|
| 240 | } T_DHCP6_CLI_MSG;
|
---|
| 241 |
|
---|
| 242 | /* prefer ã®ãã©ã° */
|
---|
| 243 |
|
---|
| 244 | #define DHCP6_ClI_MSG_PREFER_ADDR UINT_C(0x8000) /* ã¢ãã¬ã¹æ
|
---|
| 245 | å ±ãã */
|
---|
| 246 | #define DHCP6_ClI_MSG_PREFER_REQUIRED UINT_C(0x4000) /* å¿
|
---|
| 247 | é ãªãã·ã§ã³ãã */
|
---|
| 248 | #define DHCP6_ClI_MSG_PREFER_REQUEST UINT_C(0x2000) /* è¦æ±ãªãã·ã§ã³ãã */
|
---|
| 249 | #define DHCP6_ClI_MSG_PREFER_OPTION UINT_C(0x1000) /* PREFER ãªãã·ã§ã³ãã */
|
---|
| 250 | #define DHCP6_ClI_MSG_PREFER_FLAG_MASK UINT_C(0xf000)
|
---|
| 251 | #define DHCP6_ClI_MSG_PREFER_VALUE_MASK (~(DHCP6_ClI_MSG_PREFER_FLAG_MASK))
|
---|
| 252 |
|
---|
| 253 | /*
|
---|
| 254 | * STATUS CODE ãªãã·ã§ã³ãç¡ãæã®å¤
|
---|
| 255 | */
|
---|
| 256 |
|
---|
| 257 | #define DHCP6_CLI_STAT_UNDEFINED (-1)
|
---|
| 258 |
|
---|
| 259 | /*
|
---|
| 260 | * ã³ã¼ã«ããã¯é¢æ°
|
---|
| 261 | */
|
---|
| 262 |
|
---|
| 263 | extern ER callback_nblk_dhcp6_cli (ID cepid, FN fncd, void *p_parblk);
|
---|
| 264 |
|
---|
| 265 | /*
|
---|
| 266 | * ã¿ã¹ã¯
|
---|
| 267 | */
|
---|
| 268 |
|
---|
| 269 | extern void dhcp6_cli_task(intptr_t exinf);
|
---|
| 270 |
|
---|
| 271 | /*
|
---|
| 272 | * é¢æ°
|
---|
| 273 | */
|
---|
| 274 |
|
---|
| 275 | extern ER dhcp6c_rel_info (void);
|
---|
| 276 | extern ER dhcp6c_renew_info (void);
|
---|
| 277 | extern ER dhcp6c_get_info (T_IN6_ADDR *addr, uint32_t *expire, uint32_t *renew,
|
---|
| 278 | uint32_t *rebind, uint32_t *deprefer, SYSTIM *bind_start);
|
---|
| 279 |
|
---|
| 280 | #endif /* of #ifdef DHCP6_CLI_CFG */
|
---|
| 281 |
|
---|
| 282 | #endif /* of #ifndef DHCP6_CLI_H */
|
---|