Deleted Added
full compact
ipcp.c (47648) ipcp.c (47695)
1/*
2 * PPP IP Control Protocol (IPCP) Module
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan, Inc. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
1/*
2 * PPP IP Control Protocol (IPCP) Module
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan, Inc. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
20 * $Id: ipcp.c,v 1.77 1999/05/09 20:02:19 brian Exp $
20 * $Id: ipcp.c,v 1.78 1999/05/31 23:57:40 brian Exp $
21 *
22 * TODO:
23 * o Support IPADDRS properly
24 * o Validate the length in IpcpDecodeConfig
25 */
26#include <sys/param.h>
27#include <netinet/in_systm.h>
28#include <netinet/in.h>

--- 606 unchanged lines hidden (view full) ---

635 struct in_addr dns[2];
636 getdns(ipcp, dns);
637 memcpy(o->data, &dns[0].s_addr, 4);
638 INC_LCP_OPT(TY_PRIMARY_DNS, 6, o);
639 memcpy(o->data, &dns[1].s_addr, 4);
640 INC_LCP_OPT(TY_SECONDARY_DNS, 6, o);
641 }
642
21 *
22 * TODO:
23 * o Support IPADDRS properly
24 * o Validate the length in IpcpDecodeConfig
25 */
26#include <sys/param.h>
27#include <netinet/in_systm.h>
28#include <netinet/in.h>

--- 606 unchanged lines hidden (view full) ---

635 struct in_addr dns[2];
636 getdns(ipcp, dns);
637 memcpy(o->data, &dns[0].s_addr, 4);
638 INC_LCP_OPT(TY_PRIMARY_DNS, 6, o);
639 memcpy(o->data, &dns[1].s_addr, 4);
640 INC_LCP_OPT(TY_SECONDARY_DNS, 6, o);
641 }
642
643 fsm_Output(fp, CODE_CONFIGREQ, fp->reqid, buff, (u_char *)o - buff);
643 fsm_Output(fp, CODE_CONFIGREQ, fp->reqid, buff, (u_char *)o - buff,
644 MB_IPCPOUT);
644}
645
646static void
647IpcpSentTerminateReq(struct fsm *fp)
648{
649 /* Term REQ just sent by FSM */
650}
651
652static void
653IpcpSendTerminateAck(struct fsm *fp, u_char id)
654{
655 /* Send Term ACK please */
645}
646
647static void
648IpcpSentTerminateReq(struct fsm *fp)
649{
650 /* Term REQ just sent by FSM */
651}
652
653static void
654IpcpSendTerminateAck(struct fsm *fp, u_char id)
655{
656 /* Send Term ACK please */
656 fsm_Output(fp, CODE_TERMACK, id, NULL, 0);
657 fsm_Output(fp, CODE_TERMACK, id, NULL, 0, MB_IPCPOUT);
657}
658
659static void
660IpcpLayerStart(struct fsm *fp)
661{
662 /* We're about to start up ! */
663 struct ipcp *ipcp = fsm2ipcp(fp);
664

--- 474 unchanged lines hidden (view full) ---

1139 dec->ackend = dec->ack;
1140 }
1141}
1142
1143extern struct mbuf *
1144ipcp_Input(struct bundle *bundle, struct link *l, struct mbuf *bp)
1145{
1146 /* Got PROTO_IPCP from link */
658}
659
660static void
661IpcpLayerStart(struct fsm *fp)
662{
663 /* We're about to start up ! */
664 struct ipcp *ipcp = fsm2ipcp(fp);
665

--- 474 unchanged lines hidden (view full) ---

1140 dec->ackend = dec->ack;
1141 }
1142}
1143
1144extern struct mbuf *
1145ipcp_Input(struct bundle *bundle, struct link *l, struct mbuf *bp)
1146{
1147 /* Got PROTO_IPCP from link */
1148 mbuf_SetType(bp, MB_IPCPIN);
1147 if (bundle_Phase(bundle) == PHASE_NETWORK)
1148 fsm_Input(&bundle->ncp.ipcp.fsm, bp);
1149 else {
1150 if (bundle_Phase(bundle) < PHASE_NETWORK)
1151 log_Printf(LogIPCP, "%s: Error: Unexpected IPCP in phase %s (ignored)\n",
1152 l->name, bundle_PhaseName(bundle));
1153 mbuf_Free(bp);
1154 }

--- 72 unchanged lines hidden ---
1149 if (bundle_Phase(bundle) == PHASE_NETWORK)
1150 fsm_Input(&bundle->ncp.ipcp.fsm, bp);
1151 else {
1152 if (bundle_Phase(bundle) < PHASE_NETWORK)
1153 log_Printf(LogIPCP, "%s: Error: Unexpected IPCP in phase %s (ignored)\n",
1154 l->name, bundle_PhaseName(bundle));
1155 mbuf_Free(bp);
1156 }

--- 72 unchanged lines hidden ---