ipcp.c (31343) | ipcp.c (31514) |
---|---|
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.37 1997/11/18 14:52:04 brian Exp $ | 20 * $Id: ipcp.c,v 1.38 1997/11/22 03:37:34 brian Exp $ |
21 * 22 * TODO: 23 * o More RFC1772 backwoard compatibility 24 */ 25#include <sys/param.h> 26#include <netinet/in_systm.h> 27#include <netinet/in.h> 28#include <netinet/ip.h> --- 111 unchanged lines hidden (view full) --- 140ReportIpcpStatus(struct cmdargs const *arg) 141{ 142 struct ipcpstate *icp = &IpcpInfo; 143 struct fsm *fp = &IpcpFsm; 144 145 if (!VarTerm) 146 return 1; 147 fprintf(VarTerm, "%s [%s]\n", fp->name, StateNames[fp->state]); | 21 * 22 * TODO: 23 * o More RFC1772 backwoard compatibility 24 */ 25#include <sys/param.h> 26#include <netinet/in_systm.h> 27#include <netinet/in.h> 28#include <netinet/ip.h> --- 111 unchanged lines hidden (view full) --- 140ReportIpcpStatus(struct cmdargs const *arg) 141{ 142 struct ipcpstate *icp = &IpcpInfo; 143 struct fsm *fp = &IpcpFsm; 144 145 if (!VarTerm) 146 return 1; 147 fprintf(VarTerm, "%s [%s]\n", fp->name, StateNames[fp->state]); |
148 fprintf(VarTerm, " his side: %s, %lx\n", 149 inet_ntoa(icp->his_ipaddr), icp->his_compproto); 150 fprintf(VarTerm, " my side: %s, %lx\n", 151 inet_ntoa(icp->want_ipaddr), icp->want_compproto); | 148 fprintf(VarTerm, " his side: %s, %s\n", 149 inet_ntoa(icp->his_ipaddr), vj2asc(icp->his_compproto)); 150 fprintf(VarTerm, " my side: %s, %s\n", 151 inet_ntoa(icp->want_ipaddr), vj2asc(icp->want_compproto)); |
152 153 fprintf(VarTerm, "Defaults:\n"); 154 fprintf(VarTerm, " My Address: %s/%d\n", 155 inet_ntoa(DefMyAddress.ipaddr), DefMyAddress.width); 156 fprintf(VarTerm, " His Address: %s/%d\n", 157 inet_ntoa(DefHisAddress.ipaddr), DefHisAddress.width); 158 if (HaveTriggerAddress) 159 fprintf(VarTerm, " Negotiation(trigger): %s\n", inet_ntoa(TriggerAddress)); --- 63 unchanged lines hidden (view full) --- 223 fp->restart = 5; 224} 225 226static void 227IpcpSendConfigReq(struct fsm * fp) 228{ 229 u_char *cp; 230 struct ipcpstate *icp = &IpcpInfo; | 152 153 fprintf(VarTerm, "Defaults:\n"); 154 fprintf(VarTerm, " My Address: %s/%d\n", 155 inet_ntoa(DefMyAddress.ipaddr), DefMyAddress.width); 156 fprintf(VarTerm, " His Address: %s/%d\n", 157 inet_ntoa(DefHisAddress.ipaddr), DefHisAddress.width); 158 if (HaveTriggerAddress) 159 fprintf(VarTerm, " Negotiation(trigger): %s\n", inet_ntoa(TriggerAddress)); --- 63 unchanged lines hidden (view full) --- 223 fp->restart = 5; 224} 225 226static void 227IpcpSendConfigReq(struct fsm * fp) 228{ 229 u_char *cp; 230 struct ipcpstate *icp = &IpcpInfo; |
231 struct lcp_opt o; |
|
231 232 cp = ReqBuff; 233 LogPrintf(LogIPCP, "IpcpSendConfigReq\n"); | 232 233 cp = ReqBuff; 234 LogPrintf(LogIPCP, "IpcpSendConfigReq\n"); |
234 if (!DEV_IS_SYNC || !REJECTED(icp, TY_IPADDR)) 235 PutConfValue(LogIPCP, &cp, cftypes, TY_IPADDR, 6, 236 ntohl(icp->want_ipaddr.s_addr)); | 235 if (!DEV_IS_SYNC || !REJECTED(icp, TY_IPADDR)) { 236 o.id = TY_IPADDR; 237 o.len = 6; 238 *(u_long *)o.data = icp->want_ipaddr.s_addr; 239 cp += LcpPutConf(LogIPCP, cp, &o, cftypes[o.id], 240 inet_ntoa(icp->want_ipaddr)); 241 } 242 |
237 if (icp->want_compproto && !REJECTED(icp, TY_COMPPROTO)) { | 243 if (icp->want_compproto && !REJECTED(icp, TY_COMPPROTO)) { |
238 if (icp->heis1172) 239 PutConfValue(LogIPCP, &cp, cftypes, TY_COMPPROTO, 4, 240 icp->want_compproto >> 16); 241 else 242 PutConfValue(LogIPCP, &cp, cftypes, TY_COMPPROTO, 6, icp->want_compproto); | 244 const char *args; 245 o.id = TY_COMPPROTO; 246 if (icp->heis1172) { 247 o.len = 4; 248 *(u_short *)o.data = htons(PROTO_VJCOMP); 249 args = ""; 250 } else { 251 o.len = 6; 252 *(u_long *)o.data = htonl(icp->want_compproto); 253 args = vj2asc(icp->want_compproto); 254 } 255 cp += LcpPutConf(LogIPCP, cp, &o, cftypes[o.id], args); |
243 } 244 FsmOutput(fp, CODE_CONFIGREQ, fp->reqid++, ReqBuff, cp - ReqBuff); 245} 246 247static void 248IpcpSendTerminateReq(struct fsm * fp) 249{ 250 /* XXX: No code yet */ --- 147 unchanged lines hidden (view full) --- 398 case MODE_REJ: 399 IpcpInfo.his_reject |= (1 << type); 400 break; 401 } 402 break; 403 case TY_COMPPROTO: 404 lp = (u_long *) (cp + 2); 405 compproto = htonl(*lp); | 256 } 257 FsmOutput(fp, CODE_CONFIGREQ, fp->reqid++, ReqBuff, cp - ReqBuff); 258} 259 260static void 261IpcpSendTerminateReq(struct fsm * fp) 262{ 263 /* XXX: No code yet */ --- 147 unchanged lines hidden (view full) --- 411 case MODE_REJ: 412 IpcpInfo.his_reject |= (1 << type); 413 break; 414 } 415 break; 416 case TY_COMPPROTO: 417 lp = (u_long *) (cp + 2); 418 compproto = htonl(*lp); |
406 LogPrintf(LogIPCP, "%s %08x\n", tbuff, compproto); | 419 LogPrintf(LogIPCP, "%s %s\n", tbuff, vj2asc(compproto)); |
407 408 switch (mode_type) { 409 case MODE_REQ: 410 if (!Acceptable(ConfVjcomp)) { 411 memcpy(rejp, cp, length); 412 rejp += length; 413 } else { 414 pcomp = (struct compreq *) (cp + 2); --- 187 unchanged lines hidden --- | 420 421 switch (mode_type) { 422 case MODE_REQ: 423 if (!Acceptable(ConfVjcomp)) { 424 memcpy(rejp, cp, length); 425 rejp += length; 426 } else { 427 pcomp = (struct compreq *) (cp + 2); --- 187 unchanged lines hidden --- |