[337] | 1 | /*
|
---|
| 2 | * TINET (TCP/IP Protocol Stack)
|
---|
| 3 | *
|
---|
| 4 | * Copyright (C) 2001-2017 by Dep. of Computer Science and Engineering
|
---|
| 5 | * Tomakomai National College of Technology, JAPAN
|
---|
| 6 | *
|
---|
| 7 | * 上記著作権者は,以下の (1)~(4) の条件か,Free Software Foundation
|
---|
| 8 | * によって公表されている GNU General Public License の Version 2 に記
|
---|
| 9 | * 述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
|
---|
| 10 | * を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下,
|
---|
| 11 | * 利用と呼ぶ)することを無償で許諾する.
|
---|
| 12 | * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
|
---|
| 13 | * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
|
---|
| 14 | * スコード中に含まれていること.
|
---|
| 15 | * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
|
---|
| 16 | * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
|
---|
| 17 | * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
|
---|
| 18 | * の無保証規定を掲載すること.
|
---|
| 19 | * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
|
---|
| 20 | * 用できない形で再配布する場合には,次の条件を満たすこと.
|
---|
| 21 | * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
|
---|
| 22 | * 作権表示,この利用条件および下記の無保証規定を掲載すること.
|
---|
| 23 | * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
|
---|
| 24 | * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
|
---|
| 25 | *
|
---|
| 26 | * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
|
---|
| 27 | * よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
|
---|
| 28 | * 含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
|
---|
| 29 | * 接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
|
---|
| 30 | *
|
---|
| 31 | * @(#) $Id$
|
---|
| 32 | */
|
---|
| 33 |
|
---|
| 34 | /*
|
---|
| 35 | * デバッグコンソール
|
---|
| 36 | */
|
---|
| 37 |
|
---|
| 38 | #include <stdlib.h>
|
---|
| 39 | #include <string.h>
|
---|
| 40 |
|
---|
| 41 | #ifdef TARGET_KERNEL_ASP
|
---|
| 42 |
|
---|
| 43 | #include <kernel.h>
|
---|
| 44 | #include <sil.h>
|
---|
| 45 | #include <syssvc/serial.h>
|
---|
| 46 | #include <syssvc/logtask.h>
|
---|
| 47 | #include "kernel/kernel_impl.h"
|
---|
| 48 | #include "kernel/task.h"
|
---|
| 49 | #include "kernel_cfg.h"
|
---|
| 50 | #include "tinet_cfg.h"
|
---|
| 51 |
|
---|
| 52 | #endif /* of #ifdef TARGET_KERNEL_ASP */
|
---|
| 53 |
|
---|
| 54 | #ifdef TARGET_KERNEL_JSP
|
---|
| 55 |
|
---|
| 56 | #include <s_services.h>
|
---|
| 57 | #include <t_services.h>
|
---|
| 58 | #include "kernel_id.h"
|
---|
| 59 | #include "tinet_id.h"
|
---|
| 60 |
|
---|
| 61 | #include "../kernel/jsp_kernel.h"
|
---|
| 62 | #include "../kernel/task.h"
|
---|
| 63 |
|
---|
| 64 | #endif /* of #ifdef TARGET_KERNEL_JSP */
|
---|
| 65 |
|
---|
| 66 | #include <tinet_defs.h>
|
---|
| 67 | #include <tinet_config.h>
|
---|
| 68 |
|
---|
| 69 | #include <net/if.h>
|
---|
| 70 | #include <net/if_ppp.h>
|
---|
| 71 | #include <net/if_loop.h>
|
---|
| 72 | #include <net/ethernet.h>
|
---|
| 73 | #include <net/net.h>
|
---|
| 74 | #include <net/net_endian.h>
|
---|
| 75 | #include <net/net_buf.h>
|
---|
| 76 | #include <net/net_timer.h>
|
---|
| 77 | #include <net/ppp_var.h>
|
---|
| 78 | #include <net/ppp_fsm.h>
|
---|
| 79 | #include <net/ppp_lcp.h>
|
---|
| 80 | #include <net/ppp_ipcp.h>
|
---|
| 81 | #include <net/ppp_modem.h>
|
---|
| 82 | #include <net/net_count.h>
|
---|
| 83 |
|
---|
| 84 | #include <netinet/in.h>
|
---|
| 85 | #include <netinet/in_var.h>
|
---|
| 86 | #include <netinet/in_itron.h>
|
---|
| 87 | #include <netinet/ip.h>
|
---|
| 88 | #include <netinet/ip_var.h>
|
---|
| 89 | #include <netinet/if_ether.h>
|
---|
| 90 | #include <netinet/tcp.h>
|
---|
| 91 | #include <netinet/tcp_var.h>
|
---|
| 92 | #include <netinet/tcp_fsm.h>
|
---|
| 93 | #include <netinet/tcp_timer.h>
|
---|
| 94 | #include <netinet/udp.h>
|
---|
| 95 | #include <netinet/udp_var.h>
|
---|
| 96 |
|
---|
| 97 | #include <netinet6/nd6.h>
|
---|
| 98 |
|
---|
| 99 | #include <net/if_var.h>
|
---|
| 100 |
|
---|
| 101 | #include <netapp/netapp.h>
|
---|
| 102 | #include <netapp/netapp_var.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>
|
---|
| 114 | #include <netapp/dbg_cons.h>
|
---|
| 115 | #include <netapp/dhcp6_cli.h>
|
---|
| 116 | #include <netapp/dhcp4_cli.h>
|
---|
| 117 | #include "lcd.h"
|
---|
| 118 |
|
---|
| 119 | #ifdef USE_DBG_CONS
|
---|
| 120 |
|
---|
| 121 | /*
|
---|
| 122 | * dbg_cons_task_status -- タスクの状態の出力
|
---|
| 123 | */
|
---|
| 124 |
|
---|
| 125 | static const char task_stat_str[][sizeof("SUSPENDED")] = {
|
---|
| 126 | "DORMANT", /* 休止状態 */
|
---|
| 127 | "RUNNABLE", /* 実行できる状態 */
|
---|
| 128 | "WAINTING", /* 待ち状態 */
|
---|
| 129 | "SUSPENDED", /* 強制待ち状態 */
|
---|
| 130 | "SLEEP", /* 起床待ち状態 */
|
---|
| 131 | "WOBJ", /* 同期・通信オブジェクトに対する待ち状態 */
|
---|
| 132 | "WOBJCB", /* 共通部分の待ちキューにつながっている。 */
|
---|
| 133 | };
|
---|
| 134 |
|
---|
| 135 | void
|
---|
| 136 | dbg_cons_task_status (ID portid, char *line)
|
---|
| 137 | {
|
---|
| 138 | TCB *tcb;
|
---|
| 139 | int_t ix, st, sx;
|
---|
| 140 |
|
---|
| 141 | WAI_NET_CONS_PRINTF();
|
---|
| 142 | cons_printf(portid,
|
---|
| 143 | "TASK Status\n"
|
---|
| 144 | "ID PI State\n");
|
---|
| 145 | for (ix = TMIN_TSKID; ix <= tmax_tskid; ix ++) {
|
---|
| 146 | tcb = get_tcb(ix);
|
---|
| 147 | cons_printf(portid, "%2d %2d ", ix, tcb->priority);
|
---|
| 148 | st = tcb->tstat;
|
---|
| 149 | for (sx = 0; st; sx ++) {
|
---|
| 150 | if (st & 0x01) {
|
---|
| 151 | cons_printf(portid, "%s", task_stat_str[sx]);
|
---|
| 152 | if (st & 0xfe)
|
---|
| 153 | cons_printf(portid, "|");
|
---|
| 154 | }
|
---|
| 155 | st >>= 1;
|
---|
| 156 | }
|
---|
| 157 | cons_putchar(portid, '\n');
|
---|
| 158 | }
|
---|
| 159 |
|
---|
| 160 | SIG_NET_CONS_PRINTF();
|
---|
| 161 | FLUSH_SND_BUFF();
|
---|
| 162 | }
|
---|
| 163 |
|
---|
| 164 | #ifdef SUPPORT_TCP
|
---|
| 165 |
|
---|
| 166 | /*
|
---|
| 167 | * tcp_status -- TCP の状態の出力
|
---|
| 168 | */
|
---|
| 169 |
|
---|
| 170 | static const char tcp_fsm_str[][sizeof("ESTABLISHED")] = {
|
---|
| 171 | "CLOSED", /* クローズ */
|
---|
| 172 | "LISTEN", /* 受動オープン */
|
---|
| 173 | "SYN_SENT", /* 能動オープン、SYN 送信済み */
|
---|
| 174 | "SYN_RECVD", /* 受動オープン、SYN 受信済み */
|
---|
| 175 | "ESTABLISHED", /* コネクション開設完了 */
|
---|
| 176 | "CLOSE_WAIT", /* 相手から FIN 受信、APP の終了待ち */
|
---|
| 177 | "FIN_WAIT_1", /* APP が終了、FIN 送信済み、ACK 待ち */
|
---|
| 178 | "CLOSING", /* 同時クローズ、FIN 交換済み、ACK 待ち */
|
---|
| 179 | "LAST_ACK", /* APP が終了、ACK 待ち */
|
---|
| 180 | "FIN_WAIT_2", /* 相手からの FIN 待ち */
|
---|
| 181 | "TIME_WAIT", /* 相手からの FIN 受信済み、時間待ち */
|
---|
| 182 | };
|
---|
| 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 |
|
---|
| 238 | #if defined(SUPPORT_INET4)
|
---|
| 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 |
|
---|
| 316 | static void
|
---|
| 317 | tcp_cep_status (ID portid, char *line)
|
---|
| 318 | {
|
---|
| 319 | T_TCP_CEP* cep;
|
---|
| 320 | uint_t len;
|
---|
| 321 |
|
---|
| 322 | #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0
|
---|
| 323 |
|
---|
| 324 | T_TCP_TWCEP* twcep;
|
---|
| 325 |
|
---|
| 326 | #endif /* of #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 */
|
---|
| 327 |
|
---|
| 328 | cons_printf(portid,
|
---|
| 329 | "TCP CEP Status\n"
|
---|
| 330 | "ID Snd-Q Rcv-Q Local Address Foreign Address State\n");
|
---|
| 331 |
|
---|
| 332 | for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++)
|
---|
| 333 | if (!VALID_TCP_CEP(cep)) {
|
---|
| 334 | cons_printf(portid,
|
---|
| 335 | "%2d%c%c 0 0"
|
---|
| 336 | " - "
|
---|
| 337 | " - "
|
---|
| 338 | " INVALID\n",
|
---|
| 339 | GET_TCP_CEPID(cep),
|
---|
| 340 | DYNAMIC_TCP_CEP(cep) ? 'D' : '.',
|
---|
| 341 | TCP_IS_CEP_IPV6(cep) ? '6' : '4');
|
---|
| 342 | }
|
---|
| 343 | else if (cep->fsm_state == TCP_FSM_CLOSED) {
|
---|
| 344 | cons_printf(portid,
|
---|
| 345 | "%2d%c%c 0 0"
|
---|
| 346 | " - "
|
---|
| 347 | " - "
|
---|
| 348 | " CLOSED\n",
|
---|
| 349 | GET_TCP_CEPID(cep),
|
---|
| 350 | DYNAMIC_TCP_CEP(cep) ? 'D' : '.',
|
---|
| 351 | TCP_IS_CEP_IPV6(cep) ? '6' : '4');
|
---|
| 352 | }
|
---|
| 353 | else if (cep->fsm_state == TCP_FSM_LISTEN) {
|
---|
| 354 | cons_printf(portid,
|
---|
| 355 | "%2d%c%c 0 0 ",
|
---|
| 356 | GET_TCP_CEPID(cep),
|
---|
| 357 | DYNAMIC_TCP_CEP(cep) ? 'D' : '.',
|
---|
| 358 | TCP_IS_CEP_IPV6(cep) ? '6' : '4');
|
---|
| 359 | len = PUT_IPADDR(portid, &cep->myaddr.ipaddr, 0);
|
---|
| 360 | cons_putchar(portid, ':');
|
---|
| 361 | len += cons_putnumber(portid, cep->myaddr.portno, 10, radhex, 0, false, ' ');
|
---|
| 362 | for (len = 20 - len; len -- > 0; )
|
---|
| 363 | cons_putchar(portid, ' ');
|
---|
| 364 | cons_printf(portid,
|
---|
| 365 | " - "
|
---|
| 366 | " LISTEN\n");
|
---|
| 367 | }
|
---|
| 368 | else {
|
---|
| 369 | cons_printf(portid,
|
---|
| 370 | "%2d%c %5d %5d ",
|
---|
| 371 | GET_TCP_CEPID(cep),
|
---|
| 372 | DYNAMIC_TCP_CEP(cep) ? 'D' : ' ',
|
---|
| 373 | cep->swbuf_count, cep->rwbuf_count);
|
---|
| 374 | len = PUT_IPADDR(portid, &cep->myaddr.ipaddr, 0);
|
---|
| 375 | cons_putchar(portid, ':');
|
---|
| 376 | len += cons_putnumber(portid, cep->myaddr.portno, 10, radhex, 0, false, ' ');
|
---|
| 377 | for (len = 21 - len; len -- > 0; )
|
---|
| 378 | cons_putchar(portid, ' ');
|
---|
| 379 | len = PUT_IPADDR(portid, &cep->dstaddr.ipaddr, 0);
|
---|
| 380 | cons_putchar(portid, ':');
|
---|
| 381 | len += cons_putnumber(portid, cep->dstaddr.portno, 10, radhex, 0, false, ' ');
|
---|
| 382 | for (len = 20 - len; len -- > 0; )
|
---|
| 383 | cons_putchar(portid, ' ');
|
---|
| 384 | if (cep->fsm_state == TCP_FSM_TIME_WAIT)
|
---|
| 385 | cons_printf(portid, " %s(%d)\n", tcp_fsm_str[cep->fsm_state],
|
---|
| 386 | cep->timer[TCP_TIM_2MSL] / TCP_SLOW_HZ);
|
---|
| 387 | else
|
---|
| 388 | cons_printf(portid, " %s\n", tcp_fsm_str[cep->fsm_state]);
|
---|
| 389 | }
|
---|
| 390 |
|
---|
| 391 | #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0
|
---|
| 392 |
|
---|
| 393 | for (twcep = tcp_twcep; twcep < &tcp_twcep[NUM_TCP_TW_CEP_ENTRY]; twcep ++) {
|
---|
| 394 | if (twcep->fsm_state == TCP_FSM_CLOSED) {
|
---|
| 395 | cons_printf(portid,
|
---|
| 396 | "%2dTW 0 0"
|
---|
| 397 | " - "
|
---|
| 398 | " - "
|
---|
| 399 | " CLOSED\n",
|
---|
| 400 | GET_TCP_TWCEPID(twcep));
|
---|
| 401 | }
|
---|
| 402 | else {
|
---|
| 403 | cons_printf(portid, "%2dTW 0 0 ", GET_TCP_TWCEPID(twcep));
|
---|
| 404 | len = PUT_IPADDR(portid, &twcep->myaddr.ipaddr, 0);
|
---|
| 405 | cons_putchar(portid, ':');
|
---|
| 406 | len += cons_putnumber(portid, twcep->myaddr.portno, 10, radhex, 0, false, ' ');
|
---|
| 407 | for (len = 21 - len; len -- > 0; )
|
---|
| 408 | cons_putchar(portid, ' ');
|
---|
| 409 | len = PUT_IPADDR(portid, &twcep->dstaddr.ipaddr, 0);
|
---|
| 410 | cons_putchar(portid, ':');
|
---|
| 411 | len += cons_putnumber(portid, twcep->dstaddr.portno, 10, radhex, 0, false, ' ');
|
---|
| 412 | for (len = 20 - len; len -- > 0; )
|
---|
| 413 | cons_putchar(portid, ' ');
|
---|
| 414 | if (twcep->fsm_state == TCP_FSM_TIME_WAIT)
|
---|
| 415 | cons_printf(portid, " %s(%d)\n", tcp_fsm_str[twcep->fsm_state],
|
---|
| 416 | twcep->timer_2msl / TCP_SLOW_HZ);
|
---|
| 417 | else
|
---|
| 418 | cons_printf(portid, " %s\n", tcp_fsm_str[twcep->fsm_state]);
|
---|
| 419 | }
|
---|
| 420 | }
|
---|
| 421 |
|
---|
| 422 | #endif /* of #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 */
|
---|
| 423 |
|
---|
| 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;
|
---|
| 440 |
|
---|
| 441 | cons_printf(portid,
|
---|
| 442 | "TCP6 REP Status\n"
|
---|
| 443 | "ID Local Address CEP\n");
|
---|
| 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' : ' ');
|
---|
| 447 | if (VALID_TCP_REP(rep)) {
|
---|
| 448 | len = PUT_IPADDR(portid, &rep->myaddr.ipaddr, 0);
|
---|
| 449 | cons_putchar(portid, '.');
|
---|
| 450 | len += cons_putnumber(portid, rep->myaddr.portno, 10, radhex, 0, false, ' ');
|
---|
| 451 | for (len = 21 - len; len -- > 0; )
|
---|
| 452 | cons_putchar(portid, ' ');
|
---|
| 453 | cnt = 0;
|
---|
| 454 | for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++) {
|
---|
| 455 | if (TCP_IS_CEP_IPV6(cep) && cep->rep == rep) {
|
---|
| 456 | if (cnt > 0)
|
---|
| 457 | cons_printf(portid, ",%d", GET_TCP_CEPID(cep));
|
---|
| 458 | else
|
---|
| 459 | cons_printf(portid, "%d", GET_TCP_CEPID(cep));
|
---|
| 460 | cnt ++;
|
---|
| 461 | }
|
---|
| 462 | }
|
---|
| 463 | }
|
---|
| 464 | else
|
---|
| 465 | cons_printf(portid, "INVALID");
|
---|
| 466 | cons_putchar(portid, '\n');
|
---|
| 467 | }
|
---|
| 468 | }
|
---|
| 469 |
|
---|
| 470 | #endif /* of #if TNUM_TCP6_REPID > 0 */
|
---|
| 471 |
|
---|
| 472 | #if TNUM_TCP4_REPID > 0
|
---|
| 473 |
|
---|
| 474 | static void
|
---|
| 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;
|
---|
| 481 | uint_t len;
|
---|
| 482 |
|
---|
| 483 | cons_printf(portid,
|
---|
| 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 | }
|
---|
| 515 | }
|
---|
| 516 | else
|
---|
| 517 | cons_printf(portid, "INVALID");
|
---|
| 518 | cons_putchar(portid, '\n');
|
---|
| 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
|
---|
| 538 |
|
---|
| 539 | SIG_NET_CONS_PRINTF();
|
---|
| 540 | FLUSH_SND_BUFF();
|
---|
| 541 | }
|
---|
| 542 |
|
---|
| 543 | #endif /* of #ifdef SUPPORT_TCP */
|
---|
| 544 |
|
---|
| 545 | #ifdef SUPPORT_UDP
|
---|
| 546 |
|
---|
| 547 | /*
|
---|
| 548 | * udp6_status -- UDP の状態の出力
|
---|
| 549 | */
|
---|
| 550 |
|
---|
| 551 | #if TNUM_UDP6_CEPID > 0
|
---|
| 552 |
|
---|
| 553 | extern const ID tmax_tcp_cepid;
|
---|
| 554 |
|
---|
| 555 | static void
|
---|
| 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 | {
|
---|
| 622 | WAI_NET_CONS_PRINTF();
|
---|
| 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
|
---|
| 631 |
|
---|
| 632 | SIG_NET_CONS_PRINTF();
|
---|
| 633 | FLUSH_SND_BUFF();
|
---|
| 634 | }
|
---|
| 635 |
|
---|
| 636 | #endif /* of #ifdef SUPPORT_UDP */
|
---|
| 637 |
|
---|
| 638 | #ifdef SUPPORT_ETHER
|
---|
| 639 |
|
---|
| 640 | #if defined(SUPPORT_INET6)
|
---|
| 641 |
|
---|
| 642 | /*
|
---|
| 643 | * ifa6_status -- 近隣キャッシュ状態の出力
|
---|
| 644 | */
|
---|
| 645 |
|
---|
| 646 | static const char nd_state_str[][sizeof("INCOMPLETE")] = {
|
---|
| 647 | "FREE", /* 未使用 */
|
---|
| 648 | "NO STATE", /* 状態未定義 */
|
---|
| 649 | "INCOMPLETE", /* 未解決 */
|
---|
| 650 | "REACHABLE", /* 到達可能 */
|
---|
| 651 | "STALE", /* 到達可能性は未確認 */
|
---|
| 652 | "DELAY", /* 到達可能性の確認待機 */
|
---|
| 653 | "PROBE", /* 到達可能性を確認中 */
|
---|
| 654 | };
|
---|
| 655 |
|
---|
| 656 | static void
|
---|
| 657 | ifa6_status (ID portid, char *line)
|
---|
| 658 | {
|
---|
| 659 | const T_LLINFO_ND6 *cache;
|
---|
| 660 | SYSTIM now;
|
---|
| 661 | int_t ix;
|
---|
| 662 |
|
---|
| 663 | WAI_NET_CONS_PRINTF();
|
---|
| 664 | cons_printf(portid,
|
---|
| 665 | "ND Cache Status\n"
|
---|
| 666 | "IX Expire State MAC Address IP Address\n");
|
---|
| 667 |
|
---|
[364] | 668 | /* expire の単位は [us]。*/
|
---|
[337] | 669 | get_tim(&now);
|
---|
| 670 | cache = nd6_get_cache();
|
---|
| 671 | for (ix = 0; ix < NUM_ND6_CACHE_ENTRY; ix ++) {
|
---|
| 672 | if (cache[ix].state != ND6_LLINFO_FREE) {
|
---|
| 673 | cons_printf(portid, "%2d %6ld %10s %M %lI\n",
|
---|
| 674 | ix,
|
---|
| 675 | cache[ix].state == ND6_LLINFO_STALE ||
|
---|
| 676 | (uint32_t)((int32_t)(cache[ix].expire - now) <= 0
|
---|
| 677 | ? 0 : (int32_t)(cache[ix].expire - now) / SYSTIM_HZ),
|
---|
| 678 | nd_state_str[cache[ix].state],
|
---|
| 679 | &cache[ix].ifaddr,
|
---|
| 680 | &cache[ix].addr);
|
---|
| 681 | }
|
---|
| 682 | }
|
---|
| 683 |
|
---|
| 684 | SIG_NET_CONS_PRINTF();
|
---|
| 685 | FLUSH_SND_BUFF();
|
---|
| 686 | }
|
---|
| 687 |
|
---|
| 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 |
|
---|
[364] | 707 | /* expire の単位は [us]。*/
|
---|
[337] | 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) */
|
---|
| 721 |
|
---|
| 722 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
| 723 |
|
---|
| 724 | #if NET_COUNT_ENABLE
|
---|
| 725 |
|
---|
| 726 | /*
|
---|
| 727 | * net_count_struct -- ネットワーク統計情報
|
---|
| 728 | */
|
---|
| 729 |
|
---|
| 730 | static void
|
---|
| 731 | net_count_struct (ID portid, char *name, T_NET_COUNT *item)
|
---|
| 732 | {
|
---|
| 733 | cons_printf(portid, "\n%s\n", name);
|
---|
| 734 | cons_printf(portid, "\t受信オクテット数\t%lu\n", item->in_octets);
|
---|
| 735 | cons_printf(portid, "\t送信オクテット数\t%lu\n", item->out_octets);
|
---|
| 736 | cons_printf(portid, "\t受信バケット数\t%lu\n", item->in_packets);
|
---|
| 737 | cons_printf(portid, "\t送信バケット数\t%lu\n", item->out_packets);
|
---|
| 738 | cons_printf(portid, "\t受信エラーバケット数\t%lu\n", item->in_err_packets);
|
---|
| 739 | cons_printf(portid, "\t送信エラーバケット数\t%lu\n", item->out_err_packets);
|
---|
| 740 | }
|
---|
| 741 |
|
---|
| 742 | /*
|
---|
| 743 | * net_count -- ネットワーク統計情報
|
---|
| 744 | */
|
---|
| 745 |
|
---|
| 746 | static void
|
---|
| 747 | net_count (ID portid, char *line)
|
---|
| 748 | {
|
---|
| 749 | const T_NET_BUF_ENTRY *tbl;
|
---|
| 750 | SYSTIM now;
|
---|
| 751 | int_t ix;
|
---|
| 752 |
|
---|
| 753 | WAI_NET_CONS_PRINTF();
|
---|
| 754 | get_tim(&now);
|
---|
[364] | 755 | cons_printf(portid, "ネットワーク統計情報\t経過時間[us]\t%lu\t", now);
|
---|
[337] | 756 | if (now > (1000 * 3600 * 24))
|
---|
| 757 | cons_printf(portid, "%3lu日 %2lu時間 %2lu分 %2lu秒\n",
|
---|
| 758 | now / (1000 * 3600 * 24),
|
---|
| 759 | (now / (1000 * 3600)) % 24,
|
---|
| 760 | (now / (1000 * 60 )) % 60,
|
---|
| 761 | (now / 1000 ) % 60);
|
---|
| 762 | else
|
---|
| 763 | cons_printf(portid, "%2lu時間 %2lu分 %2lu秒\n",
|
---|
| 764 | (now / (1000 * 3600)) % 24,
|
---|
| 765 | (now / (1000 * 60 )) % 60,
|
---|
| 766 | (now / 1000 ) % 60);
|
---|
| 767 |
|
---|
| 768 | #ifdef SUPPORT_PPP
|
---|
| 769 |
|
---|
| 770 | net_count_struct(portid, "HDLC", &net_count_hdlc);
|
---|
| 771 | cons_printf(portid, "\nPPP\n");
|
---|
| 772 | cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ppp.in_octets);
|
---|
| 773 | cons_printf(portid, "\t送信オクテット数\t%lu\n", net_count_ppp.out_octets);
|
---|
| 774 | cons_printf(portid, "\t受信バケット数\t%lu\n", net_count_ppp.in_packets);
|
---|
| 775 | cons_printf(portid, "\t送信バケット数\t%lu\n", net_count_ppp.out_packets);
|
---|
| 776 | cons_printf(portid, "\t受信エラーバケット数\t%lu\n", net_count_ppp.in_err_packets);
|
---|
| 777 | cons_printf(portid, "\t送信エラーバケット数\t%lu\n", net_count_ppp.out_err_packets);
|
---|
| 778 | cons_printf(portid, "\tnet_buf 割り当て失敗数\t%lu\n", net_count_ppp_no_bufs);
|
---|
| 779 |
|
---|
| 780 | cons_printf(portid, "\nLCP\n");
|
---|
| 781 | cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ppp_lcp_in_octets);
|
---|
| 782 | cons_printf(portid, "\t受信バケット数\t%lu\n", net_count_ppp_lcp_in_packets);
|
---|
| 783 |
|
---|
| 784 | cons_printf(portid, "\nIPCP\n");
|
---|
| 785 | cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ppp_ipcp_in_octets);
|
---|
| 786 | cons_printf(portid, "\t受信バケット数\t%lu\n", net_count_ppp_ipcp_in_packets);
|
---|
| 787 |
|
---|
| 788 | cons_printf(portid, "\nPAP\n");
|
---|
| 789 | cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ppp_upap_in_octets);
|
---|
| 790 | cons_printf(portid, "\t受信バケット数\t%lu\n", net_count_ppp_upap_in_packets);
|
---|
| 791 |
|
---|
| 792 | #endif /* of #ifdef SUPPORT_PPP */
|
---|
| 793 |
|
---|
| 794 | #ifdef SUPPORT_ETHER
|
---|
| 795 |
|
---|
| 796 | net_count_struct(portid, "イーサネット", &net_count_ether);
|
---|
| 797 |
|
---|
| 798 | cons_printf(portid, "\nイーサネット・ネットワークインタフェース\n");
|
---|
| 799 | cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_IN_OCTETS]);
|
---|
| 800 | cons_printf(portid, "\t受信バケット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_IN_PACKETS]);
|
---|
| 801 | cons_printf(portid, "\t受信エラーバケット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_IN_ERR_PACKETS]);
|
---|
| 802 | cons_printf(portid, "\tnet_buf 割り当て失敗数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_NO_BUFS]);
|
---|
| 803 | cons_printf(portid, "\t受信セマフォ資源返却上限オーバー数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_RXB_QOVRS]);
|
---|
| 804 | cons_printf(portid, "\t送信オクテット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_OUT_OCTETS]);
|
---|
| 805 | cons_printf(portid, "\t送信バケット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_OUT_PACKETS]);
|
---|
| 806 | cons_printf(portid, "\t送信エラーバケット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_OUT_ERR_PACKETS]);
|
---|
| 807 | cons_printf(portid, "\tコリジョン数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_COLS]);
|
---|
| 808 | cons_printf(portid, "\t送信セマフォ資源返却上限オーバー数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_TXB_QOVRS]);
|
---|
| 809 | cons_printf(portid, "\t送信タイムアウト数 \t%lu\n", net_count_ether_nic[NC_ETHER_NIC_TIMEOUTS]);
|
---|
| 810 | cons_printf(portid, "\tリセット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_RESETS]);
|
---|
| 811 |
|
---|
| 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) */
|
---|
| 855 |
|
---|
| 856 | #if defined(SUPPORT_INET4)
|
---|
| 857 |
|
---|
| 858 | #ifdef SUPPORT_ETHER
|
---|
| 859 |
|
---|
| 860 | net_count_struct(portid, "ARP", &net_count_arp);
|
---|
| 861 |
|
---|
| 862 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
| 863 |
|
---|
| 864 | cons_printf(portid, "\nIPv4\n");
|
---|
| 865 | cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ip4[NC_IP4_IN_OCTETS]);
|
---|
| 866 | cons_printf(portid, "\t受信データグラム数\t%lu\n", net_count_ip4[NC_IP4_IN_PACKETS]);
|
---|
| 867 | cons_printf(portid, "\t受信エラーデータグラム数\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_PACKETS]);
|
---|
| 868 | cons_printf(portid, "\tチェックサムエラー数\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_CKSUM]);
|
---|
| 869 | cons_printf(portid, "\t長さエラー数\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_SHORT]);
|
---|
| 870 | cons_printf(portid, "\tバージョンエラー数\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_VER]);
|
---|
| 871 | cons_printf(portid, "\tアドレスエラー数\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_ADDR]);
|
---|
| 872 | cons_printf(portid, "\tプロトコルエラー数\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_PROTO]);
|
---|
| 873 | cons_printf(portid, "\tオプション入力数\t%lu\n", net_count_ip4[NC_IP4_OPTS]);
|
---|
| 874 | cons_printf(portid, "\t分割受信数\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN]);
|
---|
| 875 | cons_printf(portid, "\t分割受信フラグメント数\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN_FRAGS]);
|
---|
| 876 | cons_printf(portid, "\t分割受信再構成成功数\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN_OK]);
|
---|
| 877 | cons_printf(portid, "\t分割受信破棄数\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN_DROP]);
|
---|
| 878 | cons_printf(portid, "\t分割受信バッファり当て失敗数\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN_NO_BUF]);
|
---|
| 879 | cons_printf(portid, "\t分割受信タイムアウト数\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN_TMOUT]);
|
---|
| 880 | cons_printf(portid, "\t送信オクテット数\t%lu\n", net_count_ip4[NC_IP4_OUT_OCTETS]);
|
---|
| 881 | cons_printf(portid, "\t送信データグラム数\t%lu\n", net_count_ip4[NC_IP4_OUT_PACKETS]);
|
---|
| 882 | cons_printf(portid, "\t送信エラーデータグラム数\t%lu\n", net_count_ip4[NC_IP4_OUT_ERR_PACKETS]);
|
---|
| 883 | cons_printf(portid, "\t分割送信数\t%lu\n", net_count_ip4[NC_IP4_FRAG_OUT]);
|
---|
| 884 | cons_printf(portid, "\t分割送信フラグメント数\t%lu\n", net_count_ip4[NC_IP4_FRAG_OUT_FRAGS]);
|
---|
| 885 |
|
---|
| 886 | net_count_struct(portid, "ICMP", &net_count_icmp4);
|
---|
| 887 |
|
---|
| 888 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
| 889 |
|
---|
| 890 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
| 891 |
|
---|
| 892 | #ifdef SUPPORT_TCP
|
---|
| 893 |
|
---|
| 894 | cons_printf(portid, "\nTCP\n");
|
---|
| 895 | cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_tcp[NC_TCP_RECV_OCTETS]);
|
---|
| 896 | cons_printf(portid, "\t受信データオクテット数\t%lu\n", net_count_tcp[NC_TCP_RECV_DATA_OCTETS]);
|
---|
| 897 | cons_printf(portid, "\t受信セグメント数\t%lu\n", net_count_tcp[NC_TCP_RECV_SEGS]);
|
---|
| 898 | cons_printf(portid, "\t受信データセグメント数\t%lu\n", net_count_tcp[NC_TCP_RECV_DATA_SEGS]);
|
---|
| 899 | cons_printf(portid, "\t受信、緊急セグメント数\t%lu\n", net_count_tcp[NC_TCP_RECV_URG_SEGS]);
|
---|
| 900 | cons_printf(portid, "\t受信、ヘッダ不正数\t%lu\n", net_count_tcp[NC_TCP_RECV_BAD_HEADERS]);
|
---|
| 901 | cons_printf(portid, "\t受信、チェックサム不正数\t%lu\n", net_count_tcp[NC_TCP_RECV_BAD_CKSUMS]);
|
---|
| 902 | cons_printf(portid, "\t受信、ACK 数\t%lu\n", net_count_tcp[NC_TCP_RECV_ACKS]);
|
---|
| 903 | cons_printf(portid, "\t受信、多重 ACK 数\t%lu\n", net_count_tcp[NC_TCP_RECV_DUP_ACKS]);
|
---|
| 904 | cons_printf(portid, "\t受信、RST 数\t%lu\n", net_count_tcp[NC_TCP_RECV_RSTS]);
|
---|
| 905 | cons_printf(portid, "\t受信、多重数\t%lu\n", net_count_tcp[NC_TCP_RECV_DUP_SEGS]);
|
---|
| 906 | cons_printf(portid, "\t受信、破棄数\t%lu\n", net_count_tcp[NC_TCP_RECV_DROP_SEGS]);
|
---|
| 907 | cons_printf(portid, "\t受信キュー解放数\t%lu\n", net_count_tcp[NC_TCP_FREE_RCV_QUEUE]);
|
---|
| 908 | cons_printf(portid, "\t送信データオクテット数\t%lu\n", net_count_tcp[NC_TCP_SEND_DATA_OCTETS]);
|
---|
| 909 | cons_printf(portid, "\t送信制御セグメント数\t%lu\n", net_count_tcp[NC_TCP_SEND_CNTL_SEGS]);
|
---|
| 910 | cons_printf(portid, "\t送信セグメント数\t%lu\n", net_count_tcp[NC_TCP_SEND_SEGS]);
|
---|
| 911 | cons_printf(portid, "\t再送信セグメント数\t%lu\n", net_count_tcp[NC_TCP_SEND_REXMIT_SEGS]);
|
---|
| 912 | cons_printf(portid, "\t送信データセグメント数\t%lu\n", net_count_tcp[NC_TCP_SEND_DATA_SEGS]);
|
---|
| 913 | cons_printf(portid, "\t送信、緊急セグメント数\t%lu\n", net_count_tcp[NC_TCP_SEND_URG_SEGS]);
|
---|
| 914 | cons_printf(portid, "\t送信、ACK 数\t%lu\n", net_count_tcp[NC_TCP_SEND_ACKS]);
|
---|
| 915 | cons_printf(portid, "\t送信、RST 数\t%lu\n", net_count_tcp[NC_TCP_SEND_RSTS]);
|
---|
| 916 | cons_printf(portid, "\tRTT 更新数\t%lu\n", net_count_tcp[NC_TCP_RTT_UPDATES]);
|
---|
| 917 | cons_printf(portid, "\t受動オープン数\t%lu\n", net_count_tcp[NC_TCP_ACCEPTS]);
|
---|
| 918 | cons_printf(portid, "\t能動オープン数\t%lu\n", net_count_tcp[NC_TCP_CONNECTS]);
|
---|
| 919 |
|
---|
| 920 | #endif /* of #ifdef SUPPORT_TCP */
|
---|
| 921 |
|
---|
| 922 | #ifdef SUPPORT_UDP
|
---|
| 923 |
|
---|
| 924 | net_count_struct(portid, "UDP", &net_count_udp);
|
---|
| 925 |
|
---|
| 926 | #endif /* of #ifdef SUPPORT_UDP */
|
---|
| 927 |
|
---|
| 928 | tbl = nbuf_get_tbl();
|
---|
| 929 | cons_printf(portid, "\nネットワークバッファ\n\tサイズ\t用意数\t使用中数\t割当要求数\t割当数\t割当てエラー数\n");
|
---|
| 930 | for (ix = nbuf_get_tbl_size(); ix -- > 0; ) {
|
---|
| 931 | cons_printf(portid, "\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\n",
|
---|
| 932 | tbl[ix].size,
|
---|
| 933 | tbl[ix].prepares,
|
---|
| 934 | tbl[ix].busies,
|
---|
| 935 | tbl[ix].requests,
|
---|
| 936 | tbl[ix].allocs,
|
---|
| 937 | tbl[ix].errors);
|
---|
| 938 | }
|
---|
| 939 |
|
---|
[364] | 940 | cons_printf(portid, "\nネットワーク統計情報\t経過時間[us]\t%lu\t", now);
|
---|
[337] | 941 | if (now > (1000 * 3600 * 24))
|
---|
| 942 | cons_printf(portid, "%3lu日 %2lu時間 %2lu分 %2lu秒\n",
|
---|
| 943 | now / (1000 * 3600 * 24),
|
---|
| 944 | (now / (1000 * 3600)) % 24,
|
---|
| 945 | (now / (1000 * 60 )) % 60,
|
---|
| 946 | (now / 1000 ) % 60);
|
---|
| 947 | else
|
---|
| 948 | cons_printf(portid, "%2lu時間 %2lu分 %2lu秒\n",
|
---|
| 949 | (now / (1000 * 3600)) % 24,
|
---|
| 950 | (now / (1000 * 60 )) % 60,
|
---|
| 951 | (now / 1000 ) % 60);
|
---|
| 952 |
|
---|
| 953 | SIG_NET_CONS_PRINTF();
|
---|
| 954 | FLUSH_SND_BUFF();
|
---|
| 955 | }
|
---|
| 956 |
|
---|
| 957 | #if defined(SUPPORT_INET4)
|
---|
| 958 |
|
---|
| 959 | #ifdef IP4_CFG_FRAGMENT
|
---|
| 960 |
|
---|
| 961 | /*
|
---|
| 962 | * nbuf_stat_ip4_frag_queue -- IPv4 再構成キュー内ネットワークバッファ情報
|
---|
| 963 | */
|
---|
| 964 |
|
---|
| 965 | static void
|
---|
| 966 | nbuf_stat_ip4_frag_queue (ID portid)
|
---|
| 967 | {
|
---|
| 968 | const T_NET_BUF_ENTRY *tbl;
|
---|
| 969 | const T_NET_BUF *nbuf, **queue;
|
---|
| 970 | int_t ix, fix, count;
|
---|
| 971 |
|
---|
| 972 | cons_printf(portid, "\nIPv4再構成キュー内\nIndex\tTime");
|
---|
| 973 | tbl = nbuf_get_tbl();
|
---|
| 974 | for (ix = nbuf_get_tbl_size(); ix -- > 0; )
|
---|
| 975 | cons_printf(portid, "\t%d", tbl[ix].size);
|
---|
| 976 | cons_putchar(portid, '\n');
|
---|
| 977 |
|
---|
| 978 | queue = ip_get_frag_queue();
|
---|
| 979 | for (fix = 0; fix < NUM_IP4_FRAG_QUEUE; fix ++) {
|
---|
| 980 | if (queue[fix] != NULL) {
|
---|
| 981 | cons_printf(portid, "%d\t%d", fix, GET_QIP4_HDR(queue[fix])->ttl);
|
---|
| 982 | for (ix = nbuf_get_tbl_size(); ix -- > 0; ) {
|
---|
| 983 | count = 0;
|
---|
| 984 | for (nbuf = queue[fix]; nbuf != NULL; nbuf = GET_QIP4_HDR(nbuf)->next)
|
---|
| 985 | if (nbuf->idix == ix)
|
---|
| 986 | count ++;
|
---|
| 987 | cons_printf(portid, "\t%d", count);
|
---|
| 988 | }
|
---|
| 989 | cons_putchar(portid, '\n');
|
---|
| 990 | }
|
---|
| 991 | }
|
---|
| 992 | }
|
---|
| 993 |
|
---|
| 994 | #endif /* of #ifdef IP4_CFG_FRAGMENT */
|
---|
| 995 |
|
---|
| 996 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
| 997 |
|
---|
| 998 | #if defined(SUPPORT_INET6)
|
---|
| 999 |
|
---|
| 1000 | #ifdef IP6_CFG_FRAGMENT
|
---|
| 1001 |
|
---|
| 1002 | /*
|
---|
| 1003 | * nbuf_stat_ip6_frag_queue -- IPv6 再構成キュー内ネットワークバッファ情報
|
---|
| 1004 | */
|
---|
| 1005 |
|
---|
| 1006 | static void
|
---|
| 1007 | nbuf_stat_ip6_frag_queue (ID portid)
|
---|
| 1008 | {
|
---|
| 1009 | const T_NET_BUF_ENTRY *tbl;
|
---|
| 1010 | const T_NET_BUF *nbuf, **queue;
|
---|
| 1011 | int_t ix, fix, count;
|
---|
| 1012 |
|
---|
| 1013 | cons_printf(portid, "\nIPv6再構成キュー内\nIndex\tTime");
|
---|
| 1014 | tbl = nbuf_get_tbl();
|
---|
| 1015 | for (ix = nbuf_get_tbl_size(); ix -- > 0; )
|
---|
| 1016 | cons_printf(portid, "\t%d", tbl[ix].size);
|
---|
| 1017 | cons_putchar(portid, '\n');
|
---|
| 1018 |
|
---|
| 1019 | queue = ip6_get_frag_queue();
|
---|
| 1020 | for (fix = 0; fix < NUM_IP6_FRAG_QUEUE; fix ++) {
|
---|
| 1021 | if (queue[fix] != NULL) {
|
---|
| 1022 | cons_printf(portid, "%d\t%d", fix, GET_QIP6_HDR(queue[fix])->ftim);
|
---|
| 1023 | for (ix = nbuf_get_tbl_size(); ix -- > 0; ) {
|
---|
| 1024 | count = 0;
|
---|
| 1025 | for (nbuf = queue[fix]; nbuf != NULL; nbuf = GET_QIP6_HDR(nbuf)->next_frag)
|
---|
| 1026 | if (nbuf->idix == ix)
|
---|
| 1027 | count ++;
|
---|
| 1028 | cons_printf(portid, "\t%d", count);
|
---|
| 1029 | }
|
---|
| 1030 | cons_putchar(portid, '\n');
|
---|
| 1031 | }
|
---|
| 1032 | }
|
---|
| 1033 | }
|
---|
| 1034 |
|
---|
| 1035 | #endif /* of #ifdef IP6_CFG_FRAGMENT */
|
---|
| 1036 |
|
---|
| 1037 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
| 1038 |
|
---|
| 1039 | #endif /* of #if NET_COUNT_ENABLE */
|
---|
| 1040 |
|
---|
| 1041 | /*
|
---|
| 1042 | * nbuf_status -- ネットワークバッファ情報
|
---|
| 1043 | */
|
---|
| 1044 |
|
---|
| 1045 | static void
|
---|
| 1046 | nbuf_status (ID portid, char *line)
|
---|
| 1047 | {
|
---|
| 1048 | SYSTIM now;
|
---|
| 1049 |
|
---|
| 1050 | #if NET_COUNT_ENABLE
|
---|
| 1051 | const T_NET_BUF_ENTRY *tbl;
|
---|
| 1052 | int_t ix;
|
---|
| 1053 | #endif /* of #if NET_COUNT_ENABLE */
|
---|
| 1054 |
|
---|
| 1055 | #ifdef SUPPORT_TCP
|
---|
| 1056 | T_NET_BUF *nbuf;
|
---|
| 1057 | T_TCP_CEP* cep;
|
---|
| 1058 | T_TCP_Q_HDR* tqhdr;
|
---|
| 1059 |
|
---|
| 1060 | #ifdef TCP_CFG_SWBUF_CSAVE
|
---|
| 1061 | T_TCP_HDR* tcph;
|
---|
| 1062 | #endif /* of #ifdef TCP_CFG_SWBUF_CSAVE */
|
---|
| 1063 | #endif /* of #ifdef SUPPORT_TCP */
|
---|
| 1064 |
|
---|
| 1065 | WAI_NET_CONS_PRINTF();
|
---|
| 1066 | get_tim(&now);
|
---|
[364] | 1067 | cons_printf(portid, "ネットワークバッファ情報\t経過時間[us]\t%u\n", now);
|
---|
[337] | 1068 |
|
---|
| 1069 | #if NET_COUNT_ENABLE
|
---|
| 1070 |
|
---|
| 1071 | cons_printf(portid, "\nネットワークバッファ\n\tサイズ\t用意数\t使用中数\t割当要求数\t割当数\t割当てエラー数\n");
|
---|
| 1072 | tbl = nbuf_get_tbl();
|
---|
| 1073 | for (ix = nbuf_get_tbl_size(); ix -- > 0; ) {
|
---|
| 1074 | cons_printf(portid, "\t%u\t%u\t%u\t%u\t%u\t%u\n",
|
---|
| 1075 | tbl[ix].size,
|
---|
| 1076 | tbl[ix].prepares,
|
---|
| 1077 | tbl[ix].busies,
|
---|
| 1078 | tbl[ix].requests,
|
---|
| 1079 | tbl[ix].allocs,
|
---|
| 1080 | tbl[ix].errors);
|
---|
| 1081 | }
|
---|
| 1082 |
|
---|
| 1083 | #endif /* of #if NET_COUNT_ENABLE */
|
---|
| 1084 |
|
---|
| 1085 | #ifdef SUPPORT_TCP
|
---|
| 1086 |
|
---|
| 1087 | cons_printf(portid, "\nCEP内\nCEPID\n");
|
---|
| 1088 |
|
---|
| 1089 | for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++) {
|
---|
| 1090 | cons_printf(portid, "%2d", GET_TCP_CEPID(cep));
|
---|
| 1091 | for (nbuf = cep->reassq; nbuf != NULL; nbuf = tqhdr->next) {
|
---|
| 1092 | tqhdr = GET_TCP_Q_HDR(nbuf, GET_TCP_HDR_OFFSET(nbuf));
|
---|
| 1093 | cons_printf(portid, "[a:%6lu-%6lu] ",
|
---|
| 1094 | ntohl(tqhdr->seq) - cep->irs + tqhdr->soff,
|
---|
| 1095 | ntohl(tqhdr->seq) - cep->irs + tqhdr->soff + tqhdr->slen);
|
---|
| 1096 | }
|
---|
| 1097 |
|
---|
| 1098 | #ifdef TCP_CFG_RWBUF_CSAVE
|
---|
| 1099 | for (nbuf = cep->rwbufq; nbuf != NULL; nbuf = tqhdr->next) {
|
---|
| 1100 | tqhdr = GET_TCP_Q_HDR(nbuf, GET_TCP_HDR_OFFSET(nbuf));
|
---|
| 1101 | cons_printf(portid, "[r:%6lu-%6lu] ",
|
---|
| 1102 | ntohl(tqhdr->seq) - cep->irs + tqhdr->soff,
|
---|
| 1103 | ntohl(tqhdr->seq) - cep->irs + tqhdr->soff + tqhdr->slen);
|
---|
| 1104 | }
|
---|
| 1105 | #endif /* of #ifdef TCP_CFG_RWBUF_CSAVE */
|
---|
| 1106 |
|
---|
| 1107 | #ifdef TCP_CFG_SWBUF_CSAVE
|
---|
| 1108 | if (cep->swbufq != NULL) {
|
---|
| 1109 | tcph = GET_TCP_HDR(cep->swbufq, GET_TCP_HDR_OFFSET(cep->swbufq));
|
---|
| 1110 | #if 0
|
---|
| 1111 | cons_printf(portid, "[s:%6lu-%6lu] ",
|
---|
| 1112 | ntohl(tcph->seq) - cep->iss,
|
---|
| 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
|
---|
| 1122 | }
|
---|
| 1123 | #endif /* of #ifdef TCP_CFG_SWBUF_CSAVE */
|
---|
| 1124 |
|
---|
| 1125 | cons_putchar(portid, '\n');
|
---|
| 1126 | }
|
---|
| 1127 |
|
---|
| 1128 | #endif /* of #ifdef SUPPORT_TCP */
|
---|
| 1129 |
|
---|
| 1130 | #if NET_COUNT_ENABLE
|
---|
| 1131 |
|
---|
| 1132 | #if defined(SUPPORT_INET4)
|
---|
| 1133 |
|
---|
| 1134 | #ifdef IP4_CFG_FRAGMENT
|
---|
| 1135 |
|
---|
| 1136 | nbuf_stat_ip4_frag_queue(portid);
|
---|
| 1137 |
|
---|
| 1138 | #endif /* of #ifdef IP4_CFG_FRAGMENT */
|
---|
| 1139 |
|
---|
| 1140 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
| 1141 |
|
---|
| 1142 | #if defined(SUPPORT_INET6)
|
---|
| 1143 |
|
---|
| 1144 | #ifdef IP6_CFG_FRAGMENT
|
---|
| 1145 |
|
---|
| 1146 | nbuf_stat_ip6_frag_queue(portid);
|
---|
| 1147 |
|
---|
| 1148 | #endif /* of #ifdef IP6_CFG_FRAGMENT */
|
---|
| 1149 |
|
---|
| 1150 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
| 1151 |
|
---|
| 1152 | #endif /* of #if NET_COUNT_ENABLE */
|
---|
| 1153 |
|
---|
| 1154 | SIG_NET_CONS_PRINTF();
|
---|
| 1155 | FLUSH_SND_BUFF();
|
---|
| 1156 | }
|
---|
| 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
|
---|
| 1294 | #if defined(SUPPORT_INET4)
|
---|
| 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 | }
|
---|
| 1326 |
|
---|
| 1327 | /*
|
---|
| 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 | };
|
---|
| 1339 |
|
---|
| 1340 | static void
|
---|
| 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 | {
|
---|
| 1497 | WAI_NET_CONS_PRINTF();
|
---|
| 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;
|
---|
| 1547 | }
|
---|
| 1548 |
|
---|
| 1549 | SIG_NET_CONS_PRINTF();
|
---|
| 1550 | FLUSH_SND_BUFF();
|
---|
| 1551 | }
|
---|
| 1552 |
|
---|
| 1553 | #endif /* of #if defined(DHCP6_CLI_CFG) || defined(DHCP4_CLI_CFG) */
|
---|
| 1554 |
|
---|
| 1555 | #if defined(SUPPORT_INET6)
|
---|
| 1556 |
|
---|
| 1557 | #if NUM_ND6_DEF_RTR_ENTRY > 0
|
---|
| 1558 |
|
---|
| 1559 | /*
|
---|
| 1560 | * defrtrlist_status -- ディフォルトルータ・リスト状態の出力
|
---|
| 1561 | */
|
---|
| 1562 |
|
---|
| 1563 | static void
|
---|
| 1564 | defrtrlist_status (ID portid, char *line)
|
---|
| 1565 | {
|
---|
| 1566 | const T_DEF_ROUTER *dr;
|
---|
| 1567 | SYSTIM now;
|
---|
| 1568 | int_t rix, pix, pcnt, ptitle;
|
---|
| 1569 | uint_t count, mask;
|
---|
| 1570 |
|
---|
| 1571 | WAI_NET_CONS_PRINTF();
|
---|
| 1572 | cons_printf(portid,
|
---|
| 1573 | "Default Router List Status\n"
|
---|
| 1574 | "IX Expire Lifetime flags prefix");
|
---|
| 1575 | for (ptitle = NUM_ND6_PREFIX_ENTRY * 2 - sizeof("prefix"); ptitle -- > 0; )
|
---|
| 1576 | cons_printf(portid, " ");
|
---|
| 1577 | cons_printf(portid, " IP Address\n");
|
---|
| 1578 |
|
---|
[364] | 1579 | /* expire の単位は [us]。*/
|
---|
[337] | 1580 | get_tim(&now);
|
---|
| 1581 | dr = nd6_get_drl(&count);
|
---|
| 1582 | for (rix = 0; rix < count; rix ++) {
|
---|
| 1583 | if (dr[rix].state == ND6_DEF_RTR_BUSY) {
|
---|
| 1584 | cons_printf(portid, "%2d", rix);
|
---|
| 1585 | if (dr[rix].lifetime == ND6_INFINITE_LIFETIME)
|
---|
| 1586 | cons_printf(portid, " INFIN INFIN");
|
---|
| 1587 | else
|
---|
| 1588 | cons_printf(portid, " %6d %8d",
|
---|
| 1589 | (uint32_t)(dr[rix].expire - now) <= 0
|
---|
| 1590 | ? 0 : (dr[rix].expire - now) / SYSTIM_HZ,
|
---|
| 1591 | dr[rix].lifetime / SYSTIM_HZ);
|
---|
| 1592 | cons_printf(portid, " %02x", dr[rix].flags);
|
---|
| 1593 | pcnt = NUM_ND6_PREFIX_ENTRY;
|
---|
| 1594 | ptitle = NUM_ND6_PREFIX_ENTRY * 2 - sizeof(" prefix");
|
---|
| 1595 | mask = 1;
|
---|
| 1596 | for (pix = 0; pix < NUM_ND6_PREFIX_ENTRY; pix ++) {
|
---|
| 1597 | if ((dr[rix].plistmap & mask) != 0) {
|
---|
| 1598 | if (pcnt == NUM_ND6_PREFIX_ENTRY)
|
---|
| 1599 | cons_printf(portid, " ");
|
---|
| 1600 | else
|
---|
| 1601 | cons_printf(portid, ",");
|
---|
| 1602 | cons_printf(portid, "%d", pix);
|
---|
| 1603 | pcnt --;
|
---|
| 1604 | ptitle -= 2;
|
---|
| 1605 | }
|
---|
| 1606 | mask <<= 1;
|
---|
| 1607 | }
|
---|
| 1608 | while (pcnt --) {
|
---|
| 1609 | cons_printf(portid, " ");
|
---|
| 1610 | ptitle -= 2;
|
---|
| 1611 | }
|
---|
| 1612 | while (ptitle -- > 0)
|
---|
| 1613 | cons_printf(portid, " ");
|
---|
| 1614 | cons_printf(portid, " %lI\n", &dr[rix].addr);
|
---|
| 1615 | }
|
---|
| 1616 | }
|
---|
| 1617 |
|
---|
| 1618 | SIG_NET_CONS_PRINTF();
|
---|
| 1619 | FLUSH_SND_BUFF();
|
---|
| 1620 | }
|
---|
| 1621 |
|
---|
| 1622 | /*
|
---|
| 1623 | * prefixlist_status -- プレフィックス・リスト状態の出力
|
---|
| 1624 | */
|
---|
| 1625 |
|
---|
| 1626 | static void
|
---|
| 1627 | prefixlist_status (ID portid, char *line)
|
---|
| 1628 | {
|
---|
| 1629 | const T_ND6_PREFIX *pr;
|
---|
| 1630 | SYSTIM now;
|
---|
| 1631 | int_t rix, pix, rcnt, rtitle;
|
---|
| 1632 | uint_t mask;
|
---|
| 1633 |
|
---|
| 1634 | WAI_NET_CONS_PRINTF();
|
---|
| 1635 | cons_printf(portid,
|
---|
| 1636 | "Prefix List Status\n"
|
---|
| 1637 | "IX Expire Lifetime flags router");
|
---|
| 1638 | for (rtitle = NUM_ND6_DEF_RTR_ENTRY * 2 - sizeof("router"); rtitle -- > 0; )
|
---|
| 1639 | cons_printf(portid, " ");
|
---|
| 1640 | cons_printf(portid, " Len Prefix\n");
|
---|
| 1641 |
|
---|
| 1642 | /* expire の単位は [s]。*/
|
---|
| 1643 | get_tim(&now);
|
---|
| 1644 | now /= SYSTIM_HZ;
|
---|
| 1645 | pr = nd6_get_prl();
|
---|
| 1646 | for (pix = 0; pix < NUM_ND6_PREFIX_ENTRY; pix ++) {
|
---|
| 1647 | if ((pr[pix].flags & ND6_PREFIX_STATE_BUSY) != 0) {
|
---|
| 1648 | cons_printf(portid, "%2d", pix);
|
---|
| 1649 | if (pr[pix].vltime == ND6_INFINITE_LIFETIME)
|
---|
| 1650 | cons_printf(portid, " INFIN INFIN");
|
---|
| 1651 | else
|
---|
| 1652 | cons_printf(portid, " %7d %8d",
|
---|
| 1653 | (uint32_t)(pr[pix].expire - now) <= 0
|
---|
| 1654 | ? 0 : (pr[pix].expire - now),
|
---|
| 1655 | pr[pix].vltime);
|
---|
| 1656 | cons_printf(portid, " %02x", pr[pix].flags);
|
---|
| 1657 | rcnt = NUM_ND6_DEF_RTR_ENTRY;
|
---|
| 1658 | rtitle = NUM_ND6_DEF_RTR_ENTRY * 2 - sizeof(" router");
|
---|
| 1659 | mask = 1;
|
---|
| 1660 | for (rix = 0; rix < NUM_ND6_DEF_RTR_ENTRY; rix ++) {
|
---|
| 1661 | if ((pr[pix].routermap & mask) != 0) {
|
---|
| 1662 | if (rcnt == NUM_ND6_DEF_RTR_ENTRY)
|
---|
| 1663 | cons_printf(portid, " ");
|
---|
| 1664 | else
|
---|
| 1665 | cons_printf(portid, ",");
|
---|
| 1666 | cons_printf(portid, "%d", rix);
|
---|
| 1667 | rcnt --;
|
---|
| 1668 | rtitle -= 2;
|
---|
| 1669 | }
|
---|
| 1670 | mask <<= 1;
|
---|
| 1671 | }
|
---|
| 1672 | while (rcnt --) {
|
---|
| 1673 | cons_printf(portid, " ");
|
---|
| 1674 | rtitle -= 2;
|
---|
| 1675 | }
|
---|
| 1676 | while (rtitle -- > 0)
|
---|
| 1677 | cons_printf(portid, " ");
|
---|
| 1678 | cons_printf(portid, "%4d %lI\n", pr[pix].prefix_len, &pr[pix].prefix);
|
---|
| 1679 | }
|
---|
| 1680 | }
|
---|
| 1681 |
|
---|
| 1682 | SIG_NET_CONS_PRINTF();
|
---|
| 1683 | FLUSH_SND_BUFF();
|
---|
| 1684 | }
|
---|
| 1685 |
|
---|
| 1686 | #endif /* of #if NUM_ND6_DEF_RTR_ENTRY > 0 */
|
---|
| 1687 |
|
---|
| 1688 | #if NUM_IN6_ROUTE_ENTRY > 0
|
---|
| 1689 |
|
---|
| 1690 | /*
|
---|
| 1691 | * routing6_table_status -- 経路表(IPv6)の出力
|
---|
| 1692 | */
|
---|
| 1693 |
|
---|
| 1694 | static void
|
---|
| 1695 | routing6_table_status (ID portid, char *line)
|
---|
| 1696 | {
|
---|
| 1697 | SYSTIM now;
|
---|
| 1698 | int_t ix;
|
---|
| 1699 |
|
---|
| 1700 | WAI_NET_CONS_PRINTF();
|
---|
| 1701 | cons_printf(portid,
|
---|
| 1702 | "\nRouting Table Status (IPv6)\n"
|
---|
| 1703 | "IX Expire flags Prefix Target Gateway\n");
|
---|
| 1704 |
|
---|
| 1705 | for (ix = 0; ix < NUM_IN6_STATIC_ROUTE_ENTRY; ix ++) {
|
---|
| 1706 | cons_printf(portid, "%2d STATIC - %6d %30lI %lI\n",
|
---|
| 1707 | ix,
|
---|
| 1708 | routing6_tbl[ix].prefix_len,
|
---|
| 1709 | &routing6_tbl[ix].target,
|
---|
| 1710 | &routing6_tbl[ix].gateway);
|
---|
| 1711 |
|
---|
| 1712 | }
|
---|
| 1713 |
|
---|
| 1714 | /* expire の単位は [s]。*/
|
---|
| 1715 | get_tim(&now);
|
---|
| 1716 | now /= SYSTIM_HZ;
|
---|
| 1717 |
|
---|
| 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",
|
---|
| 1721 | ix,
|
---|
| 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);
|
---|
| 1728 |
|
---|
| 1729 | SIG_NET_CONS_PRINTF();
|
---|
| 1730 | FLUSH_SND_BUFF();
|
---|
| 1731 | }
|
---|
| 1732 |
|
---|
| 1733 | #endif /* of #if NUM_IN6_ROUTE_ENTRY > 0 */
|
---|
| 1734 |
|
---|
| 1735 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
| 1736 |
|
---|
| 1737 | #if defined(SUPPORT_INET4)
|
---|
| 1738 |
|
---|
| 1739 | #if NUM_IN4_ROUTE_ENTRY > 0
|
---|
| 1740 |
|
---|
| 1741 | /*
|
---|
| 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 -- 経路情報
|
---|
| 1796 | */
|
---|
| 1797 |
|
---|
| 1798 | static void
|
---|
| 1799 | routing_status (ID portid, char *line)
|
---|
| 1800 | {
|
---|
| 1801 | switch (*line) {
|
---|
| 1802 |
|
---|
| 1803 | #if defined(SUPPORT_INET6) && NUM_ND6_DEF_RTR_ENTRY > 0
|
---|
| 1804 |
|
---|
| 1805 | case 'l': /* ディフォルトルータ・リスト情報 */
|
---|
| 1806 | defrtrlist_status(portid, line + 1);
|
---|
| 1807 | break;
|
---|
| 1808 |
|
---|
| 1809 | case 'p': /* プレフィックス・リスト情報 */
|
---|
| 1810 | prefixlist_status(portid, line + 1);
|
---|
| 1811 | break;
|
---|
| 1812 |
|
---|
| 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 |
|
---|
| 1827 | break;
|
---|
| 1828 | }
|
---|
| 1829 | }
|
---|
| 1830 |
|
---|
| 1831 | /*
|
---|
| 1832 | * dbg_cons_network_status -- ネットワークの状態の出力
|
---|
| 1833 | */
|
---|
| 1834 |
|
---|
| 1835 | void
|
---|
| 1836 | dbg_cons_network_status (ID portid, char *line)
|
---|
| 1837 | {
|
---|
| 1838 | switch (*line) {
|
---|
| 1839 |
|
---|
| 1840 | #ifdef SUPPORT_ETHER
|
---|
| 1841 |
|
---|
| 1842 | case 'a': /* IF アドレス情報 */
|
---|
| 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 |
|
---|
| 1851 | break;
|
---|
| 1852 |
|
---|
| 1853 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
| 1854 |
|
---|
| 1855 | case 'b': /* ネットワークバッファ情報 */
|
---|
| 1856 | nbuf_status(portid, line + 1);
|
---|
| 1857 | break;
|
---|
| 1858 |
|
---|
| 1859 | #if NET_COUNT_ENABLE
|
---|
| 1860 |
|
---|
| 1861 | case 'c': /* ネットワーク統計情報 */
|
---|
| 1862 | net_count(portid, line + 1);
|
---|
| 1863 | break;
|
---|
| 1864 |
|
---|
| 1865 | #endif /* of #if NET_COUNT_ENABLE */
|
---|
| 1866 |
|
---|
| 1867 | case 'r': /* 経路情報 */
|
---|
| 1868 | routing_status(portid, line + 1);
|
---|
| 1869 | break;
|
---|
| 1870 |
|
---|
| 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 */
|
---|
| 1881 |
|
---|
| 1882 | #ifdef SUPPORT_TCP
|
---|
| 1883 |
|
---|
| 1884 | case 't': /* TCP status */
|
---|
| 1885 | tcp_status(portid, line + 1);
|
---|
| 1886 | break;
|
---|
| 1887 |
|
---|
| 1888 | #endif /* of #ifdef SUPPORT_TCP */
|
---|
| 1889 |
|
---|
| 1890 | #ifdef SUPPORT_UDP
|
---|
| 1891 |
|
---|
| 1892 | case 'u': /* UDP status */
|
---|
| 1893 | udp_status(portid, line + 1);
|
---|
| 1894 | break;
|
---|
| 1895 |
|
---|
| 1896 | #endif /* of #ifdef SUPPORT_UDP */
|
---|
| 1897 |
|
---|
| 1898 | default:
|
---|
| 1899 | cons_printf(portid, "no such command: '%c%c'.\n", *(line - 1), *line);
|
---|
| 1900 | SIG_NET_CONS_PRINTF();
|
---|
| 1901 | FLUSH_SND_BUFF();
|
---|
| 1902 | break;
|
---|
| 1903 | }
|
---|
| 1904 | }
|
---|
| 1905 |
|
---|
| 1906 | /*
|
---|
| 1907 | * dbg_cons_ifconfig -- ネットワークインタフェースの構成情報
|
---|
| 1908 | */
|
---|
| 1909 |
|
---|
| 1910 | void
|
---|
| 1911 | dbg_cons_ifconfig (ID portid, char *line)
|
---|
| 1912 | {
|
---|
| 1913 | #ifdef SUPPORT_ETHER
|
---|
| 1914 |
|
---|
| 1915 | T_IF_SOFTC *ic;
|
---|
| 1916 |
|
---|
| 1917 | WAI_NET_CONS_PRINTF();
|
---|
| 1918 | ic = IF_ETHER_NIC_GET_SOFTC();
|
---|
| 1919 | cons_printf(portid, "ether: %M\n", ic->ifaddr.lladdr);
|
---|
| 1920 | SIG_NET_CONS_PRINTF();
|
---|
| 1921 | FLUSH_SND_BUFF();
|
---|
| 1922 |
|
---|
| 1923 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
| 1924 | }
|
---|
| 1925 |
|
---|
| 1926 | #if defined(NETAPP_IP6_CFG)
|
---|
| 1927 |
|
---|
| 1928 | /*
|
---|
| 1929 | * dbg_cons_ifconfig6 -- ネットワークインタフェース(IPv6)の構成情報
|
---|
| 1930 | */
|
---|
| 1931 |
|
---|
| 1932 | void
|
---|
| 1933 | dbg_cons_ifconfig6 (ID portid, char *line)
|
---|
| 1934 | {
|
---|
| 1935 | #ifdef SUPPORT_ETHER
|
---|
| 1936 |
|
---|
| 1937 | T_IFNET *ifp = IF_GET_IFNET();
|
---|
| 1938 | int_t ix;
|
---|
| 1939 | SYSTIM now;
|
---|
| 1940 |
|
---|
| 1941 | WAI_NET_CONS_PRINTF();
|
---|
| 1942 |
|
---|
| 1943 | /* expire と vltime の単位は [s]。*/
|
---|
| 1944 | get_tim(&now);
|
---|
| 1945 | now /= SYSTIM_HZ;
|
---|
| 1946 |
|
---|
| 1947 | cons_printf(portid, "IPv6:\nIX Expire Preffered RTR PFX Flags IP Address\n");
|
---|
| 1948 | for (ix = 0; ix < NUM_IN6_IFADDR_ENTRY; ix ++) {
|
---|
| 1949 | if (ifp->in6_ifaddrs[ix].flags & IN6_IFF_DEFINED) {
|
---|
| 1950 | cons_printf(portid, " %d", ix);
|
---|
| 1951 | if (ifp->in6_ifaddrs[ix].lifetime.vltime == ND6_INFINITE_LIFETIME)
|
---|
| 1952 | cons_printf(portid, " INFIN INFIN");
|
---|
| 1953 | else
|
---|
| 1954 | cons_printf(portid, " %8d %9d",
|
---|
| 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)
|
---|
| 1960 | cons_printf(portid, " -");
|
---|
| 1961 | else
|
---|
| 1962 | cons_printf(portid, " %3d", ifp->in6_ifaddrs[ix].router_index);
|
---|
| 1963 | if (ifp->in6_ifaddrs[ix].prefix_index == ND6_PREFIX_IX_INVALID)
|
---|
| 1964 | cons_printf(portid, " -");
|
---|
| 1965 | else
|
---|
| 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
|
---|
| 1976 |
|
---|
| 1977 | SIG_NET_CONS_PRINTF();
|
---|
| 1978 | FLUSH_SND_BUFF();
|
---|
| 1979 |
|
---|
| 1980 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
| 1981 | }
|
---|
| 1982 |
|
---|
| 1983 | #endif /* of #if defined(NETAPP_IP6_CFG) */
|
---|
| 1984 |
|
---|
| 1985 | #if defined(NETAPP_IP4_CFG)
|
---|
| 1986 |
|
---|
| 1987 | /*
|
---|
| 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)
|
---|
| 2033 | {
|
---|
| 2034 | #if defined(SUPPORT_ETHER)
|
---|
| 2035 | #if defined(SUPPORT_INET4)
|
---|
| 2036 | T_IN4_ADDR addr;
|
---|
| 2037 | #endif
|
---|
| 2038 | #endif /* of #if defined(SUPPORT_ETHER) */
|
---|
| 2039 |
|
---|
| 2040 | cons_printf(portid, "DHCP:\n");
|
---|
| 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
|
---|
| 2075 |
|
---|
| 2076 | #if defined(SUPPORT_TCP)
|
---|
| 2077 |
|
---|
| 2078 | cons_printf(portid, "TCP:\n");
|
---|
| 2079 |
|
---|
| 2080 | cons_printf(portid, " TCP_CFG_OPT_MSS: ");
|
---|
| 2081 | #if defined(TCP_CFG_OPT_MSS)
|
---|
| 2082 | cons_printf(portid, "On\n");
|
---|
| 2083 | #else
|
---|
| 2084 | cons_printf(portid, "Off\n");
|
---|
| 2085 | #endif
|
---|
| 2086 |
|
---|
| 2087 | cons_printf(portid, " TCP_CFG_DELAY_ACK: ");
|
---|
| 2088 | #if defined(TCP_CFG_DELAY_ACK)
|
---|
| 2089 | cons_printf(portid, "On\n");
|
---|
| 2090 | #else
|
---|
| 2091 | cons_printf(portid, "Off\n");
|
---|
| 2092 | #endif
|
---|
| 2093 |
|
---|
| 2094 | cons_printf(portid, " TCP_CFG_ALWAYS_KEEP: ");
|
---|
| 2095 | #if defined(TCP_CFG_ALWAYS_KEEP)
|
---|
| 2096 | cons_printf(portid, "On\n");
|
---|
| 2097 | #else
|
---|
| 2098 | cons_printf(portid, "Off\n");
|
---|
| 2099 | #endif
|
---|
| 2100 |
|
---|
| 2101 | cons_printf(portid, " TCP_CFG_RWBUF_CSAVE: ");
|
---|
| 2102 | #if defined(TCP_CFG_RWBUF_CSAVE_ONLY)
|
---|
| 2103 | cons_printf(portid, "Only, ");
|
---|
| 2104 | #if defined(TCP_CFG_RWBUF_CSAVE_MAX_QUEUES)
|
---|
| 2105 | cons_printf(portid, "TCP_CFG_RWBUF_CSAVE_MAX_QUEUES: %2d\n",
|
---|
| 2106 | TCP_CFG_RWBUF_CSAVE_MAX_QUEUES);
|
---|
| 2107 | #else
|
---|
| 2108 | cons_printf(portid, "TCP_CFG_RWBUF_CSAVE_MAX_QUEUES: Undefined\n");
|
---|
| 2109 | #endif
|
---|
| 2110 | #elif defined(TCP_CFG_RWBUF_CSAVE)
|
---|
| 2111 | cons_printf(portid, "On, ");
|
---|
| 2112 | #if defined(TCP_CFG_RWBUF_CSAVE_MAX_QUEUES)
|
---|
| 2113 | cons_printf(portid, "TCP_CFG_RWBUF_CSAVE_MAX_QUEUES: %2d\n",
|
---|
| 2114 | TCP_CFG_RWBUF_CSAVE_MAX_QUEUES);
|
---|
| 2115 | #else
|
---|
| 2116 | cons_printf(portid, "TCP_CFG_RWBUF_CSAVE_MAX_QUEUES: Undefined\n");
|
---|
| 2117 | #endif
|
---|
| 2118 | #else
|
---|
| 2119 | cons_printf(portid, "Off\n");
|
---|
| 2120 | #endif
|
---|
| 2121 |
|
---|
| 2122 | cons_printf(portid, " TCP_CFG_SWBUF_CSAVE: ");
|
---|
| 2123 | #if defined(TCP_CFG_SWBUF_CSAVE_ONLY)
|
---|
| 2124 | cons_printf(portid, "Only, TCP_CFG_SWBUF_CSAVE_MAX_SIZE: %4d\n"
|
---|
| 2125 | " "
|
---|
| 2126 | " TCP_CFG_SWBUF_CSAVE_MIN_SIZE: %4d\n",
|
---|
| 2127 | TCP_CFG_SWBUF_CSAVE_MAX_SIZE,
|
---|
| 2128 | TCP_CFG_SWBUF_CSAVE_MIN_SIZE);
|
---|
| 2129 | #elif defined(TCP_CFG_SWBUF_CSAVE)
|
---|
| 2130 | cons_printf(portid, "On, TCP_CFG_SWBUF_CSAVE_MAX_SIZE: %4d\n"
|
---|
| 2131 | " "
|
---|
| 2132 | " TCP_CFG_SWBUF_CSAVE_MIN_SIZE: %4d\n",
|
---|
| 2133 | TCP_CFG_SWBUF_CSAVE_MAX_SIZE,
|
---|
| 2134 | TCP_CFG_SWBUF_CSAVE_MIN_SIZE);
|
---|
| 2135 | #else
|
---|
| 2136 | cons_printf(portid, "Off\n");
|
---|
| 2137 | #endif
|
---|
| 2138 |
|
---|
| 2139 | cons_printf(portid, " TCP_CFG_NON_BLOCKING: ");
|
---|
| 2140 | #if defined(TCP_CFG_NON_BLOCKING)
|
---|
| 2141 | #if defined(USE_TCP_NON_BLOCKING)
|
---|
| 2142 | cons_printf(portid, "Use\n");
|
---|
| 2143 | #else
|
---|
| 2144 | cons_printf(portid, "On\n");
|
---|
| 2145 | #endif
|
---|
| 2146 | #else
|
---|
| 2147 | cons_printf(portid, "Off\n");
|
---|
| 2148 | #endif
|
---|
| 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 |
|
---|
| 2157 | cons_printf(portid, " TCP_CFG_EXTENTIONS: ");
|
---|
| 2158 | #if defined(TCP_CFG_EXTENTIONS)
|
---|
| 2159 | #if defined(USE_TCP_EXTENTIONS)
|
---|
| 2160 | cons_printf(portid, "Use\n");
|
---|
| 2161 | #if defined(SUPPORT_INET6)
|
---|
| 2162 | cons_printf(portid, " NUM_VRID_TCP6_REPS: %3d\n", NUM_VRID_TCP6_REPS);
|
---|
| 2163 | cons_printf(portid, " NUM_VRID_TCP6_CEPS: %3d\n", NUM_VRID_TCP6_CEPS);
|
---|
| 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
|
---|
| 2169 | #else
|
---|
| 2170 | cons_printf(portid, "On\n");
|
---|
| 2171 | #endif
|
---|
| 2172 | #else
|
---|
| 2173 | cons_printf(portid, "Off\n");
|
---|
| 2174 | #endif
|
---|
| 2175 |
|
---|
| 2176 | cons_printf(portid, " USE_COPYSAVE_API: ");
|
---|
| 2177 | #if defined(USE_COPYSAVE_API)
|
---|
| 2178 | cons_printf(portid, "Use\n");
|
---|
| 2179 | #else
|
---|
| 2180 | cons_printf(portid, "Off\n");
|
---|
| 2181 | #endif
|
---|
| 2182 |
|
---|
| 2183 | #if NUM_TCP_TW_CEP_ENTRY > 0
|
---|
| 2184 | cons_printf(portid, " TCP_TW_CEP: On, NUM_TCP_TW_CEP_ENTRY: %d\n", NUM_TCP_TW_CEP_ENTRY);
|
---|
| 2185 | #else
|
---|
| 2186 | cons_printf(portid, " TCP_TW_CEP: Off\n");
|
---|
| 2187 | #endif
|
---|
| 2188 |
|
---|
| 2189 | #if defined(TCP_CFG_TRACE)
|
---|
| 2190 | cons_printf(portid, " TCP_CFG_TRACE: On, TCP_CFG_TRACE_LPORTNO: %d\n", TCP_CFG_TRACE_LPORTNO);
|
---|
| 2191 | #if defined(SUPPORT_INET4)
|
---|
| 2192 | addr = TCP_CFG_TRACE_IPV4_RADDR;
|
---|
| 2193 | cons_printf(portid, " TCP_CFG_TRACE_IPV4_RADDR: %hI\n", &addr);
|
---|
| 2194 | #endif
|
---|
| 2195 | cons_printf(portid, " TCP_CFG_TRACE_RPORTNO: %d\n", TCP_CFG_TRACE_RPORTNO);
|
---|
| 2196 | #else
|
---|
| 2197 | cons_printf(portid, " TCP_CFG_TRACE: Off\n");
|
---|
| 2198 | #endif
|
---|
| 2199 |
|
---|
| 2200 | cons_printf(portid, " MAX_TCP_SND_SEG: %4d\n", MAX_TCP_SND_SEG);
|
---|
| 2201 | cons_printf(portid, " DEF_TCP_SND_SEG: %4d\n", DEF_TCP_SND_SEG);
|
---|
| 2202 | cons_printf(portid, " MAX_TCP_RCV_SEG: %4d\n", MAX_TCP_RCV_SEG);
|
---|
| 2203 | cons_printf(portid, " DEF_TCP_RCV_SEG: %4d\n", DEF_TCP_RCV_SEG);
|
---|
| 2204 | cons_printf(portid, " MAX_TCP_REALLOC_SIZE: %4d\n", MAX_TCP_REALLOC_SIZE);
|
---|
| 2205 |
|
---|
| 2206 | #endif /* of #if defined(SUPPORT_TCP) */
|
---|
| 2207 |
|
---|
| 2208 | #if defined(SUPPORT_UDP)
|
---|
| 2209 |
|
---|
| 2210 | cons_printf(portid, "UDP:\n");
|
---|
| 2211 |
|
---|
| 2212 | cons_printf(portid, " UDP_CFG_IN_CHECKSUM: ");
|
---|
| 2213 | #if defined(UDP_CFG_IN_CHECKSUM)
|
---|
| 2214 | cons_printf(portid, "On\n");
|
---|
| 2215 | #else
|
---|
| 2216 | cons_printf(portid, "Off\n");
|
---|
| 2217 | #endif
|
---|
| 2218 |
|
---|
| 2219 | cons_printf(portid, " UDP_CFG_OUT_CHECKSUM: ");
|
---|
| 2220 | #if defined(UDP_CFG_OUT_CHECKSUM)
|
---|
| 2221 | cons_printf(portid, "On\n");
|
---|
| 2222 | #else
|
---|
| 2223 | cons_printf(portid, "Off\n");
|
---|
| 2224 | #endif
|
---|
| 2225 |
|
---|
| 2226 | cons_printf(portid, " UDP_CFG_NON_BLOCKING: ");
|
---|
| 2227 | #if defined(UDP_CFG_NON_BLOCKING)
|
---|
| 2228 | #if defined(USE_UDP_NON_BLOCKING)
|
---|
| 2229 | cons_printf(portid, "Use\n");
|
---|
| 2230 | #else
|
---|
| 2231 | cons_printf(portid, "On\n");
|
---|
| 2232 | #endif
|
---|
| 2233 | #else
|
---|
| 2234 | cons_printf(portid, "Off\n");
|
---|
| 2235 | #endif
|
---|
| 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 |
|
---|
| 2244 | cons_printf(portid, " UDP_CFG_EXTENTIONS: ");
|
---|
| 2245 | #if defined(UDP_CFG_EXTENTIONS)
|
---|
| 2246 | #if defined(USE_UDP_EXTENTIONS)
|
---|
| 2247 | cons_printf(portid, "Use\n");
|
---|
| 2248 | #else
|
---|
| 2249 | cons_printf(portid, "On\n");
|
---|
| 2250 | #endif
|
---|
| 2251 | cons_printf(portid, " NUM_VRID_UDP4_CEPS: %3d\n", NUM_VRID_UDP4_CEPS);
|
---|
| 2252 | cons_printf(portid, " NUM_VRID_UDP6_CEPS: %3d\n", NUM_VRID_UDP6_CEPS);
|
---|
| 2253 | #else
|
---|
| 2254 | cons_printf(portid, "Off\n");
|
---|
| 2255 | #endif
|
---|
| 2256 |
|
---|
| 2257 | cons_printf(portid, " NUM_DTQ_UDP_RCVQ: %3d\n", NUM_DTQ_UDP_RCVQ);
|
---|
| 2258 | cons_printf(portid, " NUM_DTQ_UDP_OUTPUT: %3d\n", NUM_DTQ_UDP_OUTPUT);
|
---|
| 2259 |
|
---|
| 2260 | #endif /* of #if defined(SUPPORT_UDP) */
|
---|
| 2261 |
|
---|
| 2262 | cons_printf(portid, "ICMP:\n");
|
---|
| 2263 |
|
---|
| 2264 | cons_printf(portid, " ICMP_CFG_CALLBACK_ECHO_REPLY: ");
|
---|
| 2265 | #if defined(ICMP_CFG_CALLBACK_ECHO_REPLY)
|
---|
| 2266 | cons_printf(portid, "On\n");
|
---|
| 2267 | #else
|
---|
| 2268 | cons_printf(portid, "Off\n");
|
---|
| 2269 | #endif
|
---|
| 2270 |
|
---|
| 2271 | cons_printf(portid, " ICMP_REPLY_ERROR: ");
|
---|
| 2272 | #if defined(ICMP_REPLY_ERROR)
|
---|
| 2273 | cons_printf(portid, "On\n");
|
---|
| 2274 | #else
|
---|
| 2275 | cons_printf(portid, "Off\n");
|
---|
| 2276 | #endif
|
---|
| 2277 |
|
---|
| 2278 | #if defined(NUM_REDIRECT_ROUTE_ENTRY)
|
---|
| 2279 | #if NUM_REDIRECT_ROUTE_ENTRY > 0
|
---|
| 2280 | cons_printf(portid, " TMO_IN_REDIRECT: %4d[s]\n", TMO_IN_REDIRECT / NET_TIMER_HZ);
|
---|
| 2281 | #endif
|
---|
| 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)
|
---|
| 2290 | cons_printf(portid, "On\n");
|
---|
| 2291 | #else
|
---|
| 2292 | cons_printf(portid, "Off\n");
|
---|
| 2293 | #endif
|
---|
| 2294 |
|
---|
| 2295 | cons_printf(portid, " Routing Table:\n");
|
---|
| 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);
|
---|
| 2298 |
|
---|
| 2299 | cons_printf(portid, "ND:\n");
|
---|
[364] | 2300 | cons_printf(portid, " TMO_ND6_RTR_SOL_DELAY: %5d[us]\n", TMO_ND6_RTR_SOL_DELAY);
|
---|
| 2301 | cons_printf(portid, " TMO_ND6_RTR_SOL_INTERVAL: %5d[us]\n", TMO_ND6_RTR_SOL_INTERVAL);
|
---|
[337] | 2302 | cons_printf(portid, " NUM_IP6_DAD_COUNT: %5d\n", NUM_IP6_DAD_COUNT);
|
---|
| 2303 | cons_printf(portid, " NUM_ND6_CACHE_ENTRY: %5d\n", NUM_ND6_CACHE_ENTRY);
|
---|
| 2304 |
|
---|
| 2305 | #if defined(SUPPORT_ETHER)
|
---|
| 2306 |
|
---|
| 2307 | cons_printf(portid, " NUM_ND6_DEF_RTR_ENTRY %5d\n", NUM_ND6_DEF_RTR_ENTRY);
|
---|
| 2308 | cons_printf(portid, " NUM_ND6_RTR_SOL_RETRY %5d\n", NUM_ND6_RTR_SOL_RETRY);
|
---|
| 2309 |
|
---|
| 2310 | cons_printf(portid, " IP6_CFG_AUTO_LINKLOCAL: ");
|
---|
| 2311 | #if defined(IP6_CFG_AUTO_LINKLOCAL)
|
---|
| 2312 | cons_printf(portid, "On\n");
|
---|
| 2313 | #else
|
---|
| 2314 | cons_printf(portid, "Off\n");
|
---|
| 2315 | #endif
|
---|
| 2316 |
|
---|
| 2317 | #endif /* of #if defined(SUPPORT_ETHER) */
|
---|
| 2318 |
|
---|
| 2319 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
| 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 |
|
---|
| 2350 | #if defined(SUPPORT_INET4) && defined(SUPPORT_ETHER)
|
---|
| 2351 |
|
---|
| 2352 | cons_printf(portid, "ARP:\n");
|
---|
| 2353 | cons_printf(portid, " ARP_CACHE_KEEP: %4d[s]\n", ARP_CACHE_KEEP / NET_TIMER_HZ);
|
---|
| 2354 |
|
---|
| 2355 | #endif /* of #if defined(SUPPORT_INET4) && defined(SUPPORT_ETHER) */
|
---|
| 2356 |
|
---|
| 2357 | #if defined(SUPPORT_ETHER)
|
---|
| 2358 |
|
---|
| 2359 | cons_printf(portid, "Ethernet:\n");
|
---|
| 2360 |
|
---|
| 2361 | cons_printf(portid, " NUM_DTQ_ETHER_OUTPUT: %3d\n", NUM_DTQ_ETHER_OUTPUT);
|
---|
| 2362 |
|
---|
| 2363 | cons_printf(portid, " ETHER_CFG_ACCEPT_ALL: ");
|
---|
| 2364 | #if defined(ETHER_CFG_ACCEPT_ALL)
|
---|
| 2365 | cons_printf(portid, "On\n");
|
---|
| 2366 | #else
|
---|
| 2367 | cons_printf(portid, "Off\n");
|
---|
| 2368 | #endif
|
---|
| 2369 |
|
---|
| 2370 | cons_printf(portid, " ETHER_CFG_UNEXP_WARNING: ");
|
---|
| 2371 | #if defined(ETHER_CFG_UNEXP_WARNING)
|
---|
| 2372 | cons_printf(portid, "On\n");
|
---|
| 2373 | #else
|
---|
| 2374 | cons_printf(portid, "Off\n");
|
---|
| 2375 | #endif
|
---|
| 2376 |
|
---|
| 2377 | cons_printf(portid, " ETHER_CFG_802_WARNING: ");
|
---|
| 2378 | #if defined(ETHER_CFG_802_WARNING)
|
---|
| 2379 | cons_printf(portid, "On\n");
|
---|
| 2380 | #else
|
---|
| 2381 | cons_printf(portid, "Off\n");
|
---|
| 2382 | #endif
|
---|
| 2383 |
|
---|
| 2384 | cons_printf(portid, " ETHER_CFG_MCAST_WARNING: ");
|
---|
| 2385 | #if defined(ETHER_CFG_MCAST_WARNING)
|
---|
| 2386 | cons_printf(portid, "On\n");
|
---|
| 2387 | #else
|
---|
| 2388 | cons_printf(portid, "Off\n");
|
---|
| 2389 | #endif
|
---|
| 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 |
|
---|
| 2398 | #endif /* of #if defined(SUPPORT_ETHER) */
|
---|
| 2399 |
|
---|
| 2400 | #if defined(SUPPORT_PPP)
|
---|
| 2401 |
|
---|
| 2402 | cons_printf(portid, "PPP:\n");
|
---|
| 2403 |
|
---|
| 2404 | cons_printf(portid, " HDLC_PORTNO: %d", HDLC_PORTID);
|
---|
| 2405 |
|
---|
| 2406 | cons_printf(portid, " PPP_IDLE_TIMEOUT: ");
|
---|
| 2407 | #if defined(PPP_IDLE_TIMEOUT)
|
---|
| 2408 | cons_printf(portid, " %4d[s]\n", PPP_IDLE_TIMEOUT / NET_TIMER_HZ);
|
---|
| 2409 | #else
|
---|
| 2410 | cons_printf(portid, " Off\n");
|
---|
| 2411 | #endif
|
---|
| 2412 |
|
---|
| 2413 | cons_printf(portid, " PPP_CFG_MODEM: ");
|
---|
| 2414 | #if defined(PPP_CFG_MODEM)
|
---|
| 2415 | cons_printf(portid, "On\n");
|
---|
| 2416 | #else
|
---|
| 2417 | cons_printf(portid, "Off\n");
|
---|
| 2418 | #endif
|
---|
| 2419 |
|
---|
| 2420 | #endif /* of #if defined(SUPPORT_PPP) */
|
---|
| 2421 |
|
---|
| 2422 | cons_printf(portid, "Network Buffer:\n");
|
---|
| 2423 |
|
---|
| 2424 | #if defined(NUM_MPF_NET_BUF_64)
|
---|
| 2425 | cons_printf(portid, " NUM_MPF_NET_BUF_64: %2d\n", NUM_MPF_NET_BUF_64);
|
---|
| 2426 | #endif
|
---|
| 2427 |
|
---|
| 2428 | #if defined(NUM_MPF_NET_BUF_CSEG)
|
---|
| 2429 | cons_printf(portid, " NUM_MPF_NET_BUF_CSEG: %2d\n", NUM_MPF_NET_BUF_CSEG);
|
---|
| 2430 | #endif
|
---|
| 2431 |
|
---|
| 2432 | #if defined(NUM_MPF_NET_BUF_128)
|
---|
| 2433 | cons_printf(portid, " NUM_MPF_NET_BUF_128: %2d\n", NUM_MPF_NET_BUF_128);
|
---|
| 2434 | #endif
|
---|
| 2435 |
|
---|
| 2436 | #if defined(NUM_MPF_NET_BUF_256)
|
---|
| 2437 | cons_printf(portid, " NUM_MPF_NET_BUF_256: %2d\n", NUM_MPF_NET_BUF_256);
|
---|
| 2438 | #endif
|
---|
| 2439 |
|
---|
| 2440 | #if defined(NUM_MPF_NET_BUF_512)
|
---|
| 2441 | cons_printf(portid, " NUM_MPF_NET_BUF_512: %2d\n", NUM_MPF_NET_BUF_512);
|
---|
| 2442 | #endif
|
---|
| 2443 |
|
---|
| 2444 | #if defined(NUM_MPF_NET_BUF_IP_MSS)
|
---|
| 2445 | cons_printf(portid, " NUM_MPF_NET_BUF_IP_MSS: %2d\n", NUM_MPF_NET_BUF_IP_MSS);
|
---|
| 2446 | #endif
|
---|
| 2447 |
|
---|
| 2448 | #if defined(NUM_MPF_NET_BUF_1024)
|
---|
| 2449 | cons_printf(portid, " NUM_MPF_NET_BUF_1024: %2d\n", NUM_MPF_NET_BUF_1024);
|
---|
| 2450 | #endif
|
---|
| 2451 |
|
---|
| 2452 | #if defined(NUM_MPF_NET_BUF_IPV6_MMTU)
|
---|
| 2453 | cons_printf(portid, " NUM_MPF_NET_BUF_IPV6_MMTU: %2d\n", NUM_MPF_NET_BUF_IPV6_MMTU);
|
---|
| 2454 | #endif
|
---|
| 2455 |
|
---|
| 2456 | #if defined(NUM_MPF_NET_BUF_IF_PDU)
|
---|
| 2457 | cons_printf(portid, " NUM_MPF_NET_BUF_IF_PDU: %2d\n", NUM_MPF_NET_BUF_IF_PDU);
|
---|
| 2458 | #endif
|
---|
| 2459 |
|
---|
| 2460 | #if defined(NUM_MPF_NET_BUF_REASSM)
|
---|
| 2461 | cons_printf(portid, " NUM_MPF_NET_BUF_REASSM: %2d\n", NUM_MPF_NET_BUF_REASSM);
|
---|
| 2462 | #endif
|
---|
| 2463 |
|
---|
| 2464 | #if defined(NUM_MPF_NET_BUF6_65536)
|
---|
| 2465 | cons_printf(portid, " NUM_MPF_NET_BUF6_65536: %2d\n", NUM_MPF_NET_BUF6_65536);
|
---|
| 2466 | #endif
|
---|
| 2467 |
|
---|
| 2468 | cons_printf(portid, "Network Counter Mask: %08x\n", NET_COUNT_ENABLE);
|
---|
| 2469 |
|
---|
| 2470 | cons_printf(portid, "SUPPORT_MIB: ");
|
---|
| 2471 | #if defined(SUPPORT_MIB)
|
---|
| 2472 | cons_printf(portid, "On\n");
|
---|
| 2473 | #else
|
---|
| 2474 | cons_printf(portid, "Off\n");
|
---|
| 2475 | #endif
|
---|
| 2476 |
|
---|
| 2477 | SIG_NET_CONS_PRINTF();
|
---|
| 2478 | FLUSH_SND_BUFF();
|
---|
| 2479 | }
|
---|
| 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 |
|
---|
| 2581 | /*
|
---|
| 2582 | * デバッグコマンド解析
|
---|
| 2583 | */
|
---|
| 2584 |
|
---|
| 2585 | void
|
---|
| 2586 | dbg_parse (ID portid, char *line)
|
---|
| 2587 | {
|
---|
| 2588 | int_t cepid;
|
---|
| 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
|
---|
| 2594 |
|
---|
| 2595 | switch (*line) {
|
---|
| 2596 |
|
---|
| 2597 | case 'c': /* cancel CEP */
|
---|
| 2598 | switch (*(line + 1)) {
|
---|
| 2599 |
|
---|
| 2600 | case 'f': /* show configurations */
|
---|
| 2601 | dbg_cons_show_config(portid, line + 1);
|
---|
| 2602 | break;
|
---|
| 2603 |
|
---|
| 2604 | #ifdef SUPPORT_TCP
|
---|
| 2605 |
|
---|
| 2606 | case 't': /* cancel TCP */
|
---|
| 2607 | cepid = atoi(line = skip_blanks(line + 2));
|
---|
| 2608 | while ('0' <= *line && *line <= '9')
|
---|
| 2609 | line ++;
|
---|
| 2610 | if ((error = tcp_can_cep((ID)cepid, atoi(skip_blanks(line)))) != E_OK && error != E_RLWAI) {
|
---|
| 2611 | cons_printf(portid, "[TCP CAN CEP] error: %s.\n", itron_strerror(error));
|
---|
| 2612 | SIG_NET_CONS_PRINTF();
|
---|
| 2613 | FLUSH_SND_BUFF();
|
---|
| 2614 | }
|
---|
| 2615 | break;
|
---|
| 2616 |
|
---|
| 2617 | #endif /* of #ifdef SUPPORT_TCP */
|
---|
| 2618 |
|
---|
| 2619 | #ifdef SUPPORT_UDP
|
---|
| 2620 |
|
---|
| 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 |
|
---|
| 2660 | cepid = atoi(line = skip_blanks(line + 2));
|
---|
| 2661 | while ('0' <= *line && *line <= '9')
|
---|
| 2662 | line ++;
|
---|
| 2663 |
|
---|
| 2664 | if ((error = udp_can_cep((ID)cepid, atoi(skip_blanks(line)))) != E_OK && error != E_RLWAI) {
|
---|
| 2665 | cons_printf(portid, "[UDP CAN CEP] error: %s.\n", itron_strerror(error));
|
---|
| 2666 | SIG_NET_CONS_PRINTF();
|
---|
| 2667 | FLUSH_SND_BUFF();
|
---|
| 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 |
|
---|
| 2696 | break;
|
---|
| 2697 |
|
---|
| 2698 | #endif /* of #ifdef SUPPORT_UDP */
|
---|
| 2699 |
|
---|
| 2700 | }
|
---|
| 2701 |
|
---|
| 2702 | break;
|
---|
| 2703 |
|
---|
| 2704 | case 'd': /* discard client */
|
---|
| 2705 | switch (*(line + 1)) {
|
---|
| 2706 |
|
---|
| 2707 | #if defined(SUPPORT_PPP)
|
---|
| 2708 |
|
---|
| 2709 | case 'c': /* disconnect */
|
---|
| 2710 | if (lcp_fsm.state != PPP_FSM_STOPPED)
|
---|
| 2711 | lcp_close();
|
---|
| 2712 | break;
|
---|
| 2713 |
|
---|
| 2714 | #endif /* of #if defined(SUPPORT_PPP) */
|
---|
| 2715 |
|
---|
| 2716 | #if defined(SUPPORT_ETHER) && defined(USE_NET_CONS)
|
---|
| 2717 |
|
---|
| 2718 | case 'c': /* disconnect */
|
---|
| 2719 | discon_net_cons();
|
---|
| 2720 | break;
|
---|
| 2721 |
|
---|
| 2722 | #endif /* of #if defined(SUPPORT_ETHER) && defined(USE_NET_CONS) */
|
---|
| 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 |
|
---|
| 2732 | #ifdef USE_TCP_DISCARD_CLI
|
---|
| 2733 |
|
---|
| 2734 | case 't': /* TCP discard client */
|
---|
| 2735 | line += 2;
|
---|
| 2736 | switch (*line) {
|
---|
| 2737 |
|
---|
| 2738 | case 's': /* cancel TCP discard client */
|
---|
| 2739 | tcp_discard_cli_valid = false;
|
---|
| 2740 | break;
|
---|
| 2741 |
|
---|
| 2742 | default:
|
---|
| 2743 | if ((error = psnd_dtq(DTQ_TCP_DISCARD_CLI, (intptr_t)line)) != E_OK) {
|
---|
| 2744 | cons_printf(portid, "[TCP DISCARD CLI] error: %s.\n",
|
---|
| 2745 | itron_strerror(error));
|
---|
| 2746 | SIG_NET_CONS_PRINTF();
|
---|
| 2747 | FLUSH_SND_BUFF();
|
---|
| 2748 | }
|
---|
| 2749 | break;
|
---|
| 2750 |
|
---|
| 2751 | }
|
---|
| 2752 | break;
|
---|
| 2753 |
|
---|
| 2754 | #endif /* of #ifdef USE_TCP_DISCARD_CLI */
|
---|
| 2755 |
|
---|
| 2756 | #ifdef USE_UDP_DISCARD_CLI
|
---|
| 2757 |
|
---|
| 2758 | case 'u': /* UDP discard client */
|
---|
| 2759 | line += 2;
|
---|
| 2760 | switch (*line) {
|
---|
| 2761 |
|
---|
| 2762 | case 's': /* cancel UDP discard client */
|
---|
| 2763 | udp_discard_cli_valid = false;
|
---|
| 2764 | break;
|
---|
| 2765 |
|
---|
| 2766 | default:
|
---|
| 2767 | if ((error = psnd_dtq(DTQ_UDP_DISCARD_CLI, (intptr_t)line)) != E_OK) {
|
---|
| 2768 | cons_printf(portid, "[UDP DISCARD CLI] error: %s.\n",
|
---|
| 2769 | itron_strerror(error));
|
---|
| 2770 | SIG_NET_CONS_PRINTF();
|
---|
| 2771 | FLUSH_SND_BUFF();
|
---|
| 2772 | }
|
---|
| 2773 | break;
|
---|
| 2774 |
|
---|
| 2775 | }
|
---|
| 2776 | break;
|
---|
| 2777 |
|
---|
| 2778 | #endif /* of #ifdef USE_UDP_DISCARD_CLI */
|
---|
| 2779 |
|
---|
| 2780 | }
|
---|
| 2781 |
|
---|
| 2782 | break;
|
---|
| 2783 |
|
---|
| 2784 | #if defined(USE_TCP_ECHO_CLI) || defined(USE_UDP_ECHO_CLI)
|
---|
| 2785 |
|
---|
| 2786 | case 'e': /* echo client */
|
---|
| 2787 | switch (*(line + 1)) {
|
---|
| 2788 |
|
---|
| 2789 | #ifdef USE_TCP_ECHO_CLI
|
---|
| 2790 |
|
---|
| 2791 | case 't': /* TCP echo client */
|
---|
| 2792 | line += 2;
|
---|
| 2793 | switch (*line) {
|
---|
| 2794 |
|
---|
| 2795 | case 's': /* cancel TCP echo */
|
---|
| 2796 | tcp_echo_cli_valid = false;
|
---|
| 2797 | break;
|
---|
| 2798 |
|
---|
| 2799 | default:
|
---|
| 2800 | if ((error = psnd_dtq(DTQ_TCP_ECHO_CLI_SND, (intptr_t)line)) != E_OK) {
|
---|
| 2801 | cons_printf(portid, "[TCP ECHO CLI] error: %s.\n", itron_strerror(error));
|
---|
| 2802 | SIG_NET_CONS_PRINTF();
|
---|
| 2803 | FLUSH_SND_BUFF();
|
---|
| 2804 | }
|
---|
| 2805 | break;
|
---|
| 2806 |
|
---|
| 2807 | }
|
---|
| 2808 | break;
|
---|
| 2809 |
|
---|
| 2810 | #endif /* of #ifdef USE_TCP_ECHO_CLI */
|
---|
| 2811 |
|
---|
| 2812 | #if defined(USE_UDP_ECHO_CLI)
|
---|
| 2813 |
|
---|
| 2814 | case 'u': /* UDP echo client */
|
---|
| 2815 | switch (*(line + 2)) {
|
---|
| 2816 |
|
---|
| 2817 | case 's': /* cancel UDP echo */
|
---|
| 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 |
|
---|
| 2845 | break;
|
---|
| 2846 |
|
---|
| 2847 | default:
|
---|
| 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));
|
---|
| 2883 | SIG_NET_CONS_PRINTF();
|
---|
| 2884 | FLUSH_SND_BUFF();
|
---|
| 2885 | }
|
---|
| 2886 |
|
---|
| 2887 | break;
|
---|
| 2888 |
|
---|
| 2889 | }
|
---|
| 2890 | break;
|
---|
| 2891 |
|
---|
| 2892 | #endif /* of #if defined(USE_UDP_ECHO_CLI) */
|
---|
| 2893 |
|
---|
| 2894 | }
|
---|
| 2895 |
|
---|
| 2896 | break;
|
---|
| 2897 |
|
---|
| 2898 | #endif /* of #if defined(USE_TCP_ECHO_CLI) || defined(USE_UDP_ECHO_CLI) */
|
---|
| 2899 |
|
---|
| 2900 | case 'i':
|
---|
| 2901 |
|
---|
| 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 | }
|
---|
| 2915 |
|
---|
| 2916 | #ifdef SUPPORT_PPP
|
---|
| 2917 |
|
---|
| 2918 | #ifdef PPP_CFG_MODEM
|
---|
| 2919 |
|
---|
| 2920 | else if (lcp_fsm.state == PPP_FSM_STOPPED)
|
---|
| 2921 | dial(); /* initiate */
|
---|
| 2922 |
|
---|
| 2923 | #else /* of #ifdef PPP_CFG_MODEM */
|
---|
| 2924 |
|
---|
| 2925 | else if (lcp_fsm.state == PPP_FSM_STOPPED)
|
---|
| 2926 | lcp_open(PPP_OPEN_ACTIVE);
|
---|
| 2927 |
|
---|
| 2928 | #endif /* of #ifdef PPP_CFG_MODEM */
|
---|
| 2929 |
|
---|
| 2930 | #endif /* of #ifdef SUPPORT_PPP */
|
---|
| 2931 |
|
---|
| 2932 | break;
|
---|
| 2933 |
|
---|
| 2934 | case 'n': /* network status */
|
---|
| 2935 | dbg_cons_network_status(portid, line + 1);
|
---|
| 2936 | break;
|
---|
| 2937 |
|
---|
| 2938 | case 'p': /* ping or task status */
|
---|
| 2939 |
|
---|
| 2940 | if (*(line + 1) == 's')
|
---|
| 2941 | dbg_cons_task_status(portid, skip_blanks(line + 2));
|
---|
| 2942 |
|
---|
| 2943 | #ifdef USE_PING
|
---|
| 2944 |
|
---|
| 2945 | else
|
---|
| 2946 | dbg_cons_ping_comd(portid, line + 1);
|
---|
| 2947 |
|
---|
| 2948 | #endif /* of #ifdef USE_PING */
|
---|
| 2949 |
|
---|
| 2950 | break;
|
---|
| 2951 |
|
---|
| 2952 | case 'r': /* release wait task */
|
---|
| 2953 | if ((error = rel_wai(atoi(skip_blanks(line + 1)))) != E_OK) {
|
---|
| 2954 | cons_printf(portid, "[REL WAI TSK] error: %s.\n", itron_strerror(error));
|
---|
| 2955 | SIG_NET_CONS_PRINTF();
|
---|
| 2956 | FLUSH_SND_BUFF();
|
---|
| 2957 | }
|
---|
| 2958 | break;
|
---|
| 2959 |
|
---|
| 2960 | case 't': /* terminate (delete) REP/CEP */
|
---|
| 2961 | switch (*(line + 1)) {
|
---|
| 2962 |
|
---|
| 2963 | #ifdef USE_TCP_EXTENTIONS
|
---|
| 2964 |
|
---|
| 2965 | case 't': /* TCP REP */
|
---|
| 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));
|
---|
| 2972 | SIG_NET_CONS_PRINTF();
|
---|
| 2973 | FLUSH_SND_BUFF();
|
---|
| 2974 | }
|
---|
| 2975 | break;
|
---|
| 2976 |
|
---|
| 2977 | #endif /* of #ifdef USE_TCP_EXTENTIONS */
|
---|
| 2978 |
|
---|
| 2979 | #ifdef USE_UDP_EXTENTIONS
|
---|
| 2980 |
|
---|
| 2981 | case 'u': /* UDP CEP */
|
---|
| 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));
|
---|
| 3006 | SIG_NET_CONS_PRINTF();
|
---|
| 3007 | FLUSH_SND_BUFF();
|
---|
| 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 |
|
---|
| 3026 | break;
|
---|
| 3027 |
|
---|
| 3028 | #endif /* of #ifdef USE_UDP_EXTENTIONS */
|
---|
| 3029 |
|
---|
| 3030 | }
|
---|
| 3031 | break;
|
---|
| 3032 |
|
---|
| 3033 | #if defined(USE_TCP_EXTENTIONS) || defined(USE_UDP_EXTENTIONS)
|
---|
| 3034 |
|
---|
| 3035 | case 'w': /* wakeup server */
|
---|
| 3036 | /* wake up task */
|
---|
| 3037 | switch (*(line + 1)) {
|
---|
| 3038 |
|
---|
| 3039 | #ifdef USE_TCP_EXTENTIONS
|
---|
| 3040 |
|
---|
| 3041 | case 't': /* tcp server */
|
---|
| 3042 | switch (*(line + 2)) {
|
---|
| 3043 |
|
---|
| 3044 | #ifdef USE_TCP_DISCARD_SRV
|
---|
| 3045 | case 'd': /* tcp discard server */
|
---|
| 3046 | if ((error = wup_tsk(TCP_DISCARD_SRV_TASK)) != E_OK) {
|
---|
| 3047 | //cons_printf(portid, "[WUP TCP DISCARD SRV] error: %s.\n", itron_strerror(error));
|
---|
| 3048 | SIG_NET_CONS_PRINTF();
|
---|
| 3049 | FLUSH_SND_BUFF();
|
---|
| 3050 | }
|
---|
| 3051 | break;
|
---|
| 3052 | #endif /* of #ifdef USE_TCP_DISCARD_SRV */
|
---|
| 3053 |
|
---|
| 3054 | #if defined(USE_TCP_ECHO_SRV1)
|
---|
| 3055 | case 'e': /* tcp echo server */
|
---|
| 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));
|
---|
| 3058 | SIG_NET_CONS_PRINTF();
|
---|
| 3059 | FLUSH_SND_BUFF();
|
---|
| 3060 | }
|
---|
| 3061 | break;
|
---|
| 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) */
|
---|
| 3073 |
|
---|
| 3074 | #ifdef USE_WWW_SRV
|
---|
| 3075 | case 'w': /* WWW server */
|
---|
| 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));
|
---|
| 3078 | SIG_NET_CONS_PRINTF();
|
---|
| 3079 | FLUSH_SND_BUFF();
|
---|
| 3080 | }
|
---|
| 3081 | break;
|
---|
| 3082 | #endif /* of #ifdef USE_TCP_DISCARD_SRV */
|
---|
| 3083 |
|
---|
| 3084 | }
|
---|
| 3085 | break;
|
---|
| 3086 |
|
---|
| 3087 | #endif /* of #ifdef USE_TCP_EXTENTIONS */
|
---|
| 3088 |
|
---|
| 3089 | #ifdef USE_UDP_EXTENTIONS
|
---|
| 3090 |
|
---|
| 3091 | case 'u': /* udp server */
|
---|
| 3092 | switch (*(line + 2)) {
|
---|
| 3093 |
|
---|
| 3094 | #if !defined(USE_UDP_CALL_BACK)
|
---|
| 3095 |
|
---|
| 3096 | case 'e': /* udp echo server */
|
---|
| 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));
|
---|
| 3121 | SIG_NET_CONS_PRINTF();
|
---|
| 3122 | FLUSH_SND_BUFF();
|
---|
| 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 |
|
---|
| 3141 | break;
|
---|
| 3142 |
|
---|
| 3143 | #endif /* of #if !defined(USE_UDP_CALL_BACK) */
|
---|
| 3144 |
|
---|
| 3145 | }
|
---|
| 3146 | break;
|
---|
| 3147 |
|
---|
| 3148 | #endif /* of #ifdef USE_UDP_EXTENTIONS */
|
---|
| 3149 |
|
---|
| 3150 | default:
|
---|
| 3151 | if ((error = wup_tsk(atoi(skip_blanks(line + 1)))) != E_OK) {
|
---|
| 3152 | cons_printf(portid, "[WUP TSK] error: %s.\n", itron_strerror(error));
|
---|
| 3153 | SIG_NET_CONS_PRINTF();
|
---|
| 3154 | FLUSH_SND_BUFF();
|
---|
| 3155 | }
|
---|
| 3156 | break;
|
---|
| 3157 |
|
---|
| 3158 | }
|
---|
| 3159 | break;
|
---|
| 3160 |
|
---|
| 3161 | #else /* of #if defined(USE_TCP_EXTENTIONS) || defined(USE_UDP_EXTENTIONS) */
|
---|
| 3162 |
|
---|
| 3163 | case 'w': /* wake up task */
|
---|
| 3164 | if ((error = wup_tsk(atoi(skip_blanks(line + 1)))) != E_OK) {
|
---|
| 3165 | cons_printf(portid, "[WUP TSK] error: %s.\n", itron_strerror(error));
|
---|
| 3166 | SIG_NET_CONS_PRINTF();
|
---|
| 3167 | FLUSH_SND_BUFF();
|
---|
| 3168 | }
|
---|
| 3169 | break;
|
---|
| 3170 |
|
---|
| 3171 | #endif /* of #if defined(USE_TCP_EXTENTIONS) || defined(USE_UDP_EXTENTIONS) */
|
---|
| 3172 |
|
---|
| 3173 | default:
|
---|
| 3174 |
|
---|
| 3175 | if (*line) {
|
---|
| 3176 |
|
---|
| 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);
|
---|
| 3186 | SIG_NET_CONS_PRINTF();
|
---|
| 3187 | FLUSH_SND_BUFF();
|
---|
| 3188 |
|
---|
| 3189 | #endif /* of #ifdef USE_DBG_CONS_EXTRA_PARSE */
|
---|
| 3190 |
|
---|
| 3191 | }
|
---|
| 3192 | break;
|
---|
| 3193 | }
|
---|
| 3194 | }
|
---|
| 3195 |
|
---|
| 3196 | #endif /* of #ifdef USE_DBG_CONS_PARSER */
|
---|
| 3197 |
|
---|
| 3198 | /*
|
---|
| 3199 | * デバッグコンソールタスク
|
---|
| 3200 | */
|
---|
| 3201 |
|
---|
| 3202 | void
|
---|
| 3203 | dbg_con_task (intptr_t exinf)
|
---|
| 3204 | {
|
---|
| 3205 | static char line[DBG_LINE_SIZE + 1];
|
---|
| 3206 |
|
---|
| 3207 | ID tskid;
|
---|
| 3208 |
|
---|
| 3209 | #ifdef USE_LCD
|
---|
| 3210 | #ifdef SUPPORT_ETHER
|
---|
| 3211 |
|
---|
| 3212 | #if 0
|
---|
| 3213 | #if defined(SUPPORT_INET6)
|
---|
| 3214 |
|
---|
| 3215 | uint32_t lllen;
|
---|
| 3216 | const uint8_t *lladdr;
|
---|
| 3217 |
|
---|
| 3218 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
| 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) */
|
---|
| 3233 |
|
---|
| 3234 | if ((TINET_PRVER & UINT_C(0x0f)) > 0)
|
---|
| 3235 | lcd_printf(LCD_PORTID, "TINET-%d.%d.%d\n",
|
---|
| 3236 | (TINET_PRVER >> 12) & UINT_C(0x0f),
|
---|
| 3237 | (TINET_PRVER >> 4) & UINT_C(0x0f),
|
---|
| 3238 | TINET_PRVER & UINT_C(0x0f));
|
---|
| 3239 | else
|
---|
| 3240 | lcd_printf(LCD_PORTID, "TINET-%d.%d\n",
|
---|
| 3241 | (TINET_PRVER >> 12) & UINT_C(0x0f),
|
---|
| 3242 | (TINET_PRVER >> 4) & UINT_C(0x0f));
|
---|
| 3243 |
|
---|
| 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
|
---|
| 3256 |
|
---|
| 3257 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
| 3258 | #endif /* of #ifdef USE_LCD */
|
---|
| 3259 |
|
---|
| 3260 | get_tid(&tskid);
|
---|
| 3261 | cons_printf(CONSOLE_PORTID, "[CONSOLE:%d] started.\n", tskid);
|
---|
| 3262 | serial_ctl_por(CONSOLE_PORTID,
|
---|
| 3263 | IOCTL_ECHO | IOCTL_CRLF |
|
---|
| 3264 | IOCTL_FCSND | IOCTL_FCANY | IOCTL_FCRCV);
|
---|
| 3265 | netapp_srand (tskid);
|
---|
| 3266 | while (true) {
|
---|
| 3267 | cons_getline(CONSOLE_PORTID, line, DBG_LINE_SIZE);
|
---|
| 3268 | dbg_parse(CONSOLE_PORTID, line);
|
---|
| 3269 | }
|
---|
| 3270 | }
|
---|
| 3271 |
|
---|
| 3272 | #endif /* of #ifdef USE_DBG_CONS */
|
---|