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 | * ä¸è¨èä½æ¨©è
|
---|
8 | ã¯ï¼ä»¥ä¸ã® (1)ï½(4) ã®æ¡ä»¶ãï¼Free Software Foundation
|
---|
9 | * ã«ãã£ã¦å
|
---|
10 | ¬è¡¨ããã¦ãã GNU General Public License ã® Version 2 ã«è¨
|
---|
11 | * è¿°ããã¦ããæ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§ã¢ï¼æ¬ã½ããã¦ã§ã¢
|
---|
12 | * ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹å¤ã»åé
|
---|
13 | å¸ï¼ä»¥ä¸ï¼
|
---|
14 | * å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
15 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
16 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
17 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
18 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
19 | * ç¨ã§ããå½¢ã§åé
|
---|
20 | å¸ããå ´åã«ã¯ï¼åé
|
---|
21 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
22 | * è
|
---|
23 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
24 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
25 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
26 | * ç¨ã§ããªãå½¢ã§åé
|
---|
27 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®æ¡ä»¶ãæºãããã¨ï¼
|
---|
28 | * (a) åé
|
---|
29 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
30 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
31 | * ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
32 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
33 | * 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
34 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
35 | 責ãããã¨ï¼
|
---|
36 | *
|
---|
37 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
38 | ã
|
---|
39 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ãã®é©ç¨å¯è½æ§ã
|
---|
40 | * å«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´
|
---|
41 | * æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ãã®è²¬ä»»ãè² ããªãï¼
|
---|
42 | *
|
---|
43 | * @(#) $Id: dbg_cons.c 388 2019-05-22 11:25:18Z coas-nagasima $
|
---|
44 | */
|
---|
45 |
|
---|
46 | /*
|
---|
47 | * ãããã°ã³ã³ã½ã¼ã«
|
---|
48 | */
|
---|
49 |
|
---|
50 | #include <stdlib.h>
|
---|
51 | #include <string.h>
|
---|
52 |
|
---|
53 | #ifdef TARGET_KERNEL_ASP
|
---|
54 |
|
---|
55 | #include <kernel.h>
|
---|
56 | #include <sil.h>
|
---|
57 | #include <syssvc/serial.h>
|
---|
58 | #include <syssvc/logtask.h>
|
---|
59 | #include "kernel/kernel_impl.h"
|
---|
60 | #include "kernel/task.h"
|
---|
61 | #include "kernel_cfg.h"
|
---|
62 | #include "tinet_cfg.h"
|
---|
63 |
|
---|
64 | #endif /* of #ifdef TARGET_KERNEL_ASP */
|
---|
65 |
|
---|
66 | #ifdef TARGET_KERNEL_JSP
|
---|
67 |
|
---|
68 | #include <s_services.h>
|
---|
69 | #include <t_services.h>
|
---|
70 | #include "kernel_id.h"
|
---|
71 | #include "tinet_id.h"
|
---|
72 |
|
---|
73 | #include "../kernel/jsp_kernel.h"
|
---|
74 | #include "../kernel/task.h"
|
---|
75 |
|
---|
76 | #endif /* of #ifdef TARGET_KERNEL_JSP */
|
---|
77 |
|
---|
78 | #include <tinet_defs.h>
|
---|
79 | #include <tinet_config.h>
|
---|
80 |
|
---|
81 | #include <net/if.h>
|
---|
82 | #include <net/if_ppp.h>
|
---|
83 | #include <net/if_loop.h>
|
---|
84 | #include <net/ethernet.h>
|
---|
85 | #include <net/net.h>
|
---|
86 | #include <net/net_endian.h>
|
---|
87 | #include <net/net_buf.h>
|
---|
88 | #include <net/net_timer.h>
|
---|
89 | #include <net/ppp_var.h>
|
---|
90 | #include <net/ppp_fsm.h>
|
---|
91 | #include <net/ppp_lcp.h>
|
---|
92 | #include <net/ppp_ipcp.h>
|
---|
93 | #include <net/ppp_modem.h>
|
---|
94 | #include <net/net_count.h>
|
---|
95 |
|
---|
96 | #include <netinet/in.h>
|
---|
97 | #include <netinet/in_var.h>
|
---|
98 | #include <netinet/in_itron.h>
|
---|
99 | #include <netinet/ip.h>
|
---|
100 | #include <netinet/ip_var.h>
|
---|
101 | #include <netinet/if_ether.h>
|
---|
102 | #include <netinet/tcp.h>
|
---|
103 | #include <netinet/tcp_var.h>
|
---|
104 | #include <netinet/tcp_fsm.h>
|
---|
105 | #include <netinet/tcp_timer.h>
|
---|
106 | #include <netinet/udp.h>
|
---|
107 | #include <netinet/udp_var.h>
|
---|
108 |
|
---|
109 | #include <netinet6/nd6.h>
|
---|
110 |
|
---|
111 | #include <net/if_var.h>
|
---|
112 |
|
---|
113 | #include <netapp/netapp.h>
|
---|
114 | #include <netapp/netapp_var.h>
|
---|
115 | #include <netapp/wwws.h>
|
---|
116 | #include <netapp/tcp_echo_srv1.h>
|
---|
117 | #include <netapp/tcp_echo_srv2.h>
|
---|
118 | #include <netapp/tcp_echo_cli.h>
|
---|
119 | #include <netapp/tcp_discard_cli.h>
|
---|
120 | #include <netapp/udp6_echo_srv.h>
|
---|
121 | #include <netapp/udp4_echo_srv.h>
|
---|
122 | #include <netapp/udp6_echo_cli.h>
|
---|
123 | #include <netapp/udp4_echo_cli.h>
|
---|
124 | #include <netapp/udp_discard_cli.h>
|
---|
125 | #include <netapp/resolver.h>
|
---|
126 | #include <netapp/dbg_cons.h>
|
---|
127 | #include <netapp/dhcp6_cli.h>
|
---|
128 | #include <netapp/dhcp4_cli.h>
|
---|
129 | #include "lcd.h"
|
---|
130 |
|
---|
131 | #ifdef USE_DBG_CONS
|
---|
132 |
|
---|
133 | /*
|
---|
134 | * dbg_cons_task_status -- ã¿ã¹ã¯ã®ç¶æ
|
---|
135 | ã®åºå
|
---|
136 | */
|
---|
137 |
|
---|
138 | static const char task_stat_str[][sizeof("SUSPENDED")] = {
|
---|
139 | "DORMANT", /* ä¼æ¢ç¶æ
|
---|
140 | */
|
---|
141 | "RUNNABLE", /* å®è¡ã§ããç¶æ
|
---|
142 | */
|
---|
143 | "WAINTING", /* å¾
|
---|
144 | ã¡ç¶æ
|
---|
145 | */
|
---|
146 | "SUSPENDED", /* å¼·å¶å¾
|
---|
147 | ã¡ç¶æ
|
---|
148 | */
|
---|
149 | "SLEEP", /* èµ·åºå¾
|
---|
150 | ã¡ç¶æ
|
---|
151 | */
|
---|
152 | "WOBJ", /* åæã»éä¿¡ãªãã¸ã§ã¯ãã«å¯¾ããå¾
|
---|
153 | ã¡ç¶æ
|
---|
154 | */
|
---|
155 | "WOBJCB", /* å
|
---|
156 | ±éé¨åã®å¾
|
---|
157 | ã¡ãã¥ã¼ã«ã¤ãªãã£ã¦ããã */
|
---|
158 | };
|
---|
159 |
|
---|
160 | void
|
---|
161 | dbg_cons_task_status (ID portid, char *line)
|
---|
162 | {
|
---|
163 | TCB *tcb;
|
---|
164 | int_t ix, st, sx;
|
---|
165 |
|
---|
166 | WAI_NET_CONS_PRINTF();
|
---|
167 | cons_printf(portid,
|
---|
168 | "TASK Status\n"
|
---|
169 | "ID PI State\n");
|
---|
170 | for (ix = TMIN_TSKID; ix <= tmax_tskid; ix ++) {
|
---|
171 | tcb = get_tcb(ix);
|
---|
172 | cons_printf(portid, "%2d %2d ", ix, tcb->priority);
|
---|
173 | st = tcb->tstat;
|
---|
174 | for (sx = 0; st; sx ++) {
|
---|
175 | if (st & 0x01) {
|
---|
176 | cons_printf(portid, "%s", task_stat_str[sx]);
|
---|
177 | if (st & 0xfe)
|
---|
178 | cons_printf(portid, "|");
|
---|
179 | }
|
---|
180 | st >>= 1;
|
---|
181 | }
|
---|
182 | cons_putchar(portid, '\n');
|
---|
183 | }
|
---|
184 |
|
---|
185 | SIG_NET_CONS_PRINTF();
|
---|
186 | FLUSH_SND_BUFF();
|
---|
187 | }
|
---|
188 |
|
---|
189 | #ifdef SUPPORT_TCP
|
---|
190 |
|
---|
191 | /*
|
---|
192 | * tcp_status -- TCP ã®ç¶æ
|
---|
193 | ã®åºå
|
---|
194 | */
|
---|
195 |
|
---|
196 | static const char tcp_fsm_str[][sizeof("ESTABLISHED")] = {
|
---|
197 | "CLOSED", /* ã¯ãã¼ãº */
|
---|
198 | "LISTEN", /* ååãªã¼ãã³ */
|
---|
199 | "SYN_SENT", /* è½åãªã¼ãã³ãSYN éä¿¡æ¸ã¿ */
|
---|
200 | "SYN_RECVD", /* ååãªã¼ãã³ãSYN åä¿¡æ¸ã¿ */
|
---|
201 | "ESTABLISHED", /* ã³ãã¯ã·ã§ã³éè¨å®äº */
|
---|
202 | "CLOSE_WAIT", /* ç¸æãã FIN åä¿¡ãAPP ã®çµäºå¾
|
---|
203 | ã¡ */
|
---|
204 | "FIN_WAIT_1", /* APP ãçµäºãFIN éä¿¡æ¸ã¿ãACK å¾
|
---|
205 | ã¡ */
|
---|
206 | "CLOSING", /* åæã¯ãã¼ãºãFIN 交ææ¸ã¿ãACK å¾
|
---|
207 | ã¡ */
|
---|
208 | "LAST_ACK", /* APP ãçµäºãACK å¾
|
---|
209 | ã¡ */
|
---|
210 | "FIN_WAIT_2", /* ç¸æããã® FIN å¾
|
---|
211 | ã¡ */
|
---|
212 | "TIME_WAIT", /* ç¸æããã® FIN åä¿¡æ¸ã¿ãæéå¾
|
---|
213 | ã¡ */
|
---|
214 | };
|
---|
215 |
|
---|
216 | #if defined(SUPPORT_INET6)
|
---|
217 |
|
---|
218 | static void
|
---|
219 | tcp_cep_status (ID portid, char *line)
|
---|
220 | {
|
---|
221 | T_TCP_CEP* cep;
|
---|
222 | int len;
|
---|
223 |
|
---|
224 | #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0
|
---|
225 |
|
---|
226 | T_TCP_TWCEP* twcep;
|
---|
227 |
|
---|
228 | #endif /* of #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 */
|
---|
229 |
|
---|
230 | cons_printf(portid,
|
---|
231 | "TCP CEP Status\n"
|
---|
232 | "ID Snd-Q Rcv-Q Foreign Address State\n");
|
---|
233 |
|
---|
234 | for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++)
|
---|
235 | if (!VALID_TCP_CEP(cep)) {
|
---|
236 | cons_printf(portid,
|
---|
237 | "%2d%c%c 0 0"
|
---|
238 | " - "
|
---|
239 | " INVALID\n",
|
---|
240 | GET_TCP_CEPID(cep),
|
---|
241 | DYNAMIC_TCP_CEP(cep) ? 'D' : '.',
|
---|
242 | TCP_IS_CEP_IPV6(cep) ? '6' : '4');
|
---|
243 | }
|
---|
244 | else if (cep->fsm_state == TCP_FSM_CLOSED) {
|
---|
245 | cons_printf(portid,
|
---|
246 | "%2d%c%c 0 0"
|
---|
247 | " - "
|
---|
248 | " CLOSED\n",
|
---|
249 | GET_TCP_CEPID(cep),
|
---|
250 | DYNAMIC_TCP_CEP(cep) ? 'D' : '.',
|
---|
251 | TCP_IS_CEP_IPV6(cep) ? '6' : '4');
|
---|
252 | }
|
---|
253 | else if (cep->fsm_state == TCP_FSM_LISTEN) {
|
---|
254 | cons_printf(portid,
|
---|
255 | "%2d%c%c 0 0"
|
---|
256 | " - "
|
---|
257 | " LISTEN\n",
|
---|
258 | GET_TCP_CEPID(cep),
|
---|
259 | DYNAMIC_TCP_CEP(cep) ? 'D' : '.',
|
---|
260 | TCP_IS_CEP_IPV6(cep) ? '6' : '4');
|
---|
261 | }
|
---|
262 | else {
|
---|
263 | cons_printf(portid,
|
---|
264 | "%2d%c%c %5d %5d ",
|
---|
265 | GET_TCP_CEPID(cep),
|
---|
266 | DYNAMIC_TCP_CEP(cep) ? 'D' : '.',
|
---|
267 | TCP_IS_CEP_IPV6(cep) ? '6' : '4',
|
---|
268 | cep->swbuf_count, cep->rwbuf_count);
|
---|
269 |
|
---|
270 | #if defined(SUPPORT_INET4)
|
---|
271 |
|
---|
272 | if (TCP_IS_CEP_IPV4(cep)) {
|
---|
273 | T_IN4_ADDR addr;
|
---|
274 |
|
---|
275 | addr = ntohl(cep->dstaddr.ipaddr.s6_addr32[3]);
|
---|
276 | len = put_ipv4addr(portid, &addr, 0);
|
---|
277 | }
|
---|
278 | else
|
---|
279 | len = put_ipv6addr(portid, &cep->dstaddr.ipaddr, 0);
|
---|
280 |
|
---|
281 | #else /* of #if defined(SUPPORT_INET4) */
|
---|
282 |
|
---|
283 | len = put_ipv6addr(portid, &cep->dstaddr.ipaddr, 0);
|
---|
284 |
|
---|
285 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
286 |
|
---|
287 | cons_putchar(portid, '.');
|
---|
288 | len += cons_putnumber(portid, cep->dstaddr.portno, 10, radhex, 0, false, ' ');
|
---|
289 | for (len = 44 - len; len -- > 0; )
|
---|
290 | cons_putchar(portid, ' ');
|
---|
291 | if (cep->fsm_state == TCP_FSM_TIME_WAIT)
|
---|
292 | cons_printf(portid, " %s(%d)\n", tcp_fsm_str[cep->fsm_state],
|
---|
293 | cep->timer[TCP_TIM_2MSL] / TCP_SLOW_HZ);
|
---|
294 | else
|
---|
295 | cons_printf(portid, " %s\n", tcp_fsm_str[cep->fsm_state]);
|
---|
296 | }
|
---|
297 |
|
---|
298 | #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0
|
---|
299 |
|
---|
300 | for (twcep = tcp_twcep; twcep < &tcp_twcep[NUM_TCP_TW_CEP_ENTRY]; twcep ++) {
|
---|
301 | if (twcep->fsm_state == TCP_FSM_CLOSED) {
|
---|
302 | cons_printf(portid,
|
---|
303 | "%2dTW 0 0"
|
---|
304 | " - "
|
---|
305 | " CLOSED\n",
|
---|
306 | GET_TCP_TWCEPID(twcep));
|
---|
307 | }
|
---|
308 | else {
|
---|
309 | cons_printf(portid, "%2dTW 0 0 ", GET_TCP_TWCEPID(twcep));
|
---|
310 |
|
---|
311 | #if defined(SUPPORT_INET4)
|
---|
312 |
|
---|
313 | if (TCP_IS_CEP_IPV4(twcep)) {
|
---|
314 | T_IN4_ADDR addr;
|
---|
315 |
|
---|
316 | addr = ntohl(twcep->dstaddr.ipaddr.s6_addr32[3]);
|
---|
317 | len = put_ipv4addr(portid, &addr, 0);
|
---|
318 | }
|
---|
319 | else
|
---|
320 | len = put_ipv6addr(portid, &twcep->dstaddr.ipaddr, 0);
|
---|
321 |
|
---|
322 | #else /* of #if defined(SUPPORT_INET4) */
|
---|
323 |
|
---|
324 | len = put_ipv6addr(portid, &twcep->dstaddr.ipaddr, 0);
|
---|
325 |
|
---|
326 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
327 |
|
---|
328 | cons_putchar(portid, '.');
|
---|
329 | len += cons_putnumber(portid, twcep->dstaddr.portno, 10, radhex, 0, false, ' ');
|
---|
330 | for (len = 44 - len; len -- > 0; )
|
---|
331 | cons_putchar(portid, ' ');
|
---|
332 | if (twcep->fsm_state == TCP_FSM_TIME_WAIT)
|
---|
333 | cons_printf(portid, " %s(%d)\n", tcp_fsm_str[twcep->fsm_state],
|
---|
334 | twcep->timer_2msl / TCP_SLOW_HZ);
|
---|
335 | else
|
---|
336 | cons_printf(portid, " %s\n", tcp_fsm_str[twcep->fsm_state]);
|
---|
337 | }
|
---|
338 | }
|
---|
339 |
|
---|
340 | #endif /* of #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 */
|
---|
341 |
|
---|
342 | }
|
---|
343 |
|
---|
344 | #else /* of #if defined(SUPPORT_INET6) */
|
---|
345 |
|
---|
346 | #if defined(SUPPORT_INET4)
|
---|
347 |
|
---|
348 | static void
|
---|
349 | tcp_cep_status (ID portid, char *line)
|
---|
350 | {
|
---|
351 | T_TCP_CEP* cep;
|
---|
352 | uint_t len;
|
---|
353 |
|
---|
354 | #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0
|
---|
355 |
|
---|
356 | T_TCP_TWCEP* twcep;
|
---|
357 |
|
---|
358 | #endif /* of #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 */
|
---|
359 |
|
---|
360 | cons_printf(portid,
|
---|
361 | "TCP CEP Status\n"
|
---|
362 | "ID Snd-Q Rcv-Q Local Address Foreign Address State\n");
|
---|
363 |
|
---|
364 | for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++)
|
---|
365 | if (!VALID_TCP_CEP(cep)) {
|
---|
366 | cons_printf(portid,
|
---|
367 | "%2d%c%c 0 0"
|
---|
368 | " - "
|
---|
369 | " - "
|
---|
370 | " INVALID\n",
|
---|
371 | GET_TCP_CEPID(cep),
|
---|
372 | DYNAMIC_TCP_CEP(cep) ? 'D' : '.',
|
---|
373 | TCP_IS_CEP_IPV6(cep) ? '6' : '4');
|
---|
374 | }
|
---|
375 | else if (cep->fsm_state == TCP_FSM_CLOSED) {
|
---|
376 | cons_printf(portid,
|
---|
377 | "%2d%c%c 0 0"
|
---|
378 | " - "
|
---|
379 | " - "
|
---|
380 | " CLOSED\n",
|
---|
381 | GET_TCP_CEPID(cep),
|
---|
382 | DYNAMIC_TCP_CEP(cep) ? 'D' : '.',
|
---|
383 | TCP_IS_CEP_IPV6(cep) ? '6' : '4');
|
---|
384 | }
|
---|
385 | else if (cep->fsm_state == TCP_FSM_LISTEN) {
|
---|
386 | cons_printf(portid,
|
---|
387 | "%2d%c%c 0 0 ",
|
---|
388 | GET_TCP_CEPID(cep),
|
---|
389 | DYNAMIC_TCP_CEP(cep) ? 'D' : '.',
|
---|
390 | TCP_IS_CEP_IPV6(cep) ? '6' : '4');
|
---|
391 | len = PUT_IPADDR(portid, &cep->myaddr.ipaddr, 0);
|
---|
392 | cons_putchar(portid, ':');
|
---|
393 | len += cons_putnumber(portid, cep->myaddr.portno, 10, radhex, 0, false, ' ');
|
---|
394 | for (len = 20 - len; len -- > 0; )
|
---|
395 | cons_putchar(portid, ' ');
|
---|
396 | cons_printf(portid,
|
---|
397 | " - "
|
---|
398 | " LISTEN\n");
|
---|
399 | }
|
---|
400 | else {
|
---|
401 | cons_printf(portid,
|
---|
402 | "%2d%c %5d %5d ",
|
---|
403 | GET_TCP_CEPID(cep),
|
---|
404 | DYNAMIC_TCP_CEP(cep) ? 'D' : ' ',
|
---|
405 | cep->swbuf_count, cep->rwbuf_count);
|
---|
406 | len = PUT_IPADDR(portid, &cep->myaddr.ipaddr, 0);
|
---|
407 | cons_putchar(portid, ':');
|
---|
408 | len += cons_putnumber(portid, cep->myaddr.portno, 10, radhex, 0, false, ' ');
|
---|
409 | for (len = 21 - len; len -- > 0; )
|
---|
410 | cons_putchar(portid, ' ');
|
---|
411 | len = PUT_IPADDR(portid, &cep->dstaddr.ipaddr, 0);
|
---|
412 | cons_putchar(portid, ':');
|
---|
413 | len += cons_putnumber(portid, cep->dstaddr.portno, 10, radhex, 0, false, ' ');
|
---|
414 | for (len = 20 - len; len -- > 0; )
|
---|
415 | cons_putchar(portid, ' ');
|
---|
416 | if (cep->fsm_state == TCP_FSM_TIME_WAIT)
|
---|
417 | cons_printf(portid, " %s(%d)\n", tcp_fsm_str[cep->fsm_state],
|
---|
418 | cep->timer[TCP_TIM_2MSL] / TCP_SLOW_HZ);
|
---|
419 | else
|
---|
420 | cons_printf(portid, " %s\n", tcp_fsm_str[cep->fsm_state]);
|
---|
421 | }
|
---|
422 |
|
---|
423 | #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0
|
---|
424 |
|
---|
425 | for (twcep = tcp_twcep; twcep < &tcp_twcep[NUM_TCP_TW_CEP_ENTRY]; twcep ++) {
|
---|
426 | if (twcep->fsm_state == TCP_FSM_CLOSED) {
|
---|
427 | cons_printf(portid,
|
---|
428 | "%2dTW 0 0"
|
---|
429 | " - "
|
---|
430 | " - "
|
---|
431 | " CLOSED\n",
|
---|
432 | GET_TCP_TWCEPID(twcep));
|
---|
433 | }
|
---|
434 | else {
|
---|
435 | cons_printf(portid, "%2dTW 0 0 ", GET_TCP_TWCEPID(twcep));
|
---|
436 | len = PUT_IPADDR(portid, &twcep->myaddr.ipaddr, 0);
|
---|
437 | cons_putchar(portid, ':');
|
---|
438 | len += cons_putnumber(portid, twcep->myaddr.portno, 10, radhex, 0, false, ' ');
|
---|
439 | for (len = 21 - len; len -- > 0; )
|
---|
440 | cons_putchar(portid, ' ');
|
---|
441 | len = PUT_IPADDR(portid, &twcep->dstaddr.ipaddr, 0);
|
---|
442 | cons_putchar(portid, ':');
|
---|
443 | len += cons_putnumber(portid, twcep->dstaddr.portno, 10, radhex, 0, false, ' ');
|
---|
444 | for (len = 20 - len; len -- > 0; )
|
---|
445 | cons_putchar(portid, ' ');
|
---|
446 | if (twcep->fsm_state == TCP_FSM_TIME_WAIT)
|
---|
447 | cons_printf(portid, " %s(%d)\n", tcp_fsm_str[twcep->fsm_state],
|
---|
448 | twcep->timer_2msl / TCP_SLOW_HZ);
|
---|
449 | else
|
---|
450 | cons_printf(portid, " %s\n", tcp_fsm_str[twcep->fsm_state]);
|
---|
451 | }
|
---|
452 | }
|
---|
453 |
|
---|
454 | #endif /* of #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 */
|
---|
455 |
|
---|
456 | }
|
---|
457 |
|
---|
458 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
459 |
|
---|
460 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
461 |
|
---|
462 | #if TNUM_TCP6_REPID > 0
|
---|
463 |
|
---|
464 | static void
|
---|
465 | tcp6_rep_status (ID portid, char *line)
|
---|
466 | {
|
---|
467 | T_TCP_CEP* cep;
|
---|
468 | T_TCP6_REP* rep;
|
---|
469 | ID repid;
|
---|
470 | int_t cnt;
|
---|
471 | uint_t len;
|
---|
472 |
|
---|
473 | cons_printf(portid,
|
---|
474 | "TCP6 REP Status\n"
|
---|
475 | "ID Local Address CEP\n");
|
---|
476 | for (repid = TMIN_TCP6_REPID; repid <= tmax_tcp6_repid; repid ++) {
|
---|
477 | rep = GET_TCP6_REP(repid);
|
---|
478 | cons_printf(portid, "%2d%c ", GET_TCP6_REPID(rep), DYNAMIC_TCP_REP(rep) ? 'D' : ' ');
|
---|
479 | if (VALID_TCP_REP(rep)) {
|
---|
480 | len = PUT_IPADDR(portid, &rep->myaddr.ipaddr, 0);
|
---|
481 | cons_putchar(portid, '.');
|
---|
482 | len += cons_putnumber(portid, rep->myaddr.portno, 10, radhex, 0, false, ' ');
|
---|
483 | for (len = 21 - len; len -- > 0; )
|
---|
484 | cons_putchar(portid, ' ');
|
---|
485 | cnt = 0;
|
---|
486 | for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++) {
|
---|
487 | if (TCP_IS_CEP_IPV6(cep) && cep->rep == rep) {
|
---|
488 | if (cnt > 0)
|
---|
489 | cons_printf(portid, ",%d", GET_TCP_CEPID(cep));
|
---|
490 | else
|
---|
491 | cons_printf(portid, "%d", GET_TCP_CEPID(cep));
|
---|
492 | cnt ++;
|
---|
493 | }
|
---|
494 | }
|
---|
495 | }
|
---|
496 | else
|
---|
497 | cons_printf(portid, "INVALID");
|
---|
498 | cons_putchar(portid, '\n');
|
---|
499 | }
|
---|
500 | }
|
---|
501 |
|
---|
502 | #endif /* of #if TNUM_TCP6_REPID > 0 */
|
---|
503 |
|
---|
504 | #if TNUM_TCP4_REPID > 0
|
---|
505 |
|
---|
506 | static void
|
---|
507 | tcp4_rep_status (ID portid, char *line)
|
---|
508 | {
|
---|
509 | T_TCP_CEP* cep;
|
---|
510 | T_TCP4_REP* rep;
|
---|
511 | ID repid;
|
---|
512 | int_t cnt;
|
---|
513 | uint_t len;
|
---|
514 |
|
---|
515 | cons_printf(portid,
|
---|
516 | "TCP4 REP Status\n"
|
---|
517 | "ID Local Address CEP\n");
|
---|
518 | for (repid = TMIN_TCP4_REPID; repid <= tmax_tcp4_repid; repid ++) {
|
---|
519 | rep = GET_TCP4_REP(repid);
|
---|
520 | cons_printf(portid, "%2d%c ", GET_TCP4_REPID(rep), DYNAMIC_TCP_REP(rep) ? 'D' : ' ');
|
---|
521 | if (VALID_TCP_REP(rep)) {
|
---|
522 | len = put_ipv4addr(portid, &rep->myaddr.ipaddr, 0);
|
---|
523 | cons_putchar(portid, ':');
|
---|
524 | len += cons_putnumber(portid, rep->myaddr.portno, 10, radhex, 0, false, ' ');
|
---|
525 | for (len = 21 - len; len -- > 0; )
|
---|
526 | cons_putchar(portid, ' ');
|
---|
527 | cnt = 0;
|
---|
528 | for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++) {
|
---|
529 |
|
---|
530 | #if defined(SUPPORT_INET6) && defined(SUPPORT_INET4)
|
---|
531 |
|
---|
532 | if (TCP_IS_CEP_IPV4(cep) && cep->rep4 == rep) {
|
---|
533 |
|
---|
534 | #else /* of #if defined(SUPPORT_INET6) && defined(SUPPORT_INET4) */
|
---|
535 |
|
---|
536 | if (TCP_IS_CEP_IPV4(cep) && cep->rep == rep) {
|
---|
537 |
|
---|
538 | #endif /* of #if defined(SUPPORT_INET6) && defined(SUPPORT_INET4) */
|
---|
539 |
|
---|
540 | if (cnt > 0)
|
---|
541 | cons_printf(portid, ",%d", GET_TCP_CEPID(cep));
|
---|
542 | else
|
---|
543 | cons_printf(portid, "%d", GET_TCP_CEPID(cep));
|
---|
544 | cnt ++;
|
---|
545 | }
|
---|
546 | }
|
---|
547 | }
|
---|
548 | else
|
---|
549 | cons_printf(portid, "INVALID");
|
---|
550 | cons_putchar(portid, '\n');
|
---|
551 | }
|
---|
552 | }
|
---|
553 |
|
---|
554 | #endif /* of #if TNUM_TCP4_REPID > 0 */
|
---|
555 |
|
---|
556 | static void
|
---|
557 | tcp_status (ID portid, char *line)
|
---|
558 | {
|
---|
559 | WAI_NET_CONS_PRINTF();
|
---|
560 |
|
---|
561 | tcp_cep_status(portid, line);
|
---|
562 |
|
---|
563 | #if TNUM_TCP6_REPID > 0
|
---|
564 | tcp6_rep_status(portid, line);
|
---|
565 | #endif
|
---|
566 |
|
---|
567 | #if TNUM_TCP4_REPID > 0
|
---|
568 | tcp4_rep_status(portid, line);
|
---|
569 | #endif
|
---|
570 |
|
---|
571 | SIG_NET_CONS_PRINTF();
|
---|
572 | FLUSH_SND_BUFF();
|
---|
573 | }
|
---|
574 |
|
---|
575 | #endif /* of #ifdef SUPPORT_TCP */
|
---|
576 |
|
---|
577 | #ifdef SUPPORT_UDP
|
---|
578 |
|
---|
579 | /*
|
---|
580 | * udp6_status -- UDP ã®ç¶æ
|
---|
581 | ã®åºå
|
---|
582 | */
|
---|
583 |
|
---|
584 | #if TNUM_UDP6_CEPID > 0
|
---|
585 |
|
---|
586 | extern const ID tmax_tcp_cepid;
|
---|
587 |
|
---|
588 | static void
|
---|
589 | udp6_status (ID portid, char *line)
|
---|
590 | {
|
---|
591 | T_UDP6_CEP* cep;
|
---|
592 | ID cepid;
|
---|
593 | uint_t len;
|
---|
594 |
|
---|
595 | cons_printf(portid,
|
---|
596 | "UDP6 CEP Status\n"
|
---|
597 | "ID Local Address\n");
|
---|
598 |
|
---|
599 | for (cepid = TMIN_UDP6_CEPID; cepid <= tmax_udp6_cepid; cepid ++) {
|
---|
600 | cep = GET_UDP6_CEP(cepid);
|
---|
601 | cons_printf(portid, "%2d%c ", GET_UDP6_CEPID(cep), DYNAMIC_UDP_CEP(cep) ? 'D' : ' ');
|
---|
602 | if (VALID_UDP_CEP(cep)) {
|
---|
603 | len = put_ipv6addr(portid, &cep->myaddr.ipaddr, 0);
|
---|
604 | cons_putchar(portid, '.');
|
---|
605 | len += cons_putnumber(portid, cep->myaddr.portno, 10, radhex, 0, false, ' ');
|
---|
606 | }
|
---|
607 | else
|
---|
608 | cons_printf(portid, "INVALID");
|
---|
609 | cons_putchar(portid, '\n');
|
---|
610 | }
|
---|
611 |
|
---|
612 | SIG_NET_CONS_PRINTF();
|
---|
613 | }
|
---|
614 |
|
---|
615 | #endif /* of #if TNUM_UDP6_CEPID > 0 */
|
---|
616 |
|
---|
617 | /*
|
---|
618 | * udp4_status -- UDP ã®ç¶æ
|
---|
619 | ã®åºå
|
---|
620 | */
|
---|
621 |
|
---|
622 | #if TNUM_UDP4_CEPID > 0
|
---|
623 |
|
---|
624 | static void
|
---|
625 | udp4_status (ID portid, char *line)
|
---|
626 | {
|
---|
627 | T_UDP4_CEP* cep;
|
---|
628 | ID cepid;
|
---|
629 | uint_t len;
|
---|
630 |
|
---|
631 | cons_printf(portid,
|
---|
632 | "UDP4 CEP Status\n"
|
---|
633 | "ID Local Address\n");
|
---|
634 |
|
---|
635 | for (cepid = TMIN_UDP4_CEPID; cepid <= tmax_udp4_cepid; cepid ++) {
|
---|
636 | cep = GET_UDP4_CEP(cepid);
|
---|
637 | cons_printf(portid, "%2d%c ", GET_UDP4_CEPID(cep), DYNAMIC_UDP_CEP(cep) ? 'D' : ' ');
|
---|
638 | if (VALID_UDP_CEP(cep)) {
|
---|
639 | len = put_ipv4addr(portid, &cep->myaddr.ipaddr, 0);
|
---|
640 | cons_putchar(portid, '.');
|
---|
641 | len += cons_putnumber(portid, cep->myaddr.portno, 10, radhex, 0, false, ' ');
|
---|
642 | }
|
---|
643 | else
|
---|
644 | cons_printf(portid, "INVALID");
|
---|
645 | cons_putchar(portid, '\n');
|
---|
646 | }
|
---|
647 |
|
---|
648 | SIG_NET_CONS_PRINTF();
|
---|
649 | }
|
---|
650 |
|
---|
651 | #endif /* of #if TNUM_UDP4_CEPID > 0 */
|
---|
652 |
|
---|
653 | static void
|
---|
654 | udp_status (ID portid, char *line)
|
---|
655 | {
|
---|
656 | WAI_NET_CONS_PRINTF();
|
---|
657 |
|
---|
658 | #if TNUM_UDP6_CEPID > 0
|
---|
659 | udp6_status(portid, line);
|
---|
660 | #endif
|
---|
661 |
|
---|
662 | #if TNUM_UDP4_CEPID > 0
|
---|
663 | udp4_status(portid, line);
|
---|
664 | #endif
|
---|
665 |
|
---|
666 | SIG_NET_CONS_PRINTF();
|
---|
667 | FLUSH_SND_BUFF();
|
---|
668 | }
|
---|
669 |
|
---|
670 | #endif /* of #ifdef SUPPORT_UDP */
|
---|
671 |
|
---|
672 | #ifdef SUPPORT_ETHER
|
---|
673 |
|
---|
674 | #if defined(SUPPORT_INET6)
|
---|
675 |
|
---|
676 | /*
|
---|
677 | * ifa6_status -- è¿é£ãã£ãã·ã¥ç¶æ
|
---|
678 | ã®åºå
|
---|
679 | */
|
---|
680 |
|
---|
681 | static const char nd_state_str[][sizeof("INCOMPLETE")] = {
|
---|
682 | "FREE", /* æªä½¿ç¨ */
|
---|
683 | "NO STATE", /* ç¶æ
|
---|
684 | æªå®ç¾© */
|
---|
685 | "INCOMPLETE", /* æªè§£æ±º */
|
---|
686 | "REACHABLE", /* å°éå¯è½ */
|
---|
687 | "STALE", /* å°éå¯è½æ§ã¯æªç¢ºèª */
|
---|
688 | "DELAY", /* å°éå¯è½æ§ã®ç¢ºèªå¾
|
---|
689 | æ© */
|
---|
690 | "PROBE", /* å°éå¯è½æ§ã確èªä¸ */
|
---|
691 | };
|
---|
692 |
|
---|
693 | static void
|
---|
694 | ifa6_status (ID portid, char *line)
|
---|
695 | {
|
---|
696 | const T_LLINFO_ND6 *cache;
|
---|
697 | SYSTIM now;
|
---|
698 | int_t ix;
|
---|
699 |
|
---|
700 | WAI_NET_CONS_PRINTF();
|
---|
701 | cons_printf(portid,
|
---|
702 | "ND Cache Status\n"
|
---|
703 | "IX Expire State MAC Address IP Address\n");
|
---|
704 |
|
---|
705 | /* expire ã®åä½ã¯ [us]ã*/
|
---|
706 | get_tim(&now);
|
---|
707 | cache = nd6_get_cache();
|
---|
708 | for (ix = 0; ix < NUM_ND6_CACHE_ENTRY; ix ++) {
|
---|
709 | if (cache[ix].state != ND6_LLINFO_FREE) {
|
---|
710 | cons_printf(portid, "%2d %6ld %10s %M %lI\n",
|
---|
711 | ix,
|
---|
712 | cache[ix].state == ND6_LLINFO_STALE ||
|
---|
713 | (uint32_t)((int32_t)(cache[ix].expire - now) <= 0
|
---|
714 | ? 0 : (int32_t)(cache[ix].expire - now) / SYSTIM_HZ),
|
---|
715 | nd_state_str[cache[ix].state],
|
---|
716 | &cache[ix].ifaddr,
|
---|
717 | &cache[ix].addr);
|
---|
718 | }
|
---|
719 | }
|
---|
720 |
|
---|
721 | SIG_NET_CONS_PRINTF();
|
---|
722 | FLUSH_SND_BUFF();
|
---|
723 | }
|
---|
724 |
|
---|
725 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
726 |
|
---|
727 | #if defined(SUPPORT_INET4)
|
---|
728 |
|
---|
729 | /*
|
---|
730 | * ifa4_status -- ARP ãã£ãã·ã¥åºå
|
---|
731 | */
|
---|
732 |
|
---|
733 | static void
|
---|
734 | ifa4_status (ID portid, char *line)
|
---|
735 | {
|
---|
736 | const T_ARP_ENTRY *cache;
|
---|
737 | int_t ix;
|
---|
738 |
|
---|
739 | WAI_NET_CONS_PRINTF();
|
---|
740 | cons_printf(portid,
|
---|
741 | "ARP Cache\n"
|
---|
742 | "IX Expire MAC Address IP Address\n");
|
---|
743 |
|
---|
744 | /* expire ã®åä½ã¯ [us]ã*/
|
---|
745 | cache = arp_get_cache();
|
---|
746 | for (ix = 0; ix < NUM_ARP_ENTRY; ix ++) {
|
---|
747 | if (cache[ix].expire != 0)
|
---|
748 | cons_printf(portid, "%2d %6d %M %hI\n",
|
---|
749 | ix, cache[ix].expire / NET_TIMER_HZ,
|
---|
750 | cache[ix].mac_addr, &cache[ix].ip_addr);
|
---|
751 | }
|
---|
752 |
|
---|
753 | SIG_NET_CONS_PRINTF();
|
---|
754 | FLUSH_SND_BUFF();
|
---|
755 | }
|
---|
756 |
|
---|
757 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
758 |
|
---|
759 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
760 |
|
---|
761 | #if NET_COUNT_ENABLE
|
---|
762 |
|
---|
763 | /*
|
---|
764 | * net_count_struct -- ãããã¯ã¼ã¯çµ±è¨æ
|
---|
765 | å ±
|
---|
766 | */
|
---|
767 |
|
---|
768 | static void
|
---|
769 | net_count_struct (ID portid, char *name, T_NET_COUNT *item)
|
---|
770 | {
|
---|
771 | cons_printf(portid, "\n%s\n", name);
|
---|
772 | cons_printf(portid, "\tåä¿¡ãªã¯ãããæ°\t%lu\n", item->in_octets);
|
---|
773 | cons_printf(portid, "\téä¿¡ãªã¯ãããæ°\t%lu\n", item->out_octets);
|
---|
774 | cons_printf(portid, "\tåä¿¡ãã±ããæ°\t%lu\n", item->in_packets);
|
---|
775 | cons_printf(portid, "\téä¿¡ãã±ããæ°\t%lu\n", item->out_packets);
|
---|
776 | cons_printf(portid, "\tåä¿¡ã¨ã©ã¼ãã±ããæ°\t%lu\n", item->in_err_packets);
|
---|
777 | cons_printf(portid, "\téä¿¡ã¨ã©ã¼ãã±ããæ°\t%lu\n", item->out_err_packets);
|
---|
778 | }
|
---|
779 |
|
---|
780 | /*
|
---|
781 | * net_count -- ãããã¯ã¼ã¯çµ±è¨æ
|
---|
782 | å ±
|
---|
783 | */
|
---|
784 |
|
---|
785 | static void
|
---|
786 | net_count (ID portid, char *line)
|
---|
787 | {
|
---|
788 | const T_NET_BUF_ENTRY *tbl;
|
---|
789 | SYSTIM now;
|
---|
790 | int_t ix;
|
---|
791 |
|
---|
792 | WAI_NET_CONS_PRINTF();
|
---|
793 | get_tim(&now);
|
---|
794 | cons_printf(portid, "ãããã¯ã¼ã¯çµ±è¨æ
|
---|
795 | å ±\tçµéæé[us]\t%lu\t", now);
|
---|
796 | if (now > (1000 * 3600 * 24))
|
---|
797 | cons_printf(portid, "%3luæ¥ %2luæé %2luå %2luç§\n",
|
---|
798 | now / (1000 * 3600 * 24),
|
---|
799 | (now / (1000 * 3600)) % 24,
|
---|
800 | (now / (1000 * 60 )) % 60,
|
---|
801 | (now / 1000 ) % 60);
|
---|
802 | else
|
---|
803 | cons_printf(portid, "%2luæé %2luå %2luç§\n",
|
---|
804 | (now / (1000 * 3600)) % 24,
|
---|
805 | (now / (1000 * 60 )) % 60,
|
---|
806 | (now / 1000 ) % 60);
|
---|
807 |
|
---|
808 | #ifdef SUPPORT_PPP
|
---|
809 |
|
---|
810 | net_count_struct(portid, "HDLC", &net_count_hdlc);
|
---|
811 | cons_printf(portid, "\nPPP\n");
|
---|
812 | cons_printf(portid, "\tåä¿¡ãªã¯ãããæ°\t%lu\n", net_count_ppp.in_octets);
|
---|
813 | cons_printf(portid, "\téä¿¡ãªã¯ãããæ°\t%lu\n", net_count_ppp.out_octets);
|
---|
814 | cons_printf(portid, "\tåä¿¡ãã±ããæ°\t%lu\n", net_count_ppp.in_packets);
|
---|
815 | cons_printf(portid, "\téä¿¡ãã±ããæ°\t%lu\n", net_count_ppp.out_packets);
|
---|
816 | cons_printf(portid, "\tåä¿¡ã¨ã©ã¼ãã±ããæ°\t%lu\n", net_count_ppp.in_err_packets);
|
---|
817 | cons_printf(portid, "\téä¿¡ã¨ã©ã¼ãã±ããæ°\t%lu\n", net_count_ppp.out_err_packets);
|
---|
818 | cons_printf(portid, "\tnet_buf å²ãå½ã¦å¤±ææ°\t%lu\n", net_count_ppp_no_bufs);
|
---|
819 |
|
---|
820 | cons_printf(portid, "\nLCP\n");
|
---|
821 | cons_printf(portid, "\tåä¿¡ãªã¯ãããæ°\t%lu\n", net_count_ppp_lcp_in_octets);
|
---|
822 | cons_printf(portid, "\tåä¿¡ãã±ããæ°\t%lu\n", net_count_ppp_lcp_in_packets);
|
---|
823 |
|
---|
824 | cons_printf(portid, "\nIPCP\n");
|
---|
825 | cons_printf(portid, "\tåä¿¡ãªã¯ãããæ°\t%lu\n", net_count_ppp_ipcp_in_octets);
|
---|
826 | cons_printf(portid, "\tåä¿¡ãã±ããæ°\t%lu\n", net_count_ppp_ipcp_in_packets);
|
---|
827 |
|
---|
828 | cons_printf(portid, "\nPAP\n");
|
---|
829 | cons_printf(portid, "\tåä¿¡ãªã¯ãããæ°\t%lu\n", net_count_ppp_upap_in_octets);
|
---|
830 | cons_printf(portid, "\tåä¿¡ãã±ããæ°\t%lu\n", net_count_ppp_upap_in_packets);
|
---|
831 |
|
---|
832 | #endif /* of #ifdef SUPPORT_PPP */
|
---|
833 |
|
---|
834 | #ifdef SUPPORT_ETHER
|
---|
835 |
|
---|
836 | net_count_struct(portid, "ã¤ã¼ãµããã", &net_count_ether);
|
---|
837 |
|
---|
838 | cons_printf(portid, "\nã¤ã¼ãµãããã»ãããã¯ã¼ã¯ã¤ã³ã¿ãã§ã¼ã¹\n");
|
---|
839 | cons_printf(portid, "\tåä¿¡ãªã¯ãããæ°\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_IN_OCTETS]);
|
---|
840 | cons_printf(portid, "\tåä¿¡ãã±ããæ°\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_IN_PACKETS]);
|
---|
841 | cons_printf(portid, "\tåä¿¡ã¨ã©ã¼ãã±ããæ°\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_IN_ERR_PACKETS]);
|
---|
842 | cons_printf(portid, "\tnet_buf å²ãå½ã¦å¤±ææ°\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_NO_BUFS]);
|
---|
843 | cons_printf(portid, "\tåä¿¡ã»ããã©è³æºè¿å´ä¸éãªã¼ãã¼æ°\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_RXB_QOVRS]);
|
---|
844 | cons_printf(portid, "\téä¿¡ãªã¯ãããæ°\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_OUT_OCTETS]);
|
---|
845 | cons_printf(portid, "\téä¿¡ãã±ããæ°\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_OUT_PACKETS]);
|
---|
846 | cons_printf(portid, "\téä¿¡ã¨ã©ã¼ãã±ããæ°\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_OUT_ERR_PACKETS]);
|
---|
847 | cons_printf(portid, "\tã³ãªã¸ã§ã³æ°\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_COLS]);
|
---|
848 | cons_printf(portid, "\téä¿¡ã»ããã©è³æºè¿å´ä¸éãªã¼ãã¼æ°\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_TXB_QOVRS]);
|
---|
849 | cons_printf(portid, "\téä¿¡ã¿ã¤ã ã¢ã¦ãæ° \t%lu\n", net_count_ether_nic[NC_ETHER_NIC_TIMEOUTS]);
|
---|
850 | cons_printf(portid, "\tãªã»ããæ°\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_RESETS]);
|
---|
851 |
|
---|
852 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
853 |
|
---|
854 | #if defined(SUPPORT_INET6)
|
---|
855 |
|
---|
856 | cons_printf(portid, "\nIPv6\n");
|
---|
857 | cons_printf(portid, "\tåä¿¡ãªã¯ãããæ°\t%lu\n", net_count_ip6[NC_IP6_IN_OCTETS]);
|
---|
858 | cons_printf(portid, "\tåä¿¡ãã¼ã¿ã°ã©ã æ°\t%lu\n", net_count_ip6[NC_IP6_IN_PACKETS]);
|
---|
859 | cons_printf(portid, "\tåä¿¡ã¨ã©ã¼ãã¼ã¿ã°ã©ã æ°\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_PACKETS]);
|
---|
860 | cons_printf(portid, "\té·ãã¨ã©ã¼æ°\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_SHORT]);
|
---|
861 | cons_printf(portid, "\tãã¼ã¸ã§ã³ã¨ã©ã¼æ°\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_VER]);
|
---|
862 | cons_printf(portid, "\tã¢ãã¬ã¹ã¨ã©ã¼æ°\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_ADDR]);
|
---|
863 | cons_printf(portid, "\tãããã³ã«ã¨ã©ã¼æ°\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_PROTO]);
|
---|
864 | cons_printf(portid, "\tåå²åä¿¡æ°\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN]);
|
---|
865 | cons_printf(portid, "\tåå²åä¿¡ãã©ã°ã¡ã³ãæ°\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_FRAGS]);
|
---|
866 | cons_printf(portid, "\tåå²åä¿¡åæ§ææåæ°\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_OK]);
|
---|
867 | cons_printf(portid, "\tåå²åä¿¡ç ´æ£æ°\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_DROP]);
|
---|
868 | cons_printf(portid, "\tåå²åä¿¡ãããã¡ãå½ã¦å¤±ææ°\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_NO_BUF]);
|
---|
869 | cons_printf(portid, "\tåå²åä¿¡ã¿ã¤ã ã¢ã¦ãæ°\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_TMOUT]);
|
---|
870 | cons_printf(portid, "\téä¿¡ãªã¯ãããæ°\t%lu\n", net_count_ip6[NC_IP6_OUT_OCTETS]);
|
---|
871 | cons_printf(portid, "\téä¿¡ãã¼ã¿ã°ã©ã æ°\t%lu\n", net_count_ip6[NC_IP6_OUT_PACKETS]);
|
---|
872 | cons_printf(portid, "\téä¿¡ã¨ã©ã¼ãã¼ã¿ã°ã©ã æ°\t%lu\n", net_count_ip6[NC_IP6_OUT_ERR_PACKETS]);
|
---|
873 | cons_printf(portid, "\tåå²éä¿¡æ°\t%lu\n", net_count_ip6[NC_IP6_FRAG_OUT]);
|
---|
874 | cons_printf(portid, "\tåå²éä¿¡ãã©ã°ã¡ã³ãæ°\t%lu\n", net_count_ip6[NC_IP6_FRAG_OUT_FRAGS]);
|
---|
875 |
|
---|
876 | cons_printf(portid, "\nICMPv6\n");
|
---|
877 | cons_printf(portid, "\tåä¿¡ãªã¯ãããæ°\t%lu\n", net_count_icmp6[NC_ICMP6_IN_OCTETS]);
|
---|
878 | cons_printf(portid, "\tåä¿¡ãã±ããæ°\t%lu\n", net_count_icmp6[NC_ICMP6_IN_PACKETS]);
|
---|
879 | cons_printf(portid, "\tåä¿¡ã¨ã©ã¼ãã±ããæ°\t%lu\n", net_count_icmp6[NC_ICMP6_IN_ERR_PACKETS]);
|
---|
880 | cons_printf(portid, "\tåä¿¡ããã¯ãµã ã¨ã©ã¼æ°\t%lu\n", net_count_icmp6[NC_ICMP6_IN_ERR_CKSUM]);
|
---|
881 | cons_printf(portid, "\téä¿¡ãªã¯ãããæ°\t%lu\n", net_count_icmp6[NC_ICMP6_OUT_OCTETS]);
|
---|
882 | cons_printf(portid, "\téä¿¡ãã±ããæ°\t%lu\n", net_count_icmp6[NC_ICMP6_OUT_PACKETS]);
|
---|
883 | cons_printf(portid, "\téä¿¡ã¨ã©ã¼ãã±ããæ°\t%lu\n", net_count_icmp6[NC_ICMP6_OUT_ERR_PACKETS]);
|
---|
884 |
|
---|
885 | cons_printf(portid, "\nè¿é£æ¢ç´¢\n");
|
---|
886 | cons_printf(portid, "\tã«ã¼ã¿éç¥åä¿¡æ°\t%lu\n", net_count_nd6[NC_ND6_RA_IN_PACKETS]);
|
---|
887 | cons_printf(portid, "\tã«ã¼ã¿è¦è«éä¿¡æ°\t%lu\n", net_count_nd6[NC_ND6_RS_OUT_PACKETS]);
|
---|
888 | cons_printf(portid, "\tè¿é£éç¥åä¿¡æ°\t%lu\n", net_count_nd6[NC_ND6_NA_IN_PACKETS]);
|
---|
889 | cons_printf(portid, "\tè¿é£éç¥éä¿¡æ°\t%lu\n", net_count_nd6[NC_ND6_NA_OUT_PACKETS]);
|
---|
890 | cons_printf(portid, "\tè¿é£è¦è«åä¿¡æ°\t%lu\n", net_count_nd6[NC_ND6_NS_IN_PACKETS]);
|
---|
891 | cons_printf(portid, "\tè¿é£è¦è«éä¿¡æ°\t%lu\n", net_count_nd6[NC_ND6_NS_OUT_PACKETS]);
|
---|
892 | cons_printf(portid, "\téè¤ã¢ãã¬ã¹æ¤åºéä¿¡æ°\t%lu\n", net_count_nd6[NC_ND6_DAD_OUT_PACKETS]);
|
---|
893 |
|
---|
894 | #else /* of #if defined(SUPPORT_INET6) */
|
---|
895 |
|
---|
896 | #if defined(SUPPORT_INET4)
|
---|
897 |
|
---|
898 | #ifdef SUPPORT_ETHER
|
---|
899 |
|
---|
900 | net_count_struct(portid, "ARP", &net_count_arp);
|
---|
901 |
|
---|
902 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
903 |
|
---|
904 | cons_printf(portid, "\nIPv4\n");
|
---|
905 | cons_printf(portid, "\tåä¿¡ãªã¯ãããæ°\t%lu\n", net_count_ip4[NC_IP4_IN_OCTETS]);
|
---|
906 | cons_printf(portid, "\tåä¿¡ãã¼ã¿ã°ã©ã æ°\t%lu\n", net_count_ip4[NC_IP4_IN_PACKETS]);
|
---|
907 | cons_printf(portid, "\tåä¿¡ã¨ã©ã¼ãã¼ã¿ã°ã©ã æ°\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_PACKETS]);
|
---|
908 | cons_printf(portid, "\tãã§ãã¯ãµã ã¨ã©ã¼æ°\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_CKSUM]);
|
---|
909 | cons_printf(portid, "\té·ãã¨ã©ã¼æ°\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_SHORT]);
|
---|
910 | cons_printf(portid, "\tãã¼ã¸ã§ã³ã¨ã©ã¼æ°\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_VER]);
|
---|
911 | cons_printf(portid, "\tã¢ãã¬ã¹ã¨ã©ã¼æ°\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_ADDR]);
|
---|
912 | cons_printf(portid, "\tãããã³ã«ã¨ã©ã¼æ°\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_PROTO]);
|
---|
913 | cons_printf(portid, "\tãªãã·ã§ã³å
|
---|
914 | ¥åæ°\t%lu\n", net_count_ip4[NC_IP4_OPTS]);
|
---|
915 | cons_printf(portid, "\tåå²åä¿¡æ°\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN]);
|
---|
916 | cons_printf(portid, "\tåå²åä¿¡ãã©ã°ã¡ã³ãæ°\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN_FRAGS]);
|
---|
917 | cons_printf(portid, "\tåå²åä¿¡åæ§ææåæ°\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN_OK]);
|
---|
918 | cons_printf(portid, "\tåå²åä¿¡ç ´æ£æ°\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN_DROP]);
|
---|
919 | cons_printf(portid, "\tåå²åä¿¡ãããã¡ãå½ã¦å¤±ææ°\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN_NO_BUF]);
|
---|
920 | cons_printf(portid, "\tåå²åä¿¡ã¿ã¤ã ã¢ã¦ãæ°\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN_TMOUT]);
|
---|
921 | cons_printf(portid, "\téä¿¡ãªã¯ãããæ°\t%lu\n", net_count_ip4[NC_IP4_OUT_OCTETS]);
|
---|
922 | cons_printf(portid, "\téä¿¡ãã¼ã¿ã°ã©ã æ°\t%lu\n", net_count_ip4[NC_IP4_OUT_PACKETS]);
|
---|
923 | cons_printf(portid, "\téä¿¡ã¨ã©ã¼ãã¼ã¿ã°ã©ã æ°\t%lu\n", net_count_ip4[NC_IP4_OUT_ERR_PACKETS]);
|
---|
924 | cons_printf(portid, "\tåå²éä¿¡æ°\t%lu\n", net_count_ip4[NC_IP4_FRAG_OUT]);
|
---|
925 | cons_printf(portid, "\tåå²éä¿¡ãã©ã°ã¡ã³ãæ°\t%lu\n", net_count_ip4[NC_IP4_FRAG_OUT_FRAGS]);
|
---|
926 |
|
---|
927 | net_count_struct(portid, "ICMP", &net_count_icmp4);
|
---|
928 |
|
---|
929 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
930 |
|
---|
931 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
932 |
|
---|
933 | #ifdef SUPPORT_TCP
|
---|
934 |
|
---|
935 | cons_printf(portid, "\nTCP\n");
|
---|
936 | cons_printf(portid, "\tåä¿¡ãªã¯ãããæ°\t%lu\n", net_count_tcp[NC_TCP_RECV_OCTETS]);
|
---|
937 | cons_printf(portid, "\tåä¿¡ãã¼ã¿ãªã¯ãããæ°\t%lu\n", net_count_tcp[NC_TCP_RECV_DATA_OCTETS]);
|
---|
938 | cons_printf(portid, "\tåä¿¡ã»ã°ã¡ã³ãæ°\t%lu\n", net_count_tcp[NC_TCP_RECV_SEGS]);
|
---|
939 | cons_printf(portid, "\tåä¿¡ãã¼ã¿ã»ã°ã¡ã³ãæ°\t%lu\n", net_count_tcp[NC_TCP_RECV_DATA_SEGS]);
|
---|
940 | cons_printf(portid, "\tåä¿¡ãç·æ¥ã»ã°ã¡ã³ãæ°\t%lu\n", net_count_tcp[NC_TCP_RECV_URG_SEGS]);
|
---|
941 | cons_printf(portid, "\tåä¿¡ããããä¸æ£æ°\t%lu\n", net_count_tcp[NC_TCP_RECV_BAD_HEADERS]);
|
---|
942 | cons_printf(portid, "\tåä¿¡ããã§ãã¯ãµã ä¸æ£æ°\t%lu\n", net_count_tcp[NC_TCP_RECV_BAD_CKSUMS]);
|
---|
943 | cons_printf(portid, "\tåä¿¡ãACK æ°\t%lu\n", net_count_tcp[NC_TCP_RECV_ACKS]);
|
---|
944 | cons_printf(portid, "\tåä¿¡ãå¤é ACK æ°\t%lu\n", net_count_tcp[NC_TCP_RECV_DUP_ACKS]);
|
---|
945 | cons_printf(portid, "\tåä¿¡ãRST æ°\t%lu\n", net_count_tcp[NC_TCP_RECV_RSTS]);
|
---|
946 | cons_printf(portid, "\tåä¿¡ãå¤éæ°\t%lu\n", net_count_tcp[NC_TCP_RECV_DUP_SEGS]);
|
---|
947 | cons_printf(portid, "\tåä¿¡ãç ´æ£æ°\t%lu\n", net_count_tcp[NC_TCP_RECV_DROP_SEGS]);
|
---|
948 | cons_printf(portid, "\tåä¿¡ãã¥ã¼è§£æ¾æ°\t%lu\n", net_count_tcp[NC_TCP_FREE_RCV_QUEUE]);
|
---|
949 | cons_printf(portid, "\téä¿¡ãã¼ã¿ãªã¯ãããæ°\t%lu\n", net_count_tcp[NC_TCP_SEND_DATA_OCTETS]);
|
---|
950 | cons_printf(portid, "\téä¿¡å¶å¾¡ã»ã°ã¡ã³ãæ°\t%lu\n", net_count_tcp[NC_TCP_SEND_CNTL_SEGS]);
|
---|
951 | cons_printf(portid, "\téä¿¡ã»ã°ã¡ã³ãæ°\t%lu\n", net_count_tcp[NC_TCP_SEND_SEGS]);
|
---|
952 | cons_printf(portid, "\tåéä¿¡ã»ã°ã¡ã³ãæ°\t%lu\n", net_count_tcp[NC_TCP_SEND_REXMIT_SEGS]);
|
---|
953 | cons_printf(portid, "\téä¿¡ãã¼ã¿ã»ã°ã¡ã³ãæ°\t%lu\n", net_count_tcp[NC_TCP_SEND_DATA_SEGS]);
|
---|
954 | cons_printf(portid, "\téä¿¡ãç·æ¥ã»ã°ã¡ã³ãæ°\t%lu\n", net_count_tcp[NC_TCP_SEND_URG_SEGS]);
|
---|
955 | cons_printf(portid, "\téä¿¡ãACK æ°\t%lu\n", net_count_tcp[NC_TCP_SEND_ACKS]);
|
---|
956 | cons_printf(portid, "\téä¿¡ãRST æ°\t%lu\n", net_count_tcp[NC_TCP_SEND_RSTS]);
|
---|
957 | cons_printf(portid, "\tRTT æ´æ°æ°\t%lu\n", net_count_tcp[NC_TCP_RTT_UPDATES]);
|
---|
958 | cons_printf(portid, "\tååãªã¼ãã³æ°\t%lu\n", net_count_tcp[NC_TCP_ACCEPTS]);
|
---|
959 | cons_printf(portid, "\tè½åãªã¼ãã³æ°\t%lu\n", net_count_tcp[NC_TCP_CONNECTS]);
|
---|
960 |
|
---|
961 | #endif /* of #ifdef SUPPORT_TCP */
|
---|
962 |
|
---|
963 | #ifdef SUPPORT_UDP
|
---|
964 |
|
---|
965 | net_count_struct(portid, "UDP", &net_count_udp);
|
---|
966 |
|
---|
967 | #endif /* of #ifdef SUPPORT_UDP */
|
---|
968 |
|
---|
969 | tbl = nbuf_get_tbl();
|
---|
970 | cons_printf(portid, "\nãããã¯ã¼ã¯ãããã¡\n\tãµã¤ãº\tç¨ææ°\t使ç¨ä¸æ°\tå²å½è¦æ±æ°\tå²å½æ°\tå²å½ã¦ã¨ã©ã¼æ°\n");
|
---|
971 | for (ix = nbuf_get_tbl_size(); ix -- > 0; ) {
|
---|
972 | cons_printf(portid, "\t%lu\t%lu\t%lu\t%lu\t%lu\t%lu\n",
|
---|
973 | tbl[ix].size,
|
---|
974 | tbl[ix].prepares,
|
---|
975 | tbl[ix].busies,
|
---|
976 | tbl[ix].requests,
|
---|
977 | tbl[ix].allocs,
|
---|
978 | tbl[ix].errors);
|
---|
979 | }
|
---|
980 |
|
---|
981 | cons_printf(portid, "\nãããã¯ã¼ã¯çµ±è¨æ
|
---|
982 | å ±\tçµéæé[us]\t%lu\t", now);
|
---|
983 | if (now > (1000 * 3600 * 24))
|
---|
984 | cons_printf(portid, "%3luæ¥ %2luæé %2luå %2luç§\n",
|
---|
985 | now / (1000 * 3600 * 24),
|
---|
986 | (now / (1000 * 3600)) % 24,
|
---|
987 | (now / (1000 * 60 )) % 60,
|
---|
988 | (now / 1000 ) % 60);
|
---|
989 | else
|
---|
990 | cons_printf(portid, "%2luæé %2luå %2luç§\n",
|
---|
991 | (now / (1000 * 3600)) % 24,
|
---|
992 | (now / (1000 * 60 )) % 60,
|
---|
993 | (now / 1000 ) % 60);
|
---|
994 |
|
---|
995 | SIG_NET_CONS_PRINTF();
|
---|
996 | FLUSH_SND_BUFF();
|
---|
997 | }
|
---|
998 |
|
---|
999 | #if defined(SUPPORT_INET4)
|
---|
1000 |
|
---|
1001 | #ifdef IP4_CFG_FRAGMENT
|
---|
1002 |
|
---|
1003 | /*
|
---|
1004 | * nbuf_stat_ip4_frag_queue -- IPv4 åæ§æãã¥ã¼å
|
---|
1005 | ãããã¯ã¼ã¯ãããã¡æ
|
---|
1006 | å ±
|
---|
1007 | */
|
---|
1008 |
|
---|
1009 | static void
|
---|
1010 | nbuf_stat_ip4_frag_queue (ID portid)
|
---|
1011 | {
|
---|
1012 | const T_NET_BUF_ENTRY *tbl;
|
---|
1013 | const T_NET_BUF *nbuf, **queue;
|
---|
1014 | int_t ix, fix, count;
|
---|
1015 |
|
---|
1016 | cons_printf(portid, "\nIPv4åæ§æãã¥ã¼å
|
---|
1017 | \nIndex\tTime");
|
---|
1018 | tbl = nbuf_get_tbl();
|
---|
1019 | for (ix = nbuf_get_tbl_size(); ix -- > 0; )
|
---|
1020 | cons_printf(portid, "\t%d", tbl[ix].size);
|
---|
1021 | cons_putchar(portid, '\n');
|
---|
1022 |
|
---|
1023 | queue = ip_get_frag_queue();
|
---|
1024 | for (fix = 0; fix < NUM_IP4_FRAG_QUEUE; fix ++) {
|
---|
1025 | if (queue[fix] != NULL) {
|
---|
1026 | cons_printf(portid, "%d\t%d", fix, GET_QIP4_HDR(queue[fix])->ttl);
|
---|
1027 | for (ix = nbuf_get_tbl_size(); ix -- > 0; ) {
|
---|
1028 | count = 0;
|
---|
1029 | for (nbuf = queue[fix]; nbuf != NULL; nbuf = GET_QIP4_HDR(nbuf)->next)
|
---|
1030 | if (nbuf->idix == ix)
|
---|
1031 | count ++;
|
---|
1032 | cons_printf(portid, "\t%d", count);
|
---|
1033 | }
|
---|
1034 | cons_putchar(portid, '\n');
|
---|
1035 | }
|
---|
1036 | }
|
---|
1037 | }
|
---|
1038 |
|
---|
1039 | #endif /* of #ifdef IP4_CFG_FRAGMENT */
|
---|
1040 |
|
---|
1041 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
1042 |
|
---|
1043 | #if defined(SUPPORT_INET6)
|
---|
1044 |
|
---|
1045 | #ifdef IP6_CFG_FRAGMENT
|
---|
1046 |
|
---|
1047 | /*
|
---|
1048 | * nbuf_stat_ip6_frag_queue -- IPv6 åæ§æãã¥ã¼å
|
---|
1049 | ãããã¯ã¼ã¯ãããã¡æ
|
---|
1050 | å ±
|
---|
1051 | */
|
---|
1052 |
|
---|
1053 | static void
|
---|
1054 | nbuf_stat_ip6_frag_queue (ID portid)
|
---|
1055 | {
|
---|
1056 | const T_NET_BUF_ENTRY *tbl;
|
---|
1057 | const T_NET_BUF *nbuf, **queue;
|
---|
1058 | int_t ix, fix, count;
|
---|
1059 |
|
---|
1060 | cons_printf(portid, "\nIPv6åæ§æãã¥ã¼å
|
---|
1061 | \nIndex\tTime");
|
---|
1062 | tbl = nbuf_get_tbl();
|
---|
1063 | for (ix = nbuf_get_tbl_size(); ix -- > 0; )
|
---|
1064 | cons_printf(portid, "\t%d", tbl[ix].size);
|
---|
1065 | cons_putchar(portid, '\n');
|
---|
1066 |
|
---|
1067 | queue = ip6_get_frag_queue();
|
---|
1068 | for (fix = 0; fix < NUM_IP6_FRAG_QUEUE; fix ++) {
|
---|
1069 | if (queue[fix] != NULL) {
|
---|
1070 | cons_printf(portid, "%d\t%d", fix, GET_QIP6_HDR(queue[fix])->ftim);
|
---|
1071 | for (ix = nbuf_get_tbl_size(); ix -- > 0; ) {
|
---|
1072 | count = 0;
|
---|
1073 | for (nbuf = queue[fix]; nbuf != NULL; nbuf = GET_QIP6_HDR(nbuf)->next_frag)
|
---|
1074 | if (nbuf->idix == ix)
|
---|
1075 | count ++;
|
---|
1076 | cons_printf(portid, "\t%d", count);
|
---|
1077 | }
|
---|
1078 | cons_putchar(portid, '\n');
|
---|
1079 | }
|
---|
1080 | }
|
---|
1081 | }
|
---|
1082 |
|
---|
1083 | #endif /* of #ifdef IP6_CFG_FRAGMENT */
|
---|
1084 |
|
---|
1085 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
1086 |
|
---|
1087 | #endif /* of #if NET_COUNT_ENABLE */
|
---|
1088 |
|
---|
1089 | /*
|
---|
1090 | * nbuf_status -- ãããã¯ã¼ã¯ãããã¡æ
|
---|
1091 | å ±
|
---|
1092 | */
|
---|
1093 |
|
---|
1094 | static void
|
---|
1095 | nbuf_status (ID portid, char *line)
|
---|
1096 | {
|
---|
1097 | SYSTIM now;
|
---|
1098 |
|
---|
1099 | #if NET_COUNT_ENABLE
|
---|
1100 | const T_NET_BUF_ENTRY *tbl;
|
---|
1101 | int_t ix;
|
---|
1102 | #endif /* of #if NET_COUNT_ENABLE */
|
---|
1103 |
|
---|
1104 | #ifdef SUPPORT_TCP
|
---|
1105 | T_NET_BUF *nbuf;
|
---|
1106 | T_TCP_CEP* cep;
|
---|
1107 | T_TCP_Q_HDR* tqhdr;
|
---|
1108 |
|
---|
1109 | #ifdef TCP_CFG_SWBUF_CSAVE
|
---|
1110 | T_TCP_HDR* tcph;
|
---|
1111 | #endif /* of #ifdef TCP_CFG_SWBUF_CSAVE */
|
---|
1112 | #endif /* of #ifdef SUPPORT_TCP */
|
---|
1113 |
|
---|
1114 | WAI_NET_CONS_PRINTF();
|
---|
1115 | get_tim(&now);
|
---|
1116 | cons_printf(portid, "ãããã¯ã¼ã¯ãããã¡æ
|
---|
1117 | å ±\tçµéæé[us]\t%u\n", now);
|
---|
1118 |
|
---|
1119 | #if NET_COUNT_ENABLE
|
---|
1120 |
|
---|
1121 | cons_printf(portid, "\nãããã¯ã¼ã¯ãããã¡\n\tãµã¤ãº\tç¨ææ°\t使ç¨ä¸æ°\tå²å½è¦æ±æ°\tå²å½æ°\tå²å½ã¦ã¨ã©ã¼æ°\n");
|
---|
1122 | tbl = nbuf_get_tbl();
|
---|
1123 | for (ix = nbuf_get_tbl_size(); ix -- > 0; ) {
|
---|
1124 | cons_printf(portid, "\t%u\t%u\t%u\t%u\t%u\t%u\n",
|
---|
1125 | tbl[ix].size,
|
---|
1126 | tbl[ix].prepares,
|
---|
1127 | tbl[ix].busies,
|
---|
1128 | tbl[ix].requests,
|
---|
1129 | tbl[ix].allocs,
|
---|
1130 | tbl[ix].errors);
|
---|
1131 | }
|
---|
1132 |
|
---|
1133 | #endif /* of #if NET_COUNT_ENABLE */
|
---|
1134 |
|
---|
1135 | #ifdef SUPPORT_TCP
|
---|
1136 |
|
---|
1137 | cons_printf(portid, "\nCEPå
|
---|
1138 | \nCEPID\n");
|
---|
1139 |
|
---|
1140 | for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++) {
|
---|
1141 | cons_printf(portid, "%2d", GET_TCP_CEPID(cep));
|
---|
1142 | for (nbuf = cep->reassq; nbuf != NULL; nbuf = tqhdr->next) {
|
---|
1143 | tqhdr = GET_TCP_Q_HDR(nbuf, GET_TCP_HDR_OFFSET(nbuf));
|
---|
1144 | cons_printf(portid, "[a:%6lu-%6lu] ",
|
---|
1145 | ntohl(tqhdr->seq) - cep->irs + tqhdr->soff,
|
---|
1146 | ntohl(tqhdr->seq) - cep->irs + tqhdr->soff + tqhdr->slen);
|
---|
1147 | }
|
---|
1148 |
|
---|
1149 | #ifdef TCP_CFG_RWBUF_CSAVE
|
---|
1150 | for (nbuf = cep->rwbufq; nbuf != NULL; nbuf = tqhdr->next) {
|
---|
1151 | tqhdr = GET_TCP_Q_HDR(nbuf, GET_TCP_HDR_OFFSET(nbuf));
|
---|
1152 | cons_printf(portid, "[r:%6lu-%6lu] ",
|
---|
1153 | ntohl(tqhdr->seq) - cep->irs + tqhdr->soff,
|
---|
1154 | ntohl(tqhdr->seq) - cep->irs + tqhdr->soff + tqhdr->slen);
|
---|
1155 | }
|
---|
1156 | #endif /* of #ifdef TCP_CFG_RWBUF_CSAVE */
|
---|
1157 |
|
---|
1158 | #ifdef TCP_CFG_SWBUF_CSAVE
|
---|
1159 | if (cep->swbufq != NULL) {
|
---|
1160 | tcph = GET_TCP_HDR(cep->swbufq, GET_TCP_HDR_OFFSET(cep->swbufq));
|
---|
1161 | #if 0
|
---|
1162 | cons_printf(portid, "[s:%6lu-%6lu] ",
|
---|
1163 | ntohl(tcph->seq) - cep->iss,
|
---|
1164 | ntohl(tcph->seq) - cep->iss + (GET_IP_SDU_SIZE(cep->swbufq) -
|
---|
1165 | GET_TCP_HDR_SIZE(cep->swbufq, GET_TCP_HDR_OFFSET(cep->swbufq))));
|
---|
1166 | #else
|
---|
1167 | cons_printf(portid, "[s:%6lu-%6lu,%08x,%08x] ",
|
---|
1168 | ntohl(tcph->seq) - cep->iss,
|
---|
1169 | ntohl(tcph->seq) - cep->iss + (GET_IP_SDU_SIZE(cep->swbufq) -
|
---|
1170 | GET_TCP_HDR_SIZE(cep->swbufq, GET_TCP_HDR_OFFSET(cep->swbufq))),
|
---|
1171 | ntohl(tcph->seq), cep->iss);
|
---|
1172 | #endif
|
---|
1173 | }
|
---|
1174 | #endif /* of #ifdef TCP_CFG_SWBUF_CSAVE */
|
---|
1175 |
|
---|
1176 | cons_putchar(portid, '\n');
|
---|
1177 | }
|
---|
1178 |
|
---|
1179 | #endif /* of #ifdef SUPPORT_TCP */
|
---|
1180 |
|
---|
1181 | #if NET_COUNT_ENABLE
|
---|
1182 |
|
---|
1183 | #if defined(SUPPORT_INET4)
|
---|
1184 |
|
---|
1185 | #ifdef IP4_CFG_FRAGMENT
|
---|
1186 |
|
---|
1187 | nbuf_stat_ip4_frag_queue(portid);
|
---|
1188 |
|
---|
1189 | #endif /* of #ifdef IP4_CFG_FRAGMENT */
|
---|
1190 |
|
---|
1191 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
1192 |
|
---|
1193 | #if defined(SUPPORT_INET6)
|
---|
1194 |
|
---|
1195 | #ifdef IP6_CFG_FRAGMENT
|
---|
1196 |
|
---|
1197 | nbuf_stat_ip6_frag_queue(portid);
|
---|
1198 |
|
---|
1199 | #endif /* of #ifdef IP6_CFG_FRAGMENT */
|
---|
1200 |
|
---|
1201 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
1202 |
|
---|
1203 | #endif /* of #if NET_COUNT_ENABLE */
|
---|
1204 |
|
---|
1205 | SIG_NET_CONS_PRINTF();
|
---|
1206 | FLUSH_SND_BUFF();
|
---|
1207 | }
|
---|
1208 |
|
---|
1209 | #ifdef USE_RESOLVER
|
---|
1210 |
|
---|
1211 | /*
|
---|
1212 | * show_dns_soa -- DNS ã® SOA RDATA ã表示ããã
|
---|
1213 | */
|
---|
1214 |
|
---|
1215 | static ER_UINT
|
---|
1216 | show_dns_soa (ID portid, uint8_t *msg, ER_UINT length, uint_t offset)
|
---|
1217 | {
|
---|
1218 | T_RSLV_SOA soa;
|
---|
1219 | ER_UINT error;
|
---|
1220 | uint_t rn_offset;
|
---|
1221 |
|
---|
1222 | if ((error = dns_analyze_soa(&soa, offset, msg, length)) < 0)
|
---|
1223 | return error;
|
---|
1224 |
|
---|
1225 | cons_printf(portid, " mname: ");
|
---|
1226 | rn_offset = show_dns_domain_name(portid, msg, offset);
|
---|
1227 | cons_putchar(portid, '\n');
|
---|
1228 | cons_printf(portid, " rname: ");
|
---|
1229 | show_dns_domain_name(portid, msg, rn_offset);
|
---|
1230 | cons_putchar(portid, '\n');
|
---|
1231 |
|
---|
1232 | cons_printf(portid, " serial: %d\n", soa.serial);
|
---|
1233 | cons_printf(portid, " refresh: %d\n", soa.refresh);
|
---|
1234 | cons_printf(portid, " retry: %d\n", soa.retry);
|
---|
1235 | cons_printf(portid, " expirel: %d\n", soa.expire);
|
---|
1236 | cons_printf(portid, " minimum: %d\n", soa.minimum);
|
---|
1237 |
|
---|
1238 | return E_OK;
|
---|
1239 | }
|
---|
1240 |
|
---|
1241 | /*
|
---|
1242 | * show_dns_qdsection -- DNS ã® Question ã»ã¯ã·ã§ã³ã表示ããã
|
---|
1243 | */
|
---|
1244 |
|
---|
1245 | static ER_UINT
|
---|
1246 | show_dns_qdsection (ID portid, uint8_t *msg, ER_UINT length, T_RSLV_DNS_MSG *rslv)
|
---|
1247 | {
|
---|
1248 | T_RSLV_QD qd;
|
---|
1249 | ER_UINT offset, error;
|
---|
1250 | int scount;
|
---|
1251 |
|
---|
1252 | cons_printf(portid, "question section: %d\n", rslv->dns_hdr.qdcount);
|
---|
1253 | offset = rslv->qd_offset;
|
---|
1254 | for (scount = 1; scount <= rslv->dns_hdr.qdcount; scount ++) {
|
---|
1255 | if ((error = dns_analyze_qd(&qd, offset, msg, length)) < 0)
|
---|
1256 | return error;
|
---|
1257 |
|
---|
1258 | cons_printf(portid, "%2d: ", scount);
|
---|
1259 | show_dns_domain_name(portid, msg, offset);
|
---|
1260 | cons_printf(portid, "\n type: %-4s, class: %2s\n", dns_strtype(qd.type), dns_strclass(qd.class));
|
---|
1261 | offset = error;
|
---|
1262 | }
|
---|
1263 |
|
---|
1264 | return E_OK;
|
---|
1265 | }
|
---|
1266 |
|
---|
1267 | /*
|
---|
1268 | * show_dns_section -- DNS ã®åã»ã¯ã·ã§ã³ã表示ããã
|
---|
1269 | */
|
---|
1270 |
|
---|
1271 | static ER_UINT
|
---|
1272 | show_dns_section (ID portid, uint8_t *msg, ER_UINT length, uint_t scount, uint_t offset, char *title)
|
---|
1273 | {
|
---|
1274 | T_RSLV_RR rr;
|
---|
1275 | T_IN4_ADDR in4_addr;
|
---|
1276 | ER_UINT error;
|
---|
1277 | int count, dcount, col;
|
---|
1278 | T_IN6_ADDR in6_addr;
|
---|
1279 |
|
---|
1280 | cons_printf(portid, "%10s section: %d\n", title, scount);
|
---|
1281 | for (count = 1; count <= scount; count ++) {
|
---|
1282 | if ((error = dns_analyze_rr(&rr, offset, msg, length)) < 0)
|
---|
1283 | return error;
|
---|
1284 |
|
---|
1285 | cons_printf(portid, "%2d: ", count);
|
---|
1286 | show_dns_domain_name(portid, msg, offset);
|
---|
1287 | cons_printf(portid, "\n type: %-4s, class: %2s, TTL: %2d, len: %3d, offset: 0x%02x\n",
|
---|
1288 | dns_strtype(rr.type), dns_strclass(rr.class), rr.ttl, rr.rdlength, rr.rdata_offset);
|
---|
1289 |
|
---|
1290 | switch (rr.type) {
|
---|
1291 | case DNS_TYPE_A:
|
---|
1292 | memcpy((void*)&in4_addr, (void*)(msg + rr.rdata_offset), sizeof(in4_addr));
|
---|
1293 | in4_addr = ntohl(in4_addr);
|
---|
1294 | cons_printf(portid, " IPv4 addr: %hI\n", &in4_addr);
|
---|
1295 | break;
|
---|
1296 | case DNS_TYPE_NS:
|
---|
1297 | cons_printf(portid, " host: ");
|
---|
1298 | show_dns_domain_name(portid, msg, rr.rdata_offset);
|
---|
1299 | cons_putchar(portid, '\n');
|
---|
1300 | break;
|
---|
1301 | case DNS_TYPE_CNAME:
|
---|
1302 | cons_printf(portid, " host: ");
|
---|
1303 | show_dns_domain_name(portid, msg, rr.rdata_offset);
|
---|
1304 | cons_putchar(portid, '\n');
|
---|
1305 | break;
|
---|
1306 | case DNS_TYPE_SOA:
|
---|
1307 | show_dns_soa(portid, msg, length, rr.rdata_offset);
|
---|
1308 | break;
|
---|
1309 | case DNS_TYPE_PTR:
|
---|
1310 | cons_printf(portid, " PTR: ");
|
---|
1311 | show_dns_domain_name(portid, msg, rr.rdata_offset);
|
---|
1312 | cons_putchar(portid, '\n');
|
---|
1313 | break;
|
---|
1314 | case DNS_TYPE_AAAA:
|
---|
1315 | memcpy((void*)&in6_addr, (void*)(msg + rr.rdata_offset), sizeof(in6_addr));
|
---|
1316 | cons_printf(portid, " IPv6 addr: %lI\n", &in6_addr);
|
---|
1317 | break;
|
---|
1318 | default:
|
---|
1319 | cons_printf(portid, " data: ");
|
---|
1320 | col = 32;
|
---|
1321 | for (dcount = 0; dcount < rr.rdlength; dcount ++) {
|
---|
1322 | cons_printf(portid, "%02x", *(msg + rr.rdata_offset + dcount));
|
---|
1323 | if (-- col == 0) {
|
---|
1324 | cons_printf(portid, "\n ");
|
---|
1325 | col = 32;
|
---|
1326 | }
|
---|
1327 | }
|
---|
1328 | cons_putchar(portid, '\n');
|
---|
1329 | break;
|
---|
1330 | }
|
---|
1331 | }
|
---|
1332 |
|
---|
1333 | return E_OK;
|
---|
1334 | }
|
---|
1335 | /*
|
---|
1336 | * dns_info -- DNS æ
|
---|
1337 | å ±ã®è¡¨ç¤º
|
---|
1338 | */
|
---|
1339 |
|
---|
1340 | static void
|
---|
1341 | dns_info (ID portid)
|
---|
1342 | {
|
---|
1343 | #if defined(SUPPORT_INET6)
|
---|
1344 | T_IN6_ADDR in6_addr;
|
---|
1345 | #endif
|
---|
1346 | #if defined(SUPPORT_INET4)
|
---|
1347 | T_IN4_ADDR in4_addr;
|
---|
1348 | #endif
|
---|
1349 |
|
---|
1350 | #if defined(SUPPORT_INET6)
|
---|
1351 |
|
---|
1352 | cons_printf(portid, "domain name: %s\n", dns_in6_get_dname());
|
---|
1353 |
|
---|
1354 | #else /* of #if defined(SUPPORT_INET6) */
|
---|
1355 |
|
---|
1356 | cons_printf(portid, "domain name: %s\n", dns_in4_get_dname());
|
---|
1357 |
|
---|
1358 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
1359 |
|
---|
1360 | #if defined(SUPPORT_INET6)
|
---|
1361 | dns_in6_get_addr(&in6_addr);
|
---|
1362 | cons_printf(portid, "IPv6 DNS server: ");
|
---|
1363 | if (IN6_IS_ADDR_UNSPECIFIED(&in6_addr))
|
---|
1364 | cons_printf(portid, "not available.\n");
|
---|
1365 | else
|
---|
1366 | cons_printf(portid, "%lI.\n", &in6_addr);
|
---|
1367 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
1368 |
|
---|
1369 | #if defined(SUPPORT_INET4)
|
---|
1370 | dns_in4_get_addr(&in4_addr);
|
---|
1371 | cons_printf(portid, "IPv4 DNS server: ");
|
---|
1372 | if (in4_addr == IPV4_ADDRANY)
|
---|
1373 | cons_printf(portid, "not available.\n");
|
---|
1374 | else
|
---|
1375 | cons_printf(portid, "%hI.\n", &in4_addr);
|
---|
1376 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
1377 | }
|
---|
1378 |
|
---|
1379 | /*
|
---|
1380 | * name_lookup -- ãã¹ãåï¼IP ã¢ãã¬ã¹å¤æ
|
---|
1381 | */
|
---|
1382 |
|
---|
1383 | const char *rcode_str[] = {
|
---|
1384 | "no error",
|
---|
1385 | "format error",
|
---|
1386 | "server error",
|
---|
1387 | "name error",
|
---|
1388 | "not implement",
|
---|
1389 | "refused",
|
---|
1390 | };
|
---|
1391 |
|
---|
1392 | static void
|
---|
1393 | name_lookup (ID portid, char *line)
|
---|
1394 | {
|
---|
1395 | static char hostname[DBG_LINE_SIZE + 1];
|
---|
1396 |
|
---|
1397 | T_RSLV_DNS_MSG rslv;
|
---|
1398 | ER_UINT length, offset;
|
---|
1399 | ER error;
|
---|
1400 | uint_t flags = 0;
|
---|
1401 | uint8_t *msg;
|
---|
1402 |
|
---|
1403 | /* ã³ãã³ãã®ãªãã·ã§ã³ãè¨å®ããã*/
|
---|
1404 | line = skip_blanks(resolv_options(&flags, line, DEFAULT_API_PROTO));
|
---|
1405 | if ((flags & (DNS_LUP_FLAGS_PROTO_IPV6 | DNS_LUP_FLAGS_PROTO_IPV4)) == 0) {
|
---|
1406 | cons_printf(portid, "DNS server not available.\n");
|
---|
1407 | return;
|
---|
1408 | }
|
---|
1409 |
|
---|
1410 | /* ç
|
---|
1411 | §ä¼ãããã¹ãåã»IP ã¢ãã¬ã¹ã解æããã*/
|
---|
1412 | resolv_hoststr(&flags, hostname, sizeof(hostname), line);
|
---|
1413 |
|
---|
1414 | /* æ£å¼ãã§ãéå¼ãã§ããããã³ã«ä¸ã¯æ£å¼ããæå®ããã*/
|
---|
1415 | flags |= DNS_LUP_OPCODE_FORWARD;
|
---|
1416 |
|
---|
1417 | /* IPv6 ã¢ãã¬ã¹ãã¾ã㯠IPv4 ã¢ãã¬ã¹ãæå®ãããæã¯ãç
|
---|
1418 | §ä¼ã¿ã¤ã㯠PTR ã«è¨å®ããã*/
|
---|
1419 | if (((flags & DNS_LUP_FLAGS_NAME_MASK) == DNS_LUP_FLAGS_NAME_IPV6) ||
|
---|
1420 | ((flags & DNS_LUP_FLAGS_NAME_MASK) == DNS_LUP_FLAGS_NAME_IPV4))
|
---|
1421 | flags = (flags & ~DNS_LUP_FLAGS_QTYPE_MASK) | DNS_LUP_FLAGS_QTYPE_PTR;
|
---|
1422 |
|
---|
1423 | if ((error = tget_mpf(MPF_RSLV_SRBUF, (void*)&msg, TMO_FEVR)) != E_OK) {
|
---|
1424 | cons_printf(portid, "get buffer error: %s.\n", itron_strerror(error));
|
---|
1425 | return;
|
---|
1426 | }
|
---|
1427 |
|
---|
1428 | if ((length = dns_lookup_host(flags | DNS_LUP_FLAGS_MSG, line, msg, DNS_UDP_MSG_LENGTH, &rslv)) < 0) {
|
---|
1429 | //cons_printf(portid, "error: %s.\n", itron_strerror(length));
|
---|
1430 | goto err_ret;
|
---|
1431 | }
|
---|
1432 |
|
---|
1433 | dly_tsk(1 * 1000);
|
---|
1434 | cons_printf(portid, "DNS header: flags: ");
|
---|
1435 | if (rslv.dns_hdr.code & (DNS_QR_RESPONSE | DNS_AUTHORITATIVE |
|
---|
1436 | DNS_TRUN_CATION | DNS_RECURSION_DESIRED | DNS_RECURSION_AVAILABLE)) {
|
---|
1437 | cons_printf(portid, (rslv.dns_hdr.code & DNS_QR_RESPONSE) ? "QR," : "");
|
---|
1438 | cons_printf(portid, (rslv.dns_hdr.code & DNS_AUTHORITATIVE) ? "AA," : "");
|
---|
1439 | cons_printf(portid, (rslv.dns_hdr.code & DNS_TRUN_CATION) ? "TC," : "");
|
---|
1440 | cons_printf(portid, (rslv.dns_hdr.code & DNS_RECURSION_DESIRED) ? "RD," : "");
|
---|
1441 | cons_printf(portid, (rslv.dns_hdr.code & DNS_RECURSION_AVAILABLE) ? "RA," : "");
|
---|
1442 | cons_printf(portid, " ");
|
---|
1443 | }
|
---|
1444 | cons_printf(portid, "opcode: ");
|
---|
1445 | cons_printf(portid, (rslv.dns_hdr.code & DNS_OPCODE_REVERSE) ? "RV" : "FW");
|
---|
1446 | cons_printf(portid, (rslv.dns_hdr.code & DNS_OPCODE_STATUS) ? ",ST" : "");
|
---|
1447 | cons_printf(portid, ", rcode: %s.\n",
|
---|
1448 | (rslv.dns_hdr.code & DNS_RCODE_MASK) > DNS_RCODE_REFUSED
|
---|
1449 | ? "6" : rcode_str[rslv.dns_hdr.code & DNS_RCODE_MASK]);
|
---|
1450 |
|
---|
1451 | if ((offset = show_dns_qdsection(portid, msg, length, &rslv)) < 0) {
|
---|
1452 | cons_printf(portid, "msg error: %s.\n", itron_strerror(offset));
|
---|
1453 | }
|
---|
1454 | if ((offset = show_dns_section(portid, msg, length, rslv.dns_hdr.ancount, rslv.an_offset, "answer")) < 0) {
|
---|
1455 | cons_printf(portid, "msg error: %s.\n", itron_strerror(offset));
|
---|
1456 | }
|
---|
1457 | if ((offset = show_dns_section(portid, msg, length, rslv.dns_hdr.nscount, rslv.ns_offset, "authority")) < 0) {
|
---|
1458 | cons_printf(portid, "msg error: %s.\n", itron_strerror(offset));
|
---|
1459 | }
|
---|
1460 | if ((offset = show_dns_section(portid, msg, length, rslv.dns_hdr.arcount, rslv.ar_offset, "additional")) < 0) {
|
---|
1461 | cons_printf(portid, "msg error: %s.\n", itron_strerror(offset));
|
---|
1462 | }
|
---|
1463 |
|
---|
1464 | err_ret:
|
---|
1465 | if ((error = rel_mpf(MPF_RSLV_SRBUF, msg)) != E_OK)
|
---|
1466 | cons_printf(portid, "release buffer error: %s.\n", itron_strerror(error));
|
---|
1467 | return;
|
---|
1468 | }
|
---|
1469 |
|
---|
1470 | #endif /* of #ifdef USE_RESOLVER */
|
---|
1471 |
|
---|
1472 | #if defined(DHCP6_CLI_CFG)
|
---|
1473 |
|
---|
1474 | /*
|
---|
1475 | * dhcp6c_info -- DHCPv6 ã¯ã©ã¤ã¢ã³ãæ
|
---|
1476 | å ±ã®è¡¨ç¤º
|
---|
1477 | */
|
---|
1478 |
|
---|
1479 | static void
|
---|
1480 | dhcp6c_info (ID portid)
|
---|
1481 | {
|
---|
1482 | T_IN6_ADDR svaddr;
|
---|
1483 | SYSTIM bind_start;
|
---|
1484 | ER error;
|
---|
1485 | uint32_t expire, renew, rebind, deprefer;
|
---|
1486 |
|
---|
1487 | if ((error = dhcp6c_get_info(&svaddr, &expire, &renew, &rebind, &deprefer, &bind_start)) == E_OK) {
|
---|
1488 | cons_printf(portid, " DHCPv6 server: %lI.\n", &svaddr);
|
---|
1489 |
|
---|
1490 | #if DHCP6_CLI_CFG_MODE == DHCP6_CLI_CFG_STATELESS
|
---|
1491 |
|
---|
1492 | cons_printf(portid, " DHCPv6 mode: stateless.\n");
|
---|
1493 |
|
---|
1494 | #elif DHCP6_CLI_CFG_MODE == DHCP6_CLI_CFG_STATEFULL
|
---|
1495 |
|
---|
1496 | cons_printf(portid, " DHCPv6 mode: statefull,\n");
|
---|
1497 | cons_printf(portid, " Renew: %u:%02u:%02u, Deprefer: %u:%02u:%02u,\n",
|
---|
1498 | renew / 3600, ( renew / 60) % 60, renew % 60,
|
---|
1499 | deprefer / 3600, (deprefer / 60) % 60, deprefer % 60);
|
---|
1500 | cons_printf(portid, " Rebind: %u:%02u:%02u, Expire: %u:%02u:%02u.\n",
|
---|
1501 | rebind / 3600, ( rebind / 60) % 60, rebind % 60,
|
---|
1502 | expire / 3600, ( expire / 60) % 60, expire % 60);
|
---|
1503 |
|
---|
1504 | #else /* of #if DHCP6_CLI_CFG_MODE == DHCP6_CLI_CFG_STATELESS */
|
---|
1505 |
|
---|
1506 | #endif /* of #if DHCP6_CLI_CFG_MODE == DHCP6_CLI_CFG_STATELESS */
|
---|
1507 |
|
---|
1508 | }
|
---|
1509 | else if (error == E_OBJ)
|
---|
1510 | cons_printf(portid, " DHCPv6 server: not available.\n");
|
---|
1511 | }
|
---|
1512 |
|
---|
1513 | #endif /* of #if defined(DHCP6_CLI_CFG) */
|
---|
1514 |
|
---|
1515 | #if defined(DHCP4_CLI_CFG)
|
---|
1516 |
|
---|
1517 | /*
|
---|
1518 | * dhcp4c_info -- DHCPv4 ã¯ã©ã¤ã¢ã³ãæ
|
---|
1519 | å ±ã®è¡¨ç¤º
|
---|
1520 | */
|
---|
1521 |
|
---|
1522 | static void
|
---|
1523 | dhcp4c_info (ID portid)
|
---|
1524 | {
|
---|
1525 | T_IN4_ADDR svaddr;
|
---|
1526 | SYSTIM bind_start;
|
---|
1527 | ER error;
|
---|
1528 | uint32_t expire, renew, rebind;
|
---|
1529 |
|
---|
1530 | if ((error = dhcp4c_get_info(&svaddr, &expire, &renew, &rebind, &bind_start)) == E_OK) {
|
---|
1531 | cons_printf(portid, " DHCPv4 server: %hI,\n", &svaddr);
|
---|
1532 | cons_printf(portid, " Renew: %u:%02u:%02u,\n",
|
---|
1533 | renew / 3600, (renew / 60) % 60, renew % 60);
|
---|
1534 | cons_printf(portid, " Rebind: %u:%02u:%02u, Expire: %u:%02u:%02u.\n",
|
---|
1535 | rebind / 3600, (rebind / 60) % 60, rebind % 60,
|
---|
1536 | expire / 3600, (expire / 60) % 60, expire % 60);
|
---|
1537 | }
|
---|
1538 | else if (error == E_OBJ)
|
---|
1539 | cons_printf(portid, " DHCPv4 server: not available.\n");
|
---|
1540 | }
|
---|
1541 |
|
---|
1542 | #endif /* of #if defined(DHCP4_CLI_CFG) */
|
---|
1543 |
|
---|
1544 | #if defined(DHCP6_CLI_CFG) || defined(DHCP4_CLI_CFG)
|
---|
1545 |
|
---|
1546 | /*
|
---|
1547 | * dhcpc -- DHCP ã¯ã©ã¤ã¢ã³ãæ
|
---|
1548 | å ±ã®è¡¨ç¤ºã¨å¶å¾¡
|
---|
1549 | */
|
---|
1550 |
|
---|
1551 | static void
|
---|
1552 | dhcpc (ID portid, char *line)
|
---|
1553 | {
|
---|
1554 | WAI_NET_CONS_PRINTF();
|
---|
1555 |
|
---|
1556 | switch (*line) {
|
---|
1557 |
|
---|
1558 | #if defined(DHCP6_CLI_CFG)
|
---|
1559 | case '6': /* DHCPv6 ã®å¶å¾¡ */
|
---|
1560 | switch (*(line + 1)) {
|
---|
1561 | case 'r': /* ã¢ãã¬ã¹æ
|
---|
1562 | å ±ã解æ¾ããã*/
|
---|
1563 | dhcp6c_rel_info();
|
---|
1564 | break;
|
---|
1565 |
|
---|
1566 | case 'n': /* ã¢ãã¬ã¹æ
|
---|
1567 | å ±ãååå¾ããã*/
|
---|
1568 | dhcp6c_renew_info();
|
---|
1569 | break;
|
---|
1570 |
|
---|
1571 | default:
|
---|
1572 | dhcp6c_info(portid);
|
---|
1573 | break;
|
---|
1574 | }
|
---|
1575 | break;
|
---|
1576 | #endif /* of #if defined(DHCP6_CLI_CFG) */
|
---|
1577 |
|
---|
1578 | #if defined(DHCP4_CLI_CFG)
|
---|
1579 | case '4': /* DHCPv4 ã®å¶å¾¡ */
|
---|
1580 | switch (*(line + 1)) {
|
---|
1581 | case 'r': /* ã¢ãã¬ã¹æ
|
---|
1582 | å ±ã解æ¾ããã*/
|
---|
1583 | dhcp4c_rel_info();
|
---|
1584 | break;
|
---|
1585 |
|
---|
1586 | case 'n': /* ã¢ãã¬ã¹æ
|
---|
1587 | å ±ãååå¾ããã*/
|
---|
1588 | dhcp4c_renew_info();
|
---|
1589 | break;
|
---|
1590 |
|
---|
1591 | default:
|
---|
1592 | dhcp4c_info(portid);
|
---|
1593 | break;
|
---|
1594 | }
|
---|
1595 | break;
|
---|
1596 | #endif /* of #if defined(DHCP4_CLI_CFG) */
|
---|
1597 |
|
---|
1598 | default:
|
---|
1599 |
|
---|
1600 | #if defined(DHCP6_CLI_CFG)
|
---|
1601 | dhcp6c_info(portid);
|
---|
1602 | #endif
|
---|
1603 |
|
---|
1604 | #if defined(DHCP4_CLI_CFG)
|
---|
1605 | dhcp4c_info(portid);
|
---|
1606 | #endif
|
---|
1607 | break;
|
---|
1608 | }
|
---|
1609 |
|
---|
1610 | SIG_NET_CONS_PRINTF();
|
---|
1611 | FLUSH_SND_BUFF();
|
---|
1612 | }
|
---|
1613 |
|
---|
1614 | #endif /* of #if defined(DHCP6_CLI_CFG) || defined(DHCP4_CLI_CFG) */
|
---|
1615 |
|
---|
1616 | #if defined(SUPPORT_INET6)
|
---|
1617 |
|
---|
1618 | #if NUM_ND6_DEF_RTR_ENTRY > 0
|
---|
1619 |
|
---|
1620 | /*
|
---|
1621 | * defrtrlist_status -- ãã£ãã©ã«ãã«ã¼ã¿ã»ãªã¹ãç¶æ
|
---|
1622 | ã®åºå
|
---|
1623 | */
|
---|
1624 |
|
---|
1625 | static void
|
---|
1626 | defrtrlist_status (ID portid, char *line)
|
---|
1627 | {
|
---|
1628 | const T_DEF_ROUTER *dr;
|
---|
1629 | SYSTIM now;
|
---|
1630 | int_t rix, pix, pcnt, ptitle;
|
---|
1631 | uint_t count, mask;
|
---|
1632 |
|
---|
1633 | WAI_NET_CONS_PRINTF();
|
---|
1634 | cons_printf(portid,
|
---|
1635 | "Default Router List Status\n"
|
---|
1636 | "IX Expire Lifetime flags prefix");
|
---|
1637 | for (ptitle = NUM_ND6_PREFIX_ENTRY * 2 - sizeof("prefix"); ptitle -- > 0; )
|
---|
1638 | cons_printf(portid, " ");
|
---|
1639 | cons_printf(portid, " IP Address\n");
|
---|
1640 |
|
---|
1641 | /* expire ã®åä½ã¯ [us]ã*/
|
---|
1642 | get_tim(&now);
|
---|
1643 | dr = nd6_get_drl(&count);
|
---|
1644 | for (rix = 0; rix < count; rix ++) {
|
---|
1645 | if (dr[rix].state == ND6_DEF_RTR_BUSY) {
|
---|
1646 | cons_printf(portid, "%2d", rix);
|
---|
1647 | if (dr[rix].lifetime == ND6_INFINITE_LIFETIME)
|
---|
1648 | cons_printf(portid, " INFIN INFIN");
|
---|
1649 | else
|
---|
1650 | cons_printf(portid, " %6d %8d",
|
---|
1651 | (uint32_t)(dr[rix].expire - now) <= 0
|
---|
1652 | ? 0 : (dr[rix].expire - now) / SYSTIM_HZ,
|
---|
1653 | dr[rix].lifetime / SYSTIM_HZ);
|
---|
1654 | cons_printf(portid, " %02x", dr[rix].flags);
|
---|
1655 | pcnt = NUM_ND6_PREFIX_ENTRY;
|
---|
1656 | ptitle = NUM_ND6_PREFIX_ENTRY * 2 - sizeof(" prefix");
|
---|
1657 | mask = 1;
|
---|
1658 | for (pix = 0; pix < NUM_ND6_PREFIX_ENTRY; pix ++) {
|
---|
1659 | if ((dr[rix].plistmap & mask) != 0) {
|
---|
1660 | if (pcnt == NUM_ND6_PREFIX_ENTRY)
|
---|
1661 | cons_printf(portid, " ");
|
---|
1662 | else
|
---|
1663 | cons_printf(portid, ",");
|
---|
1664 | cons_printf(portid, "%d", pix);
|
---|
1665 | pcnt --;
|
---|
1666 | ptitle -= 2;
|
---|
1667 | }
|
---|
1668 | mask <<= 1;
|
---|
1669 | }
|
---|
1670 | while (pcnt --) {
|
---|
1671 | cons_printf(portid, " ");
|
---|
1672 | ptitle -= 2;
|
---|
1673 | }
|
---|
1674 | while (ptitle -- > 0)
|
---|
1675 | cons_printf(portid, " ");
|
---|
1676 | cons_printf(portid, " %lI\n", &dr[rix].addr);
|
---|
1677 | }
|
---|
1678 | }
|
---|
1679 |
|
---|
1680 | SIG_NET_CONS_PRINTF();
|
---|
1681 | FLUSH_SND_BUFF();
|
---|
1682 | }
|
---|
1683 |
|
---|
1684 | /*
|
---|
1685 | * prefixlist_status -- ãã¬ãã£ãã¯ã¹ã»ãªã¹ãç¶æ
|
---|
1686 | ã®åºå
|
---|
1687 | */
|
---|
1688 |
|
---|
1689 | static void
|
---|
1690 | prefixlist_status (ID portid, char *line)
|
---|
1691 | {
|
---|
1692 | const T_ND6_PREFIX *pr;
|
---|
1693 | SYSTIM now;
|
---|
1694 | int_t rix, pix, rcnt, rtitle;
|
---|
1695 | uint_t mask;
|
---|
1696 |
|
---|
1697 | WAI_NET_CONS_PRINTF();
|
---|
1698 | cons_printf(portid,
|
---|
1699 | "Prefix List Status\n"
|
---|
1700 | "IX Expire Lifetime flags router");
|
---|
1701 | for (rtitle = NUM_ND6_DEF_RTR_ENTRY * 2 - sizeof("router"); rtitle -- > 0; )
|
---|
1702 | cons_printf(portid, " ");
|
---|
1703 | cons_printf(portid, " Len Prefix\n");
|
---|
1704 |
|
---|
1705 | /* expire ã®åä½ã¯ [s]ã*/
|
---|
1706 | get_tim(&now);
|
---|
1707 | now /= SYSTIM_HZ;
|
---|
1708 | pr = nd6_get_prl();
|
---|
1709 | for (pix = 0; pix < NUM_ND6_PREFIX_ENTRY; pix ++) {
|
---|
1710 | if ((pr[pix].flags & ND6_PREFIX_STATE_BUSY) != 0) {
|
---|
1711 | cons_printf(portid, "%2d", pix);
|
---|
1712 | if (pr[pix].vltime == ND6_INFINITE_LIFETIME)
|
---|
1713 | cons_printf(portid, " INFIN INFIN");
|
---|
1714 | else
|
---|
1715 | cons_printf(portid, " %7d %8d",
|
---|
1716 | (uint32_t)(pr[pix].expire - now) <= 0
|
---|
1717 | ? 0 : (pr[pix].expire - now),
|
---|
1718 | pr[pix].vltime);
|
---|
1719 | cons_printf(portid, " %02x", pr[pix].flags);
|
---|
1720 | rcnt = NUM_ND6_DEF_RTR_ENTRY;
|
---|
1721 | rtitle = NUM_ND6_DEF_RTR_ENTRY * 2 - sizeof(" router");
|
---|
1722 | mask = 1;
|
---|
1723 | for (rix = 0; rix < NUM_ND6_DEF_RTR_ENTRY; rix ++) {
|
---|
1724 | if ((pr[pix].routermap & mask) != 0) {
|
---|
1725 | if (rcnt == NUM_ND6_DEF_RTR_ENTRY)
|
---|
1726 | cons_printf(portid, " ");
|
---|
1727 | else
|
---|
1728 | cons_printf(portid, ",");
|
---|
1729 | cons_printf(portid, "%d", rix);
|
---|
1730 | rcnt --;
|
---|
1731 | rtitle -= 2;
|
---|
1732 | }
|
---|
1733 | mask <<= 1;
|
---|
1734 | }
|
---|
1735 | while (rcnt --) {
|
---|
1736 | cons_printf(portid, " ");
|
---|
1737 | rtitle -= 2;
|
---|
1738 | }
|
---|
1739 | while (rtitle -- > 0)
|
---|
1740 | cons_printf(portid, " ");
|
---|
1741 | cons_printf(portid, "%4d %lI\n", pr[pix].prefix_len, &pr[pix].prefix);
|
---|
1742 | }
|
---|
1743 | }
|
---|
1744 |
|
---|
1745 | SIG_NET_CONS_PRINTF();
|
---|
1746 | FLUSH_SND_BUFF();
|
---|
1747 | }
|
---|
1748 |
|
---|
1749 | #endif /* of #if NUM_ND6_DEF_RTR_ENTRY > 0 */
|
---|
1750 |
|
---|
1751 | #if NUM_IN6_ROUTE_ENTRY > 0
|
---|
1752 |
|
---|
1753 | /*
|
---|
1754 | * routing6_table_status -- çµè·¯è¡¨ï¼IPv6ï¼ã®åºå
|
---|
1755 | */
|
---|
1756 |
|
---|
1757 | static void
|
---|
1758 | routing6_table_status (ID portid, char *line)
|
---|
1759 | {
|
---|
1760 | SYSTIM now;
|
---|
1761 | int_t ix;
|
---|
1762 |
|
---|
1763 | WAI_NET_CONS_PRINTF();
|
---|
1764 | cons_printf(portid,
|
---|
1765 | "\nRouting Table Status (IPv6)\n"
|
---|
1766 | "IX Expire flags Prefix Target Gateway\n");
|
---|
1767 |
|
---|
1768 | for (ix = 0; ix < NUM_IN6_STATIC_ROUTE_ENTRY; ix ++) {
|
---|
1769 | cons_printf(portid, "%2d STATIC - %6d %30lI %lI\n",
|
---|
1770 | ix,
|
---|
1771 | routing6_tbl[ix].prefix_len,
|
---|
1772 | &routing6_tbl[ix].target,
|
---|
1773 | &routing6_tbl[ix].gateway);
|
---|
1774 |
|
---|
1775 | }
|
---|
1776 |
|
---|
1777 | /* expire ã®åä½ã¯ [s]ã*/
|
---|
1778 | get_tim(&now);
|
---|
1779 | now /= SYSTIM_HZ;
|
---|
1780 |
|
---|
1781 | for ( ; ix < NUM_IN6_ROUTE_ENTRY; ix ++)
|
---|
1782 | if (routing6_tbl[ix].flags & IN_RTF_DEFINED)
|
---|
1783 | cons_printf(portid, "%2d %6d %02x %6d %30lI %lI\n",
|
---|
1784 | ix,
|
---|
1785 | (uint32_t)(routing6_tbl[ix].expire - now) <= 0
|
---|
1786 | ? 0 : routing6_tbl[ix].expire - now,
|
---|
1787 | routing6_tbl[ix].flags,
|
---|
1788 | routing6_tbl[ix].prefix_len,
|
---|
1789 | &routing6_tbl[ix].target,
|
---|
1790 | &routing6_tbl[ix].gateway);
|
---|
1791 |
|
---|
1792 | SIG_NET_CONS_PRINTF();
|
---|
1793 | FLUSH_SND_BUFF();
|
---|
1794 | }
|
---|
1795 |
|
---|
1796 | #endif /* of #if NUM_IN6_ROUTE_ENTRY > 0 */
|
---|
1797 |
|
---|
1798 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
1799 |
|
---|
1800 | #if defined(SUPPORT_INET4)
|
---|
1801 |
|
---|
1802 | #if NUM_IN4_ROUTE_ENTRY > 0
|
---|
1803 |
|
---|
1804 | /*
|
---|
1805 | * routing4_table_status -- çµè·¯è¡¨ï¼IPv4ï¼ã®åºå
|
---|
1806 | */
|
---|
1807 |
|
---|
1808 | static void
|
---|
1809 | routing4_table_status (ID portid, char *line)
|
---|
1810 | {
|
---|
1811 | int_t ix;
|
---|
1812 |
|
---|
1813 | if ('0' <= *(line = skip_blanks(line)) && *line <= '9') {
|
---|
1814 | T_IN4_ADDR target, mask, gateway;
|
---|
1815 |
|
---|
1816 | ix = atoi(line);
|
---|
1817 | while ('0' <= *line && *line <= '9')
|
---|
1818 | line ++;
|
---|
1819 | line = get_ipv4addr(&target, skip_blanks(line));
|
---|
1820 | line = get_ipv4addr(&mask, skip_blanks(line));
|
---|
1821 | get_ipv4addr(&gateway, skip_blanks(line));
|
---|
1822 | in4_add_route(ix, target, mask, gateway);
|
---|
1823 | }
|
---|
1824 |
|
---|
1825 | WAI_NET_CONS_PRINTF();
|
---|
1826 | cons_printf(portid,
|
---|
1827 | "\nRouting Table Status (IPv4)\n"
|
---|
1828 | "IX Target Mask Gateway Expire\n");
|
---|
1829 |
|
---|
1830 | for (ix = 0; ix < NUM_IN4_ROUTE_ENTRY; ix ++) {
|
---|
1831 | if ((routing4_tbl[ix].flags & IN_RTF_DEFINED) == 0)
|
---|
1832 | ;
|
---|
1833 | else if ((routing4_tbl[ix].flags & IN_RTF_REDIRECT) != 0)
|
---|
1834 | cons_printf(portid, "%2d %15hI %15hI %15hI %4d\n",
|
---|
1835 | ix,
|
---|
1836 | &routing4_tbl[ix].target,
|
---|
1837 | &routing4_tbl[ix].mask,
|
---|
1838 | &routing4_tbl[ix].gateway,
|
---|
1839 | &routing4_tbl[ix].expire);
|
---|
1840 | else
|
---|
1841 | cons_printf(portid, "%2d %15hI %15hI %hI\n",
|
---|
1842 | ix,
|
---|
1843 | &routing4_tbl[ix].target,
|
---|
1844 | &routing4_tbl[ix].mask,
|
---|
1845 | &routing4_tbl[ix].gateway);
|
---|
1846 |
|
---|
1847 | }
|
---|
1848 |
|
---|
1849 | SIG_NET_CONS_PRINTF();
|
---|
1850 | FLUSH_SND_BUFF();
|
---|
1851 | }
|
---|
1852 |
|
---|
1853 | #endif /* of #if NUM_IN4_ROUTE_ENTRY > 0 */
|
---|
1854 |
|
---|
1855 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
1856 |
|
---|
1857 | /*
|
---|
1858 | * routing_status -- çµè·¯æ
|
---|
1859 | å ±
|
---|
1860 | */
|
---|
1861 |
|
---|
1862 | static void
|
---|
1863 | routing_status (ID portid, char *line)
|
---|
1864 | {
|
---|
1865 | switch (*line) {
|
---|
1866 |
|
---|
1867 | #if defined(SUPPORT_INET6) && NUM_ND6_DEF_RTR_ENTRY > 0
|
---|
1868 |
|
---|
1869 | case 'l': /* ãã£ãã©ã«ãã«ã¼ã¿ã»ãªã¹ãæ
|
---|
1870 | å ± */
|
---|
1871 | defrtrlist_status(portid, line + 1);
|
---|
1872 | break;
|
---|
1873 |
|
---|
1874 | case 'p': /* ãã¬ãã£ãã¯ã¹ã»ãªã¹ãæ
|
---|
1875 | å ± */
|
---|
1876 | prefixlist_status(portid, line + 1);
|
---|
1877 | break;
|
---|
1878 |
|
---|
1879 | #endif /* #if defined(SUPPORT_INET6) && NUM_ND6_DEF_RTR_ENTRY > 0 */
|
---|
1880 |
|
---|
1881 | default:
|
---|
1882 |
|
---|
1883 | /* çµè·¯è¡¨æ
|
---|
1884 | å ± */
|
---|
1885 |
|
---|
1886 | #if defined(SUPPORT_INET6) && NUM_IN6_ROUTE_ENTRY > 0
|
---|
1887 | routing6_table_status(portid, line);
|
---|
1888 | #endif
|
---|
1889 |
|
---|
1890 | #if defined(SUPPORT_INET4) && NUM_IN4_ROUTE_ENTRY > 0
|
---|
1891 | routing4_table_status(portid, line);
|
---|
1892 | #endif
|
---|
1893 |
|
---|
1894 | break;
|
---|
1895 | }
|
---|
1896 | }
|
---|
1897 |
|
---|
1898 | /*
|
---|
1899 | * dbg_cons_network_status -- ãããã¯ã¼ã¯ã®ç¶æ
|
---|
1900 | ã®åºå
|
---|
1901 | */
|
---|
1902 |
|
---|
1903 | void
|
---|
1904 | dbg_cons_network_status (ID portid, char *line)
|
---|
1905 | {
|
---|
1906 | switch (*line) {
|
---|
1907 |
|
---|
1908 | #ifdef SUPPORT_ETHER
|
---|
1909 |
|
---|
1910 | case 'a': /* IF ã¢ãã¬ã¹æ
|
---|
1911 | å ± */
|
---|
1912 |
|
---|
1913 | #if defined(SUPPORT_INET6)
|
---|
1914 | ifa6_status(portid, line + 1);
|
---|
1915 | #endif
|
---|
1916 | #if defined(SUPPORT_INET4)
|
---|
1917 | ifa4_status(portid, line + 1);
|
---|
1918 | #endif
|
---|
1919 |
|
---|
1920 | break;
|
---|
1921 |
|
---|
1922 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
1923 |
|
---|
1924 | case 'b': /* ãããã¯ã¼ã¯ãããã¡æ
|
---|
1925 | å ± */
|
---|
1926 | nbuf_status(portid, line + 1);
|
---|
1927 | break;
|
---|
1928 |
|
---|
1929 | #if NET_COUNT_ENABLE
|
---|
1930 |
|
---|
1931 | case 'c': /* ãããã¯ã¼ã¯çµ±è¨æ
|
---|
1932 | å ± */
|
---|
1933 | net_count(portid, line + 1);
|
---|
1934 | break;
|
---|
1935 |
|
---|
1936 | #endif /* of #if NET_COUNT_ENABLE */
|
---|
1937 |
|
---|
1938 | case 'r': /* çµè·¯æ
|
---|
1939 | å ± */
|
---|
1940 | routing_status(portid, line + 1);
|
---|
1941 | break;
|
---|
1942 |
|
---|
1943 | #ifdef USE_RESOLVER
|
---|
1944 |
|
---|
1945 | case 's': /* name lookup */
|
---|
1946 | if (*(line = skip_blanks(line + 1)) == '\0')
|
---|
1947 | dns_info(portid);
|
---|
1948 | else
|
---|
1949 | name_lookup(portid, line);
|
---|
1950 | break;
|
---|
1951 |
|
---|
1952 | #endif /* of #ifdef USE_RESOLVER */
|
---|
1953 |
|
---|
1954 | #ifdef SUPPORT_TCP
|
---|
1955 |
|
---|
1956 | case 't': /* TCP status */
|
---|
1957 | tcp_status(portid, line + 1);
|
---|
1958 | break;
|
---|
1959 |
|
---|
1960 | #endif /* of #ifdef SUPPORT_TCP */
|
---|
1961 |
|
---|
1962 | #ifdef SUPPORT_UDP
|
---|
1963 |
|
---|
1964 | case 'u': /* UDP status */
|
---|
1965 | udp_status(portid, line + 1);
|
---|
1966 | break;
|
---|
1967 |
|
---|
1968 | #endif /* of #ifdef SUPPORT_UDP */
|
---|
1969 |
|
---|
1970 | default:
|
---|
1971 | cons_printf(portid, "no such command: '%c%c'.\n", *(line - 1), *line);
|
---|
1972 | SIG_NET_CONS_PRINTF();
|
---|
1973 | FLUSH_SND_BUFF();
|
---|
1974 | break;
|
---|
1975 | }
|
---|
1976 | }
|
---|
1977 |
|
---|
1978 | /*
|
---|
1979 | * dbg_cons_ifconfig -- ãããã¯ã¼ã¯ã¤ã³ã¿ãã§ã¼ã¹ã®æ§ææ
|
---|
1980 | å ±
|
---|
1981 | */
|
---|
1982 |
|
---|
1983 | void
|
---|
1984 | dbg_cons_ifconfig (ID portid, char *line)
|
---|
1985 | {
|
---|
1986 | #ifdef SUPPORT_ETHER
|
---|
1987 |
|
---|
1988 | T_IF_SOFTC *ic;
|
---|
1989 |
|
---|
1990 | WAI_NET_CONS_PRINTF();
|
---|
1991 | ic = IF_ETHER_NIC_GET_SOFTC();
|
---|
1992 | cons_printf(portid, "ether: %M\n", ic->ifaddr.lladdr);
|
---|
1993 | SIG_NET_CONS_PRINTF();
|
---|
1994 | FLUSH_SND_BUFF();
|
---|
1995 |
|
---|
1996 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
1997 | }
|
---|
1998 |
|
---|
1999 | #if defined(NETAPP_IP6_CFG)
|
---|
2000 |
|
---|
2001 | /*
|
---|
2002 | * dbg_cons_ifconfig6 -- ãããã¯ã¼ã¯ã¤ã³ã¿ãã§ã¼ã¹ï¼IPv6ï¼ã®æ§ææ
|
---|
2003 | å ±
|
---|
2004 | */
|
---|
2005 |
|
---|
2006 | void
|
---|
2007 | dbg_cons_ifconfig6 (ID portid, char *line)
|
---|
2008 | {
|
---|
2009 | #ifdef SUPPORT_ETHER
|
---|
2010 |
|
---|
2011 | T_IFNET *ifp = IF_GET_IFNET();
|
---|
2012 | int_t ix;
|
---|
2013 | SYSTIM now;
|
---|
2014 |
|
---|
2015 | WAI_NET_CONS_PRINTF();
|
---|
2016 |
|
---|
2017 | /* expire 㨠vltime ã®åä½ã¯ [s]ã*/
|
---|
2018 | get_tim(&now);
|
---|
2019 | now /= SYSTIM_HZ;
|
---|
2020 |
|
---|
2021 | cons_printf(portid, "IPv6:\nIX Expire Preffered RTR PFX Flags IP Address\n");
|
---|
2022 | for (ix = 0; ix < NUM_IN6_IFADDR_ENTRY; ix ++) {
|
---|
2023 | if (ifp->in6_ifaddrs[ix].flags & IN6_IFF_DEFINED) {
|
---|
2024 | cons_printf(portid, " %d", ix);
|
---|
2025 | if (ifp->in6_ifaddrs[ix].lifetime.vltime == ND6_INFINITE_LIFETIME)
|
---|
2026 | cons_printf(portid, " INFIN INFIN");
|
---|
2027 | else
|
---|
2028 | cons_printf(portid, " %8d %9d",
|
---|
2029 | (uint32_t)(ifp->in6_ifaddrs[ix].lifetime.expire - now) <= 0
|
---|
2030 | ? 0 : ifp->in6_ifaddrs[ix].lifetime.expire - now,
|
---|
2031 | (uint32_t)(ifp->in6_ifaddrs[ix].lifetime.preferred - now) <= 0
|
---|
2032 | ? 0 : ifp->in6_ifaddrs[ix].lifetime.preferred - now);
|
---|
2033 | if (ifp->in6_ifaddrs[ix].router_index == IN6_RTR_IX_UNREACH)
|
---|
2034 | cons_printf(portid, " -");
|
---|
2035 | else
|
---|
2036 | cons_printf(portid, " %3d", ifp->in6_ifaddrs[ix].router_index);
|
---|
2037 | if (ifp->in6_ifaddrs[ix].prefix_index == ND6_PREFIX_IX_INVALID)
|
---|
2038 | cons_printf(portid, " -");
|
---|
2039 | else
|
---|
2040 | cons_printf(portid, " %3d", ifp->in6_ifaddrs[ix].prefix_index);
|
---|
2041 | cons_printf(portid, " %02x %lI\n",
|
---|
2042 | ifp->in6_ifaddrs[ix].flags,
|
---|
2043 | &ifp->in6_ifaddrs[ix].addr);
|
---|
2044 | }
|
---|
2045 | }
|
---|
2046 |
|
---|
2047 | #ifdef DHCP6_CLI_CFG
|
---|
2048 | dhcp6c_info(portid);
|
---|
2049 | #endif
|
---|
2050 |
|
---|
2051 | SIG_NET_CONS_PRINTF();
|
---|
2052 | FLUSH_SND_BUFF();
|
---|
2053 |
|
---|
2054 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
2055 | }
|
---|
2056 |
|
---|
2057 | #endif /* of #if defined(NETAPP_IP6_CFG) */
|
---|
2058 |
|
---|
2059 | #if defined(NETAPP_IP4_CFG)
|
---|
2060 |
|
---|
2061 | /*
|
---|
2062 | * dbg_cons_ifconfig4 -- ãããã¯ã¼ã¯ã¤ã³ã¿ãã§ã¼ã¹ï¼IPv4ï¼ã®æ§ææ
|
---|
2063 | å ±
|
---|
2064 | */
|
---|
2065 |
|
---|
2066 | void
|
---|
2067 | dbg_cons_ifconfig4 (ID portid, char *line)
|
---|
2068 | {
|
---|
2069 | T_IFNET *ifp = IF_GET_IFNET();
|
---|
2070 | T_IN4_ADDR bc;
|
---|
2071 |
|
---|
2072 | #ifdef SUPPORT_ETHER
|
---|
2073 |
|
---|
2074 | if (*(line = skip_blanks(line))) {
|
---|
2075 | T_IN4_ADDR addr, mask;
|
---|
2076 |
|
---|
2077 | get_ipv4addr(&mask, skip_blanks(get_ipv4addr(&addr, line)));
|
---|
2078 | in4_add_ifaddr(addr, mask);
|
---|
2079 | }
|
---|
2080 |
|
---|
2081 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
2082 |
|
---|
2083 | WAI_NET_CONS_PRINTF();
|
---|
2084 |
|
---|
2085 | bc = (ifp->in4_ifaddr.addr & ifp->in4_ifaddr.mask) | ~ifp->in4_ifaddr.mask;
|
---|
2086 | cons_printf(portid,
|
---|
2087 | "IPv4: %hI, mask: %hI, broadcast: %hI\n",
|
---|
2088 | &ifp->in4_ifaddr.addr,
|
---|
2089 | &ifp->in4_ifaddr.mask,
|
---|
2090 | &bc);
|
---|
2091 |
|
---|
2092 | #ifdef DHCP4_CLI_CFG
|
---|
2093 | dhcp4c_info(portid);
|
---|
2094 | #endif
|
---|
2095 |
|
---|
2096 | SIG_NET_CONS_PRINTF();
|
---|
2097 | FLUSH_SND_BUFF();
|
---|
2098 | }
|
---|
2099 |
|
---|
2100 | #endif /* of #if defined(NETAPP_IP4_CFG) */
|
---|
2101 |
|
---|
2102 | /*
|
---|
2103 | * dbg_cons_show_config -- ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³è¨å®ã®è¡¨ç¤º
|
---|
2104 | */
|
---|
2105 |
|
---|
2106 | void
|
---|
2107 | dbg_cons_show_config (ID portid, char *line)
|
---|
2108 | {
|
---|
2109 | #if defined(SUPPORT_ETHER)
|
---|
2110 | #if defined(SUPPORT_INET4)
|
---|
2111 | T_IN4_ADDR addr;
|
---|
2112 | #endif
|
---|
2113 | #endif /* of #if defined(SUPPORT_ETHER) */
|
---|
2114 |
|
---|
2115 | cons_printf(portid, "DHCP:\n");
|
---|
2116 | cons_printf(portid, " DHCP6_CLI_CFG: ");
|
---|
2117 |
|
---|
2118 | #if defined(DHCP6_CLI_CFG)
|
---|
2119 |
|
---|
2120 | cons_printf(portid, "On\n Mode: ");
|
---|
2121 |
|
---|
2122 | #if DHCP6_CLI_CFG_MODE == DHCP6_CLI_CFG_STATELESS
|
---|
2123 | cons_printf(portid, "STATELESS\n");
|
---|
2124 | #elif DHCP6_CLI_CFG_MODE == DHCP6_CLI_CFG_STATEFULL
|
---|
2125 | cons_printf(portid, "STATEFULL\n");
|
---|
2126 | #endif
|
---|
2127 |
|
---|
2128 | #else /* of #if define(DHCP6_CLI_CFG) */
|
---|
2129 |
|
---|
2130 | cons_printf(portid, "Off\n");
|
---|
2131 |
|
---|
2132 | #endif /* of #if define(DHCP6_CLI_CFG) */
|
---|
2133 |
|
---|
2134 | cons_printf(portid, " DHCP4_CLI_CFG: ");
|
---|
2135 |
|
---|
2136 | #if defined(DHCP4_CLI_CFG)
|
---|
2137 | cons_printf(portid, "On\n");
|
---|
2138 | #else
|
---|
2139 | cons_printf(portid, "Off\n");
|
---|
2140 | #endif
|
---|
2141 |
|
---|
2142 | cons_printf(portid, "Resolver:\n");
|
---|
2143 | cons_printf(portid, " USE_RESOLVER: ");
|
---|
2144 |
|
---|
2145 | #if defined(USE_RESOLVER)
|
---|
2146 | cons_printf(portid, "On\n");
|
---|
2147 | #else
|
---|
2148 | cons_printf(portid, "Off\n");
|
---|
2149 | #endif
|
---|
2150 |
|
---|
2151 | #if defined(SUPPORT_TCP)
|
---|
2152 |
|
---|
2153 | cons_printf(portid, "TCP:\n");
|
---|
2154 |
|
---|
2155 | cons_printf(portid, " TCP_CFG_OPT_MSS: ");
|
---|
2156 | #if defined(TCP_CFG_OPT_MSS)
|
---|
2157 | cons_printf(portid, "On\n");
|
---|
2158 | #else
|
---|
2159 | cons_printf(portid, "Off\n");
|
---|
2160 | #endif
|
---|
2161 |
|
---|
2162 | cons_printf(portid, " TCP_CFG_DELAY_ACK: ");
|
---|
2163 | #if defined(TCP_CFG_DELAY_ACK)
|
---|
2164 | cons_printf(portid, "On\n");
|
---|
2165 | #else
|
---|
2166 | cons_printf(portid, "Off\n");
|
---|
2167 | #endif
|
---|
2168 |
|
---|
2169 | cons_printf(portid, " TCP_CFG_ALWAYS_KEEP: ");
|
---|
2170 | #if defined(TCP_CFG_ALWAYS_KEEP)
|
---|
2171 | cons_printf(portid, "On\n");
|
---|
2172 | #else
|
---|
2173 | cons_printf(portid, "Off\n");
|
---|
2174 | #endif
|
---|
2175 |
|
---|
2176 | cons_printf(portid, " TCP_CFG_RWBUF_CSAVE: ");
|
---|
2177 | #if defined(TCP_CFG_RWBUF_CSAVE_ONLY)
|
---|
2178 | cons_printf(portid, "Only, ");
|
---|
2179 | #if defined(TCP_CFG_RWBUF_CSAVE_MAX_QUEUES)
|
---|
2180 | cons_printf(portid, "TCP_CFG_RWBUF_CSAVE_MAX_QUEUES: %2d\n",
|
---|
2181 | TCP_CFG_RWBUF_CSAVE_MAX_QUEUES);
|
---|
2182 | #else
|
---|
2183 | cons_printf(portid, "TCP_CFG_RWBUF_CSAVE_MAX_QUEUES: Undefined\n");
|
---|
2184 | #endif
|
---|
2185 | #elif defined(TCP_CFG_RWBUF_CSAVE)
|
---|
2186 | cons_printf(portid, "On, ");
|
---|
2187 | #if defined(TCP_CFG_RWBUF_CSAVE_MAX_QUEUES)
|
---|
2188 | cons_printf(portid, "TCP_CFG_RWBUF_CSAVE_MAX_QUEUES: %2d\n",
|
---|
2189 | TCP_CFG_RWBUF_CSAVE_MAX_QUEUES);
|
---|
2190 | #else
|
---|
2191 | cons_printf(portid, "TCP_CFG_RWBUF_CSAVE_MAX_QUEUES: Undefined\n");
|
---|
2192 | #endif
|
---|
2193 | #else
|
---|
2194 | cons_printf(portid, "Off\n");
|
---|
2195 | #endif
|
---|
2196 |
|
---|
2197 | cons_printf(portid, " TCP_CFG_SWBUF_CSAVE: ");
|
---|
2198 | #if defined(TCP_CFG_SWBUF_CSAVE_ONLY)
|
---|
2199 | cons_printf(portid, "Only, TCP_CFG_SWBUF_CSAVE_MAX_SIZE: %4d\n"
|
---|
2200 | " "
|
---|
2201 | " TCP_CFG_SWBUF_CSAVE_MIN_SIZE: %4d\n",
|
---|
2202 | TCP_CFG_SWBUF_CSAVE_MAX_SIZE,
|
---|
2203 | TCP_CFG_SWBUF_CSAVE_MIN_SIZE);
|
---|
2204 | #elif defined(TCP_CFG_SWBUF_CSAVE)
|
---|
2205 | cons_printf(portid, "On, TCP_CFG_SWBUF_CSAVE_MAX_SIZE: %4d\n"
|
---|
2206 | " "
|
---|
2207 | " TCP_CFG_SWBUF_CSAVE_MIN_SIZE: %4d\n",
|
---|
2208 | TCP_CFG_SWBUF_CSAVE_MAX_SIZE,
|
---|
2209 | TCP_CFG_SWBUF_CSAVE_MIN_SIZE);
|
---|
2210 | #else
|
---|
2211 | cons_printf(portid, "Off\n");
|
---|
2212 | #endif
|
---|
2213 |
|
---|
2214 | cons_printf(portid, " TCP_CFG_NON_BLOCKING: ");
|
---|
2215 | #if defined(TCP_CFG_NON_BLOCKING)
|
---|
2216 | #if defined(USE_TCP_NON_BLOCKING)
|
---|
2217 | cons_printf(portid, "Use\n");
|
---|
2218 | #else
|
---|
2219 | cons_printf(portid, "On\n");
|
---|
2220 | #endif
|
---|
2221 | #else
|
---|
2222 | cons_printf(portid, "Off\n");
|
---|
2223 | #endif
|
---|
2224 |
|
---|
2225 | cons_printf(portid, " TCP_CFG_NON_BLOCKING_COMPAT14: ");
|
---|
2226 | #if defined(TCP_CFG_NON_BLOCKING_COMPAT14)
|
---|
2227 | cons_printf(portid, "On\n");
|
---|
2228 | #else
|
---|
2229 | cons_printf(portid, "Off\n");
|
---|
2230 | #endif
|
---|
2231 |
|
---|
2232 | cons_printf(portid, " TCP_CFG_EXTENTIONS: ");
|
---|
2233 | #if defined(TCP_CFG_EXTENTIONS)
|
---|
2234 | #if defined(USE_TCP_EXTENTIONS)
|
---|
2235 | cons_printf(portid, "Use\n");
|
---|
2236 | #if defined(SUPPORT_INET6)
|
---|
2237 | cons_printf(portid, " NUM_VRID_TCP6_REPS: %3d\n", NUM_VRID_TCP6_REPS);
|
---|
2238 | cons_printf(portid, " NUM_VRID_TCP6_CEPS: %3d\n", NUM_VRID_TCP6_CEPS);
|
---|
2239 | #endif
|
---|
2240 | #if defined(SUPPORT_INET4)
|
---|
2241 | cons_printf(portid, " NUM_VRID_TCP4_REPS: %3d\n", NUM_VRID_TCP4_REPS);
|
---|
2242 | cons_printf(portid, " NUM_VRID_TCP4_CEPS: %3d\n", NUM_VRID_TCP4_CEPS);
|
---|
2243 | #endif
|
---|
2244 | #else
|
---|
2245 | cons_printf(portid, "On\n");
|
---|
2246 | #endif
|
---|
2247 | #else
|
---|
2248 | cons_printf(portid, "Off\n");
|
---|
2249 | #endif
|
---|
2250 |
|
---|
2251 | cons_printf(portid, " USE_COPYSAVE_API: ");
|
---|
2252 | #if defined(USE_COPYSAVE_API)
|
---|
2253 | cons_printf(portid, "Use\n");
|
---|
2254 | #else
|
---|
2255 | cons_printf(portid, "Off\n");
|
---|
2256 | #endif
|
---|
2257 |
|
---|
2258 | #if NUM_TCP_TW_CEP_ENTRY > 0
|
---|
2259 | cons_printf(portid, " TCP_TW_CEP: On, NUM_TCP_TW_CEP_ENTRY: %d\n", NUM_TCP_TW_CEP_ENTRY);
|
---|
2260 | #else
|
---|
2261 | cons_printf(portid, " TCP_TW_CEP: Off\n");
|
---|
2262 | #endif
|
---|
2263 |
|
---|
2264 | #if defined(TCP_CFG_TRACE)
|
---|
2265 | cons_printf(portid, " TCP_CFG_TRACE: On, TCP_CFG_TRACE_LPORTNO: %d\n", TCP_CFG_TRACE_LPORTNO);
|
---|
2266 | #if defined(SUPPORT_INET4)
|
---|
2267 | addr = TCP_CFG_TRACE_IPV4_RADDR;
|
---|
2268 | cons_printf(portid, " TCP_CFG_TRACE_IPV4_RADDR: %hI\n", &addr);
|
---|
2269 | #endif
|
---|
2270 | cons_printf(portid, " TCP_CFG_TRACE_RPORTNO: %d\n", TCP_CFG_TRACE_RPORTNO);
|
---|
2271 | #else
|
---|
2272 | cons_printf(portid, " TCP_CFG_TRACE: Off\n");
|
---|
2273 | #endif
|
---|
2274 |
|
---|
2275 | cons_printf(portid, " MAX_TCP_SND_SEG: %4d\n", MAX_TCP_SND_SEG);
|
---|
2276 | cons_printf(portid, " DEF_TCP_SND_SEG: %4d\n", DEF_TCP_SND_SEG);
|
---|
2277 | cons_printf(portid, " MAX_TCP_RCV_SEG: %4d\n", MAX_TCP_RCV_SEG);
|
---|
2278 | cons_printf(portid, " DEF_TCP_RCV_SEG: %4d\n", DEF_TCP_RCV_SEG);
|
---|
2279 | cons_printf(portid, " MAX_TCP_REALLOC_SIZE: %4d\n", MAX_TCP_REALLOC_SIZE);
|
---|
2280 |
|
---|
2281 | #endif /* of #if defined(SUPPORT_TCP) */
|
---|
2282 |
|
---|
2283 | #if defined(SUPPORT_UDP)
|
---|
2284 |
|
---|
2285 | cons_printf(portid, "UDP:\n");
|
---|
2286 |
|
---|
2287 | cons_printf(portid, " UDP_CFG_IN_CHECKSUM: ");
|
---|
2288 | #if defined(UDP_CFG_IN_CHECKSUM)
|
---|
2289 | cons_printf(portid, "On\n");
|
---|
2290 | #else
|
---|
2291 | cons_printf(portid, "Off\n");
|
---|
2292 | #endif
|
---|
2293 |
|
---|
2294 | cons_printf(portid, " UDP_CFG_OUT_CHECKSUM: ");
|
---|
2295 | #if defined(UDP_CFG_OUT_CHECKSUM)
|
---|
2296 | cons_printf(portid, "On\n");
|
---|
2297 | #else
|
---|
2298 | cons_printf(portid, "Off\n");
|
---|
2299 | #endif
|
---|
2300 |
|
---|
2301 | cons_printf(portid, " UDP_CFG_NON_BLOCKING: ");
|
---|
2302 | #if defined(UDP_CFG_NON_BLOCKING)
|
---|
2303 | #if defined(USE_UDP_NON_BLOCKING)
|
---|
2304 | cons_printf(portid, "Use\n");
|
---|
2305 | #else
|
---|
2306 | cons_printf(portid, "On\n");
|
---|
2307 | #endif
|
---|
2308 | #else
|
---|
2309 | cons_printf(portid, "Off\n");
|
---|
2310 | #endif
|
---|
2311 |
|
---|
2312 | cons_printf(portid, " UDP_CFG_NON_BLOCKING_COMPAT14: ");
|
---|
2313 | #if defined(UDP_CFG_NON_BLOCKING_COMPAT14)
|
---|
2314 | cons_printf(portid, "On\n");
|
---|
2315 | #else
|
---|
2316 | cons_printf(portid, "Off\n");
|
---|
2317 | #endif
|
---|
2318 |
|
---|
2319 | cons_printf(portid, " UDP_CFG_EXTENTIONS: ");
|
---|
2320 | #if defined(UDP_CFG_EXTENTIONS)
|
---|
2321 | #if defined(USE_UDP_EXTENTIONS)
|
---|
2322 | cons_printf(portid, "Use\n");
|
---|
2323 | #else
|
---|
2324 | cons_printf(portid, "On\n");
|
---|
2325 | #endif
|
---|
2326 | cons_printf(portid, " NUM_VRID_UDP4_CEPS: %3d\n", NUM_VRID_UDP4_CEPS);
|
---|
2327 | cons_printf(portid, " NUM_VRID_UDP6_CEPS: %3d\n", NUM_VRID_UDP6_CEPS);
|
---|
2328 | #else
|
---|
2329 | cons_printf(portid, "Off\n");
|
---|
2330 | #endif
|
---|
2331 |
|
---|
2332 | cons_printf(portid, " NUM_DTQ_UDP_RCVQ: %3d\n", NUM_DTQ_UDP_RCVQ);
|
---|
2333 | cons_printf(portid, " NUM_DTQ_UDP_OUTPUT: %3d\n", NUM_DTQ_UDP_OUTPUT);
|
---|
2334 |
|
---|
2335 | #endif /* of #if defined(SUPPORT_UDP) */
|
---|
2336 |
|
---|
2337 | cons_printf(portid, "ICMP:\n");
|
---|
2338 |
|
---|
2339 | cons_printf(portid, " ICMP_CFG_CALLBACK_ECHO_REPLY: ");
|
---|
2340 | #if defined(ICMP_CFG_CALLBACK_ECHO_REPLY)
|
---|
2341 | cons_printf(portid, "On\n");
|
---|
2342 | #else
|
---|
2343 | cons_printf(portid, "Off\n");
|
---|
2344 | #endif
|
---|
2345 |
|
---|
2346 | cons_printf(portid, " ICMP_REPLY_ERROR: ");
|
---|
2347 | #if defined(ICMP_REPLY_ERROR)
|
---|
2348 | cons_printf(portid, "On\n");
|
---|
2349 | #else
|
---|
2350 | cons_printf(portid, "Off\n");
|
---|
2351 | #endif
|
---|
2352 |
|
---|
2353 | #if defined(NUM_REDIRECT_ROUTE_ENTRY)
|
---|
2354 | #if NUM_REDIRECT_ROUTE_ENTRY > 0
|
---|
2355 | cons_printf(portid, " TMO_IN_REDIRECT: %4d[s]\n", TMO_IN_REDIRECT / NET_TIMER_HZ);
|
---|
2356 | #endif
|
---|
2357 | #endif /* of #if defined(NUM_REDIRECT_ROUTE_ENTRY) */
|
---|
2358 |
|
---|
2359 | #if defined(SUPPORT_INET6)
|
---|
2360 |
|
---|
2361 | cons_printf(portid, "IPv6:\n");
|
---|
2362 |
|
---|
2363 | cons_printf(portid, " IP6_IPV4_MAPPED_ADDR: ");
|
---|
2364 | #if defined(IP6_CFG_IPV4_MAPPED_ADDR)
|
---|
2365 | cons_printf(portid, "On\n");
|
---|
2366 | #else
|
---|
2367 | cons_printf(portid, "Off\n");
|
---|
2368 | #endif
|
---|
2369 |
|
---|
2370 | cons_printf(portid, " Routing Table:\n");
|
---|
2371 | cons_printf(portid, " NUM_IN6_STATIC_ROUTE_ENTRY: %d\n", NUM_IN6_STATIC_ROUTE_ENTRY);
|
---|
2372 | cons_printf(portid, " NUM_IN6_REDIRECT_ROUTE_ENTRY: %d\n", NUM_IN6_REDIRECT_ROUTE_ENTRY);
|
---|
2373 |
|
---|
2374 | cons_printf(portid, "ND:\n");
|
---|
2375 | cons_printf(portid, " TMO_ND6_RTR_SOL_DELAY: %5d[us]\n", TMO_ND6_RTR_SOL_DELAY);
|
---|
2376 | cons_printf(portid, " TMO_ND6_RTR_SOL_INTERVAL: %5d[us]\n", TMO_ND6_RTR_SOL_INTERVAL);
|
---|
2377 | cons_printf(portid, " NUM_IP6_DAD_COUNT: %5d\n", NUM_IP6_DAD_COUNT);
|
---|
2378 | cons_printf(portid, " NUM_ND6_CACHE_ENTRY: %5d\n", NUM_ND6_CACHE_ENTRY);
|
---|
2379 |
|
---|
2380 | #if defined(SUPPORT_ETHER)
|
---|
2381 |
|
---|
2382 | cons_printf(portid, " NUM_ND6_DEF_RTR_ENTRY %5d\n", NUM_ND6_DEF_RTR_ENTRY);
|
---|
2383 | cons_printf(portid, " NUM_ND6_RTR_SOL_RETRY %5d\n", NUM_ND6_RTR_SOL_RETRY);
|
---|
2384 |
|
---|
2385 | cons_printf(portid, " IP6_CFG_AUTO_LINKLOCAL: ");
|
---|
2386 | #if defined(IP6_CFG_AUTO_LINKLOCAL)
|
---|
2387 | cons_printf(portid, "On\n");
|
---|
2388 | #else
|
---|
2389 | cons_printf(portid, "Off\n");
|
---|
2390 | #endif
|
---|
2391 |
|
---|
2392 | #endif /* of #if defined(SUPPORT_ETHER) */
|
---|
2393 |
|
---|
2394 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
2395 |
|
---|
2396 | #if defined(SUPPORT_INET4)
|
---|
2397 |
|
---|
2398 | cons_printf(portid, "IPv4:\n");
|
---|
2399 |
|
---|
2400 | cons_printf(portid, " IP4_CFG_FRAGMENT: ");
|
---|
2401 |
|
---|
2402 | #if defined(IP4_CFG_FRAGMENT)
|
---|
2403 | cons_printf(portid, "On\n");
|
---|
2404 | cons_printf(portid, " NUM_IP4_FRAG_QUEUE: %4d\n", NUM_IP4_FRAG_QUEUE);
|
---|
2405 | cons_printf(portid, " IP4_CFG_FRAG_REASSM_SIZE: %4d\n", IP4_CFG_FRAG_REASSM_SIZE);
|
---|
2406 | #else
|
---|
2407 | cons_printf(portid, "Off\n");
|
---|
2408 | #endif /* of #if defined(IP4_CFG_FRAGMENT) */
|
---|
2409 |
|
---|
2410 | #if defined(SUPPORT_ETHER)
|
---|
2411 | addr = IPV4_ADDR_LOCAL;
|
---|
2412 | cons_printf(portid, " IPV4_ADDR_LOCAL: %hI\n", &addr);
|
---|
2413 | addr = IPV4_ADDR_LOCAL_MASK;
|
---|
2414 | cons_printf(portid, " IPV4_ADDR_LOCAL_MASK: %hI\n", &addr);
|
---|
2415 | addr = IPV4_ADDR_DEFAULT_GW;
|
---|
2416 | cons_printf(portid, " IPV4_ADDR_DEFAULT_GW: %hI\n", &addr);
|
---|
2417 | #endif /* of #if defined(SUPPORT_ETHER) */
|
---|
2418 |
|
---|
2419 | cons_printf(portid, " Routing Table:\n");
|
---|
2420 | cons_printf(portid, " NUM_IN4_STATIC_ROUTE_ENTRY: %d\n", NUM_IN4_STATIC_ROUTE_ENTRY);
|
---|
2421 | cons_printf(portid, " NUM_IN4_REDIRECT_ROUTE_ENTRY: %d\n", NUM_IN4_REDIRECT_ROUTE_ENTRY);
|
---|
2422 |
|
---|
2423 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
2424 |
|
---|
2425 | #if defined(SUPPORT_INET4) && defined(SUPPORT_ETHER)
|
---|
2426 |
|
---|
2427 | cons_printf(portid, "ARP:\n");
|
---|
2428 | cons_printf(portid, " ARP_CACHE_KEEP: %4d[s]\n", ARP_CACHE_KEEP / NET_TIMER_HZ);
|
---|
2429 |
|
---|
2430 | #endif /* of #if defined(SUPPORT_INET4) && defined(SUPPORT_ETHER) */
|
---|
2431 |
|
---|
2432 | #if defined(SUPPORT_ETHER)
|
---|
2433 |
|
---|
2434 | cons_printf(portid, "Ethernet:\n");
|
---|
2435 |
|
---|
2436 | cons_printf(portid, " NUM_DTQ_ETHER_OUTPUT: %3d\n", NUM_DTQ_ETHER_OUTPUT);
|
---|
2437 |
|
---|
2438 | cons_printf(portid, " ETHER_CFG_ACCEPT_ALL: ");
|
---|
2439 | #if defined(ETHER_CFG_ACCEPT_ALL)
|
---|
2440 | cons_printf(portid, "On\n");
|
---|
2441 | #else
|
---|
2442 | cons_printf(portid, "Off\n");
|
---|
2443 | #endif
|
---|
2444 |
|
---|
2445 | cons_printf(portid, " ETHER_CFG_UNEXP_WARNING: ");
|
---|
2446 | #if defined(ETHER_CFG_UNEXP_WARNING)
|
---|
2447 | cons_printf(portid, "On\n");
|
---|
2448 | #else
|
---|
2449 | cons_printf(portid, "Off\n");
|
---|
2450 | #endif
|
---|
2451 |
|
---|
2452 | cons_printf(portid, " ETHER_CFG_802_WARNING: ");
|
---|
2453 | #if defined(ETHER_CFG_802_WARNING)
|
---|
2454 | cons_printf(portid, "On\n");
|
---|
2455 | #else
|
---|
2456 | cons_printf(portid, "Off\n");
|
---|
2457 | #endif
|
---|
2458 |
|
---|
2459 | cons_printf(portid, " ETHER_CFG_MCAST_WARNING: ");
|
---|
2460 | #if defined(ETHER_CFG_MCAST_WARNING)
|
---|
2461 | cons_printf(portid, "On\n");
|
---|
2462 | #else
|
---|
2463 | cons_printf(portid, "Off\n");
|
---|
2464 | #endif
|
---|
2465 |
|
---|
2466 | cons_printf(portid, " ETHER_COLLECT_ADDR: ");
|
---|
2467 | #if defined(ETHER_COLLECT_ADDR)
|
---|
2468 | cons_printf(portid, "On\n");
|
---|
2469 | #else
|
---|
2470 | cons_printf(portid, "Off\n");
|
---|
2471 | #endif
|
---|
2472 |
|
---|
2473 | #endif /* of #if defined(SUPPORT_ETHER) */
|
---|
2474 |
|
---|
2475 | #if defined(SUPPORT_PPP)
|
---|
2476 |
|
---|
2477 | cons_printf(portid, "PPP:\n");
|
---|
2478 |
|
---|
2479 | cons_printf(portid, " HDLC_PORTNO: %d", HDLC_PORTID);
|
---|
2480 |
|
---|
2481 | cons_printf(portid, " PPP_IDLE_TIMEOUT: ");
|
---|
2482 | #if defined(PPP_IDLE_TIMEOUT)
|
---|
2483 | cons_printf(portid, " %4d[s]\n", PPP_IDLE_TIMEOUT / NET_TIMER_HZ);
|
---|
2484 | #else
|
---|
2485 | cons_printf(portid, " Off\n");
|
---|
2486 | #endif
|
---|
2487 |
|
---|
2488 | cons_printf(portid, " PPP_CFG_MODEM: ");
|
---|
2489 | #if defined(PPP_CFG_MODEM)
|
---|
2490 | cons_printf(portid, "On\n");
|
---|
2491 | #else
|
---|
2492 | cons_printf(portid, "Off\n");
|
---|
2493 | #endif
|
---|
2494 |
|
---|
2495 | #endif /* of #if defined(SUPPORT_PPP) */
|
---|
2496 |
|
---|
2497 | cons_printf(portid, "Network Buffer:\n");
|
---|
2498 |
|
---|
2499 | #if defined(NUM_MPF_NET_BUF_64)
|
---|
2500 | cons_printf(portid, " NUM_MPF_NET_BUF_64: %2d\n", NUM_MPF_NET_BUF_64);
|
---|
2501 | #endif
|
---|
2502 |
|
---|
2503 | #if defined(NUM_MPF_NET_BUF_CSEG)
|
---|
2504 | cons_printf(portid, " NUM_MPF_NET_BUF_CSEG: %2d\n", NUM_MPF_NET_BUF_CSEG);
|
---|
2505 | #endif
|
---|
2506 |
|
---|
2507 | #if defined(NUM_MPF_NET_BUF_128)
|
---|
2508 | cons_printf(portid, " NUM_MPF_NET_BUF_128: %2d\n", NUM_MPF_NET_BUF_128);
|
---|
2509 | #endif
|
---|
2510 |
|
---|
2511 | #if defined(NUM_MPF_NET_BUF_256)
|
---|
2512 | cons_printf(portid, " NUM_MPF_NET_BUF_256: %2d\n", NUM_MPF_NET_BUF_256);
|
---|
2513 | #endif
|
---|
2514 |
|
---|
2515 | #if defined(NUM_MPF_NET_BUF_512)
|
---|
2516 | cons_printf(portid, " NUM_MPF_NET_BUF_512: %2d\n", NUM_MPF_NET_BUF_512);
|
---|
2517 | #endif
|
---|
2518 |
|
---|
2519 | #if defined(NUM_MPF_NET_BUF_IP_MSS)
|
---|
2520 | cons_printf(portid, " NUM_MPF_NET_BUF_IP_MSS: %2d\n", NUM_MPF_NET_BUF_IP_MSS);
|
---|
2521 | #endif
|
---|
2522 |
|
---|
2523 | #if defined(NUM_MPF_NET_BUF_1024)
|
---|
2524 | cons_printf(portid, " NUM_MPF_NET_BUF_1024: %2d\n", NUM_MPF_NET_BUF_1024);
|
---|
2525 | #endif
|
---|
2526 |
|
---|
2527 | #if defined(NUM_MPF_NET_BUF_IPV6_MMTU)
|
---|
2528 | cons_printf(portid, " NUM_MPF_NET_BUF_IPV6_MMTU: %2d\n", NUM_MPF_NET_BUF_IPV6_MMTU);
|
---|
2529 | #endif
|
---|
2530 |
|
---|
2531 | #if defined(NUM_MPF_NET_BUF_IF_PDU)
|
---|
2532 | cons_printf(portid, " NUM_MPF_NET_BUF_IF_PDU: %2d\n", NUM_MPF_NET_BUF_IF_PDU);
|
---|
2533 | #endif
|
---|
2534 |
|
---|
2535 | #if defined(NUM_MPF_NET_BUF_REASSM)
|
---|
2536 | cons_printf(portid, " NUM_MPF_NET_BUF_REASSM: %2d\n", NUM_MPF_NET_BUF_REASSM);
|
---|
2537 | #endif
|
---|
2538 |
|
---|
2539 | #if defined(NUM_MPF_NET_BUF6_65536)
|
---|
2540 | cons_printf(portid, " NUM_MPF_NET_BUF6_65536: %2d\n", NUM_MPF_NET_BUF6_65536);
|
---|
2541 | #endif
|
---|
2542 |
|
---|
2543 | cons_printf(portid, "Network Counter Mask: %08x\n", NET_COUNT_ENABLE);
|
---|
2544 |
|
---|
2545 | cons_printf(portid, "SUPPORT_MIB: ");
|
---|
2546 | #if defined(SUPPORT_MIB)
|
---|
2547 | cons_printf(portid, "On\n");
|
---|
2548 | #else
|
---|
2549 | cons_printf(portid, "Off\n");
|
---|
2550 | #endif
|
---|
2551 |
|
---|
2552 | SIG_NET_CONS_PRINTF();
|
---|
2553 | FLUSH_SND_BUFF();
|
---|
2554 | }
|
---|
2555 |
|
---|
2556 | #ifdef USE_PING
|
---|
2557 |
|
---|
2558 | /*
|
---|
2559 | * ping ã³ãã³ã
|
---|
2560 | */
|
---|
2561 |
|
---|
2562 | void
|
---|
2563 | dbg_cons_ping_comd (ID portid, char *line)
|
---|
2564 | {
|
---|
2565 | int_t tmo, size;
|
---|
2566 | char apip = DEFAULT_API_PROTO;
|
---|
2567 |
|
---|
2568 | #if defined(SUPPORT_INET6)
|
---|
2569 | T_IN6_ADDR addr;
|
---|
2570 | #if defined(SUPPORT_INET4)
|
---|
2571 | T_IN4_ADDR addr4;
|
---|
2572 | #endif
|
---|
2573 | #else
|
---|
2574 | T_IN4_ADDR addr;
|
---|
2575 | #endif
|
---|
2576 |
|
---|
2577 | #if defined(PING_CFG_I6RLP)
|
---|
2578 |
|
---|
2579 | static const char i6rlp_pmtu_str1[] = " FF1E::1:2 1 1452";
|
---|
2580 | static const char i6rlp_pmtu_str2[] = " FF1E::1:2 1 1352";
|
---|
2581 | static const char i6rlp_pmtu_str3[] = " fe80::0200:00ff:fe00:0100 1 2";
|
---|
2582 |
|
---|
2583 | if (apip == '1')
|
---|
2584 | strcpy(line, i6rlp_pmtu_str1);
|
---|
2585 | else if (apip == '2')
|
---|
2586 | strcpy(line, i6rlp_pmtu_str2);
|
---|
2587 | else if (apip == '3')
|
---|
2588 | strcpy(line, i6rlp_pmtu_str3);
|
---|
2589 |
|
---|
2590 | #endif /* of #ifdef PING_CFG_I6RLP */
|
---|
2591 |
|
---|
2592 | #if defined(SUPPORT_INET6) && defined(SUPPORT_INET4)
|
---|
2593 |
|
---|
2594 | if ('0' <= *line && *line <= '9') {
|
---|
2595 | if (*line == '6')
|
---|
2596 | apip = API_PROTO_IPV6;
|
---|
2597 | if (*line == '4')
|
---|
2598 | apip = API_PROTO_IPV4;
|
---|
2599 | line ++;
|
---|
2600 | }
|
---|
2601 |
|
---|
2602 | #endif /* of #if defined(SUPPORT_INET6) && defined(SUPPORT_INET4) */
|
---|
2603 |
|
---|
2604 | if ((line = lookup_ipaddr(&addr, line, apip)) == NULL) {
|
---|
2605 | syslog(LOG_NOTICE, "[PING] unknown host.");
|
---|
2606 | return;
|
---|
2607 | }
|
---|
2608 |
|
---|
2609 | line = skip_blanks(line);
|
---|
2610 | if ('0' <= *line && *line <= '9')
|
---|
2611 | line = get_int(&tmo, line);
|
---|
2612 | else
|
---|
2613 | tmo = 3;
|
---|
2614 |
|
---|
2615 | line = skip_blanks(line);
|
---|
2616 | if ('0' <= *line && *line <= '9')
|
---|
2617 | line = get_int(&size, line);
|
---|
2618 | else
|
---|
2619 | size = 64;
|
---|
2620 |
|
---|
2621 | #if defined(SUPPORT_INET6)
|
---|
2622 |
|
---|
2623 | #if defined(SUPPORT_INET4)
|
---|
2624 |
|
---|
2625 | if (apip == API_PROTO_IPV6) {
|
---|
2626 | syslog(LOG_NOTICE, "[PING6] size: %d, tmo: %d, host: %s", size, tmo, ipv62str(NULL, &addr));
|
---|
2627 | ping6(&addr, (uint_t)tmo, (uint_t)size);
|
---|
2628 | }
|
---|
2629 | else {
|
---|
2630 | addr4 = ntohl(addr.s6_addr32[3]);
|
---|
2631 | syslog(LOG_NOTICE, "[PING4] size: %d, tmo: %d, host: %s", size, tmo, ip2str(NULL, &addr4));
|
---|
2632 | ping4(&addr4, (uint_t)tmo, (uint_t)size);
|
---|
2633 | }
|
---|
2634 |
|
---|
2635 | #else /* of #if defined(SUPPORT_INET4) */
|
---|
2636 |
|
---|
2637 | syslog(LOG_NOTICE, "[PING6] size: %d, tmo: %d, host: %s", size, tmo, ipv62str(NULL, &addr));
|
---|
2638 | ping6(&addr, (uint_t)tmo, (uint_t)size);
|
---|
2639 |
|
---|
2640 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
2641 |
|
---|
2642 | #else /* of #if defined(SUPPORT_INET6) */
|
---|
2643 |
|
---|
2644 |
|
---|
2645 | syslog(LOG_NOTICE, "[PING4] size: %d, tmo: %d, host: %s", size, tmo, ip2str(NULL, &addr));
|
---|
2646 | ping4(&addr, (uint_t)tmo, (uint_t)size);
|
---|
2647 |
|
---|
2648 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
2649 |
|
---|
2650 | }
|
---|
2651 |
|
---|
2652 | #endif /* of #ifdef USE_PING */
|
---|
2653 |
|
---|
2654 | #ifdef USE_DBG_CONS_PARSER
|
---|
2655 |
|
---|
2656 | /*
|
---|
2657 | * ãããã°ã³ãã³ã解æ
|
---|
2658 | */
|
---|
2659 |
|
---|
2660 | void
|
---|
2661 | dbg_parse (ID portid, char *line)
|
---|
2662 | {
|
---|
2663 | int_t cepid;
|
---|
2664 | ER error = E_OK;
|
---|
2665 |
|
---|
2666 | #if defined(SUPPORT_UDP) && defined(SUPPORT_INET6) && defined(SUPPORT_INET4)
|
---|
2667 | int_t udp_cep_ipproto;
|
---|
2668 | #endif
|
---|
2669 |
|
---|
2670 | switch (*line) {
|
---|
2671 |
|
---|
2672 | case 'c': /* cancel CEP */
|
---|
2673 | switch (*(line + 1)) {
|
---|
2674 |
|
---|
2675 | case 'f': /* show configurations */
|
---|
2676 | dbg_cons_show_config(portid, line + 1);
|
---|
2677 | break;
|
---|
2678 |
|
---|
2679 | #ifdef SUPPORT_TCP
|
---|
2680 |
|
---|
2681 | case 't': /* cancel TCP */
|
---|
2682 | cepid = atoi(line = skip_blanks(line + 2));
|
---|
2683 | while ('0' <= *line && *line <= '9')
|
---|
2684 | line ++;
|
---|
2685 | if ((error = tcp_can_cep((ID)cepid, atoi(skip_blanks(line)))) != E_OK && error != E_RLWAI) {
|
---|
2686 | cons_printf(portid, "[TCP CAN CEP] error: %s.\n", itron_strerror(error));
|
---|
2687 | SIG_NET_CONS_PRINTF();
|
---|
2688 | FLUSH_SND_BUFF();
|
---|
2689 | }
|
---|
2690 | break;
|
---|
2691 |
|
---|
2692 | #endif /* of #ifdef SUPPORT_TCP */
|
---|
2693 |
|
---|
2694 | #ifdef SUPPORT_UDP
|
---|
2695 |
|
---|
2696 | case 'u': /* cancel UDP */
|
---|
2697 |
|
---|
2698 | #if defined(SUPPORT_INET6)
|
---|
2699 |
|
---|
2700 | #if defined(SUPPORT_INET4)
|
---|
2701 |
|
---|
2702 | udp_cep_ipproto = (*(line + 2) == '4' ? API_PROTO_IPV4 : API_PROTO_IPV6);
|
---|
2703 | cepid = atoi(line = skip_blanks(line + 3));
|
---|
2704 | while ('0' <= *line && *line <= '9')
|
---|
2705 | line ++;
|
---|
2706 |
|
---|
2707 | #if TNUM_UDP6_CEPID > 0
|
---|
2708 |
|
---|
2709 | if (udp_cep_ipproto == API_PROTO_IPV6) {
|
---|
2710 | if ((error = udp_can_cep((ID)cepid, atoi(skip_blanks(line)))) != E_OK && error != E_RLWAI) {
|
---|
2711 | cons_printf(portid, "[UDP CAN CEP] error: %s.\n", itron_strerror(error));
|
---|
2712 | SIG_NET_CONS_PRINTF();
|
---|
2713 | FLUSH_SND_BUFF();
|
---|
2714 | }
|
---|
2715 | }
|
---|
2716 |
|
---|
2717 | #endif /* of #if TNUM_UDP6_CEPID > 0 */
|
---|
2718 |
|
---|
2719 | #if TNUM_UDP4_CEPID > 0
|
---|
2720 |
|
---|
2721 | if (udp_cep_ipproto == API_PROTO_IPV4) {
|
---|
2722 | if ((error = udp_can_cep((ID)cepid, atoi(skip_blanks(line)))) != E_OK && error != E_RLWAI) {
|
---|
2723 | cons_printf(portid, "[UDP CAN CEP] error: %s.\n", itron_strerror(error));
|
---|
2724 | SIG_NET_CONS_PRINTF();
|
---|
2725 | FLUSH_SND_BUFF();
|
---|
2726 | }
|
---|
2727 | }
|
---|
2728 |
|
---|
2729 | #endif /* of #if TNUM_UDP4_CEPID > 0 */
|
---|
2730 |
|
---|
2731 | #else /* of #if defined(SUPPORT_INET4) */
|
---|
2732 |
|
---|
2733 | #if TNUM_UDP6_CEPID > 0
|
---|
2734 |
|
---|
2735 | cepid = atoi(line = skip_blanks(line + 2));
|
---|
2736 | while ('0' <= *line && *line <= '9')
|
---|
2737 | line ++;
|
---|
2738 |
|
---|
2739 | if ((error = udp_can_cep((ID)cepid, atoi(skip_blanks(line)))) != E_OK && error != E_RLWAI) {
|
---|
2740 | cons_printf(portid, "[UDP CAN CEP] error: %s.\n", itron_strerror(error));
|
---|
2741 | SIG_NET_CONS_PRINTF();
|
---|
2742 | FLUSH_SND_BUFF();
|
---|
2743 | }
|
---|
2744 |
|
---|
2745 | #endif /* of #if TNUM_UDP6_CEPID > 0 */
|
---|
2746 |
|
---|
2747 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
2748 |
|
---|
2749 | #else /* of #if defined(SUPPORT_INET6) */
|
---|
2750 |
|
---|
2751 | #if defined(SUPPORT_INET4)
|
---|
2752 |
|
---|
2753 | #if TNUM_UDP4_CEPID > 0
|
---|
2754 |
|
---|
2755 | cepid = atoi(line = skip_blanks(line + 2));
|
---|
2756 | while ('0' <= *line && *line <= '9')
|
---|
2757 | line ++;
|
---|
2758 |
|
---|
2759 | if ((error = udp_can_cep((ID)cepid, atoi(skip_blanks(line)))) != E_OK && error != E_RLWAI) {
|
---|
2760 | cons_printf(portid, "[UDP CAN CEP] error: %s.\n", itron_strerror(error));
|
---|
2761 | SIG_NET_CONS_PRINTF();
|
---|
2762 | FLUSH_SND_BUFF();
|
---|
2763 | }
|
---|
2764 |
|
---|
2765 | #endif /* of #if TNUM_UDP4_CEPID > 0 */
|
---|
2766 |
|
---|
2767 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
2768 |
|
---|
2769 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
2770 |
|
---|
2771 | break;
|
---|
2772 |
|
---|
2773 | #endif /* of #ifdef SUPPORT_UDP */
|
---|
2774 |
|
---|
2775 | }
|
---|
2776 |
|
---|
2777 | break;
|
---|
2778 |
|
---|
2779 | case 'd': /* discard client */
|
---|
2780 | switch (*(line + 1)) {
|
---|
2781 |
|
---|
2782 | #if defined(SUPPORT_PPP)
|
---|
2783 |
|
---|
2784 | case 'c': /* disconnect */
|
---|
2785 | if (lcp_fsm.state != PPP_FSM_STOPPED)
|
---|
2786 | lcp_close();
|
---|
2787 | break;
|
---|
2788 |
|
---|
2789 | #endif /* of #if defined(SUPPORT_PPP) */
|
---|
2790 |
|
---|
2791 | #if defined(SUPPORT_ETHER) && defined(USE_NET_CONS)
|
---|
2792 |
|
---|
2793 | case 'c': /* disconnect */
|
---|
2794 | discon_net_cons();
|
---|
2795 | break;
|
---|
2796 |
|
---|
2797 | #endif /* of #if defined(SUPPORT_ETHER) && defined(USE_NET_CONS) */
|
---|
2798 |
|
---|
2799 | #if defined(DHCP6_CLI_CFG) || defined(DHCP4_CLI_CFG)
|
---|
2800 |
|
---|
2801 | case 'h': /* DHCP client */
|
---|
2802 | dhcpc(portid, line + 2);
|
---|
2803 | break;
|
---|
2804 |
|
---|
2805 | #endif /* of #if defined(DHCP6_CLI_CFG) || defined(DHCP4_CLI_CFG) */
|
---|
2806 |
|
---|
2807 | #ifdef USE_TCP_DISCARD_CLI
|
---|
2808 |
|
---|
2809 | case 't': /* TCP discard client */
|
---|
2810 | line += 2;
|
---|
2811 | switch (*line) {
|
---|
2812 |
|
---|
2813 | case 's': /* cancel TCP discard client */
|
---|
2814 | tcp_discard_cli_valid = false;
|
---|
2815 | break;
|
---|
2816 |
|
---|
2817 | default:
|
---|
2818 | if ((error = psnd_dtq(DTQ_TCP_DISCARD_CLI, (intptr_t)line)) != E_OK) {
|
---|
2819 | cons_printf(portid, "[TCP DISCARD CLI] error: %s.\n",
|
---|
2820 | itron_strerror(error));
|
---|
2821 | SIG_NET_CONS_PRINTF();
|
---|
2822 | FLUSH_SND_BUFF();
|
---|
2823 | }
|
---|
2824 | break;
|
---|
2825 |
|
---|
2826 | }
|
---|
2827 | break;
|
---|
2828 |
|
---|
2829 | #endif /* of #ifdef USE_TCP_DISCARD_CLI */
|
---|
2830 |
|
---|
2831 | #ifdef USE_UDP_DISCARD_CLI
|
---|
2832 |
|
---|
2833 | case 'u': /* UDP discard client */
|
---|
2834 | line += 2;
|
---|
2835 | switch (*line) {
|
---|
2836 |
|
---|
2837 | case 's': /* cancel UDP discard client */
|
---|
2838 | udp_discard_cli_valid = false;
|
---|
2839 | break;
|
---|
2840 |
|
---|
2841 | default:
|
---|
2842 | if ((error = psnd_dtq(DTQ_UDP_DISCARD_CLI, (intptr_t)line)) != E_OK) {
|
---|
2843 | cons_printf(portid, "[UDP DISCARD CLI] error: %s.\n",
|
---|
2844 | itron_strerror(error));
|
---|
2845 | SIG_NET_CONS_PRINTF();
|
---|
2846 | FLUSH_SND_BUFF();
|
---|
2847 | }
|
---|
2848 | break;
|
---|
2849 |
|
---|
2850 | }
|
---|
2851 | break;
|
---|
2852 |
|
---|
2853 | #endif /* of #ifdef USE_UDP_DISCARD_CLI */
|
---|
2854 |
|
---|
2855 | }
|
---|
2856 |
|
---|
2857 | break;
|
---|
2858 |
|
---|
2859 | #if defined(USE_TCP_ECHO_CLI) || defined(USE_UDP_ECHO_CLI)
|
---|
2860 |
|
---|
2861 | case 'e': /* echo client */
|
---|
2862 | switch (*(line + 1)) {
|
---|
2863 |
|
---|
2864 | #ifdef USE_TCP_ECHO_CLI
|
---|
2865 |
|
---|
2866 | case 't': /* TCP echo client */
|
---|
2867 | line += 2;
|
---|
2868 | switch (*line) {
|
---|
2869 |
|
---|
2870 | case 's': /* cancel TCP echo */
|
---|
2871 | tcp_echo_cli_valid = false;
|
---|
2872 | break;
|
---|
2873 |
|
---|
2874 | default:
|
---|
2875 | if ((error = psnd_dtq(DTQ_TCP_ECHO_CLI_SND, (intptr_t)line)) != E_OK) {
|
---|
2876 | cons_printf(portid, "[TCP ECHO CLI] error: %s.\n", itron_strerror(error));
|
---|
2877 | SIG_NET_CONS_PRINTF();
|
---|
2878 | FLUSH_SND_BUFF();
|
---|
2879 | }
|
---|
2880 | break;
|
---|
2881 |
|
---|
2882 | }
|
---|
2883 | break;
|
---|
2884 |
|
---|
2885 | #endif /* of #ifdef USE_TCP_ECHO_CLI */
|
---|
2886 |
|
---|
2887 | #if defined(USE_UDP_ECHO_CLI)
|
---|
2888 |
|
---|
2889 | case 'u': /* UDP echo client */
|
---|
2890 | switch (*(line + 2)) {
|
---|
2891 |
|
---|
2892 | case 's': /* cancel UDP echo */
|
---|
2893 |
|
---|
2894 | #if defined(USE_UDP6_ECHO_CLI_TSK)
|
---|
2895 |
|
---|
2896 | #if defined(USE_UDP4_ECHO_CLI_TSK)
|
---|
2897 |
|
---|
2898 | if (*(line + 3) == '4')
|
---|
2899 | udp4_echo_cli_valid = false;
|
---|
2900 | else
|
---|
2901 | udp6_echo_cli_valid = false;
|
---|
2902 |
|
---|
2903 | #else /* of #if defined(USE_UDP4_ECHO_CLI_TSK) */
|
---|
2904 |
|
---|
2905 | udp6_echo_cli_valid = false;
|
---|
2906 |
|
---|
2907 | #endif /* of #if defined(USE_UDP4_ECHO_CLI_TSK) */
|
---|
2908 |
|
---|
2909 | #else /* of #if defined(USE_UDP6_ECHO_CLI_TSK) */
|
---|
2910 |
|
---|
2911 | #if defined(USE_UDP4_CLI_TSK)
|
---|
2912 |
|
---|
2913 | udp4_echo_cli_valid = false;
|
---|
2914 |
|
---|
2915 | #endif /* of #if defined(USE_UDP4_CLI_TSK) */
|
---|
2916 |
|
---|
2917 | #endif /* of #if defined(USE_UDP6_ECHO_CLI_TSK) */
|
---|
2918 |
|
---|
2919 |
|
---|
2920 | break;
|
---|
2921 |
|
---|
2922 | default:
|
---|
2923 |
|
---|
2924 | line += 2;
|
---|
2925 |
|
---|
2926 | #if defined(USE_UDP6_ECHO_CLI_TSK)
|
---|
2927 |
|
---|
2928 | #if defined(USE_UDP4_ECHO_CLI_TSK)
|
---|
2929 |
|
---|
2930 | if (*line == '4') {
|
---|
2931 | line ++;
|
---|
2932 | error = psnd_dtq(DTQ_UDP4_ECHO_CLI, (intptr_t)line);
|
---|
2933 | }
|
---|
2934 | else {
|
---|
2935 | if (*line && *line != ' ')
|
---|
2936 | line ++;
|
---|
2937 | error = psnd_dtq(DTQ_UDP6_ECHO_CLI, (intptr_t)line);
|
---|
2938 | }
|
---|
2939 |
|
---|
2940 | #else /* of #if defined(USE_UDP4_ECHO_CLI_TSK) */
|
---|
2941 |
|
---|
2942 | if (*line && *line != ' ')
|
---|
2943 | line ++;
|
---|
2944 | error = psnd_dtq(DTQ_UDP6_ECHO_CLI, (intptr_t)line);
|
---|
2945 |
|
---|
2946 | #endif /* of #if defined(USE_UDP4_ECHO_CLI_TSK) */
|
---|
2947 |
|
---|
2948 | #else /* of #if defined(USE_UDP6_ECHO_CLI_TSK) */
|
---|
2949 |
|
---|
2950 | if (*line && *line != ' ')
|
---|
2951 | line ++;
|
---|
2952 | error = psnd_dtq(DTQ_UDP4_ECHO_CLI, (intptr_t)line);
|
---|
2953 |
|
---|
2954 | #endif /* of #if defined(USE_UDP6_ECHO_CLI_TSK) */
|
---|
2955 |
|
---|
2956 | if (error != E_OK) {
|
---|
2957 | cons_printf(portid, "[UDP ECHO CLI] error: %s.\n", itron_strerror(error));
|
---|
2958 | SIG_NET_CONS_PRINTF();
|
---|
2959 | FLUSH_SND_BUFF();
|
---|
2960 | }
|
---|
2961 |
|
---|
2962 | break;
|
---|
2963 |
|
---|
2964 | }
|
---|
2965 | break;
|
---|
2966 |
|
---|
2967 | #endif /* of #if defined(USE_UDP_ECHO_CLI) */
|
---|
2968 |
|
---|
2969 | }
|
---|
2970 |
|
---|
2971 | break;
|
---|
2972 |
|
---|
2973 | #endif /* of #if defined(USE_TCP_ECHO_CLI) || defined(USE_UDP_ECHO_CLI) */
|
---|
2974 |
|
---|
2975 | case 'i':
|
---|
2976 |
|
---|
2977 | if (*(line + 1) == 'f') {
|
---|
2978 |
|
---|
2979 | dbg_cons_ifconfig (portid, line + 2);
|
---|
2980 |
|
---|
2981 | #if defined(NETAPP_IP6_CFG)
|
---|
2982 | dbg_cons_ifconfig6(portid, line + 2);
|
---|
2983 | #endif
|
---|
2984 |
|
---|
2985 | #if defined(NETAPP_IP4_CFG)
|
---|
2986 | dbg_cons_ifconfig4(portid, line + 2);
|
---|
2987 | #endif
|
---|
2988 |
|
---|
2989 | }
|
---|
2990 |
|
---|
2991 | #ifdef SUPPORT_PPP
|
---|
2992 |
|
---|
2993 | #ifdef PPP_CFG_MODEM
|
---|
2994 |
|
---|
2995 | else if (lcp_fsm.state == PPP_FSM_STOPPED)
|
---|
2996 | dial(); /* initiate */
|
---|
2997 |
|
---|
2998 | #else /* of #ifdef PPP_CFG_MODEM */
|
---|
2999 |
|
---|
3000 | else if (lcp_fsm.state == PPP_FSM_STOPPED)
|
---|
3001 | lcp_open(PPP_OPEN_ACTIVE);
|
---|
3002 |
|
---|
3003 | #endif /* of #ifdef PPP_CFG_MODEM */
|
---|
3004 |
|
---|
3005 | #endif /* of #ifdef SUPPORT_PPP */
|
---|
3006 |
|
---|
3007 | break;
|
---|
3008 |
|
---|
3009 | case 'n': /* network status */
|
---|
3010 | dbg_cons_network_status(portid, line + 1);
|
---|
3011 | break;
|
---|
3012 |
|
---|
3013 | case 'p': /* ping or task status */
|
---|
3014 |
|
---|
3015 | if (*(line + 1) == 's')
|
---|
3016 | dbg_cons_task_status(portid, skip_blanks(line + 2));
|
---|
3017 |
|
---|
3018 | #ifdef USE_PING
|
---|
3019 |
|
---|
3020 | else
|
---|
3021 | dbg_cons_ping_comd(portid, line + 1);
|
---|
3022 |
|
---|
3023 | #endif /* of #ifdef USE_PING */
|
---|
3024 |
|
---|
3025 | break;
|
---|
3026 |
|
---|
3027 | case 'r': /* release wait task */
|
---|
3028 | if ((error = rel_wai(atoi(skip_blanks(line + 1)))) != E_OK) {
|
---|
3029 | cons_printf(portid, "[REL WAI TSK] error: %s.\n", itron_strerror(error));
|
---|
3030 | SIG_NET_CONS_PRINTF();
|
---|
3031 | FLUSH_SND_BUFF();
|
---|
3032 | }
|
---|
3033 | break;
|
---|
3034 |
|
---|
3035 | case 't': /* terminate (delete) REP/CEP */
|
---|
3036 | switch (*(line + 1)) {
|
---|
3037 |
|
---|
3038 | #ifdef USE_TCP_EXTENTIONS
|
---|
3039 |
|
---|
3040 | case 't': /* TCP REP */
|
---|
3041 |
|
---|
3042 | error = tcp_del_rep(atoi(skip_blanks(line + 2)));
|
---|
3043 | if (error != E_OK) {
|
---|
3044 | cons_printf(portid, "[TCP DEL REP] ID: %d, error: %s.\n",
|
---|
3045 | atoi(skip_blanks(line + 2)),
|
---|
3046 | itron_strerror(error));
|
---|
3047 | SIG_NET_CONS_PRINTF();
|
---|
3048 | FLUSH_SND_BUFF();
|
---|
3049 | }
|
---|
3050 | break;
|
---|
3051 |
|
---|
3052 | #endif /* of #ifdef USE_TCP_EXTENTIONS */
|
---|
3053 |
|
---|
3054 | #ifdef USE_UDP_EXTENTIONS
|
---|
3055 |
|
---|
3056 | case 'u': /* UDP CEP */
|
---|
3057 |
|
---|
3058 | #if defined(USE_UDP6_ECHO_SRV_TSK)
|
---|
3059 |
|
---|
3060 | #if defined(USE_UDP4_ECHO_SRV_TSK)
|
---|
3061 |
|
---|
3062 | if (*(line + 2) == '4') {
|
---|
3063 | if ((error = udp_del_cep(atoi(skip_blanks(line + 3)))) != E_OK) {
|
---|
3064 | cons_printf(portid, "[UDP DEL CEP] error: %s.\n", itron_strerror(error));
|
---|
3065 | SIG_NET_CONS_PRINTF();
|
---|
3066 | FLUSH_SND_BUFF();
|
---|
3067 | }
|
---|
3068 | }
|
---|
3069 | else {
|
---|
3070 | if ((error = udp6_del_cep(atoi(skip_blanks(line + 2)))) != E_OK) {
|
---|
3071 | cons_printf(portid, "[UDP DEL CEP] error: %s.\n", itron_strerror(error));
|
---|
3072 | SIG_NET_CONS_PRINTF();
|
---|
3073 | FLUSH_SND_BUFF();
|
---|
3074 | }
|
---|
3075 | }
|
---|
3076 |
|
---|
3077 | #else /* of #if defined(USE_UDP4_ECHO_SRV_TSK) */
|
---|
3078 |
|
---|
3079 | if ((error = udp6_del_cep(atoi(skip_blanks(line + 2)))) != E_OK) {
|
---|
3080 | cons_printf(portid, "[UDP DEL CEP] error: %s.\n", itron_strerror(error));
|
---|
3081 | SIG_NET_CONS_PRINTF();
|
---|
3082 | FLUSH_SND_BUFF();
|
---|
3083 | }
|
---|
3084 |
|
---|
3085 | #endif /* of #if defined(USE_UDP4_ECHO_SRV_TSK) */
|
---|
3086 |
|
---|
3087 | #else /* of #if defined(USE_UDP6_ECHO_SRV_TSK) */
|
---|
3088 |
|
---|
3089 | #if defined(USE_UDP4_ECHO_SRV_TSK)
|
---|
3090 |
|
---|
3091 | if ((error = udp_del_cep(atoi(skip_blanks(line + 2)))) != E_OK) {
|
---|
3092 | cons_printf(portid, "[UDP DEL CEP] error: %s.\n", itron_strerror(error));
|
---|
3093 | SIG_NET_CONS_PRINTF();
|
---|
3094 | FLUSH_SND_BUFF();
|
---|
3095 | }
|
---|
3096 |
|
---|
3097 | #endif /* of #if defined(USE_UDP4_ECHO_SRV_TSK) */
|
---|
3098 |
|
---|
3099 | #endif /* of #if defined(USE_UDP6_ECHO_SRV_TSK) */
|
---|
3100 |
|
---|
3101 | break;
|
---|
3102 |
|
---|
3103 | #endif /* of #ifdef USE_UDP_EXTENTIONS */
|
---|
3104 |
|
---|
3105 | }
|
---|
3106 | break;
|
---|
3107 |
|
---|
3108 | #if defined(USE_TCP_EXTENTIONS) || defined(USE_UDP_EXTENTIONS)
|
---|
3109 |
|
---|
3110 | case 'w': /* wakeup server */
|
---|
3111 | /* wake up task */
|
---|
3112 | switch (*(line + 1)) {
|
---|
3113 |
|
---|
3114 | #ifdef USE_TCP_EXTENTIONS
|
---|
3115 |
|
---|
3116 | case 't': /* tcp server */
|
---|
3117 | switch (*(line + 2)) {
|
---|
3118 |
|
---|
3119 | #ifdef USE_TCP_DISCARD_SRV
|
---|
3120 | case 'd': /* tcp discard server */
|
---|
3121 | if ((error = wup_tsk(TCP_DISCARD_SRV_TASK)) != E_OK) {
|
---|
3122 | //cons_printf(portid, "[WUP TCP DISCARD SRV] error: %s.\n", itron_strerror(error));
|
---|
3123 | SIG_NET_CONS_PRINTF();
|
---|
3124 | FLUSH_SND_BUFF();
|
---|
3125 | }
|
---|
3126 | break;
|
---|
3127 | #endif /* of #ifdef USE_TCP_DISCARD_SRV */
|
---|
3128 |
|
---|
3129 | #if defined(USE_TCP_ECHO_SRV1)
|
---|
3130 | case 'e': /* tcp echo server */
|
---|
3131 | if ((error = wakeup_tcp_echo_srv((*(line + 3) == '4' ? API_PROTO_IPV4 : API_PROTO_IPV6))) != E_OK) {
|
---|
3132 | //cons_printf(portid, "[WUP TCP ECHO SRV] error: %s.\n", itron_strerror(error));
|
---|
3133 | SIG_NET_CONS_PRINTF();
|
---|
3134 | FLUSH_SND_BUFF();
|
---|
3135 | }
|
---|
3136 | break;
|
---|
3137 | #endif /* of #if defined(USE_TCP_ECHO_SRV1) */
|
---|
3138 |
|
---|
3139 | #if defined(USE_TCP_ECHO_SRV2)
|
---|
3140 | case 'e': /* tcp echo server */
|
---|
3141 | if ((error = wup_tsk(TCP_ECHO_SRV_TASK2)) != E_OK) {
|
---|
3142 | //cons_printf(portid, "[WUP TCP ECHO SRV] error: %s.\n", itron_strerror(error));
|
---|
3143 | SIG_NET_CONS_PRINTF();
|
---|
3144 | FLUSH_SND_BUFF();
|
---|
3145 | }
|
---|
3146 | break;
|
---|
3147 | #endif /* of #if defined(USE_TCP_ECHO_SRV2) */
|
---|
3148 |
|
---|
3149 | #ifdef USE_WWW_SRV
|
---|
3150 | case 'w': /* WWW server */
|
---|
3151 | if ((error = wakeup_www_srv((*(line + 3) == '4' ? API_PROTO_IPV4 : API_PROTO_IPV6))) != E_OK) {
|
---|
3152 | //cons_printf(portid, "[WUP WWW SRV] error: %s.\n", itron_strerror(error));
|
---|
3153 | SIG_NET_CONS_PRINTF();
|
---|
3154 | FLUSH_SND_BUFF();
|
---|
3155 | }
|
---|
3156 | break;
|
---|
3157 | #endif /* of #ifdef USE_TCP_DISCARD_SRV */
|
---|
3158 |
|
---|
3159 | }
|
---|
3160 | break;
|
---|
3161 |
|
---|
3162 | #endif /* of #ifdef USE_TCP_EXTENTIONS */
|
---|
3163 |
|
---|
3164 | #ifdef USE_UDP_EXTENTIONS
|
---|
3165 |
|
---|
3166 | case 'u': /* udp server */
|
---|
3167 | switch (*(line + 2)) {
|
---|
3168 |
|
---|
3169 | #if !defined(USE_UDP_CALL_BACK)
|
---|
3170 |
|
---|
3171 | case 'e': /* udp echo server */
|
---|
3172 |
|
---|
3173 | #if defined(USE_UDP6_ECHO_SRV_TSK)
|
---|
3174 |
|
---|
3175 | #if defined(USE_UDP4_ECHO_SRV_TSK)
|
---|
3176 |
|
---|
3177 | if (*(line + 3) == '4') {
|
---|
3178 | if ((error = wup_tsk(UDP4_ECHO_SRV_TASK)) != E_OK) {
|
---|
3179 | cons_printf(portid, "[WUP UDP4 ECHO SRV] error: %s.\n", itron_strerror(error));
|
---|
3180 | SIG_NET_CONS_PRINTF();
|
---|
3181 | FLUSH_SND_BUFF();
|
---|
3182 | }
|
---|
3183 | }
|
---|
3184 | else {
|
---|
3185 | if ((error = wup_tsk(UDP6_ECHO_SRV_TASK)) != E_OK) {
|
---|
3186 | cons_printf(portid, "[WUP UDP6 ECHO SRV] error: %s.\n", itron_strerror(error));
|
---|
3187 | SIG_NET_CONS_PRINTF();
|
---|
3188 | FLUSH_SND_BUFF();
|
---|
3189 | }
|
---|
3190 | }
|
---|
3191 |
|
---|
3192 | #else /* of #if defined(USE_UDP4_ECHO_SRV_TSK) */
|
---|
3193 |
|
---|
3194 | if ((error = wup_tsk(UDP6_ECHO_SRV_TASK)) != E_OK) {
|
---|
3195 | cons_printf(portid, "[WUP UDP6 ECHO SRV] error: %s.\n", itron_strerror(error));
|
---|
3196 | SIG_NET_CONS_PRINTF();
|
---|
3197 | FLUSH_SND_BUFF();
|
---|
3198 | }
|
---|
3199 |
|
---|
3200 | #endif /* of #if defined(USE_UDP4_ECHO_SRV_TSK) */
|
---|
3201 |
|
---|
3202 | #else /* of #if defined(USE_UDP6_ECHO_SRV_TSK) */
|
---|
3203 |
|
---|
3204 | #if defined(USE_UDP4_ECHO_SRV_TSK)
|
---|
3205 |
|
---|
3206 | if ((error = wup_tsk(UDP4_ECHO_SRV_TASK)) != E_OK) {
|
---|
3207 | cons_printf(portid, "[WUP UDP4 ECHO SRV] error: %s.\n", itron_strerror(error));
|
---|
3208 | SIG_NET_CONS_PRINTF();
|
---|
3209 | FLUSH_SND_BUFF();
|
---|
3210 | }
|
---|
3211 |
|
---|
3212 | #endif /* of #if defined(USE_UDP4_ECHO_SRV_TSK) */
|
---|
3213 |
|
---|
3214 | #endif /* of #if defined(USE_UDP6_ECHO_SRV_TSK) */
|
---|
3215 |
|
---|
3216 | break;
|
---|
3217 |
|
---|
3218 | #endif /* of #if !defined(USE_UDP_CALL_BACK) */
|
---|
3219 |
|
---|
3220 | }
|
---|
3221 | break;
|
---|
3222 |
|
---|
3223 | #endif /* of #ifdef USE_UDP_EXTENTIONS */
|
---|
3224 |
|
---|
3225 | default:
|
---|
3226 | if ((error = wup_tsk(atoi(skip_blanks(line + 1)))) != E_OK) {
|
---|
3227 | cons_printf(portid, "[WUP TSK] error: %s.\n", itron_strerror(error));
|
---|
3228 | SIG_NET_CONS_PRINTF();
|
---|
3229 | FLUSH_SND_BUFF();
|
---|
3230 | }
|
---|
3231 | break;
|
---|
3232 |
|
---|
3233 | }
|
---|
3234 | break;
|
---|
3235 |
|
---|
3236 | #else /* of #if defined(USE_TCP_EXTENTIONS) || defined(USE_UDP_EXTENTIONS) */
|
---|
3237 |
|
---|
3238 | case 'w': /* wake up task */
|
---|
3239 | if ((error = wup_tsk(atoi(skip_blanks(line + 1)))) != E_OK) {
|
---|
3240 | cons_printf(portid, "[WUP TSK] error: %s.\n", itron_strerror(error));
|
---|
3241 | SIG_NET_CONS_PRINTF();
|
---|
3242 | FLUSH_SND_BUFF();
|
---|
3243 | }
|
---|
3244 | break;
|
---|
3245 |
|
---|
3246 | #endif /* of #if defined(USE_TCP_EXTENTIONS) || defined(USE_UDP_EXTENTIONS) */
|
---|
3247 |
|
---|
3248 | default:
|
---|
3249 |
|
---|
3250 | if (*line) {
|
---|
3251 |
|
---|
3252 | #ifdef USE_DBG_CONS_EXTRA_PARSE
|
---|
3253 |
|
---|
3254 | //cons_printf(portid, "extra command: '%c'.\n", *line);
|
---|
3255 | dbg_cons_extra_parse(portid, line);
|
---|
3256 |
|
---|
3257 | #else /* of #ifdef USE_DBG_CONS_EXTRA_PARSE */
|
---|
3258 |
|
---|
3259 | //cons_printf(portid, "command: '%c'.\n", *line);
|
---|
3260 | cons_printf(portid, "no such command: '%c'.\n", *line);
|
---|
3261 | SIG_NET_CONS_PRINTF();
|
---|
3262 | FLUSH_SND_BUFF();
|
---|
3263 |
|
---|
3264 | #endif /* of #ifdef USE_DBG_CONS_EXTRA_PARSE */
|
---|
3265 |
|
---|
3266 | }
|
---|
3267 | break;
|
---|
3268 | }
|
---|
3269 | }
|
---|
3270 |
|
---|
3271 | #endif /* of #ifdef USE_DBG_CONS_PARSER */
|
---|
3272 |
|
---|
3273 | /*
|
---|
3274 | * ãããã°ã³ã³ã½ã¼ã«ã¿ã¹ã¯
|
---|
3275 | */
|
---|
3276 |
|
---|
3277 | void
|
---|
3278 | dbg_con_task (intptr_t exinf)
|
---|
3279 | {
|
---|
3280 | static char line[DBG_LINE_SIZE + 1];
|
---|
3281 |
|
---|
3282 | ID tskid;
|
---|
3283 |
|
---|
3284 | #ifdef USE_LCD
|
---|
3285 | #ifdef SUPPORT_ETHER
|
---|
3286 |
|
---|
3287 | #if 0
|
---|
3288 | #if defined(SUPPORT_INET6)
|
---|
3289 |
|
---|
3290 | uint32_t lllen;
|
---|
3291 | const uint8_t *lladdr;
|
---|
3292 |
|
---|
3293 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
3294 | #endif
|
---|
3295 |
|
---|
3296 | lcd_initialize(0);
|
---|
3297 |
|
---|
3298 | #if 0
|
---|
3299 | #if defined(SUPPORT_INET6)
|
---|
3300 |
|
---|
3301 | dly_tsk(1 * 1000);
|
---|
3302 | lladdr = IF_ETHER_NIC_GET_SOFTC()->ifaddr.lladdr;
|
---|
3303 | for (lllen = ETHER_ADDR_LEN; lllen --; )
|
---|
3304 | lcd_printf(LCD_PORTID, "%02x", *lladdr ++);
|
---|
3305 | lcd_putc(LCD_PORTID, '\n');
|
---|
3306 |
|
---|
3307 | #else /* of #if defined(SUPPORT_INET6) */
|
---|
3308 |
|
---|
3309 | if ((TINET_PRVER & UINT_C(0x0f)) > 0)
|
---|
3310 | lcd_printf(LCD_PORTID, "TINET-%d.%d.%d\n",
|
---|
3311 | (TINET_PRVER >> 12) & UINT_C(0x0f),
|
---|
3312 | (TINET_PRVER >> 4) & UINT_C(0x0f),
|
---|
3313 | TINET_PRVER & UINT_C(0x0f));
|
---|
3314 | else
|
---|
3315 | lcd_printf(LCD_PORTID, "TINET-%d.%d\n",
|
---|
3316 | (TINET_PRVER >> 12) & UINT_C(0x0f),
|
---|
3317 | (TINET_PRVER >> 4) & UINT_C(0x0f));
|
---|
3318 |
|
---|
3319 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
3320 | #endif
|
---|
3321 |
|
---|
3322 | #if 0
|
---|
3323 | #if defined(SUPPORT_INET4)
|
---|
3324 |
|
---|
3325 | dly_tsk(1 * 1000);
|
---|
3326 | lcd_puts(LCD_PORTID, ip2str(NULL, in4_get_ifaddr(0)));
|
---|
3327 | lcd_putc(LCD_PORTID, '\n');
|
---|
3328 |
|
---|
3329 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
3330 | #endif
|
---|
3331 |
|
---|
3332 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
3333 | #endif /* of #ifdef USE_LCD */
|
---|
3334 |
|
---|
3335 | get_tid(&tskid);
|
---|
3336 | cons_printf(CONSOLE_PORTID, "[CONSOLE:%d] started.\n", tskid);
|
---|
3337 | serial_ctl_por(CONSOLE_PORTID,
|
---|
3338 | IOCTL_ECHO | IOCTL_CRLF |
|
---|
3339 | IOCTL_FCSND | IOCTL_FCANY | IOCTL_FCRCV);
|
---|
3340 | netapp_srand (tskid);
|
---|
3341 | while (true) {
|
---|
3342 | cons_getline(CONSOLE_PORTID, line, DBG_LINE_SIZE);
|
---|
3343 | dbg_parse(CONSOLE_PORTID, line);
|
---|
3344 | }
|
---|
3345 | }
|
---|
3346 |
|
---|
3347 | #endif /* of #ifdef USE_DBG_CONS */
|
---|