[270] | 1 | /*
|
---|
| 2 | * TINET (TCP/IP Protocol Stack)
|
---|
| 3 | *
|
---|
| 4 | * Copyright (C) 2001-2009 by Dep. of Computer Science and Engineering
|
---|
| 5 | * Tomakomai National College of Technology, JAPAN
|
---|
| 6 | *
|
---|
| 7 | * ä¸è¨èä½æ¨©è
|
---|
| 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: ppp.c 270 2017-02-09 04:03:47Z coas-nagasima $
|
---|
| 44 | */
|
---|
| 45 |
|
---|
| 46 | /*
|
---|
| 47 | * Copyright (c) 1989 Carnegie Mellon University.
|
---|
| 48 | * All rights reserved.
|
---|
| 49 | *
|
---|
| 50 | * Redistribution and use in source and binary forms are permitted
|
---|
| 51 | * provided that the above copyright notice and this paragraph are
|
---|
| 52 | * duplicated in all such forms and that any documentation,
|
---|
| 53 | * advertising materials, and other materials related to such
|
---|
| 54 | * distribution and use acknowledge that the software was developed
|
---|
| 55 | * by Carnegie Mellon University. The name of the
|
---|
| 56 | * University may not be used to endorse or promote products derived
|
---|
| 57 | * from this software without specific prior written permission.
|
---|
| 58 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
---|
| 59 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
---|
| 60 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 61 | */
|
---|
| 62 |
|
---|
| 63 | /*
|
---|
| 64 | * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
|
---|
| 65 | *
|
---|
| 66 | * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
|
---|
| 67 | *
|
---|
| 68 | * Redistribution and use in source and binary forms are permitted
|
---|
| 69 | * provided that the above copyright notice and this paragraph are
|
---|
| 70 | * duplicated in all such forms and that any documentation,
|
---|
| 71 | * advertising materials, and other materials related to such
|
---|
| 72 | * distribution and use acknowledge that the software was developed
|
---|
| 73 | * by the Internet Initiative Japan. The name of the
|
---|
| 74 | * IIJ may not be used to endorse or promote products derived
|
---|
| 75 | * from this software without specific prior written permission.
|
---|
| 76 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
---|
| 77 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
---|
| 78 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 79 | */
|
---|
| 80 |
|
---|
| 81 | /*
|
---|
| 82 | * PPP å¦çã¿ã¹ã¯ã®æ¬ä½
|
---|
| 83 | */
|
---|
| 84 |
|
---|
| 85 | #include <s_services.h>
|
---|
| 86 | #include <t_services.h>
|
---|
| 87 | #include "kernel_id.h"
|
---|
| 88 |
|
---|
| 89 | #include <tinet_defs.h>
|
---|
| 90 | #include <tinet_config.h>
|
---|
| 91 |
|
---|
| 92 | #include <net/if.h>
|
---|
| 93 | #include <net/if_ppp.h>
|
---|
| 94 | #include <net/net.h>
|
---|
| 95 | #include <net/net_buf.h>
|
---|
| 96 | #include <net/net_timer.h>
|
---|
| 97 | #include <net/net_count.h>
|
---|
| 98 | #include <net/ppp.h>
|
---|
| 99 | #include <net/ppp_var.h>
|
---|
| 100 | #include <net/ppp_hdlc.h>
|
---|
| 101 | #include <net/ppp_fsm.h>
|
---|
| 102 | #include <net/ppp_lcp.h>
|
---|
| 103 | #include <net/ppp_ipcp.h>
|
---|
| 104 | #include <net/ppp_ccp.h>
|
---|
| 105 | #include <net/ppp_upap.h>
|
---|
| 106 | #include <net/ppp_modem.h>
|
---|
| 107 |
|
---|
| 108 | #ifdef SUPPORT_PPP
|
---|
| 109 |
|
---|
| 110 | /*
|
---|
| 111 | * å
|
---|
| 112 | ¨åå¤æ°
|
---|
| 113 | */
|
---|
| 114 |
|
---|
| 115 | uint8_t ppp_phase = PPP_PHASE_INITIALIZE; /* ãªã³ã¯ã®ç¶æ
|
---|
| 116 | */
|
---|
| 117 |
|
---|
| 118 | /*
|
---|
| 119 | * ãããã³ã«è¡¨
|
---|
| 120 | */
|
---|
| 121 |
|
---|
| 122 | T_PPP_PROTENT *protocols[] = {
|
---|
| 123 | &lcp_protent,
|
---|
| 124 | &ipcp_protent,
|
---|
| 125 |
|
---|
| 126 | #ifdef SUPPORT_CCP
|
---|
| 127 | &ccp_protent,
|
---|
| 128 | #endif /* #ifdef SUPPORT_CCP */
|
---|
| 129 |
|
---|
| 130 | #ifdef LCP_CFG_PAP
|
---|
| 131 | &pap_protent,
|
---|
| 132 | #endif /* #ifdef LCP_CFG_PAP */
|
---|
| 133 |
|
---|
| 134 | #ifdef LCP_CFG_CHAP
|
---|
| 135 | &chap_protent,
|
---|
| 136 | #endif /* #ifdef LCP_CFG_CHAP */
|
---|
| 137 |
|
---|
| 138 | NULL
|
---|
| 139 | };
|
---|
| 140 |
|
---|
| 141 | /*
|
---|
| 142 | * å¤æ°
|
---|
| 143 | */
|
---|
| 144 |
|
---|
| 145 | #ifdef PPP_IDLE_TIMEOUT
|
---|
| 146 |
|
---|
| 147 | static bool_t idle = false;
|
---|
| 148 |
|
---|
| 149 | #endif /* of #ifdef PPP_IDLE_TIMEOUT */
|
---|
| 150 |
|
---|
| 151 | /*
|
---|
| 152 | * é¢æ°
|
---|
| 153 | */
|
---|
| 154 |
|
---|
| 155 | static void parse_input (T_NET_BUF *input);
|
---|
| 156 |
|
---|
| 157 | #ifdef PPP_IDLE_TIMEOUT
|
---|
| 158 |
|
---|
| 159 | static void idle_timeout (void *arg);
|
---|
| 160 |
|
---|
| 161 | #endif /* of #ifdef PPP_IDLE_TIMEOUT */
|
---|
| 162 |
|
---|
| 163 | /*
|
---|
| 164 | * PPP å
|
---|
| 165 | ¥åã®è§£æ
|
---|
| 166 | */
|
---|
| 167 |
|
---|
| 168 | static void
|
---|
| 169 | parse_input(T_NET_BUF *input)
|
---|
| 170 | {
|
---|
| 171 | T_PPP_PROTENT *entry;
|
---|
| 172 | int_t ix;
|
---|
| 173 | uint16_t proto;
|
---|
| 174 |
|
---|
| 175 | NET_COUNT_PPP(net_count_ppp.in_octets, input->len);
|
---|
| 176 | NET_COUNT_PPP(net_count_ppp.in_packets, 1);
|
---|
| 177 |
|
---|
| 178 | /* ãã¬ã¼ã é·ããã§ãã¯ãã */
|
---|
| 179 | if (input->len < sizeof(T_PPP_HDR)) { /* FreeBSD ã§ã¯ PPP_HDRLEN 㯠4 */
|
---|
| 180 | syslog(LOG_NOTICE, "[PPP] recv short frame.");
|
---|
| 181 | goto buf_rel;
|
---|
| 182 | }
|
---|
| 183 |
|
---|
| 184 | proto = ntohs(*GET_PPP_HDR(input));
|
---|
| 185 |
|
---|
| 186 | /* ãããã³ã«ã LCP 以å¤ã§ãLCP ããªã¼ãã³ããã¦ããªããã°ã¨ã©ã¼ */
|
---|
| 187 | if (proto != PPP_LCP && lcp_fsm.state != PPP_FSM_OPENED) {
|
---|
| 188 | syslog(LOG_NOTICE, "[PPP] LCP not open.");
|
---|
| 189 | goto buf_rel;
|
---|
| 190 | }
|
---|
| 191 |
|
---|
| 192 | /* ãªã³ã¯ãèªè¨¼ç¶æ
|
---|
| 193 | 以åã¯ãLCPãLQRãPAPãCHAP ã®ã¿åãä»ãã */
|
---|
| 194 | if (ppp_phase <= PPP_PHASE_AUTHENTICATE &&
|
---|
| 195 | !(proto == PPP_LCP || proto == PPP_LQR ||
|
---|
| 196 | proto == PPP_PAP || proto == PPP_CHAP)) {
|
---|
| 197 | syslog(LOG_NOTICE, "[PPP] disc proto: 0x%04x, phase: %d.", proto, ppp_phase);
|
---|
| 198 | goto buf_rel;
|
---|
| 199 | }
|
---|
| 200 |
|
---|
| 201 | /* ä¸ä½ãããã³ã«ã®å
|
---|
| 202 | ¥åé¢æ°ãå¼åºã */
|
---|
| 203 | for (ix = 0; (entry = protocols[ix]) != NULL; ix ++) {
|
---|
| 204 | if (entry->proto == proto && entry->input != NULL) {
|
---|
| 205 | (*entry->input)(input);
|
---|
| 206 | syscall(rel_net_buf(input));
|
---|
| 207 | return;
|
---|
| 208 | }
|
---|
| 209 | if ((entry->proto & ~0x8000) == proto && entry->datainput != NULL) {
|
---|
| 210 | (*entry->datainput)(input);
|
---|
| 211 | return;
|
---|
| 212 | }
|
---|
| 213 | }
|
---|
| 214 |
|
---|
| 215 | syslog(LOG_INFO, "[PPP] unexp proto: 0x%04x.", proto);
|
---|
| 216 | lcp_sprotrej(input);
|
---|
| 217 |
|
---|
| 218 | buf_rel:
|
---|
| 219 | NET_COUNT_PPP(net_count_ppp.in_err_packets, 1);
|
---|
| 220 | syscall(rel_net_buf(input));
|
---|
| 221 | }
|
---|
| 222 |
|
---|
| 223 | /*
|
---|
| 224 | * ppp_output -- PPP ã¤ã³ã¿ãã§ã¼ã¹ã®åºåé¢æ°
|
---|
| 225 | */
|
---|
| 226 |
|
---|
| 227 | ER
|
---|
| 228 | ppp_output (T_NET_BUF *output, TMO tmout)
|
---|
| 229 | {
|
---|
| 230 | ER error = E_OK;
|
---|
| 231 |
|
---|
| 232 | #ifdef PPP_CFG_MODEM
|
---|
| 233 |
|
---|
| 234 | #if 0 /* ä¿ç */
|
---|
| 235 | /* ã¢ãã ã®æ¥ç¶å®äºã¾ã§å¾
|
---|
| 236 | ã¤ã*/
|
---|
| 237 | if ((error = wait_modem()) != E_OK)
|
---|
| 238 | goto buf_ret;
|
---|
| 239 | #endif
|
---|
| 240 |
|
---|
| 241 | #endif /* of #ifdef PPP_CFG_MODEM */
|
---|
| 242 |
|
---|
| 243 | /* IPCP ã®æ¥ç¶å®äºã¾ã§å¾
|
---|
| 244 | ã¤ã*/
|
---|
| 245 | if ((error = wait_ipcp()) != E_OK)
|
---|
| 246 | goto buf_ret;
|
---|
| 247 |
|
---|
| 248 | #ifdef PPP_IDLE_TIMEOUT
|
---|
| 249 | wai_sem(SEM_IDLE_TIMEOUT);
|
---|
| 250 | if (idle) {
|
---|
| 251 | untimeout((FP)idle_timeout, NULL);
|
---|
| 252 | idle = false;
|
---|
| 253 | }
|
---|
| 254 | sig_sem(SEM_IDLE_TIMEOUT);
|
---|
| 255 | #endif /* of #ifdef PPP_IDLE_TIMEOUT */
|
---|
| 256 |
|
---|
| 257 | /* PPP åºåãã¥ã¼ã«æå
|
---|
| 258 | ¥ããã*/
|
---|
| 259 | if ((error = tsnd_dtq(DTQ_PPP_OUTPUT, output, tmout)) != E_OK)
|
---|
| 260 | goto buf_ret;
|
---|
| 261 |
|
---|
| 262 | #ifdef PPP_IDLE_TIMEOUT
|
---|
| 263 | wai_sem(SEM_IDLE_TIMEOUT);
|
---|
| 264 | if (!idle && ppp_phase == PPP_PHASE_NETWORK) {
|
---|
| 265 | timeout((FP)idle_timeout, NULL, PPP_IDLE_TIMEOUT);
|
---|
| 266 | idle = true;
|
---|
| 267 | }
|
---|
| 268 | sig_sem(SEM_IDLE_TIMEOUT);
|
---|
| 269 | #endif /* of #ifdef PPP_IDLE_TIMEOUT */
|
---|
| 270 |
|
---|
| 271 | return error;
|
---|
| 272 |
|
---|
| 273 | buf_ret:
|
---|
| 274 | syscall(rel_net_buf(output));
|
---|
| 275 | NET_COUNT_PPP(net_count_ppp.out_err_packets, 1);
|
---|
| 276 | return error;
|
---|
| 277 | }
|
---|
| 278 |
|
---|
| 279 | /*
|
---|
| 280 | * ppp_cp_output -- CP ãã¬ã¼ã ã®éä¿¡
|
---|
| 281 | */
|
---|
| 282 |
|
---|
| 283 | void
|
---|
| 284 | ppp_cp_output (uint8_t code, uint8_t id, T_NET_BUF *output)
|
---|
| 285 | {
|
---|
| 286 | T_PPP_CP_HDR *cph;
|
---|
| 287 |
|
---|
| 288 | /* CP ããããè¨å®ãã */
|
---|
| 289 | cph = GET_PPP_CP_HDR(output);
|
---|
| 290 | cph->code = code;
|
---|
| 291 | cph->id = id;
|
---|
| 292 | cph->len = htons(output->len - sizeof(T_PPP_HDR));
|
---|
| 293 |
|
---|
| 294 | /* PPP åºåãã¥ã¼ã«æå
|
---|
| 295 | ¥ããã*/
|
---|
| 296 | if (snd_dtq(DTQ_PPP_OUTPUT, output) != E_OK) {
|
---|
| 297 | syscall(rel_net_buf(output));
|
---|
| 298 | NET_COUNT_PPP(net_count_ppp.out_err_packets, 1);
|
---|
| 299 | }
|
---|
| 300 | }
|
---|
| 301 |
|
---|
| 302 | /*
|
---|
| 303 | * PPP å
|
---|
| 304 | ¥åã¿ã¹ã¯
|
---|
| 305 | */
|
---|
| 306 |
|
---|
| 307 | void
|
---|
| 308 | ppp_input_task(intptr_t exinf)
|
---|
| 309 | {
|
---|
| 310 | T_NET_BUF *input;
|
---|
| 311 | T_PPP_PROTENT *proto;
|
---|
| 312 | ID tskid;
|
---|
| 313 | int_t ix;
|
---|
| 314 |
|
---|
| 315 | /* ãã¼ããåæè¨å®ãã */
|
---|
| 316 | syscall(serial_opn_por(HDLC_PORTID));
|
---|
| 317 | syscall(serial_ctl_por(HDLC_PORTID, IOCTL_FCSND | IOCTL_FCRCV));
|
---|
| 318 |
|
---|
| 319 | get_tid(&tskid);
|
---|
| 320 |
|
---|
| 321 | #ifdef PPP_CFG_MODEM
|
---|
| 322 |
|
---|
| 323 | init_modem();
|
---|
| 324 | syslog(LOG_NOTICE, "[PPP INPUT:%d] started with modem on port %d.", tskid, HDLC_PORTID);
|
---|
| 325 |
|
---|
| 326 | #else /* of #ifdef PPP_CFG_MODEM */
|
---|
| 327 |
|
---|
| 328 | syslog(LOG_NOTICE, "[PPP INPUT:%d] started on port %d.", tskid, HDLC_PORTID);
|
---|
| 329 |
|
---|
| 330 | #endif /* of #ifdef PPP_CFG_MODEM */
|
---|
| 331 |
|
---|
| 332 | /* ãããã¯ã¼ã¯ã¿ã¤ãã¿ã¹ã¯ãèµ·åãã */
|
---|
| 333 | syscall(act_tsk(NET_TIMER_TASK));
|
---|
| 334 |
|
---|
| 335 | /* ä¸ä½ãããã³ã«ãåæåãã */
|
---|
| 336 | for (ix = 0; (proto = protocols[ix]) != NULL; ix ++)
|
---|
| 337 | if (proto->init != NULL)
|
---|
| 338 | (*proto->init)();
|
---|
| 339 |
|
---|
| 340 | lcp_lowerup();
|
---|
| 341 | lcp_open(PPP_OPEN_PASSIVE);
|
---|
| 342 |
|
---|
| 343 | /* PPP åºåã¿ã¹ã¯ãèµ·åãã */
|
---|
| 344 | syscall(act_tsk(PPP_OUTPUT_TASK));
|
---|
| 345 |
|
---|
| 346 | while (true) {
|
---|
| 347 | if (tget_net_buf(&input, IF_PDU_SIZE, TMO_PPP_GET_NET_BUF) == E_OK) {
|
---|
| 348 | while (HDLC_read(input, IF_PDU_SIZE) != E_OK)
|
---|
| 349 | ;
|
---|
| 350 | if (input->len > 0) {
|
---|
| 351 |
|
---|
| 352 | #ifdef PPP_IDLE_TIMEOUT
|
---|
| 353 | wai_sem(SEM_IDLE_TIMEOUT);
|
---|
| 354 | if (idle && ntohs(*GET_PPP_HDR(input)) != PPP_LCP) {
|
---|
| 355 | untimeout((FP)idle_timeout, NULL);
|
---|
| 356 | idle = false;
|
---|
| 357 | }
|
---|
| 358 | sig_sem(SEM_IDLE_TIMEOUT);
|
---|
| 359 | #endif /* of #ifdef PPP_IDLE_TIMEOUT */
|
---|
| 360 |
|
---|
| 361 | parse_input(input);
|
---|
| 362 | }
|
---|
| 363 | else
|
---|
| 364 | syscall(rel_net_buf(input));
|
---|
| 365 |
|
---|
| 366 | #ifdef PPP_IDLE_TIMEOUT
|
---|
| 367 | wai_sem(SEM_IDLE_TIMEOUT);
|
---|
| 368 | if (!idle && ppp_phase == PPP_PHASE_NETWORK) {
|
---|
| 369 | timeout((FP)idle_timeout, NULL, PPP_IDLE_TIMEOUT);
|
---|
| 370 | idle = true;
|
---|
| 371 | }
|
---|
| 372 | else if (idle && ppp_phase != PPP_PHASE_NETWORK) {
|
---|
| 373 | untimeout((FP)idle_timeout, NULL);
|
---|
| 374 | idle = false;
|
---|
| 375 | }
|
---|
| 376 | sig_sem(SEM_IDLE_TIMEOUT);
|
---|
| 377 | #endif /* of #ifdef PPP_IDLE_TIMEOUT */
|
---|
| 378 |
|
---|
| 379 | }
|
---|
| 380 | else {
|
---|
| 381 | HDLC_dummy_read();
|
---|
| 382 | NET_COUNT_PPP(net_count_ppp.in_err_packets, 1);
|
---|
| 383 | NET_COUNT_PPP(net_count_ppp_no_bufs, 1);
|
---|
| 384 | }
|
---|
| 385 | }
|
---|
| 386 | }
|
---|
| 387 |
|
---|
| 388 | /*
|
---|
| 389 | * PPP åºåã¿ã¹ã¯
|
---|
| 390 | */
|
---|
| 391 |
|
---|
| 392 | void
|
---|
| 393 | ppp_output_task(intptr_t exinf)
|
---|
| 394 | {
|
---|
| 395 | T_NET_BUF *output;
|
---|
| 396 | ID tskid;
|
---|
| 397 |
|
---|
| 398 | get_tid(&tskid);
|
---|
| 399 | syslog(LOG_NOTICE, "[PPP OUTPUT:%d] started.", tskid);
|
---|
| 400 |
|
---|
| 401 | while (true) {
|
---|
| 402 | while (rcv_dtq(DTQ_PPP_OUTPUT, (intptr_t*)&output) == E_OK) {
|
---|
| 403 | NET_COUNT_PPP(net_count_ppp.out_octets, output->len);
|
---|
| 404 | NET_COUNT_PPP(net_count_ppp.out_packets, 1);
|
---|
| 405 | syscall(HDLC_write(output));
|
---|
| 406 | syscall(rel_net_buf(output));
|
---|
| 407 | }
|
---|
| 408 | }
|
---|
| 409 | }
|
---|
| 410 |
|
---|
| 411 | #ifdef PPP_IDLE_TIMEOUT
|
---|
| 412 |
|
---|
| 413 | /*
|
---|
| 414 | * ã¢ã¤ãã«ã¿ã¤ã ã¢ã¦ãå¦ç
|
---|
| 415 | */
|
---|
| 416 |
|
---|
| 417 | static void
|
---|
| 418 | idle_timeout (void *arg)
|
---|
| 419 | {
|
---|
| 420 | syslog(LOG_NOTICE, "[PPP] idel %d [s], disconnecting.", (uint16_t)(PPP_IDLE_TIMEOUT / NET_TIMER_HZ));
|
---|
| 421 | lcp_close();
|
---|
| 422 | }
|
---|
| 423 |
|
---|
| 424 | #endif /* of #ifdef PPP_IDLE_TIMEOUT */
|
---|
| 425 |
|
---|
| 426 | #endif /* fo #ifdef SUPPORT_PPP */
|
---|