1 | /*
|
---|
2 | * TINET (TCP/IP Protocol Stack)
|
---|
3 | *
|
---|
4 | * Copyright (C) 2001-2009 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 |
|
---|
40 | #ifdef TARGET_KERNEL_ASP
|
---|
41 |
|
---|
42 | #include <kernel.h>
|
---|
43 | #include <sil.h>
|
---|
44 | #include <syssvc/serial.h>
|
---|
45 | #include <syssvc/logtask.h>
|
---|
46 | #include "kernel_cfg.h"
|
---|
47 | #include "kernel/kernel_impl.h"
|
---|
48 | #include "kernel/task.h"
|
---|
49 |
|
---|
50 | #endif /* of #ifdef TARGET_KERNEL_ASP */
|
---|
51 |
|
---|
52 | #ifdef TARGET_KERNEL_JSP
|
---|
53 |
|
---|
54 | #include <s_services.h>
|
---|
55 | #include <t_services.h>
|
---|
56 | #include "kernel_id.h"
|
---|
57 |
|
---|
58 | #include "../kernel/jsp_kernel.h"
|
---|
59 | #include "../kernel/task.h"
|
---|
60 |
|
---|
61 | #endif /* of #ifdef TARGET_KERNEL_JSP */
|
---|
62 |
|
---|
63 | #include <tinet_defs.h>
|
---|
64 | #include <tinet_config.h>
|
---|
65 |
|
---|
66 | #include <net/if.h>
|
---|
67 | #include <net/if_ppp.h>
|
---|
68 | #include <net/if_loop.h>
|
---|
69 | #include <net/ethernet.h>
|
---|
70 | #include <net/net.h>
|
---|
71 | #include <net/net_buf.h>
|
---|
72 | #include <net/net_timer.h>
|
---|
73 | #include <net/ppp_var.h>
|
---|
74 | #include <net/ppp_fsm.h>
|
---|
75 | #include <net/ppp_lcp.h>
|
---|
76 | #include <net/ppp_ipcp.h>
|
---|
77 | #include <net/ppp_modem.h>
|
---|
78 | #include <net/net_count.h>
|
---|
79 |
|
---|
80 | #include <netinet/in.h>
|
---|
81 | #include <netinet/in_var.h>
|
---|
82 | #include <netinet/in_itron.h>
|
---|
83 | #include <netinet/ip.h>
|
---|
84 | #include <netinet/ip_var.h>
|
---|
85 | #include <netinet/ip6.h>
|
---|
86 | #include <netinet6/ip6_var.h>
|
---|
87 | #include <netinet6/nd6.h>
|
---|
88 | #include <netinet/if_ether.h>
|
---|
89 | #include <netinet/tcp.h>
|
---|
90 | #include <netinet/tcp_timer.h>
|
---|
91 | #include <netinet/tcp_var.h>
|
---|
92 | #include <netinet/tcp_fsm.h>
|
---|
93 | #include <netinet/udp.h>
|
---|
94 | #include <netinet/udp_var.h>
|
---|
95 |
|
---|
96 | #include <net/if_var.h>
|
---|
97 | #include <net/if6_var.h>
|
---|
98 |
|
---|
99 | #include <netapp/netapp.h>
|
---|
100 | #include <netapp/netapp_var.h>
|
---|
101 | #include <netapp/echo.h>
|
---|
102 | #include <netapp/discard.h>
|
---|
103 | #include <netapp/dbg_cons.h>
|
---|
104 |
|
---|
105 | #ifdef USE_LCD
|
---|
106 |
|
---|
107 | #include "sc1602/lcd.h"
|
---|
108 |
|
---|
109 | #endif /* of #ifdef USE_LCD */
|
---|
110 |
|
---|
111 | #ifdef USE_DBG_CONS
|
---|
112 |
|
---|
113 | #define DBG_LINE_SIZE 63
|
---|
114 |
|
---|
115 | /*
|
---|
116 | * task_status -- タスクの状態の出力
|
---|
117 | */
|
---|
118 |
|
---|
119 | static const char task_stat_str[][sizeof("SUSPENDED")] = {
|
---|
120 | "DORMANT", /* 休止状態 */
|
---|
121 | "RUNNABLE", /* 実行できる状態 */
|
---|
122 | "WAINTING", /* 待ち状態 */
|
---|
123 | "SUSPENDED", /* 強制待ち状態 */
|
---|
124 | "SLEEP", /* 起床待ち状態 */
|
---|
125 | "WOBJ", /* 同期・通信オブジェクトに対する待ち状態 */
|
---|
126 | "WOBJCB", /* 共通部分の待ちキューにつながっている。 */
|
---|
127 | };
|
---|
128 |
|
---|
129 | static void
|
---|
130 | task_status (ID portid, char *line)
|
---|
131 | {
|
---|
132 | TCB *tcb;
|
---|
133 | int_t ix, st, sx;
|
---|
134 |
|
---|
135 | WAI_NET_CONS_PRINTF();
|
---|
136 | cons_printf(portid,
|
---|
137 | "TASK Status\n"
|
---|
138 | "ID PI State\n");
|
---|
139 | for (ix = TMIN_TSKID; ix <= tmax_tskid; ix ++) {
|
---|
140 | tcb = get_tcb(ix);
|
---|
141 | cons_printf(portid, "%2d %2d ", ix, tcb->priority);
|
---|
142 | st = tcb->tstat;
|
---|
143 | for (sx = 0; st; sx ++) {
|
---|
144 | if (st & 0x01) {
|
---|
145 | cons_printf(portid, "%s", task_stat_str[sx]);
|
---|
146 | if (st & 0xfe)
|
---|
147 | cons_printf(portid, "|");
|
---|
148 | }
|
---|
149 | st >>= 1;
|
---|
150 | }
|
---|
151 | cons_printf(portid, "\n");
|
---|
152 | }
|
---|
153 |
|
---|
154 | SIG_NET_CONS_PRINTF();
|
---|
155 | FLUSH_SND_BUFF();
|
---|
156 | }
|
---|
157 |
|
---|
158 | #ifdef SUPPORT_TCP
|
---|
159 |
|
---|
160 | /*
|
---|
161 | * tcp_status -- TCP の状態の出力
|
---|
162 | */
|
---|
163 |
|
---|
164 | static const char tcp_fsm_str[][sizeof("ESTABLISHED")] = {
|
---|
165 | "CLOSED", /* クローズ */
|
---|
166 | "LISTEN", /* 受動オープン */
|
---|
167 | "SYN_SENT", /* 能動オープン、SYN 送信済み */
|
---|
168 | "SYN_RECVD", /* 受動オープン、SYN 受信済み */
|
---|
169 | "ESTABLISHED", /* コネクション開設完了 */
|
---|
170 | "CLOSE_WAIT", /* 相手から FIN 受信、APP の終了待ち */
|
---|
171 | "FIN_WAIT_1", /* APP が終了、FIN 送信済み、ACK 待ち */
|
---|
172 | "CLOSING", /* 同時クローズ、FIN 交換済み、ACK 待ち */
|
---|
173 | "LAST_ACK", /* APP が終了、ACK 待ち */
|
---|
174 | "FIN_WAIT_2", /* 相手からの FIN 待ち */
|
---|
175 | "TIME_WAIT", /* 相手からの FIN 受信済み、時間待ち */
|
---|
176 | };
|
---|
177 |
|
---|
178 | #if defined(SUPPORT_INET4)
|
---|
179 |
|
---|
180 | static void
|
---|
181 | tcp_status (ID portid, char *line)
|
---|
182 | {
|
---|
183 | T_TCP_CEP* cep;
|
---|
184 | uint_t len;
|
---|
185 |
|
---|
186 | #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0
|
---|
187 |
|
---|
188 | T_TCP_TWCEP* twcep;
|
---|
189 |
|
---|
190 | #endif /* of #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 */
|
---|
191 |
|
---|
192 | #ifdef TCP_CFG_PASSIVE_OPEN
|
---|
193 |
|
---|
194 | T_TCP_REP* rep;
|
---|
195 | int_t cnt;
|
---|
196 |
|
---|
197 | #endif /* of #ifdef TCP_CFG_PASSIVE_OPEN */
|
---|
198 |
|
---|
199 | WAI_NET_CONS_PRINTF();
|
---|
200 | cons_printf(portid,
|
---|
201 | "TCP CEP Status\n"
|
---|
202 | "ID Snd-Q Rcv-Q Local Address Foreign Address State\n");
|
---|
203 |
|
---|
204 | for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++)
|
---|
205 | if (!VALID_TCP_CEP(cep)) {
|
---|
206 | cons_printf(portid,
|
---|
207 | "%2d%c 0 0"
|
---|
208 | " - "
|
---|
209 | " - "
|
---|
210 | " INVALID\n",
|
---|
211 | GET_TCP_CEPID(cep),
|
---|
212 | DYNAMIC_TCP_CEP(cep) ? 'D' : ' ');
|
---|
213 | }
|
---|
214 | else if (cep->fsm_state == TCP_FSM_CLOSED) {
|
---|
215 | cons_printf(portid,
|
---|
216 | "%2d%c 0 0"
|
---|
217 | " - "
|
---|
218 | " - "
|
---|
219 | " CLOSED\n",
|
---|
220 | GET_TCP_CEPID(cep),
|
---|
221 | DYNAMIC_TCP_CEP(cep) ? 'D' : ' ');
|
---|
222 | }
|
---|
223 | else if (cep->fsm_state == TCP_FSM_LISTEN) {
|
---|
224 | cons_printf(portid,
|
---|
225 | "%2d%c 0 0 ",
|
---|
226 | GET_TCP_CEPID(cep),
|
---|
227 | DYNAMIC_TCP_CEP(cep) ? 'D' : ' ');
|
---|
228 | len = PUT_IPADDR(portid, &cep->myaddr.ipaddr, 0);
|
---|
229 | cons_putchar(portid, ':');
|
---|
230 | len += cons_putnumber(portid, cep->myaddr.portno, 10, radhex, 0, false, ' ');
|
---|
231 | for (len = 20 - len; len -- > 0; )
|
---|
232 | cons_putchar(portid, ' ');
|
---|
233 | cons_printf(portid,
|
---|
234 | " - "
|
---|
235 | " LISTEN\n");
|
---|
236 | }
|
---|
237 | else {
|
---|
238 | cons_printf(portid,
|
---|
239 | "%2d%c %5d %5d ",
|
---|
240 | GET_TCP_CEPID(cep),
|
---|
241 | DYNAMIC_TCP_CEP(cep) ? 'D' : ' ',
|
---|
242 | cep->swbuf_count, cep->rwbuf_count);
|
---|
243 | len = PUT_IPADDR(portid, &cep->myaddr.ipaddr, 0);
|
---|
244 | cons_putchar(portid, ':');
|
---|
245 | len += cons_putnumber(portid, cep->myaddr.portno, 10, radhex, 0, false, ' ');
|
---|
246 | for (len = 21 - len; len -- > 0; )
|
---|
247 | cons_putchar(portid, ' ');
|
---|
248 | len = PUT_IPADDR(portid, &cep->dstaddr.ipaddr, 0);
|
---|
249 | cons_putchar(portid, ':');
|
---|
250 | len += cons_putnumber(portid, cep->dstaddr.portno, 10, radhex, 0, false, ' ');
|
---|
251 | for (len = 20 - len; len -- > 0; )
|
---|
252 | cons_putchar(portid, ' ');
|
---|
253 | if (cep->fsm_state == TCP_FSM_TIME_WAIT)
|
---|
254 | cons_printf(portid, " %s(%d)\n", tcp_fsm_str[cep->fsm_state],
|
---|
255 | cep->timer[TCP_TIM_2MSL] / TCP_SLOW_HZ);
|
---|
256 | else
|
---|
257 | cons_printf(portid, " %s\n", tcp_fsm_str[cep->fsm_state]);
|
---|
258 | }
|
---|
259 |
|
---|
260 | #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0
|
---|
261 |
|
---|
262 | for (twcep = tcp_twcep; twcep < &tcp_twcep[NUM_TCP_TW_CEP_ENTRY]; twcep ++) {
|
---|
263 | if (twcep->fsm_state == TCP_FSM_CLOSED) {
|
---|
264 | cons_printf(portid,
|
---|
265 | "%2dTW 0 0"
|
---|
266 | " - "
|
---|
267 | " - "
|
---|
268 | " CLOSED\n",
|
---|
269 | GET_TCP_TWCEPID(twcep));
|
---|
270 | }
|
---|
271 | else {
|
---|
272 | cons_printf(portid, "%2dTW 0 0 ", GET_TCP_TWCEPID(twcep));
|
---|
273 | len = PUT_IPADDR(portid, &twcep->myaddr.ipaddr, 0);
|
---|
274 | cons_putchar(portid, ':');
|
---|
275 | len += cons_putnumber(portid, twcep->myaddr.portno, 10, radhex, 0, false, ' ');
|
---|
276 | for (len = 21 - len; len -- > 0; )
|
---|
277 | cons_putchar(portid, ' ');
|
---|
278 | len = PUT_IPADDR(portid, &twcep->dstaddr.ipaddr, 0);
|
---|
279 | cons_putchar(portid, ':');
|
---|
280 | len += cons_putnumber(portid, twcep->dstaddr.portno, 10, radhex, 0, false, ' ');
|
---|
281 | for (len = 20 - len; len -- > 0; )
|
---|
282 | cons_putchar(portid, ' ');
|
---|
283 | if (twcep->fsm_state == TCP_FSM_TIME_WAIT)
|
---|
284 | cons_printf(portid, " %s(%d)\n", tcp_fsm_str[twcep->fsm_state],
|
---|
285 | twcep->timer_2msl / TCP_SLOW_HZ);
|
---|
286 | else
|
---|
287 | cons_printf(portid, " %s\n", tcp_fsm_str[twcep->fsm_state]);
|
---|
288 | }
|
---|
289 | }
|
---|
290 |
|
---|
291 | #endif /* of #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 */
|
---|
292 |
|
---|
293 | #ifdef TCP_CFG_PASSIVE_OPEN
|
---|
294 |
|
---|
295 | cons_printf(portid,
|
---|
296 | "TCP REP Status\n"
|
---|
297 | "ID Local Address CEP\n");
|
---|
298 | for (rep = tcp_rep; rep < &tcp_rep[tmax_tcp_repid]; rep ++) {
|
---|
299 | cons_printf(portid, "%2d%c ", GET_TCP_REPID(rep), DYNAMIC_TCP_REP(rep) ? 'D' : ' ');
|
---|
300 | if (VALID_TCP_REP(rep)) {
|
---|
301 | len = PUT_IPADDR(portid, &rep->myaddr.ipaddr, 0);
|
---|
302 | cons_putchar(portid, ':');
|
---|
303 | len += cons_putnumber(portid, rep->myaddr.portno, 10, radhex, 0, false, ' ');
|
---|
304 | for (len = 21 - len; len -- > 0; )
|
---|
305 | cons_putchar(portid, ' ');
|
---|
306 | cnt = 0;
|
---|
307 | for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++) {
|
---|
308 | if (cep->rep == rep) {
|
---|
309 | if (cnt > 0)
|
---|
310 | cons_printf(portid, ",%d", GET_TCP_CEPID(cep));
|
---|
311 | else
|
---|
312 | cons_printf(portid, "%d", GET_TCP_CEPID(cep));
|
---|
313 | cnt ++;
|
---|
314 | }
|
---|
315 | }
|
---|
316 | }
|
---|
317 | else
|
---|
318 | cons_printf(portid, "INVALID");
|
---|
319 | cons_putchar(portid, '\n');
|
---|
320 | }
|
---|
321 |
|
---|
322 | #endif /* of #ifdef TCP_CFG_PASSIVE_OPEN */
|
---|
323 |
|
---|
324 | SIG_NET_CONS_PRINTF();
|
---|
325 | FLUSH_SND_BUFF();
|
---|
326 | }
|
---|
327 |
|
---|
328 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
329 |
|
---|
330 | #if defined(SUPPORT_INET6)
|
---|
331 |
|
---|
332 | static void
|
---|
333 | tcp_status (ID portid, char *line)
|
---|
334 | {
|
---|
335 | T_TCP_CEP* cep;
|
---|
336 | uint_t len;
|
---|
337 |
|
---|
338 | #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0
|
---|
339 |
|
---|
340 | T_TCP_TWCEP* twcep;
|
---|
341 |
|
---|
342 | #endif /* of #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 */
|
---|
343 |
|
---|
344 | #ifdef TCP_CFG_PASSIVE_OPEN
|
---|
345 |
|
---|
346 | T_TCP_REP* rep;
|
---|
347 | int_t cnt;
|
---|
348 |
|
---|
349 | #endif /* of #ifdef TCP_CFG_PASSIVE_OPEN */
|
---|
350 |
|
---|
351 | WAI_NET_CONS_PRINTF();
|
---|
352 | cons_printf(portid,
|
---|
353 | "TCP CEP Status\n"
|
---|
354 | "ID Snd-Q Rcv-Q Foreign Address State\n");
|
---|
355 |
|
---|
356 | for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++)
|
---|
357 | if (!VALID_TCP_CEP(cep)) {
|
---|
358 | cons_printf(portid,
|
---|
359 | "%2d%c 0 0"
|
---|
360 | " - "
|
---|
361 | " INVALID\n",
|
---|
362 | GET_TCP_CEPID(cep),
|
---|
363 | DYNAMIC_TCP_CEP(cep) ? 'D' : ' ');
|
---|
364 | }
|
---|
365 | else if (cep->fsm_state == TCP_FSM_CLOSED) {
|
---|
366 | cons_printf(portid,
|
---|
367 | "%2d%c 0 0"
|
---|
368 | " - "
|
---|
369 | " CLOSED\n",
|
---|
370 | GET_TCP_CEPID(cep),
|
---|
371 | DYNAMIC_TCP_CEP(cep) ? 'D' : ' ');
|
---|
372 | }
|
---|
373 | else if (cep->fsm_state == TCP_FSM_LISTEN) {
|
---|
374 | cons_printf(portid,
|
---|
375 | "%2d%c 0 0"
|
---|
376 | " - "
|
---|
377 | " LISTEN\n",
|
---|
378 | GET_TCP_CEPID(cep),
|
---|
379 | DYNAMIC_TCP_CEP(cep) ? 'D' : ' ');
|
---|
380 | }
|
---|
381 | else {
|
---|
382 | cons_printf(portid,
|
---|
383 | "%2d%c %5d %5d ",
|
---|
384 | GET_TCP_CEPID(cep),
|
---|
385 | DYNAMIC_TCP_CEP(cep) ? 'D' : ' ',
|
---|
386 | cep->swbuf_count, cep->rwbuf_count);
|
---|
387 | len = PUT_IPADDR(portid, &cep->dstaddr.ipaddr, 0);
|
---|
388 | cons_putchar(portid, '.');
|
---|
389 | len += cons_putnumber(portid, cep->dstaddr.portno, 10, radhex, 0, false, ' ');
|
---|
390 | for (len = 42 - len; len -- > 0; )
|
---|
391 | cons_putchar(portid, ' ');
|
---|
392 | if (cep->fsm_state == TCP_FSM_TIME_WAIT)
|
---|
393 | cons_printf(portid, " %s(%d)\n", tcp_fsm_str[cep->fsm_state],
|
---|
394 | cep->timer[TCP_TIM_2MSL] / TCP_SLOW_HZ);
|
---|
395 | else
|
---|
396 | cons_printf(portid, " %s\n", tcp_fsm_str[cep->fsm_state]);
|
---|
397 | }
|
---|
398 |
|
---|
399 | #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0
|
---|
400 |
|
---|
401 | for (twcep = tcp_twcep; twcep < &tcp_twcep[NUM_TCP_TW_CEP_ENTRY]; twcep ++) {
|
---|
402 | if (twcep->fsm_state == TCP_FSM_CLOSED) {
|
---|
403 | cons_printf(portid,
|
---|
404 | "%2dTW 0 0"
|
---|
405 | " - "
|
---|
406 | " CLOSED\n",
|
---|
407 | GET_TCP_TWCEPID(twcep));
|
---|
408 | }
|
---|
409 | else {
|
---|
410 | cons_printf(portid, "%2dTW 0 0 ", GET_TCP_TWCEPID(twcep));
|
---|
411 | len = PUT_IPADDR(portid, &twcep->dstaddr.ipaddr, 0);
|
---|
412 | cons_putchar(portid, '.');
|
---|
413 | len += cons_putnumber(portid, twcep->dstaddr.portno, 10, radhex, 0, false, ' ');
|
---|
414 | for (len = 42 - len; len -- > 0; )
|
---|
415 | cons_putchar(portid, ' ');
|
---|
416 | if (twcep->fsm_state == TCP_FSM_TIME_WAIT)
|
---|
417 | cons_printf(portid, " %s(%d)\n", tcp_fsm_str[twcep->fsm_state],
|
---|
418 | twcep->timer_2msl / TCP_SLOW_HZ);
|
---|
419 | else
|
---|
420 | cons_printf(portid, " %s\n", tcp_fsm_str[twcep->fsm_state]);
|
---|
421 | }
|
---|
422 | }
|
---|
423 |
|
---|
424 | #endif /* of #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 */
|
---|
425 |
|
---|
426 | #ifdef TCP_CFG_PASSIVE_OPEN
|
---|
427 |
|
---|
428 | cons_printf(portid,
|
---|
429 | "TCP REP Status\n"
|
---|
430 | "ID Local Address CEP\n");
|
---|
431 | for (rep = tcp_rep; rep < &tcp_rep[tmax_tcp_repid]; rep ++) {
|
---|
432 | cons_printf(portid, "%2d%c ", GET_TCP_REPID(rep), DYNAMIC_TCP_REP(rep) ? 'D' : ' ');
|
---|
433 | if (VALID_TCP_REP(rep)) {
|
---|
434 | len = PUT_IPADDR(portid, &rep->myaddr.ipaddr, 0);
|
---|
435 | cons_putchar(portid, '.');
|
---|
436 | len += cons_putnumber(portid, rep->myaddr.portno, 10, radhex, 0, false, ' ');
|
---|
437 | for (len = 21 - len; len -- > 0; )
|
---|
438 | cons_putchar(portid, ' ');
|
---|
439 | cnt = 0;
|
---|
440 | for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++) {
|
---|
441 | if (cep->rep == rep) {
|
---|
442 | if (cnt > 0)
|
---|
443 | cons_printf(portid, ",%d", GET_TCP_CEPID(cep));
|
---|
444 | else
|
---|
445 | cons_printf(portid, "%d", GET_TCP_CEPID(cep));
|
---|
446 | cnt ++;
|
---|
447 | }
|
---|
448 | }
|
---|
449 | }
|
---|
450 | else
|
---|
451 | cons_printf(portid, "INVALID");
|
---|
452 | cons_putchar(portid, '\n');
|
---|
453 | }
|
---|
454 |
|
---|
455 | #endif /* of #ifdef TCP_CFG_PASSIVE_OPEN */
|
---|
456 |
|
---|
457 | SIG_NET_CONS_PRINTF();
|
---|
458 | FLUSH_SND_BUFF();
|
---|
459 | }
|
---|
460 |
|
---|
461 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
462 |
|
---|
463 | #endif /* of #ifdef SUPPORT_TCP */
|
---|
464 |
|
---|
465 | #ifdef SUPPORT_UDP
|
---|
466 |
|
---|
467 | /*
|
---|
468 | * udp_status -- UDP の状態の出力
|
---|
469 | */
|
---|
470 |
|
---|
471 | static void
|
---|
472 | udp_status (ID portid, char *line)
|
---|
473 | {
|
---|
474 | T_UDP_CEP* cep;
|
---|
475 | uint_t len;
|
---|
476 |
|
---|
477 | WAI_NET_CONS_PRINTF();
|
---|
478 | cons_printf(portid,
|
---|
479 | "UDP CEP Status\n"
|
---|
480 | "ID Local Address\n");
|
---|
481 |
|
---|
482 | for (cep = udp_cep; cep < &udp_cep[tmax_udp_ccepid]; cep ++) {
|
---|
483 | cons_printf(portid, "%2d%c ", GET_UDP_CEPID(cep), DYNAMIC_UDP_CEP(cep) ? 'D' : ' ');
|
---|
484 | if (VALID_UDP_CEP(cep)) {
|
---|
485 | len = PUT_IPADDR(portid, &cep->myaddr.ipaddr, 0);
|
---|
486 | cons_putchar(portid, '.');
|
---|
487 | len += cons_putnumber(portid, cep->myaddr.portno, 10, radhex, 0, false, ' ');
|
---|
488 | }
|
---|
489 | else
|
---|
490 | cons_printf(portid, "INVALID");
|
---|
491 | cons_putchar(portid, '\n');
|
---|
492 | }
|
---|
493 |
|
---|
494 | SIG_NET_CONS_PRINTF();
|
---|
495 | FLUSH_SND_BUFF();
|
---|
496 | }
|
---|
497 |
|
---|
498 | #endif /* of #ifdef SUPPORT_UDP */
|
---|
499 |
|
---|
500 | #ifdef SUPPORT_ETHER
|
---|
501 |
|
---|
502 | #if defined(SUPPORT_INET4)
|
---|
503 |
|
---|
504 | /*
|
---|
505 | * ifa_status -- ARP キャッシュ出力
|
---|
506 | */
|
---|
507 |
|
---|
508 | static void
|
---|
509 | ifa_status (ID portid, char *line)
|
---|
510 | {
|
---|
511 | const T_ARP_ENTRY *cache;
|
---|
512 | int_t ix;
|
---|
513 |
|
---|
514 | WAI_NET_CONS_PRINTF();
|
---|
515 | cons_printf(portid,
|
---|
516 | "ARP Cache\n"
|
---|
517 | "IX Expire IP Address MAC Address\n");
|
---|
518 |
|
---|
519 | /* expire の単位は [ms]。*/
|
---|
520 | cache = arp_get_cache();
|
---|
521 | for (ix = 0; ix < NUM_ARP_ENTRY; ix ++) {
|
---|
522 | if (cache[ix].expire != 0)
|
---|
523 | cons_printf(portid, "%2d %6d %15I %M\n",
|
---|
524 | ix, cache[ix].expire / NET_TIMER_HZ,
|
---|
525 | &cache[ix].ip_addr, cache[ix].mac_addr);
|
---|
526 | }
|
---|
527 |
|
---|
528 | SIG_NET_CONS_PRINTF();
|
---|
529 | FLUSH_SND_BUFF();
|
---|
530 | }
|
---|
531 |
|
---|
532 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
533 |
|
---|
534 | #if defined(SUPPORT_INET6)
|
---|
535 |
|
---|
536 | /*
|
---|
537 | * ifa_status -- 近隣キャッシュ状態の出力
|
---|
538 | */
|
---|
539 |
|
---|
540 | static const char nd_state_str[][sizeof("INCOMPLETE")] = {
|
---|
541 | "FREE", /* 未使用 */
|
---|
542 | "NO STATE", /* 状態未定義 */
|
---|
543 | "INCOMPLETE", /* 未解決 */
|
---|
544 | "REACHABLE", /* 到達可能 */
|
---|
545 | "STALE", /* 到達可能性は未確認 */
|
---|
546 | "DELAY", /* 到達可能性の確認待機 */
|
---|
547 | "PROBE", /* 到達可能性を確認中 */
|
---|
548 | };
|
---|
549 |
|
---|
550 | static void
|
---|
551 | ifa_status (ID portid, char *line)
|
---|
552 | {
|
---|
553 | const T_LLINFO_ND6 *cache;
|
---|
554 | SYSTIM now;
|
---|
555 | int_t ix;
|
---|
556 |
|
---|
557 | WAI_NET_CONS_PRINTF();
|
---|
558 | cons_printf(portid,
|
---|
559 | "ND Cache Status\n"
|
---|
560 | "IX Expire State MAC Address IP Address\n");
|
---|
561 |
|
---|
562 | /* expire の単位は [ms]。*/
|
---|
563 | get_tim(&now);
|
---|
564 | cache = nd6_get_cache();
|
---|
565 | for (ix = 0; ix < NUM_ND6_CACHE_ENTRY; ix ++) {
|
---|
566 | if (cache[ix].state != ND6_LLINFO_FREE) {
|
---|
567 | cons_printf(portid, "%2d %6d %10s %M %I\n",
|
---|
568 | ix,
|
---|
569 | cache[ix].state == ND6_LLINFO_STALE ||
|
---|
570 | (uint32_t)(cache[ix].expire - now) <= 0
|
---|
571 | ? 0 : (cache[ix].expire - now) / SYSTIM_HZ,
|
---|
572 | nd_state_str[cache[ix].state],
|
---|
573 | &cache[ix].ifaddr,
|
---|
574 | &cache[ix].addr);
|
---|
575 | }
|
---|
576 | }
|
---|
577 |
|
---|
578 | SIG_NET_CONS_PRINTF();
|
---|
579 | FLUSH_SND_BUFF();
|
---|
580 | }
|
---|
581 |
|
---|
582 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
583 |
|
---|
584 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
585 |
|
---|
586 | #if NET_COUNT_ENABLE
|
---|
587 |
|
---|
588 | /*
|
---|
589 | * net_count_struct -- ネットワーク統計情報
|
---|
590 | */
|
---|
591 |
|
---|
592 | static void
|
---|
593 | net_count_struct (ID portid, char *name, T_NET_COUNT *item)
|
---|
594 | {
|
---|
595 | cons_printf(portid, "\n%s\n", name);
|
---|
596 | cons_printf(portid, "\t受信オクテット数\t%lu\n", item->in_octets);
|
---|
597 | cons_printf(portid, "\t送信オクテット数\t%lu\n", item->out_octets);
|
---|
598 | cons_printf(portid, "\t受信バケット数\t%lu\n", item->in_packets);
|
---|
599 | cons_printf(portid, "\t送信バケット数\t%lu\n", item->out_packets);
|
---|
600 | cons_printf(portid, "\t受信エラーバケット数\t%lu\n", item->in_err_packets);
|
---|
601 | cons_printf(portid, "\t送信エラーバケット数\t%lu\n", item->out_err_packets);
|
---|
602 | }
|
---|
603 |
|
---|
604 | /*
|
---|
605 | * net_count -- ネットワーク統計情報
|
---|
606 | */
|
---|
607 |
|
---|
608 | static void
|
---|
609 | net_count (ID portid, char *line)
|
---|
610 | {
|
---|
611 | const T_NET_BUF_ENTRY *tbl;
|
---|
612 | SYSTIM now;
|
---|
613 | int_t ix;
|
---|
614 |
|
---|
615 | WAI_NET_CONS_PRINTF();
|
---|
616 | get_tim(&now);
|
---|
617 | cons_printf(portid, "ネットワーク統計情報\t経過時間[ms]\t%lu\t", now);
|
---|
618 | if (now > (1000 * 3600 * 24))
|
---|
619 | cons_printf(portid, "%3lu日 %2lu時間 %2lu分 %2lu秒\n",
|
---|
620 | now / (1000 * 3600 * 24),
|
---|
621 | (now / (1000 * 3600)) % 24,
|
---|
622 | (now / (1000 * 60 )) % 60,
|
---|
623 | (now / 1000 ) % 60);
|
---|
624 | else
|
---|
625 | cons_printf(portid, "%2lu時間 %2lu分 %2lu秒\n",
|
---|
626 | (now / (1000 * 3600)) % 24,
|
---|
627 | (now / (1000 * 60 )) % 60,
|
---|
628 | (now / 1000 ) % 60);
|
---|
629 |
|
---|
630 | #ifdef SUPPORT_PPP
|
---|
631 |
|
---|
632 | net_count_struct(portid, "HDLC", &net_count_hdlc);
|
---|
633 | cons_printf(portid, "\nPPP\n");
|
---|
634 | cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ppp.in_octets);
|
---|
635 | cons_printf(portid, "\t送信オクテット数\t%lu\n", net_count_ppp.out_octets);
|
---|
636 | cons_printf(portid, "\t受信バケット数\t%lu\n", net_count_ppp.in_packets);
|
---|
637 | cons_printf(portid, "\t送信バケット数\t%lu\n", net_count_ppp.out_packets);
|
---|
638 | cons_printf(portid, "\t受信エラーバケット数\t%lu\n", net_count_ppp.in_err_packets);
|
---|
639 | cons_printf(portid, "\t送信エラーバケット数\t%lu\n", net_count_ppp.out_err_packets);
|
---|
640 | cons_printf(portid, "\tnet_buf 割り当て失敗数\t%lu\n", net_count_ppp_no_bufs);
|
---|
641 |
|
---|
642 | cons_printf(portid, "\nLCP\n");
|
---|
643 | cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ppp_lcp_in_octets);
|
---|
644 | cons_printf(portid, "\t受信バケット数\t%lu\n", net_count_ppp_lcp_in_packets);
|
---|
645 |
|
---|
646 | cons_printf(portid, "\nIPCP\n");
|
---|
647 | cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ppp_ipcp_in_octets);
|
---|
648 | cons_printf(portid, "\t受信バケット数\t%lu\n", net_count_ppp_ipcp_in_packets);
|
---|
649 |
|
---|
650 | cons_printf(portid, "\nPAP\n");
|
---|
651 | cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ppp_upap_in_octets);
|
---|
652 | cons_printf(portid, "\t受信バケット数\t%lu\n", net_count_ppp_upap_in_packets);
|
---|
653 |
|
---|
654 | #endif /* of #ifdef SUPPORT_PPP */
|
---|
655 |
|
---|
656 | #ifdef SUPPORT_ETHER
|
---|
657 |
|
---|
658 | net_count_struct(portid, "イーサネット", &net_count_ether);
|
---|
659 |
|
---|
660 | cons_printf(portid, "\nイーサネット・ネットワークインタフェース\n");
|
---|
661 | cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_IN_OCTETS]);
|
---|
662 | cons_printf(portid, "\t受信バケット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_IN_PACKETS]);
|
---|
663 | cons_printf(portid, "\t受信エラーバケット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_IN_ERR_PACKETS]);
|
---|
664 | cons_printf(portid, "\tnet_buf 割り当て失敗数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_NO_BUFS]);
|
---|
665 | cons_printf(portid, "\t受信セマフォ資源返却上限オーバー数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_RXB_QOVRS]);
|
---|
666 | cons_printf(portid, "\t送信オクテット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_OUT_OCTETS]);
|
---|
667 | cons_printf(portid, "\t送信バケット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_OUT_PACKETS]);
|
---|
668 | cons_printf(portid, "\t送信エラーバケット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_OUT_ERR_PACKETS]);
|
---|
669 | cons_printf(portid, "\tコリジョン数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_COLS]);
|
---|
670 | cons_printf(portid, "\t送信セマフォ資源返却上限オーバー数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_TXB_QOVRS]);
|
---|
671 | cons_printf(portid, "\t送信タイムアウト数 \t%lu\n", net_count_ether_nic[NC_ETHER_NIC_TIMEOUTS]);
|
---|
672 | cons_printf(portid, "\tリセット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_RESETS]);
|
---|
673 |
|
---|
674 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
675 |
|
---|
676 | #if defined(SUPPORT_INET4)
|
---|
677 |
|
---|
678 | #ifdef SUPPORT_ETHER
|
---|
679 |
|
---|
680 | net_count_struct(portid, "ARP", &net_count_arp);
|
---|
681 |
|
---|
682 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
683 |
|
---|
684 | cons_printf(portid, "\nIPv4\n");
|
---|
685 | cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ip4[NC_IP4_IN_OCTETS]);
|
---|
686 | cons_printf(portid, "\t受信データグラム数\t%lu\n", net_count_ip4[NC_IP4_IN_PACKETS]);
|
---|
687 | cons_printf(portid, "\t受信エラーデータグラム数\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_PACKETS]);
|
---|
688 | cons_printf(portid, "\tチェックサムエラー数\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_CKSUM]);
|
---|
689 | cons_printf(portid, "\t長さエラー数\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_SHORT]);
|
---|
690 | cons_printf(portid, "\tバージョンエラー数\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_VER]);
|
---|
691 | cons_printf(portid, "\tアドレスエラー数\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_ADDR]);
|
---|
692 | cons_printf(portid, "\tプロトコルエラー数\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_PROTO]);
|
---|
693 | cons_printf(portid, "\tオプション入力数\t%lu\n", net_count_ip4[NC_IP4_OPTS]);
|
---|
694 | cons_printf(portid, "\t分割受信数\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN]);
|
---|
695 | cons_printf(portid, "\t分割受信フラグメント数\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN_FRAGS]);
|
---|
696 | cons_printf(portid, "\t分割受信再構成成功数\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN_OK]);
|
---|
697 | cons_printf(portid, "\t分割受信破棄数\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN_DROP]);
|
---|
698 | cons_printf(portid, "\t分割受信バッファり当て失敗数\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN_NO_BUF]);
|
---|
699 | cons_printf(portid, "\t分割受信タイムアウト数\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN_TMOUT]);
|
---|
700 | cons_printf(portid, "\t送信オクテット数\t%lu\n", net_count_ip4[NC_IP4_OUT_OCTETS]);
|
---|
701 | cons_printf(portid, "\t送信データグラム数\t%lu\n", net_count_ip4[NC_IP4_OUT_PACKETS]);
|
---|
702 | cons_printf(portid, "\t送信エラーデータグラム数\t%lu\n", net_count_ip4[NC_IP4_OUT_ERR_PACKETS]);
|
---|
703 | cons_printf(portid, "\t分割送信数\t%lu\n", net_count_ip4[NC_IP4_FRAG_OUT]);
|
---|
704 | cons_printf(portid, "\t分割送信フラグメント数\t%lu\n", net_count_ip4[NC_IP4_FRAG_OUT_FRAGS]);
|
---|
705 |
|
---|
706 | net_count_struct(portid, "ICMP", &net_count_icmp4);
|
---|
707 |
|
---|
708 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
709 |
|
---|
710 | #if defined(SUPPORT_INET6)
|
---|
711 |
|
---|
712 | cons_printf(portid, "\nIPv6\n");
|
---|
713 | cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ip6[NC_IP6_IN_OCTETS]);
|
---|
714 | cons_printf(portid, "\t受信データグラム数\t%lu\n", net_count_ip6[NC_IP6_IN_PACKETS]);
|
---|
715 | cons_printf(portid, "\t受信エラーデータグラム数\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_PACKETS]);
|
---|
716 | cons_printf(portid, "\t長さエラー数\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_SHORT]);
|
---|
717 | cons_printf(portid, "\tバージョンエラー数\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_VER]);
|
---|
718 | cons_printf(portid, "\tアドレスエラー数\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_ADDR]);
|
---|
719 | cons_printf(portid, "\tプロトコルエラー数\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_PROTO]);
|
---|
720 | cons_printf(portid, "\t分割受信数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN]);
|
---|
721 | cons_printf(portid, "\t分割受信フラグメント数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_FRAGS]);
|
---|
722 | cons_printf(portid, "\t分割受信再構成成功数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_OK]);
|
---|
723 | cons_printf(portid, "\t分割受信破棄数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_DROP]);
|
---|
724 | cons_printf(portid, "\t分割受信バッファり当て失敗数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_NO_BUF]);
|
---|
725 | cons_printf(portid, "\t分割受信タイムアウト数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_TMOUT]);
|
---|
726 | cons_printf(portid, "\t送信オクテット数\t%lu\n", net_count_ip6[NC_IP6_OUT_OCTETS]);
|
---|
727 | cons_printf(portid, "\t送信データグラム数\t%lu\n", net_count_ip6[NC_IP6_OUT_PACKETS]);
|
---|
728 | cons_printf(portid, "\t送信エラーデータグラム数\t%lu\n", net_count_ip6[NC_IP6_OUT_ERR_PACKETS]);
|
---|
729 | cons_printf(portid, "\t分割送信数\t%lu\n", net_count_ip6[NC_IP6_FRAG_OUT]);
|
---|
730 | cons_printf(portid, "\t分割送信フラグメント数\t%lu\n", net_count_ip6[NC_IP6_FRAG_OUT_FRAGS]);
|
---|
731 |
|
---|
732 | cons_printf(portid, "\nICMPv6\n");
|
---|
733 | cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_icmp6[NC_ICMP6_IN_OCTETS]);
|
---|
734 | cons_printf(portid, "\t受信パケット数\t%lu\n", net_count_icmp6[NC_ICMP6_IN_PACKETS]);
|
---|
735 | cons_printf(portid, "\t受信エラーパケット数\t%lu\n", net_count_icmp6[NC_ICMP6_IN_ERR_PACKETS]);
|
---|
736 | cons_printf(portid, "\t受信チックサムエラー数\t%lu\n", net_count_icmp6[NC_ICMP6_IN_ERR_CKSUM]);
|
---|
737 | cons_printf(portid, "\t送信オクテット数\t%lu\n", net_count_icmp6[NC_ICMP6_OUT_OCTETS]);
|
---|
738 | cons_printf(portid, "\t送信パケット数\t%lu\n", net_count_icmp6[NC_ICMP6_OUT_PACKETS]);
|
---|
739 | cons_printf(portid, "\t送信エラーパケット数\t%lu\n", net_count_icmp6[NC_ICMP6_OUT_ERR_PACKETS]);
|
---|
740 |
|
---|
741 | cons_printf(portid, "\n近隣探索\n");
|
---|
742 | cons_printf(portid, "\tルータ通知受信数\t%lu\n", net_count_nd6[NC_ND6_RA_IN_PACKETS]);
|
---|
743 | cons_printf(portid, "\tルータ要請送信数\t%lu\n", net_count_nd6[NC_ND6_RS_OUT_PACKETS]);
|
---|
744 | cons_printf(portid, "\t近隣通知受信数\t%lu\n", net_count_nd6[NC_ND6_NA_IN_PACKETS]);
|
---|
745 | cons_printf(portid, "\t近隣通知送信数\t%lu\n", net_count_nd6[NC_ND6_NA_OUT_PACKETS]);
|
---|
746 | cons_printf(portid, "\t近隣要請受信数\t%lu\n", net_count_nd6[NC_ND6_NS_IN_PACKETS]);
|
---|
747 | cons_printf(portid, "\t近隣要請送信数\t%lu\n", net_count_nd6[NC_ND6_NS_OUT_PACKETS]);
|
---|
748 | cons_printf(portid, "\t重複アドレス検出送信数\t%lu\n", net_count_nd6[NC_ND6_DAD_OUT_PACKETS]);
|
---|
749 |
|
---|
750 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
751 |
|
---|
752 | #ifdef SUPPORT_TCP
|
---|
753 |
|
---|
754 | cons_printf(portid, "\nTCP\n");
|
---|
755 | cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_tcp[NC_TCP_RECV_OCTETS]);
|
---|
756 | cons_printf(portid, "\t受信データオクテット数\t%lu\n", net_count_tcp[NC_TCP_RECV_DATA_OCTETS]);
|
---|
757 | cons_printf(portid, "\t受信セグメント数\t%lu\n", net_count_tcp[NC_TCP_RECV_SEGS]);
|
---|
758 | cons_printf(portid, "\t受信データセグメント数\t%lu\n", net_count_tcp[NC_TCP_RECV_DATA_SEGS]);
|
---|
759 | cons_printf(portid, "\t受信、緊急セグメント数\t%lu\n", net_count_tcp[NC_TCP_RECV_URG_SEGS]);
|
---|
760 | cons_printf(portid, "\t受信、ヘッダ不正数\t%lu\n", net_count_tcp[NC_TCP_RECV_BAD_HEADERS]);
|
---|
761 | cons_printf(portid, "\t受信、チェックサム不正数\t%lu\n", net_count_tcp[NC_TCP_RECV_BAD_CKSUMS]);
|
---|
762 | cons_printf(portid, "\t受信、ACK 数\t%lu\n", net_count_tcp[NC_TCP_RECV_ACKS]);
|
---|
763 | cons_printf(portid, "\t受信、多重 ACK 数\t%lu\n", net_count_tcp[NC_TCP_RECV_DUP_ACKS]);
|
---|
764 | cons_printf(portid, "\t受信、RST 数\t%lu\n", net_count_tcp[NC_TCP_RECV_RSTS]);
|
---|
765 | cons_printf(portid, "\t受信、多重数\t%lu\n", net_count_tcp[NC_TCP_RECV_DUP_SEGS]);
|
---|
766 | cons_printf(portid, "\t受信、破棄数\t%lu\n", net_count_tcp[NC_TCP_RECV_DROP_SEGS]);
|
---|
767 | cons_printf(portid, "\t受信キュー解放数\t%lu\n", net_count_tcp[NC_TCP_FREE_RCV_QUEUE]);
|
---|
768 | cons_printf(portid, "\t送信データオクテット数\t%lu\n", net_count_tcp[NC_TCP_SEND_DATA_OCTETS]);
|
---|
769 | cons_printf(portid, "\t送信制御セグメント数\t%lu\n", net_count_tcp[NC_TCP_SEND_CNTL_SEGS]);
|
---|
770 | cons_printf(portid, "\t送信セグメント数\t%lu\n", net_count_tcp[NC_TCP_SEND_SEGS]);
|
---|
771 | cons_printf(portid, "\t再送信セグメント数\t%lu\n", net_count_tcp[NC_TCP_SEND_REXMIT_SEGS]);
|
---|
772 | cons_printf(portid, "\t送信データセグメント数\t%lu\n", net_count_tcp[NC_TCP_SEND_DATA_SEGS]);
|
---|
773 | cons_printf(portid, "\t送信、緊急セグメント数\t%lu\n", net_count_tcp[NC_TCP_SEND_URG_SEGS]);
|
---|
774 | cons_printf(portid, "\t送信、ACK 数\t%lu\n", net_count_tcp[NC_TCP_SEND_ACKS]);
|
---|
775 | cons_printf(portid, "\t送信、RST 数\t%lu\n", net_count_tcp[NC_TCP_SEND_RSTS]);
|
---|
776 | cons_printf(portid, "\tRTT 更新数\t%lu\n", net_count_tcp[NC_TCP_RTT_UPDATES]);
|
---|
777 | cons_printf(portid, "\t受動オープン数\t%lu\n", net_count_tcp[NC_TCP_ACCEPTS]);
|
---|
778 | cons_printf(portid, "\t能動オープン数\t%lu\n", net_count_tcp[NC_TCP_CONNECTS]);
|
---|
779 |
|
---|
780 | #endif /* of #ifdef SUPPORT_TCP */
|
---|
781 |
|
---|
782 | #ifdef SUPPORT_UDP
|
---|
783 |
|
---|
784 | net_count_struct(portid, "UDP", &net_count_udp);
|
---|
785 |
|
---|
786 | #endif /* of #ifdef SUPPORT_UDP */
|
---|
787 |
|
---|
788 | tbl = nbuf_get_tbl();
|
---|
789 | cons_printf(portid, "\nネットワークバッファ\n\tサイズ\t用意数\t割当要求数\t割当数\t割当てエラー数\n");
|
---|
790 | for (ix = nbuf_get_tbl_size(); ix -- > 0; ) {
|
---|
791 | cons_printf(portid, "\t%lu\t%lu\t%lu\t%lu\t%lu\n",
|
---|
792 | tbl[ix].size,
|
---|
793 | tbl[ix].prepares,
|
---|
794 | tbl[ix].requests,
|
---|
795 | tbl[ix].allocs,
|
---|
796 | tbl[ix].errors);
|
---|
797 | }
|
---|
798 |
|
---|
799 | cons_printf(portid, "\nネットワーク統計情報\t経過時間[ms]\t%lu\t", now);
|
---|
800 | if (now > (1000 * 3600 * 24))
|
---|
801 | cons_printf(portid, "%3lu日 %2lu時間 %2lu分 %2lu秒\n",
|
---|
802 | now / (1000 * 3600 * 24),
|
---|
803 | (now / (1000 * 3600)) % 24,
|
---|
804 | (now / (1000 * 60 )) % 60,
|
---|
805 | (now / 1000 ) % 60);
|
---|
806 | else
|
---|
807 | cons_printf(portid, "%2lu時間 %2lu分 %2lu秒\n",
|
---|
808 | (now / (1000 * 3600)) % 24,
|
---|
809 | (now / (1000 * 60 )) % 60,
|
---|
810 | (now / 1000 ) % 60);
|
---|
811 |
|
---|
812 | SIG_NET_CONS_PRINTF();
|
---|
813 | FLUSH_SND_BUFF();
|
---|
814 | }
|
---|
815 |
|
---|
816 | #if defined(SUPPORT_INET4)
|
---|
817 |
|
---|
818 | #ifdef IP4_CFG_FRAGMENT
|
---|
819 |
|
---|
820 | /*
|
---|
821 | * nbuf_stat_ip4_frag_queue -- IPv4 再構成キュー内ネットワークバッファ情報
|
---|
822 | */
|
---|
823 |
|
---|
824 | static void
|
---|
825 | nbuf_stat_ip4_frag_queue (ID portid)
|
---|
826 | {
|
---|
827 | const T_NET_BUF_ENTRY *tbl;
|
---|
828 | const T_NET_BUF *nbuf, **queue;
|
---|
829 | int_t ix, fix, count;
|
---|
830 |
|
---|
831 | cons_printf(portid, "\nIPv4再構成キュー内\nIndex\tTime");
|
---|
832 | tbl = nbuf_get_tbl();
|
---|
833 | for (ix = nbuf_get_tbl_size(); ix -- > 0; )
|
---|
834 | cons_printf(portid, "\t%d", tbl[ix].size);
|
---|
835 | cons_printf(portid, "\n");
|
---|
836 |
|
---|
837 | queue = ip_get_frag_queue();
|
---|
838 | for (fix = 0; fix < NUM_IP4_FRAG_QUEUE; fix ++) {
|
---|
839 | if (queue[fix] != NULL) {
|
---|
840 | cons_printf(portid, "%d\t%d", fix, GET_QIP4_HDR(queue[fix])->ttl);
|
---|
841 | for (ix = nbuf_get_tbl_size(); ix -- > 0; ) {
|
---|
842 | count = 0;
|
---|
843 | for (nbuf = queue[fix]; nbuf != NULL; nbuf = GET_QIP4_HDR(nbuf)->next)
|
---|
844 | if (nbuf->idix == ix)
|
---|
845 | count ++;
|
---|
846 | cons_printf(portid, "\t%d", count);
|
---|
847 | }
|
---|
848 | cons_printf(portid, "\n");
|
---|
849 | }
|
---|
850 | }
|
---|
851 | }
|
---|
852 |
|
---|
853 | #endif /* of #ifdef IP4_CFG_FRAGMENT */
|
---|
854 |
|
---|
855 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
856 |
|
---|
857 | #if defined(SUPPORT_INET6)
|
---|
858 |
|
---|
859 | #ifdef IP6_CFG_FRAGMENT
|
---|
860 |
|
---|
861 | /*
|
---|
862 | * nbuf_stat_ip6_frag_queue -- IPv6 再構成キュー内ネットワークバッファ情報
|
---|
863 | */
|
---|
864 |
|
---|
865 | static void
|
---|
866 | nbuf_stat_ip6_frag_queue (ID portid)
|
---|
867 | {
|
---|
868 | const T_NET_BUF_ENTRY *tbl;
|
---|
869 | const T_NET_BUF *nbuf, **queue;
|
---|
870 | int_t ix, fix, count;
|
---|
871 |
|
---|
872 | cons_printf(portid, "\nIPv6再構成キュー内\nIndex\tTime");
|
---|
873 | tbl = nbuf_get_tbl();
|
---|
874 | for (ix = nbuf_get_tbl_size(); ix -- > 0; )
|
---|
875 | cons_printf(portid, "\t%d", tbl[ix].size);
|
---|
876 | cons_printf(portid, "\n");
|
---|
877 |
|
---|
878 | queue = ip6_get_frag_queue();
|
---|
879 | for (fix = 0; fix < NUM_IP6_FRAG_QUEUE; fix ++) {
|
---|
880 | if (queue[fix] != NULL) {
|
---|
881 | cons_printf(portid, "%d\t%d", fix, GET_QIP6_HDR(queue[fix])->ftim);
|
---|
882 | for (ix = nbuf_get_tbl_size(); ix -- > 0; ) {
|
---|
883 | count = 0;
|
---|
884 | for (nbuf = queue[fix]; nbuf != NULL; nbuf = GET_QIP6_HDR(nbuf)->next_frag)
|
---|
885 | if (nbuf->idix == ix)
|
---|
886 | count ++;
|
---|
887 | cons_printf(portid, "\t%d", count);
|
---|
888 | }
|
---|
889 | cons_printf(portid, "\n");
|
---|
890 | }
|
---|
891 | }
|
---|
892 | }
|
---|
893 |
|
---|
894 | #endif /* of #ifdef IP6_CFG_FRAGMENT */
|
---|
895 |
|
---|
896 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
897 |
|
---|
898 | #endif /* of #if NET_COUNT_ENABLE */
|
---|
899 |
|
---|
900 | /*
|
---|
901 | * nbuf_status -- ネットワークバッファ情報
|
---|
902 | */
|
---|
903 |
|
---|
904 | static void
|
---|
905 | nbuf_status (ID portid, char *line)
|
---|
906 | {
|
---|
907 | SYSTIM now;
|
---|
908 |
|
---|
909 | #if NET_COUNT_ENABLE
|
---|
910 | const T_NET_BUF_ENTRY *tbl;
|
---|
911 | int_t ix;
|
---|
912 | #endif /* of #if NET_COUNT_ENABLE */
|
---|
913 |
|
---|
914 | #ifdef SUPPORT_TCP
|
---|
915 | T_NET_BUF *nbuf;
|
---|
916 | T_TCP_CEP* cep;
|
---|
917 | T_TCP_Q_HDR* tqhdr;
|
---|
918 |
|
---|
919 | #ifdef TCP_CFG_SWBUF_CSAVE
|
---|
920 | T_IP_HDR* iph;
|
---|
921 | T_TCP_HDR* tcph;
|
---|
922 | #endif /* of #ifdef TCP_CFG_SWBUF_CSAVE */
|
---|
923 | #endif /* of #ifdef SUPPORT_TCP */
|
---|
924 |
|
---|
925 | WAI_NET_CONS_PRINTF();
|
---|
926 | get_tim(&now);
|
---|
927 | cons_printf(portid, "ネットワークバッファ情報\t経過時間[ms]\t%lu\n", now);
|
---|
928 |
|
---|
929 | #if NET_COUNT_ENABLE
|
---|
930 |
|
---|
931 | cons_printf(portid, "\nネットワークバッファ\n\tサイズ\t用意数\t割当要求数\t割当数\t割当てエラー数\n");
|
---|
932 | tbl = nbuf_get_tbl();
|
---|
933 | for (ix = nbuf_get_tbl_size(); ix -- > 0; ) {
|
---|
934 | cons_printf(portid, "\t%lu\t%lu\t%lu\t%lu\t%lu\n",
|
---|
935 | tbl[ix].size,
|
---|
936 | tbl[ix].prepares,
|
---|
937 | tbl[ix].requests,
|
---|
938 | tbl[ix].allocs,
|
---|
939 | tbl[ix].errors);
|
---|
940 | }
|
---|
941 |
|
---|
942 | #endif /* of #if NET_COUNT_ENABLE */
|
---|
943 |
|
---|
944 | #ifdef SUPPORT_TCP
|
---|
945 |
|
---|
946 | cons_printf(portid, "\nCEP内\nCEPID\n");
|
---|
947 |
|
---|
948 | for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++) {
|
---|
949 | cons_printf(portid, "%2d", GET_TCP_CEPID(cep));
|
---|
950 | for (nbuf = cep->reassq; nbuf != NULL; nbuf = tqhdr->next) {
|
---|
951 | tqhdr = GET_TCP_Q_HDR(nbuf, GET_TCP_IP_Q_HDR(nbuf)->thoff);
|
---|
952 | cons_printf(portid, "[a:%6d-%6d] ",
|
---|
953 | ntohl(tqhdr->seq) - cep->irs + tqhdr->soff,
|
---|
954 | ntohl(tqhdr->seq) - cep->irs + tqhdr->soff + tqhdr->slen);
|
---|
955 | }
|
---|
956 |
|
---|
957 | #ifdef TCP_CFG_RWBUF_CSAVE
|
---|
958 | for (nbuf = cep->rwbufq; nbuf != NULL; nbuf = tqhdr->next) {
|
---|
959 | tqhdr = GET_TCP_Q_HDR(nbuf, GET_TCP_IP_Q_HDR(nbuf)->thoff);
|
---|
960 | cons_printf(portid, "[r:%6d-%6d] ",
|
---|
961 | ntohl(tqhdr->seq) - cep->irs + tqhdr->soff,
|
---|
962 | ntohl(tqhdr->seq) - cep->irs + tqhdr->soff + tqhdr->slen);
|
---|
963 | }
|
---|
964 | #endif /* of #ifdef TCP_CFG_RWBUF_CSAVE */
|
---|
965 |
|
---|
966 | #ifdef TCP_CFG_SWBUF_CSAVE
|
---|
967 | if (cep->swbufq != NULL) {
|
---|
968 | iph = GET_IP_HDR(cep->swbufq);
|
---|
969 | tcph = GET_TCP_HDR(cep->swbufq, GET_TCP_HDR_OFFSET(cep->swbufq));
|
---|
970 | cons_printf(portid, "[s:%6d-%6d] ",
|
---|
971 | ntohl(tcph->seq) - cep->iss,
|
---|
972 | ntohl(tcph->seq) - cep->iss + (GET_IP_SDU_SIZE(iph) -
|
---|
973 | GET_TCP_HDR_SIZE2(cep->swbufq, GET_TCP_HDR_OFFSET(cep->swbufq))));
|
---|
974 | }
|
---|
975 | #endif /* of #ifdef TCP_CFG_SWBUF_CSAVE */
|
---|
976 |
|
---|
977 | cons_printf(portid, "\n");
|
---|
978 | }
|
---|
979 |
|
---|
980 | #endif /* of #ifdef SUPPORT_TCP */
|
---|
981 |
|
---|
982 | #if NET_COUNT_ENABLE
|
---|
983 |
|
---|
984 | #if defined(SUPPORT_INET4)
|
---|
985 |
|
---|
986 | #ifdef IP4_CFG_FRAGMENT
|
---|
987 |
|
---|
988 | nbuf_stat_ip4_frag_queue(portid);
|
---|
989 |
|
---|
990 | #endif /* of #ifdef IP4_CFG_FRAGMENT */
|
---|
991 |
|
---|
992 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
993 |
|
---|
994 | #if defined(SUPPORT_INET6)
|
---|
995 |
|
---|
996 | #ifdef IP6_CFG_FRAGMENT
|
---|
997 |
|
---|
998 | nbuf_stat_ip6_frag_queue(portid);
|
---|
999 |
|
---|
1000 | #endif /* of #ifdef IP6_CFG_FRAGMENT */
|
---|
1001 |
|
---|
1002 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
1003 |
|
---|
1004 | #endif /* of #if NET_COUNT_ENABLE */
|
---|
1005 |
|
---|
1006 | SIG_NET_CONS_PRINTF();
|
---|
1007 | FLUSH_SND_BUFF();
|
---|
1008 | }
|
---|
1009 |
|
---|
1010 | #if defined(SUPPORT_INET4)
|
---|
1011 |
|
---|
1012 | #if NUM_ROUTE_ENTRY > 0
|
---|
1013 |
|
---|
1014 | /*
|
---|
1015 | * routing_table_status -- 経路表の出力
|
---|
1016 | */
|
---|
1017 |
|
---|
1018 | static void
|
---|
1019 | routing_table_status (ID portid, char *line)
|
---|
1020 | {
|
---|
1021 | int_t ix;
|
---|
1022 |
|
---|
1023 | if ('0' <= *(line = skip_blanks(line)) && *line <= '9') {
|
---|
1024 | T_IN4_ADDR target, mask, gateway;
|
---|
1025 |
|
---|
1026 | ix = atoi(line);
|
---|
1027 | while ('0' <= *line && *line <= '9')
|
---|
1028 | line ++;
|
---|
1029 | line = GET_IPADDR(&target, skip_blanks(line));
|
---|
1030 | line = GET_IPADDR(&mask, skip_blanks(line));
|
---|
1031 | GET_IPADDR(&gateway, skip_blanks(line));
|
---|
1032 | in4_add_route(ix, target, mask, gateway);
|
---|
1033 | }
|
---|
1034 |
|
---|
1035 | WAI_NET_CONS_PRINTF();
|
---|
1036 | cons_printf(portid,
|
---|
1037 | "Routing Table Status\n"
|
---|
1038 | "IX Target Mask Gateway Expire\n");
|
---|
1039 |
|
---|
1040 | for (ix = 0; ix < NUM_ROUTE_ENTRY; ix ++) {
|
---|
1041 | if ((routing_tbl[ix].flags & IN_RTF_DEFINED) == 0)
|
---|
1042 | ;
|
---|
1043 | else if ((routing_tbl[ix].flags & IN_RTF_REDIRECT) != 0)
|
---|
1044 | cons_printf(portid, "%2d %15I %15I %15I %4d\n",
|
---|
1045 | ix,
|
---|
1046 | &routing_tbl[ix].target,
|
---|
1047 | &routing_tbl[ix].mask,
|
---|
1048 | &routing_tbl[ix].gateway,
|
---|
1049 | &routing_tbl[ix].expire);
|
---|
1050 | else
|
---|
1051 | cons_printf(portid, "%2d %15I %15I %I\n",
|
---|
1052 | ix,
|
---|
1053 | &routing_tbl[ix].target,
|
---|
1054 | &routing_tbl[ix].mask,
|
---|
1055 | &routing_tbl[ix].gateway);
|
---|
1056 |
|
---|
1057 | }
|
---|
1058 |
|
---|
1059 | SIG_NET_CONS_PRINTF();
|
---|
1060 | FLUSH_SND_BUFF();
|
---|
1061 | }
|
---|
1062 |
|
---|
1063 | #endif /* of #if NUM_ROUTE_ENTRY > 0 */
|
---|
1064 |
|
---|
1065 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
1066 |
|
---|
1067 | #if defined(SUPPORT_INET6)
|
---|
1068 |
|
---|
1069 | #if NUM_ND6_DEF_RTR_ENTRY > 0
|
---|
1070 |
|
---|
1071 | /*
|
---|
1072 | * defrtrlist_status -- ディフォルトルータ・リスト状態の出力
|
---|
1073 | */
|
---|
1074 |
|
---|
1075 | static void
|
---|
1076 | defrtrlist_status (ID portid, char *line)
|
---|
1077 | {
|
---|
1078 | const T_DEF_ROUTER *dr;
|
---|
1079 | SYSTIM now;
|
---|
1080 | int_t rix, pix, pcnt, ptitle;
|
---|
1081 | uint_t count, mask;
|
---|
1082 |
|
---|
1083 | WAI_NET_CONS_PRINTF();
|
---|
1084 | cons_printf(portid,
|
---|
1085 | "Default Router List Status\n"
|
---|
1086 | "IX Expire Lifetime flags prefix");
|
---|
1087 | for (ptitle = NUM_ND6_PREFIX_ENTRY * 2 - sizeof("prefix"); ptitle -- > 0; )
|
---|
1088 | cons_printf(portid, " ");
|
---|
1089 | cons_printf(portid, " IP Address\n");
|
---|
1090 |
|
---|
1091 | /* expire の単位は [ms]。*/
|
---|
1092 | get_tim(&now);
|
---|
1093 | dr = nd6_get_drl(&count);
|
---|
1094 | for (rix = 0; rix < count; rix ++) {
|
---|
1095 | if (dr[rix].state == ND6_DEF_RTR_BUSY) {
|
---|
1096 | cons_printf(portid, "%2d", rix);
|
---|
1097 | if (dr[rix].lifetime == ND6_INFINITE_LIFETIME)
|
---|
1098 | cons_printf(portid, " INFIN INFIN");
|
---|
1099 | else
|
---|
1100 | cons_printf(portid, " %6d %8d",
|
---|
1101 | (uint32_t)(dr[rix].expire - now) <= 0
|
---|
1102 | ? 0 : (dr[rix].expire - now) / SYSTIM_HZ,
|
---|
1103 | dr[rix].lifetime / SYSTIM_HZ);
|
---|
1104 | cons_printf(portid, " %02x", dr[rix].flags);
|
---|
1105 | pcnt = NUM_ND6_PREFIX_ENTRY;
|
---|
1106 | ptitle = NUM_ND6_PREFIX_ENTRY * 2 - sizeof(" prefix");
|
---|
1107 | mask = 1;
|
---|
1108 | for (pix = 0; pix < NUM_ND6_PREFIX_ENTRY; pix ++) {
|
---|
1109 | if ((dr[rix].plistmap & mask) != 0) {
|
---|
1110 | if (pcnt == NUM_ND6_PREFIX_ENTRY)
|
---|
1111 | cons_printf(portid, " ");
|
---|
1112 | else
|
---|
1113 | cons_printf(portid, ",");
|
---|
1114 | cons_printf(portid, "%d", pix);
|
---|
1115 | pcnt --;
|
---|
1116 | ptitle -= 2;
|
---|
1117 | }
|
---|
1118 | mask <<= 1;
|
---|
1119 | }
|
---|
1120 | while (pcnt --) {
|
---|
1121 | cons_printf(portid, " ");
|
---|
1122 | ptitle -= 2;
|
---|
1123 | }
|
---|
1124 | while (ptitle -- > 0)
|
---|
1125 | cons_printf(portid, " ");
|
---|
1126 | cons_printf(portid, " %I\n", &dr[rix].addr);
|
---|
1127 | }
|
---|
1128 | }
|
---|
1129 |
|
---|
1130 | SIG_NET_CONS_PRINTF();
|
---|
1131 | FLUSH_SND_BUFF();
|
---|
1132 | }
|
---|
1133 |
|
---|
1134 | /*
|
---|
1135 | * prefixlist_status -- プレフィックス・リスト状態の出力
|
---|
1136 | */
|
---|
1137 |
|
---|
1138 | static void
|
---|
1139 | prefixlist_status (ID portid, char *line)
|
---|
1140 | {
|
---|
1141 | const T_ND6_PREFIX *pr;
|
---|
1142 | SYSTIM now;
|
---|
1143 | int_t rix, pix, rcnt, rtitle;
|
---|
1144 | uint_t mask;
|
---|
1145 |
|
---|
1146 | WAI_NET_CONS_PRINTF();
|
---|
1147 | cons_printf(portid,
|
---|
1148 | "Prefix List Status\n"
|
---|
1149 | "IX Expire Lifetime flags router");
|
---|
1150 | for (rtitle = NUM_ND6_DEF_RTR_ENTRY * 2 - sizeof("router"); rtitle -- > 0; )
|
---|
1151 | cons_printf(portid, " ");
|
---|
1152 | cons_printf(portid, " Len Prefix\n");
|
---|
1153 |
|
---|
1154 | /* expire の単位は [s]。*/
|
---|
1155 | get_tim(&now);
|
---|
1156 | now /= SYSTIM_HZ;
|
---|
1157 | pr = nd6_get_prl();
|
---|
1158 | for (pix = 0; pix < NUM_ND6_PREFIX_ENTRY; pix ++) {
|
---|
1159 | if ((pr[pix].flags & ND6_PREFIX_STATE_BUSY) != 0) {
|
---|
1160 | cons_printf(portid, "%2d", pix);
|
---|
1161 | if (pr[pix].vltime == ND6_INFINITE_LIFETIME)
|
---|
1162 | cons_printf(portid, " INFIN INFIN");
|
---|
1163 | else
|
---|
1164 | cons_printf(portid, " %7d %8d",
|
---|
1165 | (uint32_t)(pr[pix].expire - now) <= 0
|
---|
1166 | ? 0 : (pr[pix].expire - now),
|
---|
1167 | pr[pix].vltime);
|
---|
1168 | cons_printf(portid, " %02x", pr[pix].flags);
|
---|
1169 | rcnt = NUM_ND6_DEF_RTR_ENTRY;
|
---|
1170 | rtitle = NUM_ND6_DEF_RTR_ENTRY * 2 - sizeof(" router");
|
---|
1171 | mask = 1;
|
---|
1172 | for (rix = 0; rix < NUM_ND6_DEF_RTR_ENTRY; rix ++) {
|
---|
1173 | if ((pr[pix].routermap & mask) != 0) {
|
---|
1174 | if (rcnt == NUM_ND6_DEF_RTR_ENTRY)
|
---|
1175 | cons_printf(portid, " ");
|
---|
1176 | else
|
---|
1177 | cons_printf(portid, ",");
|
---|
1178 | cons_printf(portid, "%d", rix);
|
---|
1179 | rcnt --;
|
---|
1180 | rtitle -= 2;
|
---|
1181 | }
|
---|
1182 | mask <<= 1;
|
---|
1183 | }
|
---|
1184 | while (rcnt --) {
|
---|
1185 | cons_printf(portid, " ");
|
---|
1186 | rtitle -= 2;
|
---|
1187 | }
|
---|
1188 | while (rtitle -- > 0)
|
---|
1189 | cons_printf(portid, " ");
|
---|
1190 | cons_printf(portid, "%4d %I\n", pr[pix].prefix_len, &pr[pix].prefix);
|
---|
1191 | }
|
---|
1192 | }
|
---|
1193 |
|
---|
1194 | SIG_NET_CONS_PRINTF();
|
---|
1195 | FLUSH_SND_BUFF();
|
---|
1196 | }
|
---|
1197 |
|
---|
1198 | #endif /* of #if NUM_ND6_DEF_RTR_ENTRY > 0 */
|
---|
1199 |
|
---|
1200 | #if NUM_ROUTE_ENTRY > 0
|
---|
1201 |
|
---|
1202 | /*
|
---|
1203 | * routing_table_status -- 経路表の出力
|
---|
1204 | */
|
---|
1205 |
|
---|
1206 | static void
|
---|
1207 | routing_table_status (ID portid, char *line)
|
---|
1208 | {
|
---|
1209 | SYSTIM now;
|
---|
1210 | int_t ix;
|
---|
1211 |
|
---|
1212 | WAI_NET_CONS_PRINTF();
|
---|
1213 | cons_printf(portid,
|
---|
1214 | "Routing Table Status\n"
|
---|
1215 | "IX Expire flags Prefix Target Gateway\n");
|
---|
1216 |
|
---|
1217 | for (ix = 0; ix < NUM_STATIC_ROUTE_ENTRY; ix ++) {
|
---|
1218 | cons_printf(portid, "%2d STATIC - %6d %30I %I\n",
|
---|
1219 | ix,
|
---|
1220 | routing_tbl[ix].prefix_len,
|
---|
1221 | &routing_tbl[ix].target,
|
---|
1222 | &routing_tbl[ix].gateway);
|
---|
1223 |
|
---|
1224 | }
|
---|
1225 |
|
---|
1226 | /* expire の単位は [s]。*/
|
---|
1227 | get_tim(&now);
|
---|
1228 | now /= SYSTIM_HZ;
|
---|
1229 |
|
---|
1230 | for ( ; ix < NUM_ROUTE_ENTRY; ix ++)
|
---|
1231 | if (routing_tbl[ix].flags & IN_RTF_DEFINED)
|
---|
1232 | cons_printf(portid, "%2d %6d %02x %6d %30I %I\n",
|
---|
1233 | ix,
|
---|
1234 | (uint32_t)(routing_tbl[ix].expire - now) <= 0
|
---|
1235 | ? 0 : routing_tbl[ix].expire - now,
|
---|
1236 | routing_tbl[ix].flags,
|
---|
1237 | routing_tbl[ix].prefix_len,
|
---|
1238 | &routing_tbl[ix].target,
|
---|
1239 | &routing_tbl[ix].gateway);
|
---|
1240 |
|
---|
1241 | SIG_NET_CONS_PRINTF();
|
---|
1242 | FLUSH_SND_BUFF();
|
---|
1243 | }
|
---|
1244 |
|
---|
1245 | #endif /* of #if NUM_ROUTE_ENTRY > 0 */
|
---|
1246 |
|
---|
1247 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
1248 |
|
---|
1249 | #if NUM_ROUTE_ENTRY > 0
|
---|
1250 |
|
---|
1251 | /*
|
---|
1252 | * routing_status -- ルーティング情報
|
---|
1253 | */
|
---|
1254 |
|
---|
1255 | static void
|
---|
1256 | routing_status (ID portid, char *line)
|
---|
1257 | {
|
---|
1258 | switch (*line) {
|
---|
1259 |
|
---|
1260 | #if defined(SUPPORT_INET6)
|
---|
1261 |
|
---|
1262 | #if NUM_ND6_DEF_RTR_ENTRY > 0
|
---|
1263 |
|
---|
1264 | case 'l': /* ディフォルトルータ・リスト情報 */
|
---|
1265 | defrtrlist_status(portid, line + 1);
|
---|
1266 | break;
|
---|
1267 |
|
---|
1268 | case 'p': /* プレフィックス・リスト情報 */
|
---|
1269 | prefixlist_status(portid, line + 1);
|
---|
1270 | break;
|
---|
1271 |
|
---|
1272 | #endif /* of #if NUM_ND6_DEF_RTR_ENTRY > 0 */
|
---|
1273 |
|
---|
1274 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
1275 |
|
---|
1276 | default: /* ルーティング表情報 */
|
---|
1277 | routing_table_status(portid, line);
|
---|
1278 | break;
|
---|
1279 |
|
---|
1280 | break;
|
---|
1281 | }
|
---|
1282 | }
|
---|
1283 |
|
---|
1284 | #endif /* of #if NUM_ROUTE_ENTRY > 0 */
|
---|
1285 |
|
---|
1286 | /*
|
---|
1287 | * network_status -- ネットワークの状態の出力
|
---|
1288 | */
|
---|
1289 |
|
---|
1290 | static void
|
---|
1291 | network_status (ID portid, char *line)
|
---|
1292 | {
|
---|
1293 | switch (*line) {
|
---|
1294 |
|
---|
1295 | #ifdef SUPPORT_ETHER
|
---|
1296 |
|
---|
1297 | case 'a': /* IF アドレス情報 */
|
---|
1298 | ifa_status(portid, line + 1);
|
---|
1299 | break;
|
---|
1300 |
|
---|
1301 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
1302 |
|
---|
1303 | case 'b': /* ネットワークバッファ情報 */
|
---|
1304 | nbuf_status(portid, line + 1);
|
---|
1305 | break;
|
---|
1306 |
|
---|
1307 | #if NET_COUNT_ENABLE
|
---|
1308 |
|
---|
1309 | case 'c': /* ネットワーク統計情報 */
|
---|
1310 | net_count(portid, line + 1);
|
---|
1311 | break;
|
---|
1312 |
|
---|
1313 | #endif /* of #if NET_COUNT_ENABLE */
|
---|
1314 |
|
---|
1315 | #if NUM_ROUTE_ENTRY > 0
|
---|
1316 |
|
---|
1317 | case 'r': /* ルーティング情報 */
|
---|
1318 | routing_status(portid, line + 1);
|
---|
1319 | break;
|
---|
1320 |
|
---|
1321 | #endif /* of #if NUM_ROUTE_ENTRY > 0 */
|
---|
1322 |
|
---|
1323 | #ifdef SUPPORT_TCP
|
---|
1324 |
|
---|
1325 | case 't': /* TCP status */
|
---|
1326 | tcp_status(portid, line + 1);
|
---|
1327 | break;
|
---|
1328 |
|
---|
1329 | #endif /* of #ifdef SUPPORT_TCP */
|
---|
1330 |
|
---|
1331 | #ifdef SUPPORT_UDP
|
---|
1332 |
|
---|
1333 | case 'u': /* UDP status */
|
---|
1334 | udp_status(portid, line + 1);
|
---|
1335 | break;
|
---|
1336 |
|
---|
1337 | #endif /* of #ifdef SUPPORT_UDP */
|
---|
1338 |
|
---|
1339 | default:
|
---|
1340 | cons_printf(portid, "no such command: '%c%c'\n", *(line - 1), *line);
|
---|
1341 | SIG_NET_CONS_PRINTF();
|
---|
1342 | FLUSH_SND_BUFF();
|
---|
1343 | break;
|
---|
1344 | }
|
---|
1345 | }
|
---|
1346 |
|
---|
1347 | #if defined(SUPPORT_INET4)
|
---|
1348 |
|
---|
1349 | /*
|
---|
1350 | * ifconfig -- ネットワークインタフェースの構成情報
|
---|
1351 | */
|
---|
1352 |
|
---|
1353 | static void
|
---|
1354 | ifconfig (ID portid, char *line)
|
---|
1355 | {
|
---|
1356 | T_IFNET *ifp = IF_GET_IFNET();
|
---|
1357 | T_IN4_ADDR bc;
|
---|
1358 |
|
---|
1359 | #ifdef SUPPORT_ETHER
|
---|
1360 |
|
---|
1361 | if (*(line = skip_blanks(line))) {
|
---|
1362 | T_IN4_ADDR addr, mask;
|
---|
1363 |
|
---|
1364 | GET_IPADDR(&mask, skip_blanks(GET_IPADDR(&addr, line)));
|
---|
1365 | in4_add_ifaddr(addr, mask);
|
---|
1366 | }
|
---|
1367 |
|
---|
1368 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
1369 |
|
---|
1370 | WAI_NET_CONS_PRINTF();
|
---|
1371 | cons_printf(portid,
|
---|
1372 | "Network Interface Configurations\n");
|
---|
1373 |
|
---|
1374 | #ifdef SUPPORT_ETHER
|
---|
1375 |
|
---|
1376 | cons_printf(portid,
|
---|
1377 | "ether: %M\n",
|
---|
1378 | IF_ETHER_NIC_GET_SOFTC()->ifaddr.lladdr);
|
---|
1379 |
|
---|
1380 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
1381 |
|
---|
1382 | bc = (ifp->in_ifaddr.addr & ifp->in_ifaddr.mask) | ~ifp->in_ifaddr.mask;
|
---|
1383 | cons_printf(portid,
|
---|
1384 | "inet: %I, mask: %I, broadcast: %I\n",
|
---|
1385 | &ifp->in_ifaddr.addr,
|
---|
1386 | &ifp->in_ifaddr.mask,
|
---|
1387 | &bc);
|
---|
1388 |
|
---|
1389 | SIG_NET_CONS_PRINTF();
|
---|
1390 | FLUSH_SND_BUFF();
|
---|
1391 | }
|
---|
1392 |
|
---|
1393 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
1394 |
|
---|
1395 | #if defined(SUPPORT_INET6)
|
---|
1396 |
|
---|
1397 | /*
|
---|
1398 | * ifconfig -- ネットワークインタフェースの構成情報
|
---|
1399 | */
|
---|
1400 |
|
---|
1401 | static void
|
---|
1402 | ifconfig (ID portid, char *line)
|
---|
1403 | {
|
---|
1404 | #ifdef SUPPORT_ETHER
|
---|
1405 |
|
---|
1406 | T_IF_SOFTC *ic;
|
---|
1407 | T_IFNET *ifp = IF_GET_IFNET();
|
---|
1408 | int_t ix;
|
---|
1409 | SYSTIM now;
|
---|
1410 |
|
---|
1411 | WAI_NET_CONS_PRINTF();
|
---|
1412 | ic = IF_ETHER_NIC_GET_SOFTC();
|
---|
1413 | cons_printf(portid, "ether: %M\ninet6:\nIX Expire Preffered RTR PFX Flags IP Address\n",
|
---|
1414 | ic->ifaddr.lladdr);
|
---|
1415 |
|
---|
1416 | /* expire と vltime の単位は [s]。*/
|
---|
1417 | get_tim(&now);
|
---|
1418 | now /= SYSTIM_HZ;
|
---|
1419 |
|
---|
1420 | for (ix = 0; ix < NUM_IN6_IFADDR_ENTRY; ix ++) {
|
---|
1421 | if (ifp->in_ifaddrs[ix].flags & IN6_IFF_DEFINED) {
|
---|
1422 | cons_printf(portid, " %d", ix);
|
---|
1423 | if (ifp->in_ifaddrs[ix].lifetime.vltime == ND6_INFINITE_LIFETIME)
|
---|
1424 | cons_printf(portid, " INFIN INFIN");
|
---|
1425 | else
|
---|
1426 | cons_printf(portid, " %8d %9d",
|
---|
1427 | (uint32_t)(ifp->in_ifaddrs[ix].lifetime.expire - now) <= 0
|
---|
1428 | ? 0 : ifp->in_ifaddrs[ix].lifetime.expire - now,
|
---|
1429 | (uint32_t)(ifp->in_ifaddrs[ix].lifetime.preferred - now) <= 0
|
---|
1430 | ? 0 : ifp->in_ifaddrs[ix].lifetime.preferred - now);
|
---|
1431 | if (ifp->in_ifaddrs[ix].router_index == IN6_RTR_IX_UNREACH)
|
---|
1432 | cons_printf(portid, " -");
|
---|
1433 | else
|
---|
1434 | cons_printf(portid, " %3d", ifp->in_ifaddrs[ix].router_index);
|
---|
1435 | if (ifp->in_ifaddrs[ix].prefix_index == ND6_PREFIX_IX_INVALID)
|
---|
1436 | cons_printf(portid, " -");
|
---|
1437 | else
|
---|
1438 | cons_printf(portid, " %3d", ifp->in_ifaddrs[ix].prefix_index);
|
---|
1439 | cons_printf(portid, " %02x %I\n",
|
---|
1440 | ifp->in_ifaddrs[ix].flags,
|
---|
1441 | &ifp->in_ifaddrs[ix].addr);
|
---|
1442 | }
|
---|
1443 | }
|
---|
1444 |
|
---|
1445 | SIG_NET_CONS_PRINTF();
|
---|
1446 | FLUSH_SND_BUFF();
|
---|
1447 |
|
---|
1448 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
1449 | }
|
---|
1450 |
|
---|
1451 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
1452 |
|
---|
1453 | /*
|
---|
1454 | * show_config -- コンフィギュレーション設定の表示
|
---|
1455 | */
|
---|
1456 |
|
---|
1457 | static void
|
---|
1458 | show_config (ID portid, char *line)
|
---|
1459 | {
|
---|
1460 | #if defined(SUPPORT_ETHER)
|
---|
1461 | #if defined(SUPPORT_INET4)
|
---|
1462 | T_IN4_ADDR addr;
|
---|
1463 | #endif
|
---|
1464 | #endif /* of #if defined(SUPPORT_ETHER) */
|
---|
1465 |
|
---|
1466 | #if defined(DHCP_CFG)
|
---|
1467 |
|
---|
1468 | cons_printf(portid, "DHCP:\n");
|
---|
1469 |
|
---|
1470 | cons_printf(portid, " DHCP_CFG: On\n");
|
---|
1471 |
|
---|
1472 | #endif /* of #if define(DHCP_CFG) */
|
---|
1473 |
|
---|
1474 | #if defined(SUPPORT_TCP)
|
---|
1475 |
|
---|
1476 | cons_printf(portid, "TCP:\n");
|
---|
1477 |
|
---|
1478 | cons_printf(portid, " TCP_CFG_PASSIVE_OPEN: ");
|
---|
1479 | #if defined(TCP_CFG_PASSIVE_OPEN)
|
---|
1480 | cons_printf(portid, "On\n");
|
---|
1481 | #else
|
---|
1482 | cons_printf(portid, "Off\n");
|
---|
1483 | #endif
|
---|
1484 |
|
---|
1485 | cons_printf(portid, " TCP_CFG_OPT_MSS: ");
|
---|
1486 | #if defined(TCP_CFG_OPT_MSS)
|
---|
1487 | cons_printf(portid, "On\n");
|
---|
1488 | #else
|
---|
1489 | cons_printf(portid, "Off\n");
|
---|
1490 | #endif
|
---|
1491 |
|
---|
1492 | cons_printf(portid, " TCP_CFG_DELAY_ACK: ");
|
---|
1493 | #if defined(TCP_CFG_DELAY_ACK)
|
---|
1494 | cons_printf(portid, "On\n");
|
---|
1495 | #else
|
---|
1496 | cons_printf(portid, "Off\n");
|
---|
1497 | #endif
|
---|
1498 |
|
---|
1499 | cons_printf(portid, " TCP_CFG_ALWAYS_KEEP: ");
|
---|
1500 | #if defined(TCP_CFG_ALWAYS_KEEP)
|
---|
1501 | cons_printf(portid, "On\n");
|
---|
1502 | #else
|
---|
1503 | cons_printf(portid, "Off\n");
|
---|
1504 | #endif
|
---|
1505 |
|
---|
1506 | cons_printf(portid, " TCP_CFG_RWBUF_CSAVE: ");
|
---|
1507 | #if defined(TCP_CFG_RWBUF_CSAVE_ONLY)
|
---|
1508 | cons_printf(portid, "Only, ");
|
---|
1509 | #if defined(TCP_CFG_RWBUF_CSAVE_MAX_QUEUES)
|
---|
1510 | cons_printf(portid, "TCP_CFG_RWBUF_CSAVE_MAX_QUEUES: %2d\n",
|
---|
1511 | TCP_CFG_RWBUF_CSAVE_MAX_QUEUES);
|
---|
1512 | #else
|
---|
1513 | cons_printf(portid, "TCP_CFG_RWBUF_CSAVE_MAX_QUEUES: Undefined\n");
|
---|
1514 | #endif
|
---|
1515 | #elif defined(TCP_CFG_RWBUF_CSAVE)
|
---|
1516 | cons_printf(portid, "On, ");
|
---|
1517 | #if defined(TCP_CFG_RWBUF_CSAVE_MAX_QUEUES)
|
---|
1518 | cons_printf(portid, "TCP_CFG_RWBUF_CSAVE_MAX_QUEUES: %2d\n",
|
---|
1519 | TCP_CFG_RWBUF_CSAVE_MAX_QUEUES);
|
---|
1520 | #else
|
---|
1521 | cons_printf(portid, "TCP_CFG_RWBUF_CSAVE_MAX_QUEUES: Undefined\n");
|
---|
1522 | #endif
|
---|
1523 | #else
|
---|
1524 | cons_printf(portid, "Off\n");
|
---|
1525 | #endif
|
---|
1526 |
|
---|
1527 | cons_printf(portid, " TCP_CFG_SWBUF_CSAVE: ");
|
---|
1528 | #if defined(TCP_CFG_SWBUF_CSAVE_ONLY)
|
---|
1529 | cons_printf(portid, "Only, TCP_CFG_SWBUF_CSAVE_MAX_SIZE: %4d\n"
|
---|
1530 | " "
|
---|
1531 | " TCP_CFG_SWBUF_CSAVE_MIN_SIZE: %4d\n",
|
---|
1532 | TCP_CFG_SWBUF_CSAVE_MAX_SIZE,
|
---|
1533 | TCP_CFG_SWBUF_CSAVE_MIN_SIZE);
|
---|
1534 | #elif defined(TCP_CFG_SWBUF_CSAVE)
|
---|
1535 | cons_printf(portid, "On, TCP_CFG_SWBUF_CSAVE_MAX_SIZE: %4d\n"
|
---|
1536 | " "
|
---|
1537 | " TCP_CFG_SWBUF_CSAVE_MIN_SIZE: %4d\n",
|
---|
1538 | TCP_CFG_SWBUF_CSAVE_MAX_SIZE,
|
---|
1539 | TCP_CFG_SWBUF_CSAVE_MIN_SIZE);
|
---|
1540 | #else
|
---|
1541 | cons_printf(portid, "Off\n");
|
---|
1542 | #endif
|
---|
1543 |
|
---|
1544 | cons_printf(portid, " TCP_CFG_NON_BLOCKING: ");
|
---|
1545 | #if defined(TCP_CFG_NON_BLOCKING)
|
---|
1546 | #if defined(USE_TCP_NON_BLOCKING)
|
---|
1547 | cons_printf(portid, "Use\n");
|
---|
1548 | #else
|
---|
1549 | cons_printf(portid, "On\n");
|
---|
1550 | #endif
|
---|
1551 | #else
|
---|
1552 | cons_printf(portid, "Off\n");
|
---|
1553 | #endif
|
---|
1554 |
|
---|
1555 | cons_printf(portid, " TCP_CFG_EXTENTIONS: ");
|
---|
1556 | #if defined(TCP_CFG_EXTENTIONS)
|
---|
1557 | #if defined(USE_TCP_EXTENTIONS)
|
---|
1558 | cons_printf(portid, "Use\n");
|
---|
1559 | #if defined(SUPPORT_INET4)
|
---|
1560 | cons_printf(portid, " NUM_VRID_TCP_REPS: %3d\n", NUM_VRID_TCP_REPS);
|
---|
1561 | cons_printf(portid, " NUM_VRID_TCP_CEPS: %3d\n", NUM_VRID_TCP_CEPS);
|
---|
1562 | #endif
|
---|
1563 | #if defined(SUPPORT_INET6)
|
---|
1564 | cons_printf(portid, " NUM_VRID_TCP6_REPS: %3d\n", NUM_VRID_TCP6_REPS);
|
---|
1565 | cons_printf(portid, " NUM_VRID_TCP6_CEPS: %3d\n", NUM_VRID_TCP6_CEPS);
|
---|
1566 | #endif
|
---|
1567 | #else
|
---|
1568 | cons_printf(portid, "On\n");
|
---|
1569 | #endif
|
---|
1570 | #else
|
---|
1571 | cons_printf(portid, "Off\n");
|
---|
1572 | #endif
|
---|
1573 |
|
---|
1574 | cons_printf(portid, " USE_COPYSAVE_API: ");
|
---|
1575 | #if defined(USE_COPYSAVE_API)
|
---|
1576 | cons_printf(portid, "Use\n");
|
---|
1577 | #else
|
---|
1578 | cons_printf(portid, "Off\n");
|
---|
1579 | #endif
|
---|
1580 |
|
---|
1581 | #if NUM_TCP_TW_CEP_ENTRY > 0
|
---|
1582 | cons_printf(portid, " TCP_TW_CEP: On, NUM_TCP_TW_CEP_ENTRY: %d\n", NUM_TCP_TW_CEP_ENTRY);
|
---|
1583 | #else
|
---|
1584 | cons_printf(portid, " TCP_TW_CEP: Off\n");
|
---|
1585 | #endif
|
---|
1586 |
|
---|
1587 | #if defined(TCP_CFG_TRACE)
|
---|
1588 | cons_printf(portid, " TCP_CFG_TRACE: On, TCP_CFG_TRACE_LPORTNO: %d\n", TCP_CFG_TRACE_LPORTNO);
|
---|
1589 | #if defined(SUPPORT_INET4)
|
---|
1590 | addr = TCP_CFG_TRACE_IPV4_RADDR;
|
---|
1591 | cons_printf(portid, " TCP_CFG_TRACE_IPV4_RADDR: %I\n", &addr);
|
---|
1592 | #endif
|
---|
1593 | cons_printf(portid, " TCP_CFG_TRACE_RPORTNO: %d\n", TCP_CFG_TRACE_RPORTNO);
|
---|
1594 | #else
|
---|
1595 | cons_printf(portid, " TCP_CFG_TRACE: Off\n");
|
---|
1596 | #endif
|
---|
1597 |
|
---|
1598 | cons_printf(portid, " MAX_TCP_SND_SEG: %4d\n", MAX_TCP_SND_SEG);
|
---|
1599 | cons_printf(portid, " DEF_TCP_SND_SEG: %4d\n", DEF_TCP_SND_SEG);
|
---|
1600 | cons_printf(portid, " MAX_TCP_RCV_SEG: %4d\n", MAX_TCP_RCV_SEG);
|
---|
1601 | cons_printf(portid, " DEF_TCP_RCV_SEG: %4d\n", DEF_TCP_RCV_SEG);
|
---|
1602 | cons_printf(portid, " MAX_TCP_REALLOC_SIZE: %4d\n", MAX_TCP_REALLOC_SIZE);
|
---|
1603 |
|
---|
1604 | #endif /* of #if defined(SUPPORT_TCP) */
|
---|
1605 |
|
---|
1606 | #if defined(SUPPORT_UDP)
|
---|
1607 |
|
---|
1608 | cons_printf(portid, "UDP:\n");
|
---|
1609 |
|
---|
1610 | cons_printf(portid, " UDP_CFG_IN_CHECKSUM: ");
|
---|
1611 | #if defined(UDP_CFG_IN_CHECKSUM)
|
---|
1612 | cons_printf(portid, "On\n");
|
---|
1613 | #else
|
---|
1614 | cons_printf(portid, "Off\n");
|
---|
1615 | #endif
|
---|
1616 |
|
---|
1617 | cons_printf(portid, " UDP_CFG_OUT_CHECKSUM: ");
|
---|
1618 | #if defined(UDP_CFG_OUT_CHECKSUM)
|
---|
1619 | cons_printf(portid, "On\n");
|
---|
1620 | #else
|
---|
1621 | cons_printf(portid, "Off\n");
|
---|
1622 | #endif
|
---|
1623 |
|
---|
1624 | cons_printf(portid, " UDP_CFG_NON_BLOCKING: ");
|
---|
1625 | #if defined(UDP_CFG_NON_BLOCKING)
|
---|
1626 | #if defined(USE_UDP_NON_BLOCKING)
|
---|
1627 | cons_printf(portid, "Use\n");
|
---|
1628 | #else
|
---|
1629 | cons_printf(portid, "On\n");
|
---|
1630 | #endif
|
---|
1631 | #else
|
---|
1632 | cons_printf(portid, "Off\n");
|
---|
1633 | #endif
|
---|
1634 |
|
---|
1635 | cons_printf(portid, " UDP_CFG_EXTENTIONS: ");
|
---|
1636 | #if defined(UDP_CFG_EXTENTIONS)
|
---|
1637 | #if defined(USE_UDP_EXTENTIONS)
|
---|
1638 | cons_printf(portid, "Use\n");
|
---|
1639 | #else
|
---|
1640 | cons_printf(portid, "On\n");
|
---|
1641 | #endif
|
---|
1642 | cons_printf(portid, " NUM_VRID_UDP_CEPS: %3d\n", NUM_VRID_UDP_CEPS);
|
---|
1643 | cons_printf(portid, " NUM_VRID_UDP6_CEPS: %3d\n", NUM_VRID_UDP6_CEPS);
|
---|
1644 | #else
|
---|
1645 | cons_printf(portid, "Off\n");
|
---|
1646 | #endif
|
---|
1647 |
|
---|
1648 | cons_printf(portid, " NUM_DTQ_UDP_RCVQ: %3d\n", NUM_DTQ_UDP_RCVQ);
|
---|
1649 | cons_printf(portid, " NUM_DTQ_UDP_OUTPUT: %3d\n", NUM_DTQ_UDP_OUTPUT);
|
---|
1650 |
|
---|
1651 | #endif /* of #if defined(SUPPORT_UDP) */
|
---|
1652 |
|
---|
1653 | cons_printf(portid, "ICMP:\n");
|
---|
1654 |
|
---|
1655 | cons_printf(portid, " ICMP_CFG_CALLBACK_ECHO_REPLY: ");
|
---|
1656 | #if defined(ICMP_CFG_CALLBACK_ECHO_REPLY)
|
---|
1657 | cons_printf(portid, "On\n");
|
---|
1658 | #else
|
---|
1659 | cons_printf(portid, "Off\n");
|
---|
1660 | #endif
|
---|
1661 |
|
---|
1662 | cons_printf(portid, " ICMP_REPLY_ERROR: ");
|
---|
1663 | #if defined(ICMP_REPLY_ERROR)
|
---|
1664 | cons_printf(portid, "On\n");
|
---|
1665 | #else
|
---|
1666 | cons_printf(portid, "Off\n");
|
---|
1667 | #endif
|
---|
1668 |
|
---|
1669 | #if NUM_REDIRECT_ROUTE_ENTRY > 0
|
---|
1670 | cons_printf(portid, " TMO_IN_REDIRECT: %4d[s]\n", TMO_IN_REDIRECT / NET_TIMER_HZ);
|
---|
1671 | #endif
|
---|
1672 |
|
---|
1673 | #if defined(SUPPORT_INET4)
|
---|
1674 |
|
---|
1675 | cons_printf(portid, "IPv4:\n");
|
---|
1676 |
|
---|
1677 | cons_printf(portid, " IP4_CFG_FRAGMENT: ");
|
---|
1678 |
|
---|
1679 | #if defined(IP4_CFG_FRAGMENT)
|
---|
1680 | cons_printf(portid, "On\n");
|
---|
1681 | cons_printf(portid, " NUM_IP4_FRAG_QUEUE: %4d\n", NUM_IP4_FRAG_QUEUE);
|
---|
1682 | cons_printf(portid, " IP4_CFG_FRAG_REASSM_SIZE: %4d\n", IP4_CFG_FRAG_REASSM_SIZE);
|
---|
1683 | #else
|
---|
1684 | cons_printf(portid, "Off\n");
|
---|
1685 | #endif /* of #if defined(IP4_CFG_FRAGMENT) */
|
---|
1686 |
|
---|
1687 | #if defined(SUPPORT_ETHER)
|
---|
1688 | addr = IPV4_ADDR_LOCAL;
|
---|
1689 | cons_printf(portid, " IPV4_ADDR_LOCAL: %I\n", &addr);
|
---|
1690 | addr = IPV4_ADDR_LOCAL_MASK;
|
---|
1691 | cons_printf(portid, " IPV4_ADDR_LOCAL_MASK: %I\n", &addr);
|
---|
1692 | addr = IPV4_ADDR_DEFAULT_GW;
|
---|
1693 | cons_printf(portid, " IPV4_ADDR_DEFAULT_GW: %I\n", &addr);
|
---|
1694 | #endif /* of #if defined(SUPPORT_ETHER) */
|
---|
1695 |
|
---|
1696 | cons_printf(portid, " Routing Table:\n");
|
---|
1697 | cons_printf(portid, " NUM_STATIC_ROUTE_ENTRY: %d\n", NUM_STATIC_ROUTE_ENTRY);
|
---|
1698 | cons_printf(portid, " NUM_REDIRECT_ROUTE_ENTRY: %d\n", NUM_REDIRECT_ROUTE_ENTRY);
|
---|
1699 |
|
---|
1700 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
1701 |
|
---|
1702 | #if defined(SUPPORT_INET6)
|
---|
1703 |
|
---|
1704 | cons_printf(portid, "IPv6:\n");
|
---|
1705 |
|
---|
1706 | cons_printf(portid, " Routing Table:\n");
|
---|
1707 | cons_printf(portid, " NUM_STATIC_ROUTE_ENTRY: %d\n", NUM_STATIC_ROUTE_ENTRY);
|
---|
1708 | cons_printf(portid, " NUM_REDIRECT_ROUTE_ENTRY: %d\n", NUM_REDIRECT_ROUTE_ENTRY);
|
---|
1709 |
|
---|
1710 | cons_printf(portid, "ND:\n");
|
---|
1711 | cons_printf(portid, " TMO_ND6_RTR_SOL_DELAY: %5d[ms]\n", TMO_ND6_RTR_SOL_DELAY);
|
---|
1712 | cons_printf(portid, " TMO_ND6_RTR_SOL_INTERVAL: %5d[ms]\n", TMO_ND6_RTR_SOL_INTERVAL);
|
---|
1713 | cons_printf(portid, " NUM_IP6_DAD_COUNT: %5d\n", NUM_IP6_DAD_COUNT);
|
---|
1714 | cons_printf(portid, " NUM_ND6_CACHE_ENTRY: %5d\n", NUM_ND6_CACHE_ENTRY);
|
---|
1715 |
|
---|
1716 | #if defined(SUPPORT_ETHER)
|
---|
1717 |
|
---|
1718 | cons_printf(portid, " NUM_ND6_DEF_RTR_ENTRY %5d\n", NUM_ND6_DEF_RTR_ENTRY);
|
---|
1719 | cons_printf(portid, " NUM_ND6_RTR_SOL_RETRY %5d\n", NUM_ND6_RTR_SOL_RETRY);
|
---|
1720 |
|
---|
1721 | cons_printf(portid, " IP6_CFG_AUTO_LINKLOCAL: ");
|
---|
1722 | #if defined(IP6_CFG_AUTO_LINKLOCAL)
|
---|
1723 | cons_printf(portid, "On\n");
|
---|
1724 | #else
|
---|
1725 | cons_printf(portid, "Off\n");
|
---|
1726 | #endif
|
---|
1727 |
|
---|
1728 | #endif /* of #if defined(SUPPORT_ETHER) */
|
---|
1729 |
|
---|
1730 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
1731 |
|
---|
1732 | #if defined(SUPPORT_INET4) && defined(SUPPORT_ETHER)
|
---|
1733 |
|
---|
1734 | cons_printf(portid, "ARP:\n");
|
---|
1735 | cons_printf(portid, " ARP_CACHE_KEEP: %4d[s]\n", ARP_CACHE_KEEP / NET_TIMER_HZ);
|
---|
1736 |
|
---|
1737 | #endif /* of #if defined(SUPPORT_INET4) && defined(SUPPORT_ETHER) */
|
---|
1738 |
|
---|
1739 | #if defined(SUPPORT_ETHER)
|
---|
1740 |
|
---|
1741 | cons_printf(portid, "Ethernet:\n");
|
---|
1742 |
|
---|
1743 | cons_printf(portid, " NUM_DTQ_ETHER_OUTPUT: %3d\n", NUM_DTQ_ETHER_OUTPUT);
|
---|
1744 |
|
---|
1745 | cons_printf(portid, " ETHER_CFG_ACCEPT_ALL: ");
|
---|
1746 | #if defined(ETHER_CFG_ACCEPT_ALL)
|
---|
1747 | cons_printf(portid, "On\n");
|
---|
1748 | #else
|
---|
1749 | cons_printf(portid, "Off\n");
|
---|
1750 | #endif
|
---|
1751 |
|
---|
1752 | cons_printf(portid, " ETHER_CFG_UNEXP_WARNING: ");
|
---|
1753 | #if defined(ETHER_CFG_UNEXP_WARNING)
|
---|
1754 | cons_printf(portid, "On\n");
|
---|
1755 | #else
|
---|
1756 | cons_printf(portid, "Off\n");
|
---|
1757 | #endif
|
---|
1758 |
|
---|
1759 | cons_printf(portid, " ETHER_CFG_802_WARNING: ");
|
---|
1760 | #if defined(ETHER_CFG_802_WARNING)
|
---|
1761 | cons_printf(portid, "On\n");
|
---|
1762 | #else
|
---|
1763 | cons_printf(portid, "Off\n");
|
---|
1764 | #endif
|
---|
1765 |
|
---|
1766 | cons_printf(portid, " ETHER_CFG_MCAST_WARNING: ");
|
---|
1767 | #if defined(ETHER_CFG_MCAST_WARNING)
|
---|
1768 | cons_printf(portid, "On\n");
|
---|
1769 | #else
|
---|
1770 | cons_printf(portid, "Off\n");
|
---|
1771 | #endif
|
---|
1772 |
|
---|
1773 | #endif /* of #if defined(SUPPORT_ETHER) */
|
---|
1774 |
|
---|
1775 | #if defined(SUPPORT_PPP)
|
---|
1776 |
|
---|
1777 | cons_printf(portid, "PPP:\n");
|
---|
1778 |
|
---|
1779 | cons_printf(portid, " HDLC_PORTNO: %d", HDLC_PORTID);
|
---|
1780 |
|
---|
1781 | cons_printf(portid, " PPP_IDLE_TIMEOUT: ");
|
---|
1782 | #if defined(PPP_IDLE_TIMEOUT)
|
---|
1783 | cons_printf(portid, " %4d[s]\n", PPP_IDLE_TIMEOUT / NET_TIMER_HZ);
|
---|
1784 | #else
|
---|
1785 | cons_printf(portid, " Off\n");
|
---|
1786 | #endif
|
---|
1787 |
|
---|
1788 | cons_printf(portid, " PPP_CFG_MODEM: ");
|
---|
1789 | #if defined(PPP_CFG_MODEM)
|
---|
1790 | cons_printf(portid, "On\n");
|
---|
1791 | #else
|
---|
1792 | cons_printf(portid, "Off\n");
|
---|
1793 | #endif
|
---|
1794 |
|
---|
1795 | #endif /* of #if defined(SUPPORT_PPP) */
|
---|
1796 |
|
---|
1797 | cons_printf(portid, "Network Buffer:\n");
|
---|
1798 |
|
---|
1799 | #if defined(NUM_MPF_NET_BUF_64)
|
---|
1800 | cons_printf(portid, " NUM_MPF_NET_BUF_64: %2d\n", NUM_MPF_NET_BUF_64);
|
---|
1801 | #endif
|
---|
1802 |
|
---|
1803 | #if defined(NUM_MPF_NET_BUF_CSEG)
|
---|
1804 | cons_printf(portid, " NUM_MPF_NET_BUF_CSEG: %2d\n", NUM_MPF_NET_BUF_CSEG);
|
---|
1805 | #endif
|
---|
1806 |
|
---|
1807 | #if defined(NUM_MPF_NET_BUF_128)
|
---|
1808 | cons_printf(portid, " NUM_MPF_NET_BUF_128: %2d\n", NUM_MPF_NET_BUF_128);
|
---|
1809 | #endif
|
---|
1810 |
|
---|
1811 | #if defined(NUM_MPF_NET_BUF_256)
|
---|
1812 | cons_printf(portid, " NUM_MPF_NET_BUF_256: %2d\n", NUM_MPF_NET_BUF_256);
|
---|
1813 | #endif
|
---|
1814 |
|
---|
1815 | #if defined(NUM_MPF_NET_BUF_512)
|
---|
1816 | cons_printf(portid, " NUM_MPF_NET_BUF_512: %2d\n", NUM_MPF_NET_BUF_512);
|
---|
1817 | #endif
|
---|
1818 |
|
---|
1819 | #if defined(NUM_MPF_NET_BUF_IP_MSS)
|
---|
1820 | cons_printf(portid, " NUM_MPF_NET_BUF_IP_MSS: %2d\n", NUM_MPF_NET_BUF_IP_MSS);
|
---|
1821 | #endif
|
---|
1822 |
|
---|
1823 | #if defined(NUM_MPF_NET_BUF_1024)
|
---|
1824 | cons_printf(portid, " NUM_MPF_NET_BUF_1024: %2d\n", NUM_MPF_NET_BUF_1024);
|
---|
1825 | #endif
|
---|
1826 |
|
---|
1827 | #if defined(NUM_MPF_NET_BUF_IPV6_MMTU)
|
---|
1828 | cons_printf(portid, " NUM_MPF_NET_BUF_IPV6_MMTU: %2d\n", NUM_MPF_NET_BUF_IPV6_MMTU);
|
---|
1829 | #endif
|
---|
1830 |
|
---|
1831 | #if defined(NUM_MPF_NET_BUF_IF_PDU)
|
---|
1832 | cons_printf(portid, " NUM_MPF_NET_BUF_IF_PDU: %2d\n", NUM_MPF_NET_BUF_IF_PDU);
|
---|
1833 | #endif
|
---|
1834 |
|
---|
1835 | #if defined(NUM_MPF_NET_BUF_REASSM)
|
---|
1836 | cons_printf(portid, " NUM_MPF_NET_BUF_REASSM: %2d\n", NUM_MPF_NET_BUF_REASSM);
|
---|
1837 | #endif
|
---|
1838 |
|
---|
1839 | #if defined(NUM_MPF_NET_BUF6_65536)
|
---|
1840 | cons_printf(portid, " NUM_MPF_NET_BUF6_65536: %2d\n", NUM_MPF_NET_BUF6_65536);
|
---|
1841 | #endif
|
---|
1842 |
|
---|
1843 | cons_printf(portid, "Network Counter Mask: %08x\n", NET_COUNT_ENABLE);
|
---|
1844 |
|
---|
1845 | cons_printf(portid, "SUPPORT_MIB: ");
|
---|
1846 | #if defined(SUPPORT_MIB)
|
---|
1847 | cons_printf(portid, "On\n");
|
---|
1848 | #else
|
---|
1849 | cons_printf(portid, "Off\n");
|
---|
1850 | #endif
|
---|
1851 |
|
---|
1852 | SIG_NET_CONS_PRINTF();
|
---|
1853 | FLUSH_SND_BUFF();
|
---|
1854 | }
|
---|
1855 |
|
---|
1856 | /*
|
---|
1857 | * デバッグコマンド解析
|
---|
1858 | */
|
---|
1859 |
|
---|
1860 | static void
|
---|
1861 | dbg_parse (ID portid, char *line)
|
---|
1862 | {
|
---|
1863 | int_t cepid;
|
---|
1864 | ER error;
|
---|
1865 |
|
---|
1866 | switch (*line) {
|
---|
1867 |
|
---|
1868 | case 'c': /* cancel CEP */
|
---|
1869 | switch (*(line + 1)) {
|
---|
1870 |
|
---|
1871 | case 'f': /* show configurations */
|
---|
1872 | show_config(portid, line + 1);
|
---|
1873 | break;
|
---|
1874 |
|
---|
1875 | #ifdef SUPPORT_TCP
|
---|
1876 |
|
---|
1877 | case 't': /* cancel TCP */
|
---|
1878 | cepid = atoi(line = skip_blanks(line + 2));
|
---|
1879 | while ('0' <= *line && *line <= '9')
|
---|
1880 | line ++;
|
---|
1881 | if ((error = tcp_can_cep((ID)cepid, atoi(skip_blanks(line)))) != E_OK && error != E_RLWAI) {
|
---|
1882 | cons_printf(portid, "[TCP CAN CEP] error: %s\n", itron_strerror(error));
|
---|
1883 | SIG_NET_CONS_PRINTF();
|
---|
1884 | FLUSH_SND_BUFF();
|
---|
1885 | }
|
---|
1886 | break;
|
---|
1887 |
|
---|
1888 | #endif /* of #ifdef SUPPORT_TCP */
|
---|
1889 |
|
---|
1890 | #ifdef SUPPORT_UDP
|
---|
1891 |
|
---|
1892 | case 'u': /* cancel UDP */
|
---|
1893 | cepid = atoi(line = skip_blanks(line + 2));
|
---|
1894 | while ('0' <= *line && *line <= '9')
|
---|
1895 | line ++;
|
---|
1896 | if ((error = udp_can_cep((ID)cepid, atoi(skip_blanks(line)))) != E_OK && error != E_RLWAI) {
|
---|
1897 | cons_printf(portid, "[UDP CAN CEP] error: %s\n", itron_strerror(error));
|
---|
1898 | SIG_NET_CONS_PRINTF();
|
---|
1899 | FLUSH_SND_BUFF();
|
---|
1900 | }
|
---|
1901 | break;
|
---|
1902 |
|
---|
1903 | #endif /* of #ifdef SUPPORT_UDP */
|
---|
1904 |
|
---|
1905 | }
|
---|
1906 |
|
---|
1907 | break;
|
---|
1908 |
|
---|
1909 | #if defined(USE_UDP_DISCARD_CLI) || defined(USE_TCP_DISCARD_CLI) || defined(SUPPORT_PPP) || defined(SUPPORT_ETHER) && defined(USE_NET_CONS)
|
---|
1910 |
|
---|
1911 | case 'd': /* discard client */
|
---|
1912 | switch (*(line + 1)) {
|
---|
1913 |
|
---|
1914 | #if defined(SUPPORT_PPP)
|
---|
1915 |
|
---|
1916 | case 'c': /* disconnect */
|
---|
1917 | if (lcp_fsm.state != PPP_FSM_STOPPED)
|
---|
1918 | lcp_close();
|
---|
1919 | break;
|
---|
1920 |
|
---|
1921 | #endif /* of #if defined(SUPPORT_PPP) */
|
---|
1922 |
|
---|
1923 | #if defined(SUPPORT_ETHER) && defined(USE_NET_CONS)
|
---|
1924 |
|
---|
1925 | case 'c': /* disconnect */
|
---|
1926 | discon_net_cons();
|
---|
1927 | break;
|
---|
1928 |
|
---|
1929 | #endif /* of #if defined(SUPPORT_ETHER) && defined(USE_NET_CONS) */
|
---|
1930 |
|
---|
1931 | #ifdef USE_TCP_DISCARD_CLI
|
---|
1932 |
|
---|
1933 | case 't': /* TCP discard client */
|
---|
1934 | line += 2;
|
---|
1935 | switch (*line) {
|
---|
1936 |
|
---|
1937 | case 's': /* cancel TCP discard client */
|
---|
1938 | tcp_discard_cli_valid = false;
|
---|
1939 | break;
|
---|
1940 |
|
---|
1941 | default:
|
---|
1942 | if ((error = psnd_dtq(DTQ_TCP_DISCARD_CLI, (intptr_t)line)) != E_OK) {
|
---|
1943 | cons_printf(portid, "[TCP DISCARD CLI] error: %s\n",
|
---|
1944 | itron_strerror(error));
|
---|
1945 | SIG_NET_CONS_PRINTF();
|
---|
1946 | FLUSH_SND_BUFF();
|
---|
1947 | }
|
---|
1948 | break;
|
---|
1949 |
|
---|
1950 | }
|
---|
1951 | break;
|
---|
1952 |
|
---|
1953 | #endif /* of #ifdef USE_TCP_DISCARD_CLI */
|
---|
1954 |
|
---|
1955 | #ifdef USE_UDP_DISCARD_CLI
|
---|
1956 |
|
---|
1957 | case 'u': /* UDP discard client */
|
---|
1958 | line += 2;
|
---|
1959 | switch (*line) {
|
---|
1960 |
|
---|
1961 | case 's': /* cancel UDP discard client */
|
---|
1962 | udp_discard_cli_valid = false;
|
---|
1963 | break;
|
---|
1964 |
|
---|
1965 | default:
|
---|
1966 | if ((error = psnd_dtq(DTQ_UDP_DISCARD_CLI, (intptr_t)line)) != E_OK) {
|
---|
1967 | cons_printf(portid, "[UDP DISCARD CLI] error: %s\n",
|
---|
1968 | itron_strerror(error));
|
---|
1969 | SIG_NET_CONS_PRINTF();
|
---|
1970 | FLUSH_SND_BUFF();
|
---|
1971 | }
|
---|
1972 | break;
|
---|
1973 |
|
---|
1974 | }
|
---|
1975 | break;
|
---|
1976 |
|
---|
1977 | #endif /* of #ifdef USE_UDP_DISCARD_CLI */
|
---|
1978 |
|
---|
1979 | }
|
---|
1980 |
|
---|
1981 | break;
|
---|
1982 |
|
---|
1983 | #endif /* of #if defined(USE_UDP_DISCARD_CLI) || defined(USE_TCP_DISCARD_CLI) || defined(SUPPORT_PPP) || defined(SUPPORT_ETHER) && defined(USE_NET_CONS) */
|
---|
1984 |
|
---|
1985 | #if defined(USE_UDP_ECHO_CLI) || defined(USE_TCP_ECHO_CLI)
|
---|
1986 |
|
---|
1987 | case 'e': /* echo client */
|
---|
1988 | switch (*(line + 1)) {
|
---|
1989 |
|
---|
1990 | #ifdef USE_TCP_ECHO_CLI
|
---|
1991 |
|
---|
1992 | case 't': /* TCP echo client */
|
---|
1993 | line += 2;
|
---|
1994 | switch (*line) {
|
---|
1995 |
|
---|
1996 | case 's': /* cancel TCP echo */
|
---|
1997 | tcp_echo_cli_valid = false;
|
---|
1998 | break;
|
---|
1999 |
|
---|
2000 | default:
|
---|
2001 | if ((error = psnd_dtq(DTQ_TCP_ECHO_CLI_SND, (intptr_t)line)) != E_OK) {
|
---|
2002 | cons_printf(portid, "[TCP ECHO CLI] error: %s\n", itron_strerror(error));
|
---|
2003 | SIG_NET_CONS_PRINTF();
|
---|
2004 | FLUSH_SND_BUFF();
|
---|
2005 | }
|
---|
2006 | break;
|
---|
2007 |
|
---|
2008 | }
|
---|
2009 | break;
|
---|
2010 |
|
---|
2011 | #endif /* of #ifdef USE_TCP_ECHO_CLI */
|
---|
2012 |
|
---|
2013 | #ifdef USE_UDP_ECHO_CLI
|
---|
2014 |
|
---|
2015 | case 'u': /* UDP echo client */
|
---|
2016 | line += 2;
|
---|
2017 | switch (*line) {
|
---|
2018 |
|
---|
2019 | case 's': /* cancel UDP echo */
|
---|
2020 | udp_echo_cli_valid = false;
|
---|
2021 | break;
|
---|
2022 |
|
---|
2023 | default:
|
---|
2024 | if ((error = psnd_dtq(DTQ_UDP_ECHO_CLI, (intptr_t)line)) != E_OK) {
|
---|
2025 | cons_printf(portid, "[UDP ECHO CLI] error: %s\n", itron_strerror(error));
|
---|
2026 | SIG_NET_CONS_PRINTF();
|
---|
2027 | FLUSH_SND_BUFF();
|
---|
2028 | }
|
---|
2029 | break;
|
---|
2030 |
|
---|
2031 | }
|
---|
2032 | break;
|
---|
2033 |
|
---|
2034 | #endif /* of #ifdef USE_UDP_ECHO_CLI */
|
---|
2035 |
|
---|
2036 | }
|
---|
2037 |
|
---|
2038 | break;
|
---|
2039 |
|
---|
2040 | #endif /* of #if defined(USE_UDP_ECHO_CLI) || defined(USE_TCP_ECHO_CLI) */
|
---|
2041 |
|
---|
2042 | case 'i':
|
---|
2043 |
|
---|
2044 | if (*(line + 1) == 'f')
|
---|
2045 | ifconfig(portid, line + 2);
|
---|
2046 |
|
---|
2047 | #ifdef SUPPORT_PPP
|
---|
2048 |
|
---|
2049 | #ifdef PPP_CFG_MODEM
|
---|
2050 |
|
---|
2051 | else if (lcp_fsm.state == PPP_FSM_STOPPED)
|
---|
2052 | dial(); /* initiate */
|
---|
2053 |
|
---|
2054 | #else /* of #ifdef PPP_CFG_MODEM */
|
---|
2055 |
|
---|
2056 | else if (lcp_fsm.state == PPP_FSM_STOPPED)
|
---|
2057 | lcp_open(PPP_OPEN_ACTIVE);
|
---|
2058 |
|
---|
2059 | #endif /* of #ifdef PPP_CFG_MODEM */
|
---|
2060 |
|
---|
2061 | #endif /* of #ifdef SUPPORT_PPP */
|
---|
2062 |
|
---|
2063 | break;
|
---|
2064 |
|
---|
2065 | case 'n': /* network status */
|
---|
2066 | network_status(portid, line + 1);
|
---|
2067 | break;
|
---|
2068 |
|
---|
2069 | case 'p': /* ping or task status */
|
---|
2070 |
|
---|
2071 | if (*(line + 1) == 's')
|
---|
2072 | task_status(portid, skip_blanks(line + 2));
|
---|
2073 |
|
---|
2074 | #ifdef USE_PING
|
---|
2075 |
|
---|
2076 | else {
|
---|
2077 | int_t tmo, size;
|
---|
2078 | T_IN_ADDR addr;
|
---|
2079 |
|
---|
2080 | #ifdef PING_CFG_I6RLP
|
---|
2081 | static const char i6rlp_pmtu_str1[] = " FF1E::1:2 1 1452";
|
---|
2082 | static const char i6rlp_pmtu_str2[] = " FF1E::1:2 1 1352";
|
---|
2083 | static const char i6rlp_pmtu_str3[] = " fe80::0200:00ff:fe00:0100 1 2";
|
---|
2084 |
|
---|
2085 | if (*(line + 1) == '1')
|
---|
2086 | strcpy(line + 1, i6rlp_pmtu_str1);
|
---|
2087 | else if (*(line + 1) == '2')
|
---|
2088 | strcpy(line + 1, i6rlp_pmtu_str2);
|
---|
2089 | else if (*(line + 1) == '3')
|
---|
2090 | strcpy(line + 1, i6rlp_pmtu_str3);
|
---|
2091 |
|
---|
2092 | #endif /* of #ifdef PING_CFG_I6RLP */
|
---|
2093 |
|
---|
2094 | line = skip_blanks(GET_IPADDR(&addr, skip_blanks(line + 1)));
|
---|
2095 | if ('0' <= *line && *line <= '9')
|
---|
2096 | line = get_int(&tmo, line);
|
---|
2097 | else
|
---|
2098 | tmo = 3;
|
---|
2099 |
|
---|
2100 | line = skip_blanks(line + 1);
|
---|
2101 | if ('0' <= *line && *line <= '9')
|
---|
2102 | line = get_int(&size, line);
|
---|
2103 | else
|
---|
2104 | size = 64;
|
---|
2105 |
|
---|
2106 | PING(&addr, (uint_t)tmo, (uint_t)size);
|
---|
2107 | }
|
---|
2108 |
|
---|
2109 | #endif /* of #ifdef USE_PING */
|
---|
2110 |
|
---|
2111 | break;
|
---|
2112 |
|
---|
2113 | case 'r': /* release wait task */
|
---|
2114 | if ((error = rel_wai(atoi(skip_blanks(line + 1)))) != E_OK) {
|
---|
2115 | cons_printf(portid, "[REL WAI TSK] error: %s\n", itron_strerror(error));
|
---|
2116 | SIG_NET_CONS_PRINTF();
|
---|
2117 | FLUSH_SND_BUFF();
|
---|
2118 | }
|
---|
2119 | break;
|
---|
2120 |
|
---|
2121 | case 't': /* terminate (delete) REP/CEP */
|
---|
2122 | switch (*(line + 1)) {
|
---|
2123 |
|
---|
2124 | #ifdef USE_TCP_EXTENTIONS
|
---|
2125 |
|
---|
2126 | case 't': /* TCP REP */
|
---|
2127 | if ((error = tcp_del_rep(atoi(skip_blanks(line + 2)))) != E_OK) {
|
---|
2128 | cons_printf(portid, "[TCP DEL REP] error: %s\n", itron_strerror(error));
|
---|
2129 | SIG_NET_CONS_PRINTF();
|
---|
2130 | FLUSH_SND_BUFF();
|
---|
2131 | }
|
---|
2132 | break;
|
---|
2133 |
|
---|
2134 | #endif /* of #ifdef USE_TCP_EXTENTIONS */
|
---|
2135 |
|
---|
2136 | #ifdef USE_UDP_EXTENTIONS
|
---|
2137 |
|
---|
2138 | case 'u': /* UDP CEP */
|
---|
2139 | if ((error = udp_del_cep(atoi(skip_blanks(line + 2)))) != E_OK) {
|
---|
2140 | cons_printf(portid, "[UDP DEL CEP] error: %s\n", itron_strerror(error));
|
---|
2141 | SIG_NET_CONS_PRINTF();
|
---|
2142 | FLUSH_SND_BUFF();
|
---|
2143 | }
|
---|
2144 | break;
|
---|
2145 |
|
---|
2146 | #endif /* of #ifdef USE_UDP_EXTENTIONS */
|
---|
2147 |
|
---|
2148 | }
|
---|
2149 | break;
|
---|
2150 |
|
---|
2151 | #if defined(USE_TCP_EXTENTIONS) || defined(USE_UDP_EXTENTIONS)
|
---|
2152 |
|
---|
2153 | case 'w': /* wakeup server */
|
---|
2154 | /* wake up task */
|
---|
2155 | switch (*(line + 1)) {
|
---|
2156 |
|
---|
2157 | #ifdef USE_TCP_EXTENTIONS
|
---|
2158 |
|
---|
2159 | case 't': /* tcp server */
|
---|
2160 | switch (*(line + 2)) {
|
---|
2161 |
|
---|
2162 | #ifdef USE_TCP_DISCARD_SRV
|
---|
2163 | case 'd': /* tcp discard server */
|
---|
2164 | if ((error = wup_tsk(TCP_DISCARD_SRV_TASK)) != E_OK) {
|
---|
2165 | cons_printf(portid, "[WUP TCP DISCARD SRV] error: %s\n", itron_strerror(error));
|
---|
2166 | SIG_NET_CONS_PRINTF();
|
---|
2167 | FLUSH_SND_BUFF();
|
---|
2168 | }
|
---|
2169 | break;
|
---|
2170 | #endif /* of #ifdef USE_TCP_DISCARD_SRV */
|
---|
2171 |
|
---|
2172 | #if defined(USE_TCP_ECHO_SRV1) || defined(USE_TCP_ECHO_SRV2)
|
---|
2173 | case 'e': /* tcp echo server */
|
---|
2174 | if ((error = wup_tsk(TCP_ECHO_SRV_TASK)) != E_OK) {
|
---|
2175 | cons_printf(portid, "[WUP UDP DISCARD SRV] error: %s\n", itron_strerror(error));
|
---|
2176 | SIG_NET_CONS_PRINTF();
|
---|
2177 | FLUSH_SND_BUFF();
|
---|
2178 | }
|
---|
2179 | break;
|
---|
2180 | #endif /* of #if defined(USE_TCP_ECHO_SRV1) || defined(USE_TCP_ECHO_SRV2) */
|
---|
2181 |
|
---|
2182 | #ifdef USE_WWW_SRV
|
---|
2183 | case 'w': /* WWW server */
|
---|
2184 | if ((error = wup_tsk(WWW_SRV_TASK1)) != E_OK) {
|
---|
2185 | cons_printf(portid, "[WUP WWW SRV] error: %s\n", itron_strerror(error));
|
---|
2186 | SIG_NET_CONS_PRINTF();
|
---|
2187 | FLUSH_SND_BUFF();
|
---|
2188 | }
|
---|
2189 | break;
|
---|
2190 | #endif /* of #ifdef USE_TCP_DISCARD_SRV */
|
---|
2191 |
|
---|
2192 | }
|
---|
2193 | break;
|
---|
2194 |
|
---|
2195 | #endif /* of #ifdef USE_TCP_EXTENTIONS */
|
---|
2196 |
|
---|
2197 | #ifdef USE_UDP_EXTENTIONS
|
---|
2198 |
|
---|
2199 | case 'u': /* udp server */
|
---|
2200 | switch (*(line + 2)) {
|
---|
2201 |
|
---|
2202 | #if defined(USE_UDP_ECHO_SRV) && !defined(USE_UDP_CALL_BACK)
|
---|
2203 | case 'e': /* udp echo server */
|
---|
2204 | if ((error = wup_tsk(UDP_ECHO_SRV_TASK)) != E_OK) {
|
---|
2205 | cons_printf(portid, "[WUP UDP ECHO SRV] error: %s\n", itron_strerror(error));
|
---|
2206 | SIG_NET_CONS_PRINTF();
|
---|
2207 | FLUSH_SND_BUFF();
|
---|
2208 | }
|
---|
2209 | break;
|
---|
2210 | #endif /* of #if defined(USE_UDP_ECHO_SRV) && !defined(USE_UDP_CALL_BACK) */
|
---|
2211 |
|
---|
2212 | }
|
---|
2213 | break;
|
---|
2214 |
|
---|
2215 | #endif /* of #ifdef USE_UDP_EXTENTIONS */
|
---|
2216 |
|
---|
2217 | default:
|
---|
2218 | if ((error = wup_tsk(atoi(skip_blanks(line + 1)))) != E_OK) {
|
---|
2219 | cons_printf(portid, "[WUP TSK] error: %s\n", itron_strerror(error));
|
---|
2220 | SIG_NET_CONS_PRINTF();
|
---|
2221 | FLUSH_SND_BUFF();
|
---|
2222 | }
|
---|
2223 | break;
|
---|
2224 |
|
---|
2225 | }
|
---|
2226 | break;
|
---|
2227 |
|
---|
2228 | #else /* of #if defined(USE_TCP_EXTENTIONS) || defined(USE_UDP_EXTENTIONS) */
|
---|
2229 |
|
---|
2230 | case 'w': /* wake up task */
|
---|
2231 | if ((error = wup_tsk(atoi(skip_blanks(line + 1)))) != E_OK) {
|
---|
2232 | cons_printf(portid, "[WUP TSK] error: %s\n", itron_strerror(error));
|
---|
2233 | SIG_NET_CONS_PRINTF();
|
---|
2234 | FLUSH_SND_BUFF();
|
---|
2235 | }
|
---|
2236 | break;
|
---|
2237 |
|
---|
2238 | #endif /* of #if defined(USE_TCP_EXTENTIONS) || defined(USE_UDP_EXTENTIONS) */
|
---|
2239 |
|
---|
2240 | default:
|
---|
2241 |
|
---|
2242 | if (*line) {
|
---|
2243 |
|
---|
2244 | #ifdef USE_EXTRA_PARSE
|
---|
2245 |
|
---|
2246 | extra_parse(line);
|
---|
2247 |
|
---|
2248 | #else /* of #ifdef USE_EXTRA_PARSE */
|
---|
2249 |
|
---|
2250 | cons_printf(portid, "no such command: '%c'\n", *line);
|
---|
2251 | SIG_NET_CONS_PRINTF();
|
---|
2252 | FLUSH_SND_BUFF();
|
---|
2253 |
|
---|
2254 | #endif /* of #ifdef USE_EXTRA_PARSE */
|
---|
2255 |
|
---|
2256 | }
|
---|
2257 | break;
|
---|
2258 | }
|
---|
2259 | }
|
---|
2260 |
|
---|
2261 | /*
|
---|
2262 | * デバッグコンソールタスク
|
---|
2263 | */
|
---|
2264 |
|
---|
2265 | void
|
---|
2266 | dbg_con_task (intptr_t exinf)
|
---|
2267 | {
|
---|
2268 | static char line[DBG_LINE_SIZE + 1];
|
---|
2269 |
|
---|
2270 | uint_t len;
|
---|
2271 | ID tskid;
|
---|
2272 |
|
---|
2273 | #ifdef USE_LCD
|
---|
2274 | #ifdef SUPPORT_ETHER
|
---|
2275 |
|
---|
2276 | #if defined(SUPPORT_INET6)
|
---|
2277 |
|
---|
2278 | int_t lllen;
|
---|
2279 | const uint8_t *lladdr;
|
---|
2280 |
|
---|
2281 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
2282 |
|
---|
2283 | lcd_init();
|
---|
2284 |
|
---|
2285 | if ((TINET_PRVER & UINT_C(0x0f)) > 0)
|
---|
2286 | lcd_printf("TINET-%d.%d.%d\n",
|
---|
2287 | (TINET_PRVER >> 12) & UINT_C(0x0f),
|
---|
2288 | (TINET_PRVER >> 4) & UINT_C(0x0f),
|
---|
2289 | TINET_PRVER & UINT_C(0x0f));
|
---|
2290 | else
|
---|
2291 | lcd_printf("TINET-%d.%d\n",
|
---|
2292 | (TINET_PRVER >> 12) & UINT_C(0x0f),
|
---|
2293 | (TINET_PRVER >> 4) & UINT_C(0x0f));
|
---|
2294 |
|
---|
2295 | #if defined(SUPPORT_INET6)
|
---|
2296 |
|
---|
2297 | lladdr = IF_ETHER_NIC_GET_SOFTC()->ifaddr.lladdr;
|
---|
2298 | for (lllen = ETHER_ADDR_LEN; lllen --; )
|
---|
2299 | lcd_printf("%02x", *lladdr ++);
|
---|
2300 | lcd_printf("\n");
|
---|
2301 |
|
---|
2302 | #else /* of #if defined(SUPPORT_INET6) */
|
---|
2303 |
|
---|
2304 | lcd_puts(ip2str(NULL, in4_get_ifaddr(0)));
|
---|
2305 |
|
---|
2306 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
2307 |
|
---|
2308 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
2309 | #else /* of #ifdef USE_LCD */
|
---|
2310 |
|
---|
2311 | get_tid(&tskid);
|
---|
2312 | cons_printf(CONSOLE_PORTID, "[CONSOLE:%d] started.\n", tskid);
|
---|
2313 |
|
---|
2314 | #endif /* of #ifdef USE_LCD */
|
---|
2315 |
|
---|
2316 | serial_ctl_por(CONSOLE_PORTID,
|
---|
2317 | IOCTL_ECHO | IOCTL_CRLF |
|
---|
2318 | IOCTL_FCSND | IOCTL_FCANY | IOCTL_FCRCV);
|
---|
2319 | while (true) {
|
---|
2320 | len = cons_getline(CONSOLE_PORTID, line, DBG_LINE_SIZE);
|
---|
2321 | dbg_parse(CONSOLE_PORTID, line);
|
---|
2322 | }
|
---|
2323 | }
|
---|
2324 |
|
---|
2325 | #endif /* of #ifdef USE_DBG_CONS */
|
---|