Changeset 331 for EcnlProtoTool/trunk/asp3_dcre/tinet/netapp/dbg_cons.c
- Timestamp:
- Jan 21, 2018, 12:10:09 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/asp3_dcre/tinet/netapp/dbg_cons.c
r321 r331 2 2 * TINET (TCP/IP Protocol Stack) 3 3 * 4 * Copyright (C) 2001-20 09by Dep. of Computer Science and Engineering4 * Copyright (C) 2001-2017 by Dep. of Computer Science and Engineering 5 5 * Tomakomai National College of Technology, JAPAN 6 6 * … … 37 37 38 38 #include <stdlib.h> 39 #include <string.h> 39 40 40 41 #ifdef TARGET_KERNEL_ASP … … 44 45 #include <syssvc/serial.h> 45 46 #include <syssvc/logtask.h> 46 #include "kernel_cfg.h"47 47 #include "kernel/kernel_impl.h" 48 48 #include "kernel/task.h" 49 #include "kernel_cfg.h" 50 #include "tinet_cfg.h" 49 51 50 52 #endif /* of #ifdef TARGET_KERNEL_ASP */ … … 55 57 #include <t_services.h> 56 58 #include "kernel_id.h" 59 #include "tinet_id.h" 57 60 58 61 #include "../kernel/jsp_kernel.h" … … 69 72 #include <net/ethernet.h> 70 73 #include <net/net.h> 74 #include <net/net_endian.h> 71 75 #include <net/net_buf.h> 72 76 #include <net/net_timer.h> … … 83 87 #include <netinet/ip.h> 84 88 #include <netinet/ip_var.h> 85 #include <netinet/ip6.h>86 #include <netinet6/ip6_var.h>87 #include <netinet6/nd6.h>88 89 #include <netinet/if_ether.h> 89 90 #include <netinet/tcp.h> 90 #include <netinet/tcp_timer.h>91 91 #include <netinet/tcp_var.h> 92 92 #include <netinet/tcp_fsm.h> 93 #include <netinet/tcp_timer.h> 93 94 #include <netinet/udp.h> 94 95 #include <netinet/udp_var.h> 95 96 97 #include <netinet6/nd6.h> 98 96 99 #include <net/if_var.h> 97 #include <net/if6_var.h>98 100 99 101 #include <netapp/netapp.h> 100 102 #include <netapp/netapp_var.h> 101 #include <netapp/echo.h> 102 #include <netapp/discard.h> 103 #include <netapp/wwws.h> 104 #include <netapp/tcp_echo_srv1.h> 105 #include <netapp/tcp_echo_srv2.h> 106 #include <netapp/tcp_echo_cli.h> 107 #include <netapp/tcp_discard_cli.h> 108 #include <netapp/udp6_echo_srv.h> 109 #include <netapp/udp4_echo_srv.h> 110 #include <netapp/udp6_echo_cli.h> 111 #include <netapp/udp4_echo_cli.h> 112 #include <netapp/udp_discard_cli.h> 113 #include <netapp/resolver.h> 103 114 #include <netapp/dbg_cons.h> 104 105 #ifdef USE_LCD 106 107 #include "sc1602/lcd.h" 108 109 #endif /* of #ifdef USE_LCD */ 115 #include <netapp/dhcp6_cli.h> 116 #include <netapp/dhcp4_cli.h> 117 #include "lcd.h" 110 118 111 119 #ifdef USE_DBG_CONS 112 120 113 #define DBG_LINE_SIZE 63114 115 121 /* 116 * task_status -- タスクの状態の出力122 * dbg_cons_task_status -- タスクの状態の出力 117 123 */ 118 124 … … 127 133 }; 128 134 129 staticvoid130 task_status (ID portid, char *line)135 void 136 dbg_cons_task_status (ID portid, char *line) 131 137 { 132 138 TCB *tcb; … … 149 155 st >>= 1; 150 156 } 151 cons_p rintf(portid, "\n");157 cons_putchar(portid, '\n'); 152 158 } 153 159 … … 176 182 }; 177 183 184 #if defined(SUPPORT_INET6) 185 186 static void 187 tcp_cep_status (ID portid, char *line) 188 { 189 T_TCP_CEP* cep; 190 int len; 191 192 #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 193 194 T_TCP_TWCEP* twcep; 195 196 #endif /* of #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 */ 197 198 cons_printf(portid, 199 "TCP CEP Status\n" 200 "ID Snd-Q Rcv-Q Foreign Address State\n"); 201 202 for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++) 203 if (!VALID_TCP_CEP(cep)) { 204 cons_printf(portid, 205 "%2d%c%c 0 0" 206 " - " 207 " INVALID\n", 208 GET_TCP_CEPID(cep), 209 DYNAMIC_TCP_CEP(cep) ? 'D' : '.', 210 TCP_IS_CEP_IPV6(cep) ? '6' : '4'); 211 } 212 else if (cep->fsm_state == TCP_FSM_CLOSED) { 213 cons_printf(portid, 214 "%2d%c%c 0 0" 215 " - " 216 " CLOSED\n", 217 GET_TCP_CEPID(cep), 218 DYNAMIC_TCP_CEP(cep) ? 'D' : '.', 219 TCP_IS_CEP_IPV6(cep) ? '6' : '4'); 220 } 221 else if (cep->fsm_state == TCP_FSM_LISTEN) { 222 cons_printf(portid, 223 "%2d%c%c 0 0" 224 " - " 225 " LISTEN\n", 226 GET_TCP_CEPID(cep), 227 DYNAMIC_TCP_CEP(cep) ? 'D' : '.', 228 TCP_IS_CEP_IPV6(cep) ? '6' : '4'); 229 } 230 else { 231 cons_printf(portid, 232 "%2d%c%c %5d %5d ", 233 GET_TCP_CEPID(cep), 234 DYNAMIC_TCP_CEP(cep) ? 'D' : '.', 235 TCP_IS_CEP_IPV6(cep) ? '6' : '4', 236 cep->swbuf_count, cep->rwbuf_count); 237 178 238 #if defined(SUPPORT_INET4) 179 239 240 if (TCP_IS_CEP_IPV4(cep)) { 241 T_IN4_ADDR addr; 242 243 addr = ntohl(cep->dstaddr.ipaddr.s6_addr32[3]); 244 len = put_ipv4addr(portid, &addr, 0); 245 } 246 else 247 len = put_ipv6addr(portid, &cep->dstaddr.ipaddr, 0); 248 249 #else /* of #if defined(SUPPORT_INET4) */ 250 251 len = put_ipv6addr(portid, &cep->dstaddr.ipaddr, 0); 252 253 #endif /* of #if defined(SUPPORT_INET4) */ 254 255 cons_putchar(portid, '.'); 256 len += cons_putnumber(portid, cep->dstaddr.portno, 10, radhex, 0, false, ' '); 257 for (len = 44 - len; len -- > 0; ) 258 cons_putchar(portid, ' '); 259 if (cep->fsm_state == TCP_FSM_TIME_WAIT) 260 cons_printf(portid, " %s(%d)\n", tcp_fsm_str[cep->fsm_state], 261 cep->timer[TCP_TIM_2MSL] / TCP_SLOW_HZ); 262 else 263 cons_printf(portid, " %s\n", tcp_fsm_str[cep->fsm_state]); 264 } 265 266 #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 267 268 for (twcep = tcp_twcep; twcep < &tcp_twcep[NUM_TCP_TW_CEP_ENTRY]; twcep ++) { 269 if (twcep->fsm_state == TCP_FSM_CLOSED) { 270 cons_printf(portid, 271 "%2dTW 0 0" 272 " - " 273 " CLOSED\n", 274 GET_TCP_TWCEPID(twcep)); 275 } 276 else { 277 cons_printf(portid, "%2dTW 0 0 ", GET_TCP_TWCEPID(twcep)); 278 279 #if defined(SUPPORT_INET4) 280 281 if (TCP_IS_CEP_IPV4(twcep)) { 282 T_IN4_ADDR addr; 283 284 addr = ntohl(twcep->dstaddr.ipaddr.s6_addr32[3]); 285 len = put_ipv4addr(portid, &addr, 0); 286 } 287 else 288 len = put_ipv6addr(portid, &twcep->dstaddr.ipaddr, 0); 289 290 #else /* of #if defined(SUPPORT_INET4) */ 291 292 len = put_ipv6addr(portid, &twcep->dstaddr.ipaddr, 0); 293 294 #endif /* of #if defined(SUPPORT_INET4) */ 295 296 cons_putchar(portid, '.'); 297 len += cons_putnumber(portid, twcep->dstaddr.portno, 10, radhex, 0, false, ' '); 298 for (len = 44 - len; len -- > 0; ) 299 cons_putchar(portid, ' '); 300 if (twcep->fsm_state == TCP_FSM_TIME_WAIT) 301 cons_printf(portid, " %s(%d)\n", tcp_fsm_str[twcep->fsm_state], 302 twcep->timer_2msl / TCP_SLOW_HZ); 303 else 304 cons_printf(portid, " %s\n", tcp_fsm_str[twcep->fsm_state]); 305 } 306 } 307 308 #endif /* of #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 */ 309 310 } 311 312 #else /* of #if defined(SUPPORT_INET6) */ 313 314 #if defined(SUPPORT_INET4) 315 180 316 static void 181 tcp_ status (ID portid, char *line)317 tcp_cep_status (ID portid, char *line) 182 318 { 183 319 T_TCP_CEP* cep; … … 190 326 #endif /* of #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 */ 191 327 192 #ifdef TCP_CFG_PASSIVE_OPEN193 194 T_TCP_REP* rep;195 int_t cnt;196 197 #endif /* of #ifdef TCP_CFG_PASSIVE_OPEN */198 199 WAI_NET_CONS_PRINTF();200 328 cons_printf(portid, 201 329 "TCP CEP Status\n" … … 205 333 if (!VALID_TCP_CEP(cep)) { 206 334 cons_printf(portid, 207 "%2d%c 0 0"335 "%2d%c%c 0 0" 208 336 " - " 209 337 " - " 210 338 " INVALID\n", 211 339 GET_TCP_CEPID(cep), 212 DYNAMIC_TCP_CEP(cep) ? 'D' : ' '); 340 DYNAMIC_TCP_CEP(cep) ? 'D' : '.', 341 TCP_IS_CEP_IPV6(cep) ? '6' : '4'); 213 342 } 214 343 else if (cep->fsm_state == TCP_FSM_CLOSED) { 215 344 cons_printf(portid, 216 "%2d%c 0 0"345 "%2d%c%c 0 0" 217 346 " - " 218 347 " - " 219 348 " CLOSED\n", 220 349 GET_TCP_CEPID(cep), 221 DYNAMIC_TCP_CEP(cep) ? 'D' : ' '); 350 DYNAMIC_TCP_CEP(cep) ? 'D' : '.', 351 TCP_IS_CEP_IPV6(cep) ? '6' : '4'); 222 352 } 223 353 else if (cep->fsm_state == TCP_FSM_LISTEN) { 224 354 cons_printf(portid, 225 "%2d%c 0 0 ",355 "%2d%c%c 0 0 ", 226 356 GET_TCP_CEPID(cep), 227 DYNAMIC_TCP_CEP(cep) ? 'D' : ' '); 357 DYNAMIC_TCP_CEP(cep) ? 'D' : '.', 358 TCP_IS_CEP_IPV6(cep) ? '6' : '4'); 228 359 len = PUT_IPADDR(portid, &cep->myaddr.ipaddr, 0); 229 360 cons_putchar(portid, ':'); … … 263 394 if (twcep->fsm_state == TCP_FSM_CLOSED) { 264 395 cons_printf(portid, 265 "%2dTW 0 0"396 "%2dTW 0 0" 266 397 " - " 267 398 " - " … … 270 401 } 271 402 else { 272 cons_printf(portid, "%2dTW 0 0 ", GET_TCP_TWCEPID(twcep));403 cons_printf(portid, "%2dTW 0 0 ", GET_TCP_TWCEPID(twcep)); 273 404 len = PUT_IPADDR(portid, &twcep->myaddr.ipaddr, 0); 274 405 cons_putchar(portid, ':'); … … 291 422 #endif /* of #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 */ 292 423 293 #ifdef TCP_CFG_PASSIVE_OPEN 424 } 425 426 #endif /* of #if defined(SUPPORT_INET4) */ 427 428 #endif /* of #if defined(SUPPORT_INET6) */ 429 430 #if TNUM_TCP6_REPID > 0 431 432 static void 433 tcp6_rep_status (ID portid, char *line) 434 { 435 T_TCP_CEP* cep; 436 T_TCP6_REP* rep; 437 ID repid; 438 int_t cnt; 439 uint_t len; 294 440 295 441 cons_printf(portid, 296 "TCP REP Status\n"442 "TCP6 REP Status\n" 297 443 "ID Local Address CEP\n"); 298 for (rep = tcp_rep; rep < &tcp_rep[tmax_tcp_repid]; rep ++) { 299 cons_printf(portid, "%2d%c ", GET_TCP_REPID(rep), DYNAMIC_TCP_REP(rep) ? 'D' : ' '); 300 if (VALID_TCP_REP(rep)) { 301 len = PUT_IPADDR(portid, &rep->myaddr.ipaddr, 0); 302 cons_putchar(portid, ':'); 303 len += cons_putnumber(portid, rep->myaddr.portno, 10, radhex, 0, false, ' '); 304 for (len = 21 - len; len -- > 0; ) 305 cons_putchar(portid, ' '); 306 cnt = 0; 307 for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++) { 308 if (cep->rep == rep) { 309 if (cnt > 0) 310 cons_printf(portid, ",%d", GET_TCP_CEPID(cep)); 311 else 312 cons_printf(portid, "%d", GET_TCP_CEPID(cep)); 313 cnt ++; 314 } 315 } 316 } 317 else 318 cons_printf(portid, "INVALID"); 319 cons_putchar(portid, '\n'); 320 } 321 322 #endif /* of #ifdef TCP_CFG_PASSIVE_OPEN */ 323 324 SIG_NET_CONS_PRINTF(); 325 FLUSH_SND_BUFF(); 326 } 327 328 #endif /* of #if defined(SUPPORT_INET4) */ 329 330 #if defined(SUPPORT_INET6) 331 332 static void 333 tcp_status (ID portid, char *line) 334 { 335 T_TCP_CEP* cep; 336 uint_t len; 337 338 #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 339 340 T_TCP_TWCEP* twcep; 341 342 #endif /* of #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 */ 343 344 #ifdef TCP_CFG_PASSIVE_OPEN 345 346 T_TCP_REP* rep; 347 int_t cnt; 348 349 #endif /* of #ifdef TCP_CFG_PASSIVE_OPEN */ 350 351 WAI_NET_CONS_PRINTF(); 352 cons_printf(portid, 353 "TCP CEP Status\n" 354 "ID Snd-Q Rcv-Q Foreign Address State\n"); 355 356 for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++) 357 if (!VALID_TCP_CEP(cep)) { 358 cons_printf(portid, 359 "%2d%c 0 0" 360 " - " 361 " INVALID\n", 362 GET_TCP_CEPID(cep), 363 DYNAMIC_TCP_CEP(cep) ? 'D' : ' '); 364 } 365 else if (cep->fsm_state == TCP_FSM_CLOSED) { 366 cons_printf(portid, 367 "%2d%c 0 0" 368 " - " 369 " CLOSED\n", 370 GET_TCP_CEPID(cep), 371 DYNAMIC_TCP_CEP(cep) ? 'D' : ' '); 372 } 373 else if (cep->fsm_state == TCP_FSM_LISTEN) { 374 cons_printf(portid, 375 "%2d%c 0 0" 376 " - " 377 " LISTEN\n", 378 GET_TCP_CEPID(cep), 379 DYNAMIC_TCP_CEP(cep) ? 'D' : ' '); 380 } 381 else { 382 cons_printf(portid, 383 "%2d%c %5d %5d ", 384 GET_TCP_CEPID(cep), 385 DYNAMIC_TCP_CEP(cep) ? 'D' : ' ', 386 cep->swbuf_count, cep->rwbuf_count); 387 len = PUT_IPADDR(portid, &cep->dstaddr.ipaddr, 0); 388 cons_putchar(portid, '.'); 389 len += cons_putnumber(portid, cep->dstaddr.portno, 10, radhex, 0, false, ' '); 390 for (len = 42 - len; len -- > 0; ) 391 cons_putchar(portid, ' '); 392 if (cep->fsm_state == TCP_FSM_TIME_WAIT) 393 cons_printf(portid, " %s(%d)\n", tcp_fsm_str[cep->fsm_state], 394 cep->timer[TCP_TIM_2MSL] / TCP_SLOW_HZ); 395 else 396 cons_printf(portid, " %s\n", tcp_fsm_str[cep->fsm_state]); 397 } 398 399 #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 400 401 for (twcep = tcp_twcep; twcep < &tcp_twcep[NUM_TCP_TW_CEP_ENTRY]; twcep ++) { 402 if (twcep->fsm_state == TCP_FSM_CLOSED) { 403 cons_printf(portid, 404 "%2dTW 0 0" 405 " - " 406 " CLOSED\n", 407 GET_TCP_TWCEPID(twcep)); 408 } 409 else { 410 cons_printf(portid, "%2dTW 0 0 ", GET_TCP_TWCEPID(twcep)); 411 len = PUT_IPADDR(portid, &twcep->dstaddr.ipaddr, 0); 412 cons_putchar(portid, '.'); 413 len += cons_putnumber(portid, twcep->dstaddr.portno, 10, radhex, 0, false, ' '); 414 for (len = 42 - len; len -- > 0; ) 415 cons_putchar(portid, ' '); 416 if (twcep->fsm_state == TCP_FSM_TIME_WAIT) 417 cons_printf(portid, " %s(%d)\n", tcp_fsm_str[twcep->fsm_state], 418 twcep->timer_2msl / TCP_SLOW_HZ); 419 else 420 cons_printf(portid, " %s\n", tcp_fsm_str[twcep->fsm_state]); 421 } 422 } 423 424 #endif /* of #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 */ 425 426 #ifdef TCP_CFG_PASSIVE_OPEN 427 428 cons_printf(portid, 429 "TCP REP Status\n" 430 "ID Local Address CEP\n"); 431 for (rep = tcp_rep; rep < &tcp_rep[tmax_tcp_repid]; rep ++) { 432 cons_printf(portid, "%2d%c ", GET_TCP_REPID(rep), DYNAMIC_TCP_REP(rep) ? 'D' : ' '); 444 for (repid = TMIN_TCP6_REPID; repid <= tmax_tcp6_repid; repid ++) { 445 rep = GET_TCP6_REP(repid); 446 cons_printf(portid, "%2d%c ", GET_TCP6_REPID(rep), DYNAMIC_TCP_REP(rep) ? 'D' : ' '); 433 447 if (VALID_TCP_REP(rep)) { 434 448 len = PUT_IPADDR(portid, &rep->myaddr.ipaddr, 0); … … 439 453 cnt = 0; 440 454 for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++) { 441 if ( cep->rep == rep) {455 if (TCP_IS_CEP_IPV6(cep) && cep->rep == rep) { 442 456 if (cnt > 0) 443 457 cons_printf(portid, ",%d", GET_TCP_CEPID(cep)); … … 452 466 cons_putchar(portid, '\n'); 453 467 } 454 455 #endif /* of #ifdef TCP_CFG_PASSIVE_OPEN */ 456 457 SIG_NET_CONS_PRINTF(); 458 FLUSH_SND_BUFF(); 459 } 460 461 #endif /* of #if defined(SUPPORT_INET6) */ 462 463 #endif /* of #ifdef SUPPORT_TCP */ 464 465 #ifdef SUPPORT_UDP 466 467 /* 468 * udp_status -- UDP の状態の出力 469 */ 468 } 469 470 #endif /* of #if TNUM_TCP6_REPID > 0 */ 471 472 #if TNUM_TCP4_REPID > 0 470 473 471 474 static void 472 udp_status (ID portid, char *line) 473 { 474 T_UDP_CEP* cep; 475 tcp4_rep_status (ID portid, char *line) 476 { 477 T_TCP_CEP* cep; 478 T_TCP4_REP* rep; 479 ID repid; 480 int_t cnt; 475 481 uint_t len; 476 482 477 WAI_NET_CONS_PRINTF();478 483 cons_printf(portid, 479 "UDP CEP Status\n" 480 "ID Local Address\n"); 481 482 for (cep = udp_cep; cep < &udp_cep[tmax_udp_ccepid]; cep ++) { 483 cons_printf(portid, "%2d%c ", GET_UDP_CEPID(cep), DYNAMIC_UDP_CEP(cep) ? 'D' : ' '); 484 if (VALID_UDP_CEP(cep)) { 485 len = PUT_IPADDR(portid, &cep->myaddr.ipaddr, 0); 486 cons_putchar(portid, '.'); 487 len += cons_putnumber(portid, cep->myaddr.portno, 10, radhex, 0, false, ' '); 484 "TCP4 REP Status\n" 485 "ID Local Address CEP\n"); 486 for (repid = TMIN_TCP4_REPID; repid <= tmax_tcp4_repid; repid ++) { 487 rep = GET_TCP4_REP(repid); 488 cons_printf(portid, "%2d%c ", GET_TCP4_REPID(rep), DYNAMIC_TCP_REP(rep) ? 'D' : ' '); 489 if (VALID_TCP_REP(rep)) { 490 len = put_ipv4addr(portid, &rep->myaddr.ipaddr, 0); 491 cons_putchar(portid, ':'); 492 len += cons_putnumber(portid, rep->myaddr.portno, 10, radhex, 0, false, ' '); 493 for (len = 21 - len; len -- > 0; ) 494 cons_putchar(portid, ' '); 495 cnt = 0; 496 for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++) { 497 498 #if defined(SUPPORT_INET6) && defined(SUPPORT_INET4) 499 500 if (TCP_IS_CEP_IPV4(cep) && cep->rep4 == rep) { 501 502 #else /* of #if defined(SUPPORT_INET6) && defined(SUPPORT_INET4) */ 503 504 if (TCP_IS_CEP_IPV4(cep) && cep->rep == rep) { 505 506 #endif /* of #if defined(SUPPORT_INET6) && defined(SUPPORT_INET4) */ 507 508 if (cnt > 0) 509 cons_printf(portid, ",%d", GET_TCP_CEPID(cep)); 510 else 511 cons_printf(portid, "%d", GET_TCP_CEPID(cep)); 512 cnt ++; 513 } 514 } 488 515 } 489 516 else … … 491 518 cons_putchar(portid, '\n'); 492 519 } 520 } 521 522 #endif /* of #if TNUM_TCP4_REPID > 0 */ 523 524 static void 525 tcp_status (ID portid, char *line) 526 { 527 WAI_NET_CONS_PRINTF(); 528 529 tcp_cep_status(portid, line); 530 531 #if TNUM_TCP6_REPID > 0 532 tcp6_rep_status(portid, line); 533 #endif 534 535 #if TNUM_TCP4_REPID > 0 536 tcp4_rep_status(portid, line); 537 #endif 493 538 494 539 SIG_NET_CONS_PRINTF(); … … 496 541 } 497 542 498 #endif /* of #ifdef SUPPORT_UDP */ 499 500 #ifdef SUPPORT_ETHER 501 502 #if defined(SUPPORT_INET4) 543 #endif /* of #ifdef SUPPORT_TCP */ 544 545 #ifdef SUPPORT_UDP 503 546 504 547 /* 505 * ifa_status -- ARP キャッシュ出力 506 */ 548 * udp6_status -- UDP の状態の出力 549 */ 550 551 #if TNUM_UDP6_CEPID > 0 552 553 extern const ID tmax_tcp_cepid; 507 554 508 555 static void 509 ifa_status (ID portid, char *line) 510 { 511 const T_ARP_ENTRY *cache; 512 int_t ix; 513 556 udp6_status (ID portid, char *line) 557 { 558 T_UDP6_CEP* cep; 559 ID cepid; 560 uint_t len; 561 562 cons_printf(portid, 563 "UDP6 CEP Status\n" 564 "ID Local Address\n"); 565 566 for (cepid = TMIN_UDP6_CEPID; cepid <= tmax_udp6_cepid; cepid ++) { 567 cep = GET_UDP6_CEP(cepid); 568 cons_printf(portid, "%2d%c ", GET_UDP6_CEPID(cep), DYNAMIC_UDP_CEP(cep) ? 'D' : ' '); 569 if (VALID_UDP_CEP(cep)) { 570 len = put_ipv6addr(portid, &cep->myaddr.ipaddr, 0); 571 cons_putchar(portid, '.'); 572 len += cons_putnumber(portid, cep->myaddr.portno, 10, radhex, 0, false, ' '); 573 } 574 else 575 cons_printf(portid, "INVALID"); 576 cons_putchar(portid, '\n'); 577 } 578 579 SIG_NET_CONS_PRINTF(); 580 } 581 582 #endif /* of #if TNUM_UDP6_CEPID > 0 */ 583 584 /* 585 * udp4_status -- UDP の状態の出力 586 */ 587 588 #if TNUM_UDP4_CEPID > 0 589 590 static void 591 udp4_status (ID portid, char *line) 592 { 593 T_UDP4_CEP* cep; 594 ID cepid; 595 uint_t len; 596 597 cons_printf(portid, 598 "UDP4 CEP Status\n" 599 "ID Local Address\n"); 600 601 for (cepid = TMIN_UDP4_CEPID; cepid <= tmax_udp4_cepid; cepid ++) { 602 cep = GET_UDP4_CEP(cepid); 603 cons_printf(portid, "%2d%c ", GET_UDP4_CEPID(cep), DYNAMIC_UDP_CEP(cep) ? 'D' : ' '); 604 if (VALID_UDP_CEP(cep)) { 605 len = put_ipv4addr(portid, &cep->myaddr.ipaddr, 0); 606 cons_putchar(portid, '.'); 607 len += cons_putnumber(portid, cep->myaddr.portno, 10, radhex, 0, false, ' '); 608 } 609 else 610 cons_printf(portid, "INVALID"); 611 cons_putchar(portid, '\n'); 612 } 613 614 SIG_NET_CONS_PRINTF(); 615 } 616 617 #endif /* of #if TNUM_UDP4_CEPID > 0 */ 618 619 static void 620 udp_status (ID portid, char *line) 621 { 514 622 WAI_NET_CONS_PRINTF(); 515 cons_printf(portid, 516 "ARP Cache\n" 517 "IX Expire IP Address MAC Address\n"); 518 519 /* expire の単位は [ms]。*/ 520 cache = arp_get_cache(); 521 for (ix = 0; ix < NUM_ARP_ENTRY; ix ++) { 522 if (cache[ix].expire != 0) 523 cons_printf(portid, "%2d %6d %15I %M\n", 524 ix, cache[ix].expire / NET_TIMER_HZ, 525 &cache[ix].ip_addr, cache[ix].mac_addr); 526 } 623 624 #if TNUM_UDP6_CEPID > 0 625 udp6_status(portid, line); 626 #endif 627 628 #if TNUM_UDP4_CEPID > 0 629 udp4_status(portid, line); 630 #endif 527 631 528 632 SIG_NET_CONS_PRINTF(); … … 530 634 } 531 635 532 #endif /* of #if defined(SUPPORT_INET4) */ 636 #endif /* of #ifdef SUPPORT_UDP */ 637 638 #ifdef SUPPORT_ETHER 533 639 534 640 #if defined(SUPPORT_INET6) 535 641 536 642 /* 537 * ifa _status -- 近隣キャッシュ状態の出力643 * ifa6_status -- 近隣キャッシュ状態の出力 538 644 */ 539 645 … … 549 655 550 656 static void 551 ifa _status (ID portid, char *line)657 ifa6_status (ID portid, char *line) 552 658 { 553 659 const T_LLINFO_ND6 *cache; … … 565 671 for (ix = 0; ix < NUM_ND6_CACHE_ENTRY; ix ++) { 566 672 if (cache[ix].state != ND6_LLINFO_FREE) { 567 cons_printf(portid, "%2d %6 d %10s %M %I\n",673 cons_printf(portid, "%2d %6ld %10s %M %lI\n", 568 674 ix, 569 675 cache[ix].state == ND6_LLINFO_STALE || 570 (uint32_t)( cache[ix].expire - now) <= 0571 ? 0 : (cache[ix].expire - now) / SYSTIM_HZ,676 (uint32_t)((int32_t)(cache[ix].expire - now) <= 0 677 ? 0 : (int32_t)(cache[ix].expire - now) / SYSTIM_HZ), 572 678 nd_state_str[cache[ix].state], 573 679 &cache[ix].ifaddr, … … 581 687 582 688 #endif /* of #if defined(SUPPORT_INET6) */ 689 690 #if defined(SUPPORT_INET4) 691 692 /* 693 * ifa4_status -- ARP キャッシュ出力 694 */ 695 696 static void 697 ifa4_status (ID portid, char *line) 698 { 699 const T_ARP_ENTRY *cache; 700 int_t ix; 701 702 WAI_NET_CONS_PRINTF(); 703 cons_printf(portid, 704 "ARP Cache\n" 705 "IX Expire MAC Address IP Address\n"); 706 707 /* expire の単位は [ms]。*/ 708 cache = arp_get_cache(); 709 for (ix = 0; ix < NUM_ARP_ENTRY; ix ++) { 710 if (cache[ix].expire != 0) 711 cons_printf(portid, "%2d %6d %M %hI\n", 712 ix, cache[ix].expire / NET_TIMER_HZ, 713 cache[ix].mac_addr, &cache[ix].ip_addr); 714 } 715 716 SIG_NET_CONS_PRINTF(); 717 FLUSH_SND_BUFF(); 718 } 719 720 #endif /* of #if defined(SUPPORT_INET4) */ 583 721 584 722 #endif /* of #ifdef SUPPORT_ETHER */ … … 673 811 674 812 #endif /* of #ifdef SUPPORT_ETHER */ 813 814 #if defined(SUPPORT_INET6) 815 816 cons_printf(portid, "\nIPv6\n"); 817 cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ip6[NC_IP6_IN_OCTETS]); 818 cons_printf(portid, "\t受信データグラム数\t%lu\n", net_count_ip6[NC_IP6_IN_PACKETS]); 819 cons_printf(portid, "\t受信エラーデータグラム数\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_PACKETS]); 820 cons_printf(portid, "\t長さエラー数\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_SHORT]); 821 cons_printf(portid, "\tバージョンエラー数\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_VER]); 822 cons_printf(portid, "\tアドレスエラー数\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_ADDR]); 823 cons_printf(portid, "\tプロトコルエラー数\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_PROTO]); 824 cons_printf(portid, "\t分割受信数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN]); 825 cons_printf(portid, "\t分割受信フラグメント数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_FRAGS]); 826 cons_printf(portid, "\t分割受信再構成成功数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_OK]); 827 cons_printf(portid, "\t分割受信破棄数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_DROP]); 828 cons_printf(portid, "\t分割受信バッファり当て失敗数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_NO_BUF]); 829 cons_printf(portid, "\t分割受信タイムアウト数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_TMOUT]); 830 cons_printf(portid, "\t送信オクテット数\t%lu\n", net_count_ip6[NC_IP6_OUT_OCTETS]); 831 cons_printf(portid, "\t送信データグラム数\t%lu\n", net_count_ip6[NC_IP6_OUT_PACKETS]); 832 cons_printf(portid, "\t送信エラーデータグラム数\t%lu\n", net_count_ip6[NC_IP6_OUT_ERR_PACKETS]); 833 cons_printf(portid, "\t分割送信数\t%lu\n", net_count_ip6[NC_IP6_FRAG_OUT]); 834 cons_printf(portid, "\t分割送信フラグメント数\t%lu\n", net_count_ip6[NC_IP6_FRAG_OUT_FRAGS]); 835 836 cons_printf(portid, "\nICMPv6\n"); 837 cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_icmp6[NC_ICMP6_IN_OCTETS]); 838 cons_printf(portid, "\t受信パケット数\t%lu\n", net_count_icmp6[NC_ICMP6_IN_PACKETS]); 839 cons_printf(portid, "\t受信エラーパケット数\t%lu\n", net_count_icmp6[NC_ICMP6_IN_ERR_PACKETS]); 840 cons_printf(portid, "\t受信チックサムエラー数\t%lu\n", net_count_icmp6[NC_ICMP6_IN_ERR_CKSUM]); 841 cons_printf(portid, "\t送信オクテット数\t%lu\n", net_count_icmp6[NC_ICMP6_OUT_OCTETS]); 842 cons_printf(portid, "\t送信パケット数\t%lu\n", net_count_icmp6[NC_ICMP6_OUT_PACKETS]); 843 cons_printf(portid, "\t送信エラーパケット数\t%lu\n", net_count_icmp6[NC_ICMP6_OUT_ERR_PACKETS]); 844 845 cons_printf(portid, "\n近隣探索\n"); 846 cons_printf(portid, "\tルータ通知受信数\t%lu\n", net_count_nd6[NC_ND6_RA_IN_PACKETS]); 847 cons_printf(portid, "\tルータ要請送信数\t%lu\n", net_count_nd6[NC_ND6_RS_OUT_PACKETS]); 848 cons_printf(portid, "\t近隣通知受信数\t%lu\n", net_count_nd6[NC_ND6_NA_IN_PACKETS]); 849 cons_printf(portid, "\t近隣通知送信数\t%lu\n", net_count_nd6[NC_ND6_NA_OUT_PACKETS]); 850 cons_printf(portid, "\t近隣要請受信数\t%lu\n", net_count_nd6[NC_ND6_NS_IN_PACKETS]); 851 cons_printf(portid, "\t近隣要請送信数\t%lu\n", net_count_nd6[NC_ND6_NS_OUT_PACKETS]); 852 cons_printf(portid, "\t重複アドレス検出送信数\t%lu\n", net_count_nd6[NC_ND6_DAD_OUT_PACKETS]); 853 854 #else /* of #if defined(SUPPORT_INET6) */ 675 855 676 856 #if defined(SUPPORT_INET4) … … 707 887 708 888 #endif /* of #if defined(SUPPORT_INET4) */ 709 710 #if defined(SUPPORT_INET6)711 712 cons_printf(portid, "\nIPv6\n");713 cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ip6[NC_IP6_IN_OCTETS]);714 cons_printf(portid, "\t受信データグラム数\t%lu\n", net_count_ip6[NC_IP6_IN_PACKETS]);715 cons_printf(portid, "\t受信エラーデータグラム数\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_PACKETS]);716 cons_printf(portid, "\t長さエラー数\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_SHORT]);717 cons_printf(portid, "\tバージョンエラー数\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_VER]);718 cons_printf(portid, "\tアドレスエラー数\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_ADDR]);719 cons_printf(portid, "\tプロトコルエラー数\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_PROTO]);720 cons_printf(portid, "\t分割受信数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN]);721 cons_printf(portid, "\t分割受信フラグメント数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_FRAGS]);722 cons_printf(portid, "\t分割受信再構成成功数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_OK]);723 cons_printf(portid, "\t分割受信破棄数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_DROP]);724 cons_printf(portid, "\t分割受信バッファり当て失敗数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_NO_BUF]);725 cons_printf(portid, "\t分割受信タイムアウト数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_TMOUT]);726 cons_printf(portid, "\t送信オクテット数\t%lu\n", net_count_ip6[NC_IP6_OUT_OCTETS]);727 cons_printf(portid, "\t送信データグラム数\t%lu\n", net_count_ip6[NC_IP6_OUT_PACKETS]);728 cons_printf(portid, "\t送信エラーデータグラム数\t%lu\n", net_count_ip6[NC_IP6_OUT_ERR_PACKETS]);729 cons_printf(portid, "\t分割送信数\t%lu\n", net_count_ip6[NC_IP6_FRAG_OUT]);730 cons_printf(portid, "\t分割送信フラグメント数\t%lu\n", net_count_ip6[NC_IP6_FRAG_OUT_FRAGS]);731 732 cons_printf(portid, "\nICMPv6\n");733 cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_icmp6[NC_ICMP6_IN_OCTETS]);734 cons_printf(portid, "\t受信パケット数\t%lu\n", net_count_icmp6[NC_ICMP6_IN_PACKETS]);735 cons_printf(portid, "\t受信エラーパケット数\t%lu\n", net_count_icmp6[NC_ICMP6_IN_ERR_PACKETS]);736 cons_printf(portid, "\t受信チックサムエラー数\t%lu\n", net_count_icmp6[NC_ICMP6_IN_ERR_CKSUM]);737 cons_printf(portid, "\t送信オクテット数\t%lu\n", net_count_icmp6[NC_ICMP6_OUT_OCTETS]);738 cons_printf(portid, "\t送信パケット数\t%lu\n", net_count_icmp6[NC_ICMP6_OUT_PACKETS]);739 cons_printf(portid, "\t送信エラーパケット数\t%lu\n", net_count_icmp6[NC_ICMP6_OUT_ERR_PACKETS]);740 741 cons_printf(portid, "\n近隣探索\n");742 cons_printf(portid, "\tルータ通知受信数\t%lu\n", net_count_nd6[NC_ND6_RA_IN_PACKETS]);743 cons_printf(portid, "\tルータ要請送信数\t%lu\n", net_count_nd6[NC_ND6_RS_OUT_PACKETS]);744 cons_printf(portid, "\t近隣通知受信数\t%lu\n", net_count_nd6[NC_ND6_NA_IN_PACKETS]);745 cons_printf(portid, "\t近隣通知送信数\t%lu\n", net_count_nd6[NC_ND6_NA_OUT_PACKETS]);746 cons_printf(portid, "\t近隣要請受信数\t%lu\n", net_count_nd6[NC_ND6_NS_IN_PACKETS]);747 cons_printf(portid, "\t近隣要請送信数\t%lu\n", net_count_nd6[NC_ND6_NS_OUT_PACKETS]);748 cons_printf(portid, "\t重複アドレス検出送信数\t%lu\n", net_count_nd6[NC_ND6_DAD_OUT_PACKETS]);749 889 750 890 #endif /* of #if defined(SUPPORT_INET6) */ … … 787 927 788 928 tbl = nbuf_get_tbl(); 789 cons_printf(portid, "\nネットワークバッファ\n\tサイズ\t用意数\t 割当要求数\t割当数\t割当てエラー数\n");929 cons_printf(portid, "\nネットワークバッファ\n\tサイズ\t用意数\t使用中数\t割当要求数\t割当数\t割当てエラー数\n"); 790 930 for (ix = nbuf_get_tbl_size(); ix -- > 0; ) { 791 cons_printf(portid, "\t%lu\t%lu\t%lu\t%lu\t%lu\ n",931 cons_printf(portid, "\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\n", 792 932 tbl[ix].size, 793 933 tbl[ix].prepares, 934 tbl[ix].busies, 794 935 tbl[ix].requests, 795 936 tbl[ix].allocs, … … 833 974 for (ix = nbuf_get_tbl_size(); ix -- > 0; ) 834 975 cons_printf(portid, "\t%d", tbl[ix].size); 835 cons_p rintf(portid, "\n");976 cons_putchar(portid, '\n'); 836 977 837 978 queue = ip_get_frag_queue(); … … 846 987 cons_printf(portid, "\t%d", count); 847 988 } 848 cons_p rintf(portid, "\n");989 cons_putchar(portid, '\n'); 849 990 } 850 991 } … … 874 1015 for (ix = nbuf_get_tbl_size(); ix -- > 0; ) 875 1016 cons_printf(portid, "\t%d", tbl[ix].size); 876 cons_p rintf(portid, "\n");1017 cons_putchar(portid, '\n'); 877 1018 878 1019 queue = ip6_get_frag_queue(); … … 887 1028 cons_printf(portid, "\t%d", count); 888 1029 } 889 cons_p rintf(portid, "\n");1030 cons_putchar(portid, '\n'); 890 1031 } 891 1032 } … … 918 1059 919 1060 #ifdef TCP_CFG_SWBUF_CSAVE 920 T_IP_HDR* iph;921 1061 T_TCP_HDR* tcph; 922 1062 #endif /* of #ifdef TCP_CFG_SWBUF_CSAVE */ … … 925 1065 WAI_NET_CONS_PRINTF(); 926 1066 get_tim(&now); 927 cons_printf(portid, "ネットワークバッファ情報\t経過時間[ms]\t% lu\n", now);1067 cons_printf(portid, "ネットワークバッファ情報\t経過時間[ms]\t%u\n", now); 928 1068 929 1069 #if NET_COUNT_ENABLE 930 1070 931 cons_printf(portid, "\nネットワークバッファ\n\tサイズ\t用意数\t 割当要求数\t割当数\t割当てエラー数\n");1071 cons_printf(portid, "\nネットワークバッファ\n\tサイズ\t用意数\t使用中数\t割当要求数\t割当数\t割当てエラー数\n"); 932 1072 tbl = nbuf_get_tbl(); 933 1073 for (ix = nbuf_get_tbl_size(); ix -- > 0; ) { 934 cons_printf(portid, "\t% lu\t%lu\t%lu\t%lu\t%lu\n",1074 cons_printf(portid, "\t%u\t%u\t%u\t%u\t%u\t%u\n", 935 1075 tbl[ix].size, 936 1076 tbl[ix].prepares, 1077 tbl[ix].busies, 937 1078 tbl[ix].requests, 938 1079 tbl[ix].allocs, … … 949 1090 cons_printf(portid, "%2d", GET_TCP_CEPID(cep)); 950 1091 for (nbuf = cep->reassq; nbuf != NULL; nbuf = tqhdr->next) { 951 tqhdr = GET_TCP_Q_HDR(nbuf, GET_TCP_ IP_Q_HDR(nbuf)->thoff);952 cons_printf(portid, "[a:%6 d-%6d] ",1092 tqhdr = GET_TCP_Q_HDR(nbuf, GET_TCP_HDR_OFFSET(nbuf)); 1093 cons_printf(portid, "[a:%6lu-%6lu] ", 953 1094 ntohl(tqhdr->seq) - cep->irs + tqhdr->soff, 954 1095 ntohl(tqhdr->seq) - cep->irs + tqhdr->soff + tqhdr->slen); … … 957 1098 #ifdef TCP_CFG_RWBUF_CSAVE 958 1099 for (nbuf = cep->rwbufq; nbuf != NULL; nbuf = tqhdr->next) { 959 tqhdr = GET_TCP_Q_HDR(nbuf, GET_TCP_ IP_Q_HDR(nbuf)->thoff);960 cons_printf(portid, "[r:%6 d-%6d] ",1100 tqhdr = GET_TCP_Q_HDR(nbuf, GET_TCP_HDR_OFFSET(nbuf)); 1101 cons_printf(portid, "[r:%6lu-%6lu] ", 961 1102 ntohl(tqhdr->seq) - cep->irs + tqhdr->soff, 962 1103 ntohl(tqhdr->seq) - cep->irs + tqhdr->soff + tqhdr->slen); … … 966 1107 #ifdef TCP_CFG_SWBUF_CSAVE 967 1108 if (cep->swbufq != NULL) { 968 iph = GET_IP_HDR(cep->swbufq);969 1109 tcph = GET_TCP_HDR(cep->swbufq, GET_TCP_HDR_OFFSET(cep->swbufq)); 970 cons_printf(portid, "[s:%6d-%6d] ", 1110 #if 0 1111 cons_printf(portid, "[s:%6lu-%6lu] ", 971 1112 ntohl(tcph->seq) - cep->iss, 972 ntohl(tcph->seq) - cep->iss + (GET_IP_SDU_SIZE(iph) - 973 GET_TCP_HDR_SIZE2(cep->swbufq, GET_TCP_HDR_OFFSET(cep->swbufq)))); 1113 ntohl(tcph->seq) - cep->iss + (GET_IP_SDU_SIZE(cep->swbufq) - 1114 GET_TCP_HDR_SIZE(cep->swbufq, GET_TCP_HDR_OFFSET(cep->swbufq)))); 1115 #else 1116 cons_printf(portid, "[s:%6lu-%6lu,%08x,%08x] ", 1117 ntohl(tcph->seq) - cep->iss, 1118 ntohl(tcph->seq) - cep->iss + (GET_IP_SDU_SIZE(cep->swbufq) - 1119 GET_TCP_HDR_SIZE(cep->swbufq, GET_TCP_HDR_OFFSET(cep->swbufq))), 1120 ntohl(tcph->seq), cep->iss); 1121 #endif 974 1122 } 975 1123 #endif /* of #ifdef TCP_CFG_SWBUF_CSAVE */ 976 1124 977 cons_p rintf(portid, "\n");1125 cons_putchar(portid, '\n'); 978 1126 } 979 1127 … … 1008 1156 } 1009 1157 1158 #ifdef USE_RESOLVER 1159 1160 /* 1161 * show_dns_soa -- DNS の SOA RDATA を表示する。 1162 */ 1163 1164 static ER_UINT 1165 show_dns_soa (ID portid, uint8_t *msg, ER_UINT length, uint_t offset) 1166 { 1167 T_RSLV_SOA soa; 1168 ER_UINT error; 1169 uint_t rn_offset; 1170 1171 if ((error = dns_analyze_soa(&soa, offset, msg, length)) < 0) 1172 return error; 1173 1174 cons_printf(portid, " mname: "); 1175 rn_offset = show_dns_domain_name(portid, msg, offset); 1176 cons_putchar(portid, '\n'); 1177 cons_printf(portid, " rname: "); 1178 show_dns_domain_name(portid, msg, rn_offset); 1179 cons_putchar(portid, '\n'); 1180 1181 cons_printf(portid, " serial: %d\n", soa.serial); 1182 cons_printf(portid, " refresh: %d\n", soa.refresh); 1183 cons_printf(portid, " retry: %d\n", soa.retry); 1184 cons_printf(portid, " expirel: %d\n", soa.expire); 1185 cons_printf(portid, " minimum: %d\n", soa.minimum); 1186 1187 return E_OK; 1188 } 1189 1190 /* 1191 * show_dns_qdsection -- DNS の Question セクションを表示する。 1192 */ 1193 1194 static ER_UINT 1195 show_dns_qdsection (ID portid, uint8_t *msg, ER_UINT length, T_RSLV_DNS_MSG *rslv) 1196 { 1197 T_RSLV_QD qd; 1198 ER_UINT offset, error; 1199 int scount; 1200 1201 cons_printf(portid, "question section: %d\n", rslv->dns_hdr.qdcount); 1202 offset = rslv->qd_offset; 1203 for (scount = 1; scount <= rslv->dns_hdr.qdcount; scount ++) { 1204 if ((error = dns_analyze_qd(&qd, offset, msg, length)) < 0) 1205 return error; 1206 1207 cons_printf(portid, "%2d: ", scount); 1208 show_dns_domain_name(portid, msg, offset); 1209 cons_printf(portid, "\n type: %-4s, class: %2s\n", dns_strtype(qd.type), dns_strclass(qd.class)); 1210 offset = error; 1211 } 1212 1213 return E_OK; 1214 } 1215 1216 /* 1217 * show_dns_section -- DNS の各セクションを表示する。 1218 */ 1219 1220 static ER_UINT 1221 show_dns_section (ID portid, uint8_t *msg, ER_UINT length, uint_t scount, uint_t offset, char *title) 1222 { 1223 T_RSLV_RR rr; 1224 T_IN4_ADDR in4_addr; 1225 ER_UINT error; 1226 int count, dcount, col; 1227 T_IN6_ADDR in6_addr; 1228 1229 cons_printf(portid, "%10s section: %d\n", title, scount); 1230 for (count = 1; count <= scount; count ++) { 1231 if ((error = dns_analyze_rr(&rr, offset, msg, length)) < 0) 1232 return error; 1233 1234 cons_printf(portid, "%2d: ", count); 1235 show_dns_domain_name(portid, msg, offset); 1236 cons_printf(portid, "\n type: %-4s, class: %2s, TTL: %2d, len: %3d, offset: 0x%02x\n", 1237 dns_strtype(rr.type), dns_strclass(rr.class), rr.ttl, rr.rdlength, rr.rdata_offset); 1238 1239 switch (rr.type) { 1240 case DNS_TYPE_A: 1241 memcpy((void*)&in4_addr, (void*)(msg + rr.rdata_offset), sizeof(in4_addr)); 1242 in4_addr = ntohl(in4_addr); 1243 cons_printf(portid, " IPv4 addr: %hI\n", &in4_addr); 1244 break; 1245 case DNS_TYPE_NS: 1246 cons_printf(portid, " host: "); 1247 show_dns_domain_name(portid, msg, rr.rdata_offset); 1248 cons_putchar(portid, '\n'); 1249 break; 1250 case DNS_TYPE_CNAME: 1251 cons_printf(portid, " host: "); 1252 show_dns_domain_name(portid, msg, rr.rdata_offset); 1253 cons_putchar(portid, '\n'); 1254 break; 1255 case DNS_TYPE_SOA: 1256 show_dns_soa(portid, msg, length, rr.rdata_offset); 1257 break; 1258 case DNS_TYPE_PTR: 1259 cons_printf(portid, " PTR: "); 1260 show_dns_domain_name(portid, msg, rr.rdata_offset); 1261 cons_putchar(portid, '\n'); 1262 break; 1263 case DNS_TYPE_AAAA: 1264 memcpy((void*)&in6_addr, (void*)(msg + rr.rdata_offset), sizeof(in6_addr)); 1265 cons_printf(portid, " IPv6 addr: %lI\n", &in6_addr); 1266 break; 1267 default: 1268 cons_printf(portid, " data: "); 1269 col = 32; 1270 for (dcount = 0; dcount < rr.rdlength; dcount ++) { 1271 cons_printf(portid, "%02x", *(msg + rr.rdata_offset + dcount)); 1272 if (-- col == 0) { 1273 cons_printf(portid, "\n "); 1274 col = 32; 1275 } 1276 } 1277 cons_putchar(portid, '\n'); 1278 break; 1279 } 1280 } 1281 1282 return E_OK; 1283 } 1284 /* 1285 * dns_info -- DNS 情報の表示 1286 */ 1287 1288 static void 1289 dns_info (ID portid) 1290 { 1291 #if defined(SUPPORT_INET6) 1292 T_IN6_ADDR in6_addr; 1293 #endif 1010 1294 #if defined(SUPPORT_INET4) 1011 1012 #if NUM_ROUTE_ENTRY > 0 1295 T_IN4_ADDR in4_addr; 1296 #endif 1297 1298 #if defined(SUPPORT_INET6) 1299 1300 cons_printf(portid, "domain name: %s\n", dns_in6_get_dname()); 1301 1302 #else /* of #if defined(SUPPORT_INET6) */ 1303 1304 cons_printf(portid, "domain name: %s\n", dns_in4_get_dname()); 1305 1306 #endif /* of #if defined(SUPPORT_INET6) */ 1307 1308 #if defined(SUPPORT_INET6) 1309 dns_in6_get_addr(&in6_addr); 1310 cons_printf(portid, "IPv6 DNS server: "); 1311 if (IN6_IS_ADDR_UNSPECIFIED(&in6_addr)) 1312 cons_printf(portid, "not available.\n"); 1313 else 1314 cons_printf(portid, "%lI.\n", &in6_addr); 1315 #endif /* of #if defined(SUPPORT_INET6) */ 1316 1317 #if defined(SUPPORT_INET4) 1318 dns_in4_get_addr(&in4_addr); 1319 cons_printf(portid, "IPv4 DNS server: "); 1320 if (in4_addr == IPV4_ADDRANY) 1321 cons_printf(portid, "not available.\n"); 1322 else 1323 cons_printf(portid, "%hI.\n", &in4_addr); 1324 #endif /* of #if defined(SUPPORT_INET4) */ 1325 } 1013 1326 1014 1327 /* 1015 * routing_table_status -- 経路表の出力 1016 */ 1328 * name_lookup -- ホスト名-IP アドレス変換 1329 */ 1330 1331 const char *rcode_str[] = { 1332 "no error", 1333 "format error", 1334 "server error", 1335 "name error", 1336 "not implement", 1337 "refused", 1338 }; 1017 1339 1018 1340 static void 1019 routing_table_status (ID portid, char *line) 1020 { 1021 int_t ix; 1022 1023 if ('0' <= *(line = skip_blanks(line)) && *line <= '9') { 1024 T_IN4_ADDR target, mask, gateway; 1025 1026 ix = atoi(line); 1027 while ('0' <= *line && *line <= '9') 1028 line ++; 1029 line = GET_IPADDR(&target, skip_blanks(line)); 1030 line = GET_IPADDR(&mask, skip_blanks(line)); 1031 GET_IPADDR(&gateway, skip_blanks(line)); 1032 in4_add_route(ix, target, mask, gateway); 1033 } 1034 1341 name_lookup (ID portid, char *line) 1342 { 1343 static char hostname[DBG_LINE_SIZE + 1]; 1344 1345 T_RSLV_DNS_MSG rslv; 1346 ER_UINT length, offset; 1347 ER error; 1348 uint_t flags = 0; 1349 uint8_t *msg; 1350 1351 /* コマンドのオプションを設定する。*/ 1352 line = skip_blanks(resolv_options(&flags, line, DEFAULT_API_PROTO)); 1353 if ((flags & (DNS_LUP_FLAGS_PROTO_IPV6 | DNS_LUP_FLAGS_PROTO_IPV4)) == 0) { 1354 cons_printf(portid, "DNS server not available.\n"); 1355 return; 1356 } 1357 1358 /* 照会するホスト名・IP アドレスを解析する。*/ 1359 resolv_hoststr(&flags, hostname, sizeof(hostname), line); 1360 1361 /* 正引きでも逆引きでもプロトコル上は正引きを指定する。*/ 1362 flags |= DNS_LUP_OPCODE_FORWARD; 1363 1364 /* IPv6 アドレス、または IPv4 アドレスが指定された時は、照会タイプは PTR に設定する。*/ 1365 if (((flags & DNS_LUP_FLAGS_NAME_MASK) == DNS_LUP_FLAGS_NAME_IPV6) || 1366 ((flags & DNS_LUP_FLAGS_NAME_MASK) == DNS_LUP_FLAGS_NAME_IPV4)) 1367 flags = (flags & ~DNS_LUP_FLAGS_QTYPE_MASK) | DNS_LUP_FLAGS_QTYPE_PTR; 1368 1369 if ((error = tget_mpf(MPF_RSLV_SRBUF, (void*)&msg, TMO_FEVR)) != E_OK) { 1370 cons_printf(portid, "get buffer error: %s.\n", itron_strerror(error)); 1371 return; 1372 } 1373 1374 if ((length = dns_lookup_host(flags | DNS_LUP_FLAGS_MSG, line, msg, DNS_UDP_MSG_LENGTH, &rslv)) < 0) { 1375 //cons_printf(portid, "error: %s.\n", itron_strerror(length)); 1376 goto err_ret; 1377 } 1378 1379 dly_tsk(1 * 1000); 1380 cons_printf(portid, "DNS header: flags: "); 1381 if (rslv.dns_hdr.code & (DNS_QR_RESPONSE | DNS_AUTHORITATIVE | 1382 DNS_TRUN_CATION | DNS_RECURSION_DESIRED | DNS_RECURSION_AVAILABLE)) { 1383 cons_printf(portid, (rslv.dns_hdr.code & DNS_QR_RESPONSE) ? "QR," : ""); 1384 cons_printf(portid, (rslv.dns_hdr.code & DNS_AUTHORITATIVE) ? "AA," : ""); 1385 cons_printf(portid, (rslv.dns_hdr.code & DNS_TRUN_CATION) ? "TC," : ""); 1386 cons_printf(portid, (rslv.dns_hdr.code & DNS_RECURSION_DESIRED) ? "RD," : ""); 1387 cons_printf(portid, (rslv.dns_hdr.code & DNS_RECURSION_AVAILABLE) ? "RA," : ""); 1388 cons_printf(portid, " "); 1389 } 1390 cons_printf(portid, "opcode: "); 1391 cons_printf(portid, (rslv.dns_hdr.code & DNS_OPCODE_REVERSE) ? "RV" : "FW"); 1392 cons_printf(portid, (rslv.dns_hdr.code & DNS_OPCODE_STATUS) ? ",ST" : ""); 1393 cons_printf(portid, ", rcode: %s.\n", 1394 (rslv.dns_hdr.code & DNS_RCODE_MASK) > DNS_RCODE_REFUSED 1395 ? "6" : rcode_str[rslv.dns_hdr.code & DNS_RCODE_MASK]); 1396 1397 if ((offset = show_dns_qdsection(portid, msg, length, &rslv)) < 0) { 1398 cons_printf(portid, "msg error: %s.\n", itron_strerror(offset)); 1399 } 1400 if ((offset = show_dns_section(portid, msg, length, rslv.dns_hdr.ancount, rslv.an_offset, "answer")) < 0) { 1401 cons_printf(portid, "msg error: %s.\n", itron_strerror(offset)); 1402 } 1403 if ((offset = show_dns_section(portid, msg, length, rslv.dns_hdr.nscount, rslv.ns_offset, "authority")) < 0) { 1404 cons_printf(portid, "msg error: %s.\n", itron_strerror(offset)); 1405 } 1406 if ((offset = show_dns_section(portid, msg, length, rslv.dns_hdr.arcount, rslv.ar_offset, "additional")) < 0) { 1407 cons_printf(portid, "msg error: %s.\n", itron_strerror(offset)); 1408 } 1409 1410 err_ret: 1411 if ((error = rel_mpf(MPF_RSLV_SRBUF, msg)) != E_OK) 1412 cons_printf(portid, "release buffer error: %s.\n", itron_strerror(error)); 1413 return; 1414 } 1415 1416 #endif /* of #ifdef USE_RESOLVER */ 1417 1418 #if defined(DHCP6_CLI_CFG) 1419 1420 /* 1421 * dhcp6c_info -- DHCPv6 クライアント情報の表示 1422 */ 1423 1424 static void 1425 dhcp6c_info (ID portid) 1426 { 1427 T_IN6_ADDR svaddr; 1428 SYSTIM bind_start; 1429 ER error; 1430 uint32_t expire, renew, rebind, deprefer; 1431 1432 if ((error = dhcp6c_get_info(&svaddr, &expire, &renew, &rebind, &deprefer, &bind_start)) == E_OK) { 1433 cons_printf(portid, " DHCPv6 server: %lI.\n", &svaddr); 1434 1435 #if DHCP6_CLI_CFG_MODE == DHCP6_CLI_CFG_STATELESS 1436 1437 cons_printf(portid, " DHCPv6 mode: stateless.\n"); 1438 1439 #elif DHCP6_CLI_CFG_MODE == DHCP6_CLI_CFG_STATEFULL 1440 1441 cons_printf(portid, " DHCPv6 mode: statefull,\n"); 1442 cons_printf(portid, " Renew: %u:%02u:%02u, Deprefer: %u:%02u:%02u,\n", 1443 renew / 3600, ( renew / 60) % 60, renew % 60, 1444 deprefer / 3600, (deprefer / 60) % 60, deprefer % 60); 1445 cons_printf(portid, " Rebind: %u:%02u:%02u, Expire: %u:%02u:%02u.\n", 1446 rebind / 3600, ( rebind / 60) % 60, rebind % 60, 1447 expire / 3600, ( expire / 60) % 60, expire % 60); 1448 1449 #else /* of #if DHCP6_CLI_CFG_MODE == DHCP6_CLI_CFG_STATELESS */ 1450 1451 #endif /* of #if DHCP6_CLI_CFG_MODE == DHCP6_CLI_CFG_STATELESS */ 1452 1453 } 1454 else if (error == E_OBJ) 1455 cons_printf(portid, " DHCPv6 server: not available.\n"); 1456 } 1457 1458 #endif /* of #if defined(DHCP6_CLI_CFG) */ 1459 1460 #if defined(DHCP4_CLI_CFG) 1461 1462 /* 1463 * dhcp4c_info -- DHCPv4 クライアント情報の表示 1464 */ 1465 1466 static void 1467 dhcp4c_info (ID portid) 1468 { 1469 T_IN4_ADDR svaddr; 1470 SYSTIM bind_start; 1471 ER error; 1472 uint32_t expire, renew, rebind; 1473 1474 if ((error = dhcp4c_get_info(&svaddr, &expire, &renew, &rebind, &bind_start)) == E_OK) { 1475 cons_printf(portid, " DHCPv4 server: %hI,\n", &svaddr); 1476 cons_printf(portid, " Renew: %u:%02u:%02u,\n", 1477 renew / 3600, (renew / 60) % 60, renew % 60); 1478 cons_printf(portid, " Rebind: %u:%02u:%02u, Expire: %u:%02u:%02u.\n", 1479 rebind / 3600, (rebind / 60) % 60, rebind % 60, 1480 expire / 3600, (expire / 60) % 60, expire % 60); 1481 } 1482 else if (error == E_OBJ) 1483 cons_printf(portid, " DHCPv4 server: not available.\n"); 1484 } 1485 1486 #endif /* of #if defined(DHCP4_CLI_CFG) */ 1487 1488 #if defined(DHCP6_CLI_CFG) || defined(DHCP4_CLI_CFG) 1489 1490 /* 1491 * dhcpc -- DHCP クライアント情報の表示と制御 1492 */ 1493 1494 static void 1495 dhcpc (ID portid, char *line) 1496 { 1035 1497 WAI_NET_CONS_PRINTF(); 1036 cons_printf(portid, 1037 "Routing Table Status\n" 1038 "IX Target Mask Gateway Expire\n"); 1039 1040 for (ix = 0; ix < NUM_ROUTE_ENTRY; ix ++) { 1041 if ((routing_tbl[ix].flags & IN_RTF_DEFINED) == 0) 1042 ; 1043 else if ((routing_tbl[ix].flags & IN_RTF_REDIRECT) != 0) 1044 cons_printf(portid, "%2d %15I %15I %15I %4d\n", 1045 ix, 1046 &routing_tbl[ix].target, 1047 &routing_tbl[ix].mask, 1048 &routing_tbl[ix].gateway, 1049 &routing_tbl[ix].expire); 1050 else 1051 cons_printf(portid, "%2d %15I %15I %I\n", 1052 ix, 1053 &routing_tbl[ix].target, 1054 &routing_tbl[ix].mask, 1055 &routing_tbl[ix].gateway); 1056 1498 1499 switch (*line) { 1500 1501 #if defined(DHCP6_CLI_CFG) 1502 case '6': /* DHCPv6 の制御 */ 1503 switch (*(line + 1)) { 1504 case 'r': /* アドレス情報を解放する。*/ 1505 dhcp6c_rel_info(); 1506 break; 1507 1508 case 'n': /* アドレス情報を再取得する。*/ 1509 dhcp6c_renew_info(); 1510 break; 1511 1512 default: 1513 dhcp6c_info(portid); 1514 break; 1515 } 1516 break; 1517 #endif /* of #if defined(DHCP6_CLI_CFG) */ 1518 1519 #if defined(DHCP4_CLI_CFG) 1520 case '4': /* DHCPv4 の制御 */ 1521 switch (*(line + 1)) { 1522 case 'r': /* アドレス情報を解放する。*/ 1523 dhcp4c_rel_info(); 1524 break; 1525 1526 case 'n': /* アドレス情報を再取得する。*/ 1527 dhcp4c_renew_info(); 1528 break; 1529 1530 default: 1531 dhcp4c_info(portid); 1532 break; 1533 } 1534 break; 1535 #endif /* of #if defined(DHCP4_CLI_CFG) */ 1536 1537 default: 1538 1539 #if defined(DHCP6_CLI_CFG) 1540 dhcp6c_info(portid); 1541 #endif 1542 1543 #if defined(DHCP4_CLI_CFG) 1544 dhcp4c_info(portid); 1545 #endif 1546 break; 1057 1547 } 1058 1548 … … 1061 1551 } 1062 1552 1063 #endif /* of #if NUM_ROUTE_ENTRY > 0 */ 1064 1065 #endif /* of #if defined(SUPPORT_INET4) */ 1553 #endif /* of #if defined(DHCP6_CLI_CFG) || defined(DHCP4_CLI_CFG) */ 1066 1554 1067 1555 #if defined(SUPPORT_INET6) … … 1124 1612 while (ptitle -- > 0) 1125 1613 cons_printf(portid, " "); 1126 cons_printf(portid, " % I\n", &dr[rix].addr);1614 cons_printf(portid, " %lI\n", &dr[rix].addr); 1127 1615 } 1128 1616 } … … 1188 1676 while (rtitle -- > 0) 1189 1677 cons_printf(portid, " "); 1190 cons_printf(portid, "%4d % I\n", pr[pix].prefix_len, &pr[pix].prefix);1678 cons_printf(portid, "%4d %lI\n", pr[pix].prefix_len, &pr[pix].prefix); 1191 1679 } 1192 1680 } … … 1198 1686 #endif /* of #if NUM_ND6_DEF_RTR_ENTRY > 0 */ 1199 1687 1200 #if NUM_ ROUTE_ENTRY > 01688 #if NUM_IN6_ROUTE_ENTRY > 0 1201 1689 1202 1690 /* 1203 * routing _table_status -- 経路表の出力1691 * routing6_table_status -- 経路表(IPv6)の出力 1204 1692 */ 1205 1693 1206 1694 static void 1207 routing _table_status (ID portid, char *line)1695 routing6_table_status (ID portid, char *line) 1208 1696 { 1209 1697 SYSTIM now; … … 1212 1700 WAI_NET_CONS_PRINTF(); 1213 1701 cons_printf(portid, 1214 " Routing Table Status\n"1702 "\nRouting Table Status (IPv6)\n" 1215 1703 "IX Expire flags Prefix Target Gateway\n"); 1216 1704 1217 for (ix = 0; ix < NUM_ STATIC_ROUTE_ENTRY; ix ++) {1218 cons_printf(portid, "%2d STATIC - %6d %30 I %I\n",1705 for (ix = 0; ix < NUM_IN6_STATIC_ROUTE_ENTRY; ix ++) { 1706 cons_printf(portid, "%2d STATIC - %6d %30lI %lI\n", 1219 1707 ix, 1220 routing _tbl[ix].prefix_len,1221 &routing _tbl[ix].target,1222 &routing _tbl[ix].gateway);1708 routing6_tbl[ix].prefix_len, 1709 &routing6_tbl[ix].target, 1710 &routing6_tbl[ix].gateway); 1223 1711 1224 1712 } … … 1228 1716 now /= SYSTIM_HZ; 1229 1717 1230 for ( ; ix < NUM_ ROUTE_ENTRY; ix ++)1231 if (routing _tbl[ix].flags & IN_RTF_DEFINED)1232 cons_printf(portid, "%2d %6d %02x %6d %30 I %I\n",1718 for ( ; ix < NUM_IN6_ROUTE_ENTRY; ix ++) 1719 if (routing6_tbl[ix].flags & IN_RTF_DEFINED) 1720 cons_printf(portid, "%2d %6d %02x %6d %30lI %lI\n", 1233 1721 ix, 1234 (uint32_t)(routing _tbl[ix].expire - now) <= 01235 ? 0 : routing _tbl[ix].expire - now,1236 routing _tbl[ix].flags,1237 routing _tbl[ix].prefix_len,1238 &routing _tbl[ix].target,1239 &routing _tbl[ix].gateway);1722 (uint32_t)(routing6_tbl[ix].expire - now) <= 0 1723 ? 0 : routing6_tbl[ix].expire - now, 1724 routing6_tbl[ix].flags, 1725 routing6_tbl[ix].prefix_len, 1726 &routing6_tbl[ix].target, 1727 &routing6_tbl[ix].gateway); 1240 1728 1241 1729 SIG_NET_CONS_PRINTF(); … … 1243 1731 } 1244 1732 1245 #endif /* of #if NUM_ ROUTE_ENTRY > 0 */1733 #endif /* of #if NUM_IN6_ROUTE_ENTRY > 0 */ 1246 1734 1247 1735 #endif /* of #if defined(SUPPORT_INET6) */ 1248 1736 1249 #if NUM_ROUTE_ENTRY > 0 1737 #if defined(SUPPORT_INET4) 1738 1739 #if NUM_IN4_ROUTE_ENTRY > 0 1250 1740 1251 1741 /* 1252 * routing_status -- ルーティング情報 1742 * routing4_table_status -- 経路表(IPv4)の出力 1743 */ 1744 1745 static void 1746 routing4_table_status (ID portid, char *line) 1747 { 1748 int_t ix; 1749 1750 if ('0' <= *(line = skip_blanks(line)) && *line <= '9') { 1751 T_IN4_ADDR target, mask, gateway; 1752 1753 ix = atoi(line); 1754 while ('0' <= *line && *line <= '9') 1755 line ++; 1756 line = get_ipv4addr(&target, skip_blanks(line)); 1757 line = get_ipv4addr(&mask, skip_blanks(line)); 1758 get_ipv4addr(&gateway, skip_blanks(line)); 1759 in4_add_route(ix, target, mask, gateway); 1760 } 1761 1762 WAI_NET_CONS_PRINTF(); 1763 cons_printf(portid, 1764 "\nRouting Table Status (IPv4)\n" 1765 "IX Target Mask Gateway Expire\n"); 1766 1767 for (ix = 0; ix < NUM_IN4_ROUTE_ENTRY; ix ++) { 1768 if ((routing4_tbl[ix].flags & IN_RTF_DEFINED) == 0) 1769 ; 1770 else if ((routing4_tbl[ix].flags & IN_RTF_REDIRECT) != 0) 1771 cons_printf(portid, "%2d %15hI %15hI %15hI %4d\n", 1772 ix, 1773 &routing4_tbl[ix].target, 1774 &routing4_tbl[ix].mask, 1775 &routing4_tbl[ix].gateway, 1776 &routing4_tbl[ix].expire); 1777 else 1778 cons_printf(portid, "%2d %15hI %15hI %hI\n", 1779 ix, 1780 &routing4_tbl[ix].target, 1781 &routing4_tbl[ix].mask, 1782 &routing4_tbl[ix].gateway); 1783 1784 } 1785 1786 SIG_NET_CONS_PRINTF(); 1787 FLUSH_SND_BUFF(); 1788 } 1789 1790 #endif /* of #if NUM_IN4_ROUTE_ENTRY > 0 */ 1791 1792 #endif /* of #if defined(SUPPORT_INET4) */ 1793 1794 /* 1795 * routing_status -- 経路情報 1253 1796 */ 1254 1797 … … 1258 1801 switch (*line) { 1259 1802 1260 #if defined(SUPPORT_INET6) 1261 1262 #if NUM_ND6_DEF_RTR_ENTRY > 0 1803 #if defined(SUPPORT_INET6) && NUM_ND6_DEF_RTR_ENTRY > 0 1263 1804 1264 1805 case 'l': /* ディフォルトルータ・リスト情報 */ … … 1270 1811 break; 1271 1812 1272 #endif /* of #if NUM_ND6_DEF_RTR_ENTRY > 0 */ 1273 1274 #endif /* of #if defined(SUPPORT_INET6) */ 1275 1276 default: /* ルーティング表情報 */ 1277 routing_table_status(portid, line); 1813 #endif /* #if defined(SUPPORT_INET6) && NUM_ND6_DEF_RTR_ENTRY > 0 */ 1814 1815 default: 1816 1817 /* 経路表情報 */ 1818 1819 #if defined(SUPPORT_INET6) && NUM_IN6_ROUTE_ENTRY > 0 1820 routing6_table_status(portid, line); 1821 #endif 1822 1823 #if defined(SUPPORT_INET4) && NUM_IN4_ROUTE_ENTRY > 0 1824 routing4_table_status(portid, line); 1825 #endif 1826 1278 1827 break; 1279 1280 break; 1281 } 1282 } 1283 1284 #endif /* of #if NUM_ROUTE_ENTRY > 0 */ 1828 } 1829 } 1285 1830 1286 1831 /* 1287 * network_status -- ネットワークの状態の出力1288 */ 1289 1290 staticvoid1291 network_status (ID portid, char *line)1832 * dbg_cons_network_status -- ネットワークの状態の出力 1833 */ 1834 1835 void 1836 dbg_cons_network_status (ID portid, char *line) 1292 1837 { 1293 1838 switch (*line) { … … 1296 1841 1297 1842 case 'a': /* IF アドレス情報 */ 1298 ifa_status(portid, line + 1); 1843 1844 #if defined(SUPPORT_INET6) 1845 ifa6_status(portid, line + 1); 1846 #endif 1847 #if defined(SUPPORT_INET4) 1848 ifa4_status(portid, line + 1); 1849 #endif 1850 1299 1851 break; 1300 1852 … … 1313 1865 #endif /* of #if NET_COUNT_ENABLE */ 1314 1866 1315 #if NUM_ROUTE_ENTRY > 0 1316 1317 case 'r': /* ルーティング情報 */ 1867 case 'r': /* 経路情報 */ 1318 1868 routing_status(portid, line + 1); 1319 1869 break; 1320 1870 1321 #endif /* of #if NUM_ROUTE_ENTRY > 0 */ 1871 #ifdef USE_RESOLVER 1872 1873 case 's': /* name lookup */ 1874 if (*(line = skip_blanks(line + 1)) == '\0') 1875 dns_info(portid); 1876 else 1877 name_lookup(portid, line); 1878 break; 1879 1880 #endif /* of #ifdef USE_RESOLVER */ 1322 1881 1323 1882 #ifdef SUPPORT_TCP … … 1338 1897 1339 1898 default: 1340 cons_printf(portid, "no such command: '%c%c' \n", *(line - 1), *line);1899 cons_printf(portid, "no such command: '%c%c'.\n", *(line - 1), *line); 1341 1900 SIG_NET_CONS_PRINTF(); 1342 1901 FLUSH_SND_BUFF(); … … 1345 1904 } 1346 1905 1347 #if defined(SUPPORT_INET4)1348 1349 1906 /* 1350 * ifconfig -- ネットワークインタフェースの構成情報 1351 */ 1352 1353 static void 1354 ifconfig (ID portid, char *line) 1355 { 1356 T_IFNET *ifp = IF_GET_IFNET(); 1357 T_IN4_ADDR bc; 1358 1907 * dbg_cons_ifconfig -- ネットワークインタフェースの構成情報 1908 */ 1909 1910 void 1911 dbg_cons_ifconfig (ID portid, char *line) 1912 { 1359 1913 #ifdef SUPPORT_ETHER 1360 1914 1361 if (*(line = skip_blanks(line))) { 1362 T_IN4_ADDR addr, mask; 1363 1364 GET_IPADDR(&mask, skip_blanks(GET_IPADDR(&addr, line))); 1365 in4_add_ifaddr(addr, mask); 1366 } 1367 1368 #endif /* of #ifdef SUPPORT_ETHER */ 1915 T_IF_SOFTC *ic; 1369 1916 1370 1917 WAI_NET_CONS_PRINTF(); 1371 cons_printf(portid, 1372 "Network Interface Configurations\n"); 1373 1374 #ifdef SUPPORT_ETHER 1375 1376 cons_printf(portid, 1377 "ether: %M\n", 1378 IF_ETHER_NIC_GET_SOFTC()->ifaddr.lladdr); 1379 1380 #endif /* of #ifdef SUPPORT_ETHER */ 1381 1382 bc = (ifp->in_ifaddr.addr & ifp->in_ifaddr.mask) | ~ifp->in_ifaddr.mask; 1383 cons_printf(portid, 1384 "inet: %I, mask: %I, broadcast: %I\n", 1385 &ifp->in_ifaddr.addr, 1386 &ifp->in_ifaddr.mask, 1387 &bc); 1388 1918 ic = IF_ETHER_NIC_GET_SOFTC(); 1919 cons_printf(portid, "ether: %M\n", ic->ifaddr.lladdr); 1389 1920 SIG_NET_CONS_PRINTF(); 1390 1921 FLUSH_SND_BUFF(); 1391 } 1392 1393 #endif /* of #if defined(SUPPORT_INET4) */ 1394 1395 #if defined( SUPPORT_INET6)1922 1923 #endif /* of #ifdef SUPPORT_ETHER */ 1924 } 1925 1926 #if defined(NETAPP_IP6_CFG) 1396 1927 1397 1928 /* 1398 * ifconfig -- ネットワークインタフェースの構成情報1399 */ 1400 1401 staticvoid1402 ifconfig(ID portid, char *line)1929 * dbg_cons_ifconfig6 -- ネットワークインタフェース(IPv6)の構成情報 1930 */ 1931 1932 void 1933 dbg_cons_ifconfig6 (ID portid, char *line) 1403 1934 { 1404 1935 #ifdef SUPPORT_ETHER 1405 1936 1406 T_IF_SOFTC *ic;1407 1937 T_IFNET *ifp = IF_GET_IFNET(); 1408 1938 int_t ix; … … 1410 1940 1411 1941 WAI_NET_CONS_PRINTF(); 1412 ic = IF_ETHER_NIC_GET_SOFTC();1413 cons_printf(portid, "ether: %M\ninet6:\nIX Expire Preffered RTR PFX Flags IP Address\n",1414 ic->ifaddr.lladdr);1415 1942 1416 1943 /* expire と vltime の単位は [s]。*/ … … 1418 1945 now /= SYSTIM_HZ; 1419 1946 1947 cons_printf(portid, "IPv6:\nIX Expire Preffered RTR PFX Flags IP Address\n"); 1420 1948 for (ix = 0; ix < NUM_IN6_IFADDR_ENTRY; ix ++) { 1421 if (ifp->in _ifaddrs[ix].flags & IN6_IFF_DEFINED) {1949 if (ifp->in6_ifaddrs[ix].flags & IN6_IFF_DEFINED) { 1422 1950 cons_printf(portid, " %d", ix); 1423 if (ifp->in _ifaddrs[ix].lifetime.vltime == ND6_INFINITE_LIFETIME)1951 if (ifp->in6_ifaddrs[ix].lifetime.vltime == ND6_INFINITE_LIFETIME) 1424 1952 cons_printf(portid, " INFIN INFIN"); 1425 1953 else 1426 1954 cons_printf(portid, " %8d %9d", 1427 (uint32_t)(ifp->in _ifaddrs[ix].lifetime.expire - now) <= 01428 ? 0 : ifp->in_ifaddrs[ix].lifetime.expire - now,1429 (uint32_t)(ifp->in _ifaddrs[ix].lifetime.preferred - now) <= 01430 ? 0 : ifp->in_ifaddrs[ix].lifetime.preferred - now);1431 if (ifp->in _ifaddrs[ix].router_index == IN6_RTR_IX_UNREACH)1955 (uint32_t)(ifp->in6_ifaddrs[ix].lifetime.expire - now) <= 0 1956 ? 0 : ifp->in6_ifaddrs[ix].lifetime.expire - now, 1957 (uint32_t)(ifp->in6_ifaddrs[ix].lifetime.preferred - now) <= 0 1958 ? 0 : ifp->in6_ifaddrs[ix].lifetime.preferred - now); 1959 if (ifp->in6_ifaddrs[ix].router_index == IN6_RTR_IX_UNREACH) 1432 1960 cons_printf(portid, " -"); 1433 1961 else 1434 cons_printf(portid, " %3d", ifp->in _ifaddrs[ix].router_index);1435 if (ifp->in _ifaddrs[ix].prefix_index == ND6_PREFIX_IX_INVALID)1962 cons_printf(portid, " %3d", ifp->in6_ifaddrs[ix].router_index); 1963 if (ifp->in6_ifaddrs[ix].prefix_index == ND6_PREFIX_IX_INVALID) 1436 1964 cons_printf(portid, " -"); 1437 1965 else 1438 cons_printf(portid, " %3d", ifp->in_ifaddrs[ix].prefix_index); 1439 cons_printf(portid, " %02x %I\n", 1440 ifp->in_ifaddrs[ix].flags, 1441 &ifp->in_ifaddrs[ix].addr); 1442 } 1443 } 1966 cons_printf(portid, " %3d", ifp->in6_ifaddrs[ix].prefix_index); 1967 cons_printf(portid, " %02x %lI\n", 1968 ifp->in6_ifaddrs[ix].flags, 1969 &ifp->in6_ifaddrs[ix].addr); 1970 } 1971 } 1972 1973 #ifdef DHCP6_CLI_CFG 1974 dhcp6c_info(portid); 1975 #endif 1444 1976 1445 1977 SIG_NET_CONS_PRINTF(); … … 1449 1981 } 1450 1982 1451 #endif /* of #if defined(SUPPORT_INET6) */ 1983 #endif /* of #if defined(NETAPP_IP6_CFG) */ 1984 1985 #if defined(NETAPP_IP4_CFG) 1452 1986 1453 1987 /* 1454 * show_config -- コンフィギュレーション設定の表示 1455 */ 1456 1457 static void 1458 show_config (ID portid, char *line) 1988 * dbg_cons_ifconfig4 -- ネットワークインタフェース(IPv4)の構成情報 1989 */ 1990 1991 void 1992 dbg_cons_ifconfig4 (ID portid, char *line) 1993 { 1994 T_IFNET *ifp = IF_GET_IFNET(); 1995 T_IN4_ADDR bc; 1996 1997 #ifdef SUPPORT_ETHER 1998 1999 if (*(line = skip_blanks(line))) { 2000 T_IN4_ADDR addr, mask; 2001 2002 get_ipv4addr(&mask, skip_blanks(get_ipv4addr(&addr, line))); 2003 in4_add_ifaddr(addr, mask); 2004 } 2005 2006 #endif /* of #ifdef SUPPORT_ETHER */ 2007 2008 WAI_NET_CONS_PRINTF(); 2009 2010 bc = (ifp->in4_ifaddr.addr & ifp->in4_ifaddr.mask) | ~ifp->in4_ifaddr.mask; 2011 cons_printf(portid, 2012 "IPv4: %hI, mask: %hI, broadcast: %hI\n", 2013 &ifp->in4_ifaddr.addr, 2014 &ifp->in4_ifaddr.mask, 2015 &bc); 2016 2017 #ifdef DHCP4_CLI_CFG 2018 dhcp4c_info(portid); 2019 #endif 2020 2021 SIG_NET_CONS_PRINTF(); 2022 FLUSH_SND_BUFF(); 2023 } 2024 2025 #endif /* of #if defined(NETAPP_IP4_CFG) */ 2026 2027 /* 2028 * dbg_cons_show_config -- コンフィギュレーション設定の表示 2029 */ 2030 2031 void 2032 dbg_cons_show_config (ID portid, char *line) 1459 2033 { 1460 2034 #if defined(SUPPORT_ETHER) … … 1464 2038 #endif /* of #if defined(SUPPORT_ETHER) */ 1465 2039 1466 #if defined(DHCP_CFG)1467 1468 2040 cons_printf(portid, "DHCP:\n"); 1469 1470 cons_printf(portid, " DHCP_CFG: On\n"); 1471 1472 #endif /* of #if define(DHCP_CFG) */ 2041 cons_printf(portid, " DHCP6_CLI_CFG: "); 2042 2043 #if defined(DHCP6_CLI_CFG) 2044 2045 cons_printf(portid, "On\n Mode: "); 2046 2047 #if DHCP6_CLI_CFG_MODE == DHCP6_CLI_CFG_STATELESS 2048 cons_printf(portid, "STATELESS\n"); 2049 #elif DHCP6_CLI_CFG_MODE == DHCP6_CLI_CFG_STATEFULL 2050 cons_printf(portid, "STATEFULL\n"); 2051 #endif 2052 2053 #else /* of #if define(DHCP6_CLI_CFG) */ 2054 2055 cons_printf(portid, "Off\n"); 2056 2057 #endif /* of #if define(DHCP6_CLI_CFG) */ 2058 2059 cons_printf(portid, " DHCP4_CLI_CFG: "); 2060 2061 #if defined(DHCP4_CLI_CFG) 2062 cons_printf(portid, "On\n"); 2063 #else 2064 cons_printf(portid, "Off\n"); 2065 #endif 2066 2067 cons_printf(portid, "Resolver:\n"); 2068 cons_printf(portid, " USE_RESOLVER: "); 2069 2070 #if defined(USE_RESOLVER) 2071 cons_printf(portid, "On\n"); 2072 #else 2073 cons_printf(portid, "Off\n"); 2074 #endif 1473 2075 1474 2076 #if defined(SUPPORT_TCP) 1475 2077 1476 2078 cons_printf(portid, "TCP:\n"); 1477 1478 cons_printf(portid, " TCP_CFG_PASSIVE_OPEN: ");1479 #if defined(TCP_CFG_PASSIVE_OPEN)1480 cons_printf(portid, "On\n");1481 #else1482 cons_printf(portid, "Off\n");1483 #endif1484 2079 1485 2080 cons_printf(portid, " TCP_CFG_OPT_MSS: "); … … 1553 2148 #endif 1554 2149 2150 cons_printf(portid, " TCP_CFG_NON_BLOCKING_COMPAT14: "); 2151 #if defined(TCP_CFG_NON_BLOCKING_COMPAT14) 2152 cons_printf(portid, "On\n"); 2153 #else 2154 cons_printf(portid, "Off\n"); 2155 #endif 2156 1555 2157 cons_printf(portid, " TCP_CFG_EXTENTIONS: "); 1556 2158 #if defined(TCP_CFG_EXTENTIONS) 1557 2159 #if defined(USE_TCP_EXTENTIONS) 1558 2160 cons_printf(portid, "Use\n"); 1559 #if defined(SUPPORT_INET4)1560 cons_printf(portid, " NUM_VRID_TCP_REPS: %3d\n", NUM_VRID_TCP_REPS);1561 cons_printf(portid, " NUM_VRID_TCP_CEPS: %3d\n", NUM_VRID_TCP_CEPS);1562 #endif1563 2161 #if defined(SUPPORT_INET6) 1564 2162 cons_printf(portid, " NUM_VRID_TCP6_REPS: %3d\n", NUM_VRID_TCP6_REPS); 1565 2163 cons_printf(portid, " NUM_VRID_TCP6_CEPS: %3d\n", NUM_VRID_TCP6_CEPS); 1566 #endif 2164 #endif 2165 #if defined(SUPPORT_INET4) 2166 cons_printf(portid, " NUM_VRID_TCP4_REPS: %3d\n", NUM_VRID_TCP4_REPS); 2167 cons_printf(portid, " NUM_VRID_TCP4_CEPS: %3d\n", NUM_VRID_TCP4_CEPS); 2168 #endif 1567 2169 #else 1568 2170 cons_printf(portid, "On\n"); … … 1589 2191 #if defined(SUPPORT_INET4) 1590 2192 addr = TCP_CFG_TRACE_IPV4_RADDR; 1591 cons_printf(portid, " TCP_CFG_TRACE_IPV4_RADDR: % I\n", &addr);2193 cons_printf(portid, " TCP_CFG_TRACE_IPV4_RADDR: %hI\n", &addr); 1592 2194 #endif 1593 2195 cons_printf(portid, " TCP_CFG_TRACE_RPORTNO: %d\n", TCP_CFG_TRACE_RPORTNO); … … 1633 2235 #endif 1634 2236 2237 cons_printf(portid, " UDP_CFG_NON_BLOCKING_COMPAT14: "); 2238 #if defined(UDP_CFG_NON_BLOCKING_COMPAT14) 2239 cons_printf(portid, "On\n"); 2240 #else 2241 cons_printf(portid, "Off\n"); 2242 #endif 2243 1635 2244 cons_printf(portid, " UDP_CFG_EXTENTIONS: "); 1636 2245 #if defined(UDP_CFG_EXTENTIONS) … … 1640 2249 cons_printf(portid, "On\n"); 1641 2250 #endif 1642 cons_printf(portid, " NUM_VRID_UDP _CEPS: %3d\n", NUM_VRID_UDP_CEPS);2251 cons_printf(portid, " NUM_VRID_UDP4_CEPS: %3d\n", NUM_VRID_UDP4_CEPS); 1643 2252 cons_printf(portid, " NUM_VRID_UDP6_CEPS: %3d\n", NUM_VRID_UDP6_CEPS); 1644 2253 #else … … 1667 2276 #endif 1668 2277 2278 #if defined(NUM_REDIRECT_ROUTE_ENTRY) 1669 2279 #if NUM_REDIRECT_ROUTE_ENTRY > 0 1670 2280 cons_printf(portid, " TMO_IN_REDIRECT: %4d[s]\n", TMO_IN_REDIRECT / NET_TIMER_HZ); 1671 2281 #endif 1672 1673 #if defined(SUPPORT_INET4) 1674 1675 cons_printf(portid, "IPv4:\n"); 1676 1677 cons_printf(portid, " IP4_CFG_FRAGMENT: "); 1678 1679 #if defined(IP 4_CFG_FRAGMENT)2282 #endif /* of #if defined(NUM_REDIRECT_ROUTE_ENTRY) */ 2283 2284 #if defined(SUPPORT_INET6) 2285 2286 cons_printf(portid, "IPv6:\n"); 2287 2288 cons_printf(portid, " IP6_IPV4_MAPPED_ADDR: "); 2289 #if defined(IP6_CFG_IPV4_MAPPED_ADDR) 1680 2290 cons_printf(portid, "On\n"); 1681 cons_printf(portid, " NUM_IP4_FRAG_QUEUE: %4d\n", NUM_IP4_FRAG_QUEUE);1682 cons_printf(portid, " IP4_CFG_FRAG_REASSM_SIZE: %4d\n", IP4_CFG_FRAG_REASSM_SIZE);1683 2291 #else 1684 2292 cons_printf(portid, "Off\n"); 1685 #endif /* of #if defined(IP4_CFG_FRAGMENT) */ 1686 1687 #if defined(SUPPORT_ETHER) 1688 addr = IPV4_ADDR_LOCAL; 1689 cons_printf(portid, " IPV4_ADDR_LOCAL: %I\n", &addr); 1690 addr = IPV4_ADDR_LOCAL_MASK; 1691 cons_printf(portid, " IPV4_ADDR_LOCAL_MASK: %I\n", &addr); 1692 addr = IPV4_ADDR_DEFAULT_GW; 1693 cons_printf(portid, " IPV4_ADDR_DEFAULT_GW: %I\n", &addr); 1694 #endif /* of #if defined(SUPPORT_ETHER) */ 2293 #endif 1695 2294 1696 2295 cons_printf(portid, " Routing Table:\n"); 1697 cons_printf(portid, " NUM_STATIC_ROUTE_ENTRY: %d\n", NUM_STATIC_ROUTE_ENTRY); 1698 cons_printf(portid, " NUM_REDIRECT_ROUTE_ENTRY: %d\n", NUM_REDIRECT_ROUTE_ENTRY); 1699 1700 #endif /* of #if defined(SUPPORT_INET4) */ 1701 1702 #if defined(SUPPORT_INET6) 1703 1704 cons_printf(portid, "IPv6:\n"); 1705 1706 cons_printf(portid, " Routing Table:\n"); 1707 cons_printf(portid, " NUM_STATIC_ROUTE_ENTRY: %d\n", NUM_STATIC_ROUTE_ENTRY); 1708 cons_printf(portid, " NUM_REDIRECT_ROUTE_ENTRY: %d\n", NUM_REDIRECT_ROUTE_ENTRY); 2296 cons_printf(portid, " NUM_IN6_STATIC_ROUTE_ENTRY: %d\n", NUM_IN6_STATIC_ROUTE_ENTRY); 2297 cons_printf(portid, " NUM_IN6_REDIRECT_ROUTE_ENTRY: %d\n", NUM_IN6_REDIRECT_ROUTE_ENTRY); 1709 2298 1710 2299 cons_printf(portid, "ND:\n"); … … 1730 2319 #endif /* of #if defined(SUPPORT_INET6) */ 1731 2320 2321 #if defined(SUPPORT_INET4) 2322 2323 cons_printf(portid, "IPv4:\n"); 2324 2325 cons_printf(portid, " IP4_CFG_FRAGMENT: "); 2326 2327 #if defined(IP4_CFG_FRAGMENT) 2328 cons_printf(portid, "On\n"); 2329 cons_printf(portid, " NUM_IP4_FRAG_QUEUE: %4d\n", NUM_IP4_FRAG_QUEUE); 2330 cons_printf(portid, " IP4_CFG_FRAG_REASSM_SIZE: %4d\n", IP4_CFG_FRAG_REASSM_SIZE); 2331 #else 2332 cons_printf(portid, "Off\n"); 2333 #endif /* of #if defined(IP4_CFG_FRAGMENT) */ 2334 2335 #if defined(SUPPORT_ETHER) 2336 addr = IPV4_ADDR_LOCAL; 2337 cons_printf(portid, " IPV4_ADDR_LOCAL: %hI\n", &addr); 2338 addr = IPV4_ADDR_LOCAL_MASK; 2339 cons_printf(portid, " IPV4_ADDR_LOCAL_MASK: %hI\n", &addr); 2340 addr = IPV4_ADDR_DEFAULT_GW; 2341 cons_printf(portid, " IPV4_ADDR_DEFAULT_GW: %hI\n", &addr); 2342 #endif /* of #if defined(SUPPORT_ETHER) */ 2343 2344 cons_printf(portid, " Routing Table:\n"); 2345 cons_printf(portid, " NUM_IN4_STATIC_ROUTE_ENTRY: %d\n", NUM_IN4_STATIC_ROUTE_ENTRY); 2346 cons_printf(portid, " NUM_IN4_REDIRECT_ROUTE_ENTRY: %d\n", NUM_IN4_REDIRECT_ROUTE_ENTRY); 2347 2348 #endif /* of #if defined(SUPPORT_INET4) */ 2349 1732 2350 #if defined(SUPPORT_INET4) && defined(SUPPORT_ETHER) 1733 2351 … … 1771 2389 #endif 1772 2390 2391 cons_printf(portid, " ETHER_COLLECT_ADDR: "); 2392 #if defined(ETHER_COLLECT_ADDR) 2393 cons_printf(portid, "On\n"); 2394 #else 2395 cons_printf(portid, "Off\n"); 2396 #endif 2397 1773 2398 #endif /* of #if defined(SUPPORT_ETHER) */ 1774 2399 … … 1854 2479 } 1855 2480 2481 #ifdef USE_PING 2482 2483 /* 2484 * ping コマンド 2485 */ 2486 2487 void 2488 dbg_cons_ping_comd (ID portid, char *line) 2489 { 2490 int_t tmo, size; 2491 char apip = DEFAULT_API_PROTO; 2492 2493 #if defined(SUPPORT_INET6) 2494 T_IN6_ADDR addr; 2495 #if defined(SUPPORT_INET4) 2496 T_IN4_ADDR addr4; 2497 #endif 2498 #else 2499 T_IN4_ADDR addr; 2500 #endif 2501 2502 #if defined(PING_CFG_I6RLP) 2503 2504 static const char i6rlp_pmtu_str1[] = " FF1E::1:2 1 1452"; 2505 static const char i6rlp_pmtu_str2[] = " FF1E::1:2 1 1352"; 2506 static const char i6rlp_pmtu_str3[] = " fe80::0200:00ff:fe00:0100 1 2"; 2507 2508 if (apip == '1') 2509 strcpy(line, i6rlp_pmtu_str1); 2510 else if (apip == '2') 2511 strcpy(line, i6rlp_pmtu_str2); 2512 else if (apip == '3') 2513 strcpy(line, i6rlp_pmtu_str3); 2514 2515 #endif /* of #ifdef PING_CFG_I6RLP */ 2516 2517 #if defined(SUPPORT_INET6) && defined(SUPPORT_INET4) 2518 2519 if ('0' <= *line && *line <= '9') { 2520 if (*line == '6') 2521 apip = API_PROTO_IPV6; 2522 if (*line == '4') 2523 apip = API_PROTO_IPV4; 2524 line ++; 2525 } 2526 2527 #endif /* of #if defined(SUPPORT_INET6) && defined(SUPPORT_INET4) */ 2528 2529 if ((line = lookup_ipaddr(&addr, line, apip)) == NULL) { 2530 syslog(LOG_NOTICE, "[PING] unknown host."); 2531 return; 2532 } 2533 2534 line = skip_blanks(line); 2535 if ('0' <= *line && *line <= '9') 2536 line = get_int(&tmo, line); 2537 else 2538 tmo = 3; 2539 2540 line = skip_blanks(line); 2541 if ('0' <= *line && *line <= '9') 2542 line = get_int(&size, line); 2543 else 2544 size = 64; 2545 2546 #if defined(SUPPORT_INET6) 2547 2548 #if defined(SUPPORT_INET4) 2549 2550 if (apip == API_PROTO_IPV6) { 2551 syslog(LOG_NOTICE, "[PING6] size: %d, tmo: %d, host: %s", size, tmo, ipv62str(NULL, &addr)); 2552 ping6(&addr, (uint_t)tmo, (uint_t)size); 2553 } 2554 else { 2555 addr4 = ntohl(addr.s6_addr32[3]); 2556 syslog(LOG_NOTICE, "[PING4] size: %d, tmo: %d, host: %s", size, tmo, ip2str(NULL, &addr4)); 2557 ping4(&addr4, (uint_t)tmo, (uint_t)size); 2558 } 2559 2560 #else /* of #if defined(SUPPORT_INET4) */ 2561 2562 syslog(LOG_NOTICE, "[PING6] size: %d, tmo: %d, host: %s", size, tmo, ipv62str(NULL, &addr)); 2563 ping6(&addr, (uint_t)tmo, (uint_t)size); 2564 2565 #endif /* of #if defined(SUPPORT_INET4) */ 2566 2567 #else /* of #if defined(SUPPORT_INET6) */ 2568 2569 2570 syslog(LOG_NOTICE, "[PING4] size: %d, tmo: %d, host: %s", size, tmo, ip2str(NULL, &addr)); 2571 ping4(&addr, (uint_t)tmo, (uint_t)size); 2572 2573 #endif /* of #if defined(SUPPORT_INET6) */ 2574 2575 } 2576 2577 #endif /* of #ifdef USE_PING */ 2578 2579 #ifdef USE_DBG_CONS_PARSER 2580 1856 2581 /* 1857 2582 * デバッグコマンド解析 1858 2583 */ 1859 2584 1860 staticvoid2585 void 1861 2586 dbg_parse (ID portid, char *line) 1862 2587 { 1863 2588 int_t cepid; 1864 ER error; 2589 ER error = E_OK; 2590 2591 #if defined(SUPPORT_UDP) && defined(SUPPORT_INET6) && defined(SUPPORT_INET4) 2592 int_t udp_cep_ipproto; 2593 #endif 1865 2594 1866 2595 switch (*line) { … … 1870 2599 1871 2600 case 'f': /* show configurations */ 1872 show_config(portid, line + 1);2601 dbg_cons_show_config(portid, line + 1); 1873 2602 break; 1874 2603 … … 1880 2609 line ++; 1881 2610 if ((error = tcp_can_cep((ID)cepid, atoi(skip_blanks(line)))) != E_OK && error != E_RLWAI) { 1882 cons_printf(portid, "[TCP CAN CEP] error: %s \n", itron_strerror(error));2611 cons_printf(portid, "[TCP CAN CEP] error: %s.\n", itron_strerror(error)); 1883 2612 SIG_NET_CONS_PRINTF(); 1884 2613 FLUSH_SND_BUFF(); … … 1891 2620 1892 2621 case 'u': /* cancel UDP */ 2622 2623 #if defined(SUPPORT_INET6) 2624 2625 #if defined(SUPPORT_INET4) 2626 2627 udp_cep_ipproto = (*(line + 2) == '4' ? API_PROTO_IPV4 : API_PROTO_IPV6); 2628 cepid = atoi(line = skip_blanks(line + 3)); 2629 while ('0' <= *line && *line <= '9') 2630 line ++; 2631 2632 #if TNUM_UDP6_CEPID > 0 2633 2634 if (udp_cep_ipproto == API_PROTO_IPV6) { 2635 if ((error = udp_can_cep((ID)cepid, atoi(skip_blanks(line)))) != E_OK && error != E_RLWAI) { 2636 cons_printf(portid, "[UDP CAN CEP] error: %s.\n", itron_strerror(error)); 2637 SIG_NET_CONS_PRINTF(); 2638 FLUSH_SND_BUFF(); 2639 } 2640 } 2641 2642 #endif /* of #if TNUM_UDP6_CEPID > 0 */ 2643 2644 #if TNUM_UDP4_CEPID > 0 2645 2646 if (udp_cep_ipproto == API_PROTO_IPV4) { 2647 if ((error = udp_can_cep((ID)cepid, atoi(skip_blanks(line)))) != E_OK && error != E_RLWAI) { 2648 cons_printf(portid, "[UDP CAN CEP] error: %s.\n", itron_strerror(error)); 2649 SIG_NET_CONS_PRINTF(); 2650 FLUSH_SND_BUFF(); 2651 } 2652 } 2653 2654 #endif /* of #if TNUM_UDP4_CEPID > 0 */ 2655 2656 #else /* of #if defined(SUPPORT_INET4) */ 2657 2658 #if TNUM_UDP6_CEPID > 0 2659 1893 2660 cepid = atoi(line = skip_blanks(line + 2)); 1894 2661 while ('0' <= *line && *line <= '9') 1895 2662 line ++; 2663 1896 2664 if ((error = udp_can_cep((ID)cepid, atoi(skip_blanks(line)))) != E_OK && error != E_RLWAI) { 1897 cons_printf(portid, "[UDP CAN CEP] error: %s \n", itron_strerror(error));2665 cons_printf(portid, "[UDP CAN CEP] error: %s.\n", itron_strerror(error)); 1898 2666 SIG_NET_CONS_PRINTF(); 1899 2667 FLUSH_SND_BUFF(); 1900 2668 } 2669 2670 #endif /* of #if TNUM_UDP6_CEPID > 0 */ 2671 2672 #endif /* of #if defined(SUPPORT_INET4) */ 2673 2674 #else /* of #if defined(SUPPORT_INET6) */ 2675 2676 #if defined(SUPPORT_INET4) 2677 2678 #if TNUM_UDP4_CEPID > 0 2679 2680 cepid = atoi(line = skip_blanks(line + 2)); 2681 while ('0' <= *line && *line <= '9') 2682 line ++; 2683 2684 if ((error = udp_can_cep((ID)cepid, atoi(skip_blanks(line)))) != E_OK && error != E_RLWAI) { 2685 cons_printf(portid, "[UDP CAN CEP] error: %s.\n", itron_strerror(error)); 2686 SIG_NET_CONS_PRINTF(); 2687 FLUSH_SND_BUFF(); 2688 } 2689 2690 #endif /* of #if TNUM_UDP4_CEPID > 0 */ 2691 2692 #endif /* of #if defined(SUPPORT_INET4) */ 2693 2694 #endif /* of #if defined(SUPPORT_INET6) */ 2695 1901 2696 break; 1902 2697 … … 1906 2701 1907 2702 break; 1908 1909 #if defined(USE_UDP_DISCARD_CLI) || defined(USE_TCP_DISCARD_CLI) || defined(SUPPORT_PPP) || defined(SUPPORT_ETHER) && defined(USE_NET_CONS)1910 2703 1911 2704 case 'd': /* discard client */ … … 1929 2722 #endif /* of #if defined(SUPPORT_ETHER) && defined(USE_NET_CONS) */ 1930 2723 2724 #if defined(DHCP6_CLI_CFG) || defined(DHCP4_CLI_CFG) 2725 2726 case 'h': /* DHCP client */ 2727 dhcpc(portid, line + 2); 2728 break; 2729 2730 #endif /* of #if defined(DHCP6_CLI_CFG) || defined(DHCP4_CLI_CFG) */ 2731 1931 2732 #ifdef USE_TCP_DISCARD_CLI 1932 2733 … … 1941 2742 default: 1942 2743 if ((error = psnd_dtq(DTQ_TCP_DISCARD_CLI, (intptr_t)line)) != E_OK) { 1943 cons_printf(portid, "[TCP DISCARD CLI] error: %s \n",2744 cons_printf(portid, "[TCP DISCARD CLI] error: %s.\n", 1944 2745 itron_strerror(error)); 1945 2746 SIG_NET_CONS_PRINTF(); … … 1965 2766 default: 1966 2767 if ((error = psnd_dtq(DTQ_UDP_DISCARD_CLI, (intptr_t)line)) != E_OK) { 1967 cons_printf(portid, "[UDP DISCARD CLI] error: %s \n",2768 cons_printf(portid, "[UDP DISCARD CLI] error: %s.\n", 1968 2769 itron_strerror(error)); 1969 2770 SIG_NET_CONS_PRINTF(); … … 1981 2782 break; 1982 2783 1983 #endif /* of #if defined(USE_UDP_DISCARD_CLI) || defined(USE_TCP_DISCARD_CLI) || defined(SUPPORT_PPP) || defined(SUPPORT_ETHER) && defined(USE_NET_CONS) */ 1984 1985 #if defined(USE_UDP_ECHO_CLI) || defined(USE_TCP_ECHO_CLI) 2784 #if defined(USE_TCP_ECHO_CLI) || defined(USE_UDP_ECHO_CLI) 1986 2785 1987 2786 case 'e': /* echo client */ … … 2000 2799 default: 2001 2800 if ((error = psnd_dtq(DTQ_TCP_ECHO_CLI_SND, (intptr_t)line)) != E_OK) { 2002 cons_printf(portid, "[TCP ECHO CLI] error: %s \n", itron_strerror(error));2801 cons_printf(portid, "[TCP ECHO CLI] error: %s.\n", itron_strerror(error)); 2003 2802 SIG_NET_CONS_PRINTF(); 2004 2803 FLUSH_SND_BUFF(); … … 2011 2810 #endif /* of #ifdef USE_TCP_ECHO_CLI */ 2012 2811 2013 #if def USE_UDP_ECHO_CLI2812 #if defined(USE_UDP_ECHO_CLI) 2014 2813 2015 2814 case 'u': /* UDP echo client */ 2016 line += 2; 2017 switch (*line) { 2815 switch (*(line + 2)) { 2018 2816 2019 2817 case 's': /* cancel UDP echo */ 2020 udp_echo_cli_valid = false; 2818 2819 #if defined(USE_UDP6_ECHO_CLI_TSK) 2820 2821 #if defined(USE_UDP4_ECHO_CLI_TSK) 2822 2823 if (*(line + 3) == '4') 2824 udp4_echo_cli_valid = false; 2825 else 2826 udp6_echo_cli_valid = false; 2827 2828 #else /* of #if defined(USE_UDP4_ECHO_CLI_TSK) */ 2829 2830 udp6_echo_cli_valid = false; 2831 2832 #endif /* of #if defined(USE_UDP4_ECHO_CLI_TSK) */ 2833 2834 #else /* of #if defined(USE_UDP6_ECHO_CLI_TSK) */ 2835 2836 #if defined(USE_UDP4_CLI_TSK) 2837 2838 udp4_echo_cli_valid = false; 2839 2840 #endif /* of #if defined(USE_UDP4_CLI_TSK) */ 2841 2842 #endif /* of #if defined(USE_UDP6_ECHO_CLI_TSK) */ 2843 2844 2021 2845 break; 2022 2846 2023 2847 default: 2024 if ((error = psnd_dtq(DTQ_UDP_ECHO_CLI, (intptr_t)line)) != E_OK) { 2025 cons_printf(portid, "[UDP ECHO CLI] error: %s\n", itron_strerror(error)); 2848 2849 line += 2; 2850 2851 #if defined(USE_UDP6_ECHO_CLI_TSK) 2852 2853 #if defined(USE_UDP4_ECHO_CLI_TSK) 2854 2855 if (*line == '4') { 2856 line ++; 2857 error = psnd_dtq(DTQ_UDP4_ECHO_CLI, (intptr_t)line); 2858 } 2859 else { 2860 if (*line && *line != ' ') 2861 line ++; 2862 error = psnd_dtq(DTQ_UDP6_ECHO_CLI, (intptr_t)line); 2863 } 2864 2865 #else /* of #if defined(USE_UDP4_ECHO_CLI_TSK) */ 2866 2867 if (*line && *line != ' ') 2868 line ++; 2869 error = psnd_dtq(DTQ_UDP6_ECHO_CLI, (intptr_t)line); 2870 2871 #endif /* of #if defined(USE_UDP4_ECHO_CLI_TSK) */ 2872 2873 #else /* of #if defined(USE_UDP6_ECHO_CLI_TSK) */ 2874 2875 if (*line && *line != ' ') 2876 line ++; 2877 error = psnd_dtq(DTQ_UDP4_ECHO_CLI, (intptr_t)line); 2878 2879 #endif /* of #if defined(USE_UDP6_ECHO_CLI_TSK) */ 2880 2881 if (error != E_OK) { 2882 cons_printf(portid, "[UDP ECHO CLI] error: %s.\n", itron_strerror(error)); 2026 2883 SIG_NET_CONS_PRINTF(); 2027 2884 FLUSH_SND_BUFF(); 2028 2885 } 2886 2029 2887 break; 2030 2888 … … 2032 2890 break; 2033 2891 2034 #endif /* of #if def USE_UDP_ECHO_CLI*/2892 #endif /* of #if defined(USE_UDP_ECHO_CLI) */ 2035 2893 2036 2894 } … … 2038 2896 break; 2039 2897 2040 #endif /* of #if defined(USE_ UDP_ECHO_CLI) || defined(USE_TCP_ECHO_CLI) */2898 #endif /* of #if defined(USE_TCP_ECHO_CLI) || defined(USE_UDP_ECHO_CLI) */ 2041 2899 2042 2900 case 'i': 2043 2901 2044 if (*(line + 1) == 'f') 2045 ifconfig(portid, line + 2); 2902 if (*(line + 1) == 'f') { 2903 2904 dbg_cons_ifconfig (portid, line + 2); 2905 2906 #if defined(NETAPP_IP6_CFG) 2907 dbg_cons_ifconfig6(portid, line + 2); 2908 #endif 2909 2910 #if defined(NETAPP_IP4_CFG) 2911 dbg_cons_ifconfig4(portid, line + 2); 2912 #endif 2913 2914 } 2046 2915 2047 2916 #ifdef SUPPORT_PPP … … 2064 2933 2065 2934 case 'n': /* network status */ 2066 network_status(portid, line + 1);2935 dbg_cons_network_status(portid, line + 1); 2067 2936 break; 2068 2937 … … 2070 2939 2071 2940 if (*(line + 1) == 's') 2072 task_status(portid, skip_blanks(line + 2));2941 dbg_cons_task_status(portid, skip_blanks(line + 2)); 2073 2942 2074 2943 #ifdef USE_PING 2075 2944 2076 else { 2077 int_t tmo, size; 2078 T_IN_ADDR addr; 2079 2080 #ifdef PING_CFG_I6RLP 2081 static const char i6rlp_pmtu_str1[] = " FF1E::1:2 1 1452"; 2082 static const char i6rlp_pmtu_str2[] = " FF1E::1:2 1 1352"; 2083 static const char i6rlp_pmtu_str3[] = " fe80::0200:00ff:fe00:0100 1 2"; 2084 2085 if (*(line + 1) == '1') 2086 strcpy(line + 1, i6rlp_pmtu_str1); 2087 else if (*(line + 1) == '2') 2088 strcpy(line + 1, i6rlp_pmtu_str2); 2089 else if (*(line + 1) == '3') 2090 strcpy(line + 1, i6rlp_pmtu_str3); 2091 2092 #endif /* of #ifdef PING_CFG_I6RLP */ 2093 2094 line = skip_blanks(GET_IPADDR(&addr, skip_blanks(line + 1))); 2095 if ('0' <= *line && *line <= '9') 2096 line = get_int(&tmo, line); 2097 else 2098 tmo = 3; 2099 2100 line = skip_blanks(line + 1); 2101 if ('0' <= *line && *line <= '9') 2102 line = get_int(&size, line); 2103 else 2104 size = 64; 2105 2106 PING(&addr, (uint_t)tmo, (uint_t)size); 2107 } 2945 else 2946 dbg_cons_ping_comd(portid, line + 1); 2108 2947 2109 2948 #endif /* of #ifdef USE_PING */ … … 2113 2952 case 'r': /* release wait task */ 2114 2953 if ((error = rel_wai(atoi(skip_blanks(line + 1)))) != E_OK) { 2115 cons_printf(portid, "[REL WAI TSK] error: %s \n", itron_strerror(error));2954 cons_printf(portid, "[REL WAI TSK] error: %s.\n", itron_strerror(error)); 2116 2955 SIG_NET_CONS_PRINTF(); 2117 2956 FLUSH_SND_BUFF(); … … 2125 2964 2126 2965 case 't': /* TCP REP */ 2127 if ((error = tcp_del_rep(atoi(skip_blanks(line + 2)))) != E_OK) { 2128 cons_printf(portid, "[TCP DEL REP] error: %s\n", itron_strerror(error)); 2966 2967 error = tcp_del_rep(atoi(skip_blanks(line + 2))); 2968 if (error != E_OK) { 2969 cons_printf(portid, "[TCP DEL REP] ID: %d, error: %s.\n", 2970 atoi(skip_blanks(line + 2)), 2971 itron_strerror(error)); 2129 2972 SIG_NET_CONS_PRINTF(); 2130 2973 FLUSH_SND_BUFF(); … … 2137 2980 2138 2981 case 'u': /* UDP CEP */ 2139 if ((error = udp_del_cep(atoi(skip_blanks(line + 2)))) != E_OK) { 2140 cons_printf(portid, "[UDP DEL CEP] error: %s\n", itron_strerror(error)); 2982 2983 #if defined(USE_UDP6_ECHO_SRV_TSK) 2984 2985 #if defined(USE_UDP4_ECHO_SRV_TSK) 2986 2987 if (*(line + 2) == '4') { 2988 if ((error = udp_del_cep(atoi(skip_blanks(line + 3)))) != E_OK) { 2989 cons_printf(portid, "[UDP DEL CEP] error: %s.\n", itron_strerror(error)); 2990 SIG_NET_CONS_PRINTF(); 2991 FLUSH_SND_BUFF(); 2992 } 2993 } 2994 else { 2995 if ((error = udp6_del_cep(atoi(skip_blanks(line + 2)))) != E_OK) { 2996 cons_printf(portid, "[UDP DEL CEP] error: %s.\n", itron_strerror(error)); 2997 SIG_NET_CONS_PRINTF(); 2998 FLUSH_SND_BUFF(); 2999 } 3000 } 3001 3002 #else /* of #if defined(USE_UDP4_ECHO_SRV_TSK) */ 3003 3004 if ((error = udp6_del_cep(atoi(skip_blanks(line + 2)))) != E_OK) { 3005 cons_printf(portid, "[UDP DEL CEP] error: %s.\n", itron_strerror(error)); 2141 3006 SIG_NET_CONS_PRINTF(); 2142 3007 FLUSH_SND_BUFF(); 2143 3008 } 3009 3010 #endif /* of #if defined(USE_UDP4_ECHO_SRV_TSK) */ 3011 3012 #else /* of #if defined(USE_UDP6_ECHO_SRV_TSK) */ 3013 3014 #if defined(USE_UDP4_ECHO_SRV_TSK) 3015 3016 if ((error = udp_del_cep(atoi(skip_blanks(line + 2)))) != E_OK) { 3017 cons_printf(portid, "[UDP DEL CEP] error: %s.\n", itron_strerror(error)); 3018 SIG_NET_CONS_PRINTF(); 3019 FLUSH_SND_BUFF(); 3020 } 3021 3022 #endif /* of #if defined(USE_UDP4_ECHO_SRV_TSK) */ 3023 3024 #endif /* of #if defined(USE_UDP6_ECHO_SRV_TSK) */ 3025 2144 3026 break; 2145 3027 … … 2163 3045 case 'd': /* tcp discard server */ 2164 3046 if ((error = wup_tsk(TCP_DISCARD_SRV_TASK)) != E_OK) { 2165 cons_printf(portid, "[WUP TCP DISCARD SRV] error: %s\n", itron_strerror(error));3047 //cons_printf(portid, "[WUP TCP DISCARD SRV] error: %s.\n", itron_strerror(error)); 2166 3048 SIG_NET_CONS_PRINTF(); 2167 3049 FLUSH_SND_BUFF(); … … 2170 3052 #endif /* of #ifdef USE_TCP_DISCARD_SRV */ 2171 3053 2172 #if defined(USE_TCP_ECHO_SRV1) || defined(USE_TCP_ECHO_SRV2)3054 #if defined(USE_TCP_ECHO_SRV1) 2173 3055 case 'e': /* tcp echo server */ 2174 if ((error = w up_tsk(TCP_ECHO_SRV_TASK)) != E_OK) {2175 cons_printf(portid, "[WUP UDP DISCARD SRV] error: %s\n", itron_strerror(error));3056 if ((error = wakeup_tcp_echo_srv((*(line + 3) == '4' ? API_PROTO_IPV4 : API_PROTO_IPV6))) != E_OK) { 3057 //cons_printf(portid, "[WUP TCP ECHO SRV] error: %s.\n", itron_strerror(error)); 2176 3058 SIG_NET_CONS_PRINTF(); 2177 3059 FLUSH_SND_BUFF(); 2178 3060 } 2179 3061 break; 2180 #endif /* of #if defined(USE_TCP_ECHO_SRV1) || defined(USE_TCP_ECHO_SRV2) */ 3062 #endif /* of #if defined(USE_TCP_ECHO_SRV1) */ 3063 3064 #if defined(USE_TCP_ECHO_SRV2) 3065 case 'e': /* tcp echo server */ 3066 if ((error = wup_tsk(TCP_ECHO_SRV_TASK2)) != E_OK) { 3067 //cons_printf(portid, "[WUP TCP ECHO SRV] error: %s.\n", itron_strerror(error)); 3068 SIG_NET_CONS_PRINTF(); 3069 FLUSH_SND_BUFF(); 3070 } 3071 break; 3072 #endif /* of #if defined(USE_TCP_ECHO_SRV2) */ 2181 3073 2182 3074 #ifdef USE_WWW_SRV 2183 3075 case 'w': /* WWW server */ 2184 if ((error = w up_tsk(WWW_SRV_TASK1)) != E_OK) {2185 cons_printf(portid, "[WUP WWW SRV] error: %s\n", itron_strerror(error));3076 if ((error = wakeup_www_srv((*(line + 3) == '4' ? API_PROTO_IPV4 : API_PROTO_IPV6))) != E_OK) { 3077 //cons_printf(portid, "[WUP WWW SRV] error: %s.\n", itron_strerror(error)); 2186 3078 SIG_NET_CONS_PRINTF(); 2187 3079 FLUSH_SND_BUFF(); … … 2200 3092 switch (*(line + 2)) { 2201 3093 2202 #if defined(USE_UDP_ECHO_SRV) && !defined(USE_UDP_CALL_BACK) 3094 #if !defined(USE_UDP_CALL_BACK) 3095 2203 3096 case 'e': /* udp echo server */ 2204 if ((error = wup_tsk(UDP_ECHO_SRV_TASK)) != E_OK) { 2205 cons_printf(portid, "[WUP UDP ECHO SRV] error: %s\n", itron_strerror(error)); 3097 3098 #if defined(USE_UDP6_ECHO_SRV_TSK) 3099 3100 #if defined(USE_UDP4_ECHO_SRV_TSK) 3101 3102 if (*(line + 3) == '4') { 3103 if ((error = wup_tsk(UDP4_ECHO_SRV_TASK)) != E_OK) { 3104 cons_printf(portid, "[WUP UDP4 ECHO SRV] error: %s.\n", itron_strerror(error)); 3105 SIG_NET_CONS_PRINTF(); 3106 FLUSH_SND_BUFF(); 3107 } 3108 } 3109 else { 3110 if ((error = wup_tsk(UDP6_ECHO_SRV_TASK)) != E_OK) { 3111 cons_printf(portid, "[WUP UDP6 ECHO SRV] error: %s.\n", itron_strerror(error)); 3112 SIG_NET_CONS_PRINTF(); 3113 FLUSH_SND_BUFF(); 3114 } 3115 } 3116 3117 #else /* of #if defined(USE_UDP4_ECHO_SRV_TSK) */ 3118 3119 if ((error = wup_tsk(UDP6_ECHO_SRV_TASK)) != E_OK) { 3120 cons_printf(portid, "[WUP UDP6 ECHO SRV] error: %s.\n", itron_strerror(error)); 2206 3121 SIG_NET_CONS_PRINTF(); 2207 3122 FLUSH_SND_BUFF(); 2208 3123 } 3124 3125 #endif /* of #if defined(USE_UDP4_ECHO_SRV_TSK) */ 3126 3127 #else /* of #if defined(USE_UDP6_ECHO_SRV_TSK) */ 3128 3129 #if defined(USE_UDP4_ECHO_SRV_TSK) 3130 3131 if ((error = wup_tsk(UDP4_ECHO_SRV_TASK)) != E_OK) { 3132 cons_printf(portid, "[WUP UDP4 ECHO SRV] error: %s.\n", itron_strerror(error)); 3133 SIG_NET_CONS_PRINTF(); 3134 FLUSH_SND_BUFF(); 3135 } 3136 3137 #endif /* of #if defined(USE_UDP4_ECHO_SRV_TSK) */ 3138 3139 #endif /* of #if defined(USE_UDP6_ECHO_SRV_TSK) */ 3140 2209 3141 break; 2210 #endif /* of #if defined(USE_UDP_ECHO_SRV) && !defined(USE_UDP_CALL_BACK) */ 3142 3143 #endif /* of #if !defined(USE_UDP_CALL_BACK) */ 2211 3144 2212 3145 } … … 2217 3150 default: 2218 3151 if ((error = wup_tsk(atoi(skip_blanks(line + 1)))) != E_OK) { 2219 cons_printf(portid, "[WUP TSK] error: %s \n", itron_strerror(error));3152 cons_printf(portid, "[WUP TSK] error: %s.\n", itron_strerror(error)); 2220 3153 SIG_NET_CONS_PRINTF(); 2221 3154 FLUSH_SND_BUFF(); … … 2230 3163 case 'w': /* wake up task */ 2231 3164 if ((error = wup_tsk(atoi(skip_blanks(line + 1)))) != E_OK) { 2232 cons_printf(portid, "[WUP TSK] error: %s \n", itron_strerror(error));3165 cons_printf(portid, "[WUP TSK] error: %s.\n", itron_strerror(error)); 2233 3166 SIG_NET_CONS_PRINTF(); 2234 3167 FLUSH_SND_BUFF(); … … 2242 3175 if (*line) { 2243 3176 2244 #ifdef USE_EXTRA_PARSE 2245 2246 extra_parse(line); 2247 2248 #else /* of #ifdef USE_EXTRA_PARSE */ 2249 2250 cons_printf(portid, "no such command: '%c'\n", *line); 3177 #ifdef USE_DBG_CONS_EXTRA_PARSE 3178 3179 //cons_printf(portid, "extra command: '%c'.\n", *line); 3180 dbg_cons_extra_parse(portid, line); 3181 3182 #else /* of #ifdef USE_DBG_CONS_EXTRA_PARSE */ 3183 3184 //cons_printf(portid, "command: '%c'.\n", *line); 3185 cons_printf(portid, "no such command: '%c'.\n", *line); 2251 3186 SIG_NET_CONS_PRINTF(); 2252 3187 FLUSH_SND_BUFF(); 2253 3188 2254 #endif /* of #ifdef USE_ EXTRA_PARSE */3189 #endif /* of #ifdef USE_DBG_CONS_EXTRA_PARSE */ 2255 3190 2256 3191 } … … 2258 3193 } 2259 3194 } 3195 3196 #endif /* of #ifdef USE_DBG_CONS_PARSER */ 2260 3197 2261 3198 /* … … 2268 3205 static char line[DBG_LINE_SIZE + 1]; 2269 3206 2270 uint_t len;2271 3207 ID tskid; 2272 3208 … … 2274 3210 #ifdef SUPPORT_ETHER 2275 3211 3212 #if 0 2276 3213 #if defined(SUPPORT_INET6) 2277 3214 2278 int_tlllen;3215 uint32_t lllen; 2279 3216 const uint8_t *lladdr; 2280 3217 2281 3218 #endif /* of #if defined(SUPPORT_INET6) */ 2282 2283 lcd_init(); 3219 #endif 3220 3221 lcd_initialize(0); 3222 3223 #if 0 3224 #if defined(SUPPORT_INET6) 3225 3226 dly_tsk(1 * 1000); 3227 lladdr = IF_ETHER_NIC_GET_SOFTC()->ifaddr.lladdr; 3228 for (lllen = ETHER_ADDR_LEN; lllen --; ) 3229 lcd_printf(LCD_PORTID, "%02x", *lladdr ++); 3230 lcd_putc(LCD_PORTID, '\n'); 3231 3232 #else /* of #if defined(SUPPORT_INET6) */ 2284 3233 2285 3234 if ((TINET_PRVER & UINT_C(0x0f)) > 0) 2286 lcd_printf( "TINET-%d.%d.%d\n",3235 lcd_printf(LCD_PORTID, "TINET-%d.%d.%d\n", 2287 3236 (TINET_PRVER >> 12) & UINT_C(0x0f), 2288 3237 (TINET_PRVER >> 4) & UINT_C(0x0f), 2289 3238 TINET_PRVER & UINT_C(0x0f)); 2290 3239 else 2291 lcd_printf( "TINET-%d.%d\n",3240 lcd_printf(LCD_PORTID, "TINET-%d.%d\n", 2292 3241 (TINET_PRVER >> 12) & UINT_C(0x0f), 2293 3242 (TINET_PRVER >> 4) & UINT_C(0x0f)); 2294 3243 2295 #if defined(SUPPORT_INET6)2296 2297 lladdr = IF_ETHER_NIC_GET_SOFTC()->ifaddr.lladdr;2298 for (lllen = ETHER_ADDR_LEN; lllen --; )2299 lcd_printf("%02x", *lladdr ++);2300 lcd_printf("\n");2301 2302 #else /* of #if defined(SUPPORT_INET6) */2303 2304 lcd_puts(ip2str(NULL, in4_get_ifaddr(0)));2305 2306 3244 #endif /* of #if defined(SUPPORT_INET6) */ 3245 #endif 3246 3247 #if 0 3248 #if defined(SUPPORT_INET4) 3249 3250 dly_tsk(1 * 1000); 3251 lcd_puts(LCD_PORTID, ip2str(NULL, in4_get_ifaddr(0))); 3252 lcd_putc(LCD_PORTID, '\n'); 3253 3254 #endif /* of #if defined(SUPPORT_INET4) */ 3255 #endif 2307 3256 2308 3257 #endif /* of #ifdef SUPPORT_ETHER */ 2309 #e lse/* of #ifdef USE_LCD */3258 #endif /* of #ifdef USE_LCD */ 2310 3259 2311 3260 get_tid(&tskid); 2312 3261 cons_printf(CONSOLE_PORTID, "[CONSOLE:%d] started.\n", tskid); 2313 2314 #endif /* of #ifdef USE_LCD */2315 2316 3262 serial_ctl_por(CONSOLE_PORTID, 2317 3263 IOCTL_ECHO | IOCTL_CRLF | 2318 3264 IOCTL_FCSND | IOCTL_FCANY | IOCTL_FCRCV); 3265 netapp_srand (tskid); 2319 3266 while (true) { 2320 len =cons_getline(CONSOLE_PORTID, line, DBG_LINE_SIZE);3267 cons_getline(CONSOLE_PORTID, line, DBG_LINE_SIZE); 2321 3268 dbg_parse(CONSOLE_PORTID, line); 2322 3269 }
Note:
See TracChangeset
for help on using the changeset viewer.