source: rubycfg_asp/trunk/asp_dcre/tinet/net/ppp_ipcp.c@ 313

Last change on this file since 313 was 313, checked in by coas-nagasima, 7 years ago

ソースを追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-csrc
File size: 18.3 KB
Line 
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: ppp_ipcp.c 313 2017-07-23 04:50:32Z coas-nagasima $
44 */
45
46/*
47 * ipcp.c - PPP IP Control Protocol.
48 *
49 * Copyright (c) 1989 Carnegie Mellon University.
50 * All rights reserved.
51 *
52 * Redistribution and use in source and binary forms are permitted
53 * provided that the above copyright notice and this paragraph are
54 * duplicated in all such forms and that any documentation,
55 * advertising materials, and other materials related to such
56 * distribution and use acknowledge that the software was developed
57 * by Carnegie Mellon University. The name of the
58 * University may not be used to endorse or promote products derived
59 * from this software without specific prior written permission.
60 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
61 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
62 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
63 */
64
65/*
66 * PPP IP Control Protocol (IPCP) Module
67 *
68 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
69 *
70 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
71 *
72 * Redistribution and use in source and binary forms are permitted
73 * provided that the above copyright notice and this paragraph are
74 * duplicated in all such forms and that any documentation,
75 * advertising materials, and other materials related to such
76 * distribution and use acknowledge that the software was developed
77 * by the Internet Initiative Japan, Inc. The name of the
78 * IIJ may not be used to endorse or promote products derived
79 * from this software without specific prior written permission.
80 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
81 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
82 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
83 *
84 * $FreeBSD: src/usr.sbin/ppp/ipcp.c,v 1.90.2.4 2000/08/19 09:30:03 brian Exp $
85 *
86 * TODO:
87 * o Support IPADDRS properly
88 * o Validate the length in IpcpDecodeConfig
89 */
90
91#include <string.h>
92
93#include <s_services.h>
94#include <t_services.h>
95#include "kernel_id.h"
96
97#include <tinet_defs.h>
98#include <tinet_config.h>
99
100#include <net/if.h>
101#include <net/if_ppp.h>
102#include <net/net.h>
103#include <net/net_endian.h>
104#include <net/net_buf.h>
105#include <net/net_count.h>
106#include <net/ppp.h>
107#include <net/ppp_var.h>
108#include <net/ppp_fsm.h>
109#include <net/ppp_lcp.h>
110#include <net/ppp_ipcp.h>
111#include <net/ppp_modem.h>
112
113#include <netinet/in.h>
114#include <netinet/in_var.h>
115#include <netinet/ip.h>
116#include <netinet/tcp.h>
117#include <netinet/tcp_var.h>
118#include <netinet/tcp_timer.h>
119#include <netinet/udp_var.h>
120
121#include <net/if_var.h>
122
123#ifdef SUPPORT_PPP
124
125/*
126 * 関数
127 */
128
129static void ipcp_init (void);
130static void ipcp_input (T_NET_BUF *input);
131static void ipcp_protrej (void);
132static void ipcp_lowerup (void);
133static void ipcp_lowerdown (void);
134static void ipcp_open (void);
135static void ipcp_close (void);
136
137/*
138 * FSM から呼出されるコールバック関
139 */
140
141static void ipcp_resetci(T_PPP_FSM *fsm); /* 自構成情
142報をリセットする。 */
143static int_t ipcp_cilen (T_PPP_FSM *fsm); /* 構成情
144報の長さを返す。 */
145static void ipcp_addci (T_PPP_FSM *fsm, T_NET_BUF *output);
146 /* 自構成情
147報を追加する。 */
148static bool_t ipcp_ackci (T_PPP_FSM *fsm, T_NET_BUF *input);
149 /* ACK を受信したときの処理 */
150static bool_t ipcp_nakci (T_PPP_FSM *fsm, T_NET_BUF *input);
151 /* NAK を受信したときの処理 */
152static bool_t ipcp_rejci (T_PPP_FSM *fsm, T_NET_BUF *input);
153 /* REJ を受信したときの処理 */
154static int_t ipcp_reqci (T_PPP_FSM *fsm, T_NET_BUF *input, T_NET_BUF *output);
155 /* 相手の構成情
156報を確認する。 */
157static void ipcp_up (T_PPP_FSM *fsm); /* リンク接続を確立する。 */
158static void ipcp_down (T_PPP_FSM *fsm); /* リンク接続を解放する。 */
159static void ipcp_finished(T_PPP_FSM *fsm); /* 下位層を終了する。 */
160
161/*
162 * 変数
163 */
164
165static T_IFNET ipcp_local_def_cfg = { /* 自構成情
166報の規定値 */
167 NULL,
168 {
169 IPV4_ADDR_LOCAL, /* IPv4 アドレス */
170 UINT_C(0), /* サブネットマスク */
171 },
172 };
173
174static T_IFNET ipcp_remote_def_cfg = { /* 相手の構成情
175報の規定値 */
176 NULL,
177 {
178 IPV4_ADDR_REMOTE, /* IPv4 アドレス */
179 UINT_C(0), /* サブネットマスク */
180 }
181 };
182
183static T_IFNET ipcp_local_neg_cfg; /* ネゴ中の自構成情
184å ± */
185
186static T_IFNET ipcp_remote_neg_cfg; /* ネゴ中の相手の構成情
187å ± */
188
189/*
190 * å…
191¨åŸŸå¤‰æ•°
192 */
193
194T_PPP_FSM_CALLBACKS ipcp_callbacks = {
195 ipcp_resetci, /* 自構成情
196報をリセットする。 */
197 ipcp_cilen, /* 構成情
198報の長さを返す。 */
199 ipcp_addci, /* 自構成情
200報を追加する。 */
201 ipcp_ackci, /* ACK を受信したときの処理 */
202 ipcp_nakci, /* NAK を受信したときの処理 */
203 ipcp_rejci, /* REJ を受信したときの処理 */
204 ipcp_reqci, /* 相手の構成情
205報を確認する。 */
206 ipcp_up, /* リンク接続を確立する。 */
207 ipcp_down, /* リンク接続を解放する。 */
208 NULL, /* 下位層を開始する。 */
209 ipcp_finished, /* 下位層を終了する。 */
210 NULL, /* 再送する。 */
211 NULL, /* 不明な CP を受信したときの処理 */
212 };
213
214T_PPP_FSM ipcp_fsm = {
215 &ipcp_callbacks, /* コールバック関数 */
216 PPP_IPCP, /* プロトコル */
217 };
218
219T_PPP_PROTENT ipcp_protent = {
220 PPP_IPCP,
221 ipcp_init, /* 初期化 */
222 ipcp_input, /* å…
223¥åŠ› */
224 ipcp_protrej, /* Proto-REJ 受信処理 */
225 ipcp_lowerup, /* 下位層を起動する */
226 ipcp_lowerdown, /* 下位層を停止する */
227 ipcp_open, /* オープンする */
228 ipcp_close, /* クローズする */
229 ip_input, /* データå…
230¥åŠ›ã€IPv4 å…
231¥åŠ› */
232 };
233
234T_IFNET ipcp_local_ack_cfg; /* 相手に許可されたの自構成情
235å ± */
236T_IFNET ipcp_remote_ack_cfg; /* 相手に許可した構成情
237å ± */
238
239/*
240 * ppp_get_ifnet -- ネットワークインタフェース構造体を返す。
241 */
242
243T_IFNET *
244ppp_get_ifnet (void)
245{
246 return &ipcp_local_ack_cfg;
247 }
248
249/*
250 * wait_ipcp -- IP 接続完了まで待
251つ。
252 *
253 * 戻り値: 接続に失敗したら E_OBJ を返す。
254 */
255
256ER
257wait_ipcp (void)
258{
259#ifdef PPP_CFG_MODEM
260 ER error;
261#endif /* of #ifdef PPP_CFG_MODEM */
262
263 if (ipcp_fsm.state <= PPP_FSM_STOPPED) {
264
265#ifdef PPP_CFG_MODEM
266
267 /* モデムの接続完了まで待
268つ。*/
269 if ((error = wait_modem()) != E_OK)
270 return error;
271
272#else /* of #ifdef PPP_CFG_MODEM */
273
274 /*
275 * 受動オープンし、相手からの接続待
276ちなら LCP を一度クローズし、
277 * 能動オープン状æ…
278‹ã§ã€å†ã‚ªãƒ¼ãƒ—ンする。
279 */
280 lcp_close();
281 lcp_open(PPP_OPEN_ACTIVE);
282
283#endif /* of #ifdef PPP_CFG_MODEM */
284
285 }
286
287 if (ipcp_fsm.state != PPP_FSM_OPENED) {
288 /* IP 接続完了まで待
289つ。*/
290 wai_sem(SEM_IPCP_READY);
291 if (ipcp_fsm.state != PPP_FSM_OPENED)
292 return E_OBJ;
293 }
294
295 return E_OK;
296 }
297
298/*
299 * ipcp_init -- IPCP モジュールの初期化
300 */
301
302static void
303ipcp_init (void)
304{
305 fsm_init(&ipcp_fsm);
306 }
307
308/*
309 * ipcp_input -- IPCP å…
310¥åŠ›
311 */
312
313static void
314ipcp_input (T_NET_BUF *input)
315{
316 NET_COUNT_PPP_IPCP(net_count_ppp_ipcp_in_octets, input->len);
317 NET_COUNT_PPP_IPCP(net_count_ppp_ipcp_in_packets, 1);
318 fsm_input(&ipcp_fsm, input);
319 }
320
321/*
322 * ipcp_resetci -- IPCPの構成情
323報をリセットする。
324 */
325
326static void
327ipcp_resetci (T_PPP_FSM *fsm)
328{
329 /* 自構成情
330報の初期設定 */
331 ipcp_local_neg_cfg = ipcp_local_def_cfg;
332 memset((void*)&ipcp_local_ack_cfg, 0, sizeof(T_IFNET));
333
334 /* 相手の構成情
335報の初期設定 */
336 ipcp_remote_neg_cfg = ipcp_remote_def_cfg;
337 memset((void*)&ipcp_remote_ack_cfg, 0, sizeof(T_IFNET));
338 }
339
340/*
341 * ipcp_cilen -- 構成情
342報の長さを返す。
343 */
344
345static int_t
346ipcp_cilen (T_PPP_FSM *fsm)
347{
348 int_t cilen = 0;
349
350 cilen += sizeof(T_PPP_CI_HDR) + sizeof(uint32_t); /* IPv4 アドレス */
351
352 return cilen;
353 }
354
355/*
356 * ipcp_addci -- IPCPの構成情
357報を追加する。
358 */
359
360static void
361ipcp_addci (T_PPP_FSM *fsm, T_NET_BUF *output)
362{
363 uint8_t *buf;
364
365 buf = output->buf + sizeof(T_PPP_HDR) + sizeof(T_PPP_CP_HDR);
366
367 /* IPv4 アドレスオプションを追加する。 */
368 *buf ++ = IPCP_CIT_ADDR;
369 *buf ++ = sizeof(T_PPP_CI_HDR) + sizeof(uint32_t);
370 ahtonl(buf, ipcp_local_neg_cfg.in4_ifaddr.addr);
371 buf += sizeof(uint32_t);
372 }
373
374/*
375 * ipcp_ackci -- ACK を受信したときの処理
376 *
377 * 戻り値: true ACK は正常
378 * false ACK は異常
379 */
380
381static bool_t
382ipcp_ackci (T_PPP_FSM *fsm, T_NET_BUF *input)
383{
384 uint8_t *buf;
385 uint16_t len;
386
387 buf = input->buf + sizeof(T_PPP_HDR) + sizeof(T_PPP_CP_HDR);
388 len = input->len - (sizeof(T_PPP_HDR) + sizeof(T_PPP_CP_HDR));
389
390 /*
391 * 構成情
392報は送信した順に完å…
393¨ã«ä¸€è‡´ã—なければならない。
394 * 従って、ipcp_addci で作成した順に解析する。
395 */
396
397 /* ADDR オプションを解析する。 */
398 if (len < sizeof(T_PPP_CI_HDR) + sizeof(uint32_t) ||
399 *buf ++ != IPCP_CIT_ADDR ||
400 *buf ++ != sizeof(T_PPP_CI_HDR) + sizeof(uint32_t)||
401 nahcmpl(buf, ipcp_local_neg_cfg.in4_ifaddr.addr))
402 return false;
403 buf += sizeof(uint32_t);
404 len -= sizeof(T_PPP_CI_HDR) + sizeof(uint32_t);
405
406 return true;
407 }
408
409/*
410 * ipcp_nakci -- NAK を受信したときの処理
411 *
412 * 戻り値: 1 NAK は正常
413 * 0 NAK は異常
414 */
415
416static int_t
417ipcp_nakci (T_PPP_FSM *fsm, T_NET_BUF *input)
418{
419 T_IFNET new_cfg;
420 uint32_t cilong;
421 uint16_t len;
422 uint8_t *buf, cilen;
423
424 buf = input->buf + sizeof(T_PPP_HDR) + sizeof(T_PPP_CP_HDR);
425 len = input->len - (sizeof(T_PPP_HDR) + sizeof(T_PPP_CP_HDR));
426
427 new_cfg = ipcp_local_neg_cfg;
428
429 /* ADDR オプションを解析する。 */
430 if (len >= sizeof(T_PPP_CI_HDR) + sizeof(uint32_t) &&
431 * buf == IPCP_CIT_ADDR &&
432 *(buf + 1) == sizeof(T_PPP_CI_HDR) + sizeof(uint32_t)) {
433 ntoahl(cilong, buf + 2);
434 buf += sizeof(T_PPP_CI_HDR) + sizeof(uint32_t);
435 len -= sizeof(T_PPP_CI_HDR) + sizeof(uint32_t);
436 new_cfg.in4_ifaddr.addr = cilong;
437 }
438
439 /* 後は無視する。*/
440 while (len > sizeof(T_PPP_CI_HDR)) {
441 cilen = *(buf + 1);
442 if (len < cilen)
443 return 0;
444 buf += cilen;
445 len -= cilen;
446 }
447
448 /* 長さが 0 でなければエラー */
449 if (len != 0)
450 return 0;
451
452 /* 新しいオプションを設定する。*/
453 if (fsm->state != PPP_FSM_OPENED)
454 ipcp_local_neg_cfg = new_cfg;
455
456 return 1;
457 }
458
459/*
460 * ipcp_rejci -- REJ を受信したときの処理
461 *
462 * 戻り値: 1 REJ は正常
463 * 0 REJ は異常
464 */
465
466static int_t
467ipcp_rejci (T_PPP_FSM *fsm, T_NET_BUF *input)
468{
469 T_IFNET new_cfg;
470 uint8_t *buf;
471 uint16_t len;
472
473 buf = input->buf + sizeof(T_PPP_HDR) + sizeof(T_PPP_CP_HDR);
474 len = input->len - (sizeof(T_PPP_HDR) + sizeof(T_PPP_CP_HDR));
475
476 new_cfg = ipcp_local_neg_cfg;
477
478 /* ADDR オプションを解析する。 */
479 if (len >= sizeof(T_PPP_CI_HDR) + sizeof(uint32_t) &&
480 * buf == IPCP_CIT_ADDR &&
481 *(buf + 1) == sizeof(T_PPP_CI_HDR) + sizeof(uint32_t)) {
482 buf += sizeof(T_PPP_CI_HDR) + sizeof(uint32_t);
483 len -= sizeof(T_PPP_CI_HDR) + sizeof(uint32_t);
484 new_cfg.in4_ifaddr.addr = 0;
485 }
486
487 /* 長さが 0 でなければエラー */
488 if (len != 0)
489 return 0;
490
491 /* 新しいオプションを設定する。*/
492 if (fsm->state != PPP_FSM_OPENED)
493 ipcp_local_neg_cfg = new_cfg;
494
495 return 1;
496 }
497
498/*
499 * ipcp_reqci -- 相手の構成情
500報を解析する。
501 */
502
503static int_t
504ipcp_reqci (T_PPP_FSM *fsm, T_NET_BUF *input, T_NET_BUF *output)
505{
506 uint32_t addr;
507 uint16_t code, final, len, cilen;
508 uint8_t *np, *rp, *ap, *cp, type = 0;
509
510 rp = ap = input->buf + sizeof(T_PPP_HDR) + sizeof(T_PPP_CP_HDR);
511 /* rp: REJ、ap: ACK する CI のポインタ */
512 /* 拒否する場合は、引数 buf に上書きする。 */
513 len = input->len - (sizeof(T_PPP_HDR) + sizeof(T_PPP_CP_HDR));
514 np = output->buf + sizeof(T_PPP_HDR) + sizeof(T_PPP_CP_HDR);
515 final = PPP_CONFACK; /* 最終的に送信するコード */
516 while (len > 0) {
517 code = PPP_CONFACK;
518 cp = ap; /* cp: 現在処理中の CI */
519
520 if (len < sizeof(T_PPP_CI_HDR)) {
521
522 /* 残りが CI ヘッダより短い */
523 syslog(LOG_NOTICE, "[PPP/IPCP] bad CI len: %d.", len);
524 cilen = len; /* データ長が異常の場合の処置 */
525 len = 0; /* ループから抜ける。 */
526 code = PPP_CONFREJ;
527 goto endswitch;
528 }
529
530 type = *ap ++; /* CI の型 */
531 cilen = *ap ++; /* CI の長さ */
532 if (len < cilen) {
533
534 /* 残りが CI 長より短い */
535 syslog(LOG_NOTICE, "[PPP/IPCP] bad CI len: %d.", cilen);
536 cilen = len; /* データ長が異常の場合の処置 */
537 len = 0; /* ループから抜ける。 */
538 code = PPP_CONFREJ;
539 goto endswitch;
540 }
541 len -= sizeof(T_PPP_CI_HDR);
542
543 /* CI の型により分岐する。*/
544 switch (type) {
545
546 case IPCP_CIT_ADDR: /* IPv4 アドレス */
547
548 /* CI 長が、ヘッダ + 4 オクテットでなければエラー */
549 if (cilen != sizeof(T_PPP_CI_HDR) + sizeof(uint32_t))
550 code = PPP_CONFREJ;
551 else {
552 ntoahl(addr, ap);
553 if (addr != ipcp_remote_neg_cfg.in4_ifaddr.addr &&
554 (addr == 0 || ipcp_remote_neg_cfg.in4_ifaddr.addr != 0)) {
555 *np ++ = IPCP_CIT_ADDR;
556 *np ++ = sizeof(T_PPP_CI_HDR) + sizeof(uint32_t);
557 ahtonl(np, ipcp_remote_neg_cfg.in4_ifaddr.addr);
558 np += sizeof(uint32_t);
559 code = PPP_CONFNAK;
560 }
561#if 1 /* 要確認 */
562 else if (addr == 0 && ipcp_remote_neg_cfg.in4_ifaddr.addr == 0)
563#else
564 else if (addr == 0 || ipcp_remote_neg_cfg.in4_ifaddr.addr == 0)
565#endif
566 code = PPP_CONFREJ;
567 else
568 ipcp_remote_neg_cfg.in4_ifaddr.addr = addr;
569 }
570 break;
571
572 default:
573 syslog(LOG_INFO, "[PPP/IPCP] unexp opt: %d.", type);
574 code = PPP_CONFREJ;
575 break;
576 }
577endswitch:
578
579 if (code == PPP_CONFNAK) {
580 /* CI の型が Magic Number の場合を除いて、NAK の回数が */
581 /* 最大値 MAX_PPP_FAILURES を超
582えたら拒否する。 */
583 if (fsm->failures >= MAX_PPP_FAILURES)
584 code = PPP_CONFREJ;
585 else if (final != PPP_CONFREJ)
586 final = PPP_CONFNAK;
587 }
588
589 /* この CI を拒否する */
590 if (code == PPP_CONFREJ) {
591 if (rp < cp) /* 前に詰める。*/
592 memcpy(rp, cp, cilen);
593 rp += cilen;
594 final = PPP_CONFREJ;
595 }
596
597 ap += cilen - sizeof(T_PPP_CI_HDR);
598 len -= cilen - sizeof(T_PPP_CI_HDR);
599 }
600
601 /* 最終的な長さを調整する。*/
602 switch (final) {
603 case PPP_CONFNAK:
604 output->len = np - output->buf;
605 memcpy(output->buf, input->buf, sizeof(T_PPP_HDR) + sizeof(T_PPP_CP_HDR));
606 break;
607 case PPP_CONFREJ:
608 memcpy(output->buf, input->buf, output->len = rp - input->buf);
609 break;
610 case PPP_CONFACK:
611 memcpy(output->buf, input->buf, input->len);
612 break;
613 }
614
615 return final;
616 }
617
618/*
619 * ipcp_up -- リンク接続を確立する。
620 */
621
622static void
623ipcp_up (T_PPP_FSM *fsm)
624{
625 /* 自構成情
626報の初期設定 */
627 ipcp_local_ack_cfg = ipcp_local_neg_cfg;
628
629 /*
630 * サブネットマスクと
631 * ローカル・ブロードキャスト IPv4 アドレスを設定する。
632 */
633 ipcp_local_ack_cfg.in4_ifaddr.mask = MAKE_IPV4_LOCAL_MASK(ipcp_local_neg_cfg.in4_ifaddr.addr);
634
635 /* 相手の構成情
636報の初期設定 */
637 ipcp_remote_ack_cfg = ipcp_remote_neg_cfg;
638
639 /*
640 * サブネットマスクと
641 * ローカル・ブロードキャスト IPv4 アドレスを設定する。
642 */
643 ipcp_remote_ack_cfg.in4_ifaddr.mask = MAKE_IPV4_LOCAL_MASK(ipcp_remote_neg_cfg.in4_ifaddr.addr);
644
645 sig_sem(SEM_IPCP_READY);
646
647 syslog(LOG_NOTICE, "[PPP/IPCP] up, Local IPv4 Addr: %s, Remote IPv4 Addr: %s.",
648 ip2str(NULL, &ipcp_local_neg_cfg.in4_ifaddr.addr),
649 ip2str(NULL, &ipcp_remote_neg_cfg.in4_ifaddr.addr));
650 }
651
652/*
653 * ipcp_down -- リンク接続を解放する。
654 */
655
656static void
657ipcp_down (T_PPP_FSM *fsm)
658{
659 sig_sem(SEM_IPCP_READY);
660 syslog(LOG_NOTICE, "[PPP/IPCP] down.");
661 }
662
663/*
664 * ipcp_finished -- 下位層を終了する。
665 */
666
667static void
668ipcp_finished (T_PPP_FSM *fsm)
669{
670 }
671
672/*
673 * ipcp_protrej -- Proto-REJ を受信したときの処理
674 */
675
676static void
677ipcp_protrej (void)
678{
679 fsm_lowerdown(&ipcp_fsm);
680 }
681
682/*
683 * ipcp_lowerup -- IPCP 下位層を起動する。
684 */
685
686static void
687ipcp_lowerup (void)
688{
689 fsm_lowerup(&ipcp_fsm);
690 }
691
692/*
693 * ipcp_lowerdown -- IPCP 下位層を停止する。
694 */
695
696static void
697ipcp_lowerdown (void)
698{
699 fsm_lowerdown(&ipcp_fsm);
700 }
701
702/*
703 * ipcp_open -- IPCP のオープン
704 */
705
706static void
707ipcp_open (void)
708{
709 fsm_open(&ipcp_fsm);
710 }
711
712/*
713 * ipcp_close -- IPCP のクローズ
714 */
715
716static void
717ipcp_close (void)
718{
719 fsm_close(&ipcp_fsm);
720 }
721
722#endif /* fo #ifdef SUPPORT_PPP */
Note: See TracBrowser for help on using the repository browser.