diff --git a/usr.sbin/ppp/Makefile b/usr.sbin/ppp/Makefile index 7d4ba53ac196..2537af136f10 100644 --- a/usr.sbin/ppp/Makefile +++ b/usr.sbin/ppp/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.2 1995/02/26 12:17:08 amurai Exp $ +# $Id: Makefile,v 1.3 1995/09/02 17:20:48 amurai Exp $ PROG= ppp SRCS= async.c auth.c ccp.c chap.c chat.c command.c filter.c fsm.c hdlc.c \ @@ -6,6 +6,7 @@ SRCS= async.c auth.c ccp.c chap.c chat.c command.c filter.c fsm.c hdlc.c \ pap.c pred.c route.c slcompress.c timer.c systems.c uucplock.c vars.c \ vjcomp.c arp.c #CFLAGS+= -DHAVE_SHELL_CMD_WITH_ANY_MODE +CFLAGS += -Wall MAN8= ppp.8 BINMODE=4555 BINOWN= root diff --git a/usr.sbin/ppp/arp.c b/usr.sbin/ppp/arp.c index 8ff7d8b74b9a..61edfbabaf9a 100644 --- a/usr.sbin/ppp/arp.c +++ b/usr.sbin/ppp/arp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: arp.c,v 1.2 1995/05/30 03:50:23 rgrimes Exp $ + * $Id: arp.c,v 1.3 1996/01/10 21:27:35 phk Exp $ * */ @@ -54,6 +54,8 @@ static int rtm_seq; +static int get_ether_addr __P((int, u_long, struct sockaddr_dl *)); + #define BCOPY(s, d, l) memcpy(d, s, l) #define BZERO(s, n) memset(s, 0, n) /* diff --git a/usr.sbin/ppp/arp.h b/usr.sbin/ppp/arp.h new file mode 100644 index 000000000000..95c10ba2e4da --- /dev/null +++ b/usr.sbin/ppp/arp.h @@ -0,0 +1,28 @@ +/* + * User Process PPP + * + * Written by Toshiharu OHNO (tony-o@iij.ad.jp) + * + * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the Internet Initiative Japan, Inc. The name of the + * IIJ may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $Id: main.c,v 1.12 1996/01/10 21:27:53 phk Exp $ + * + */ + +#ifndef _ARP_H_ +#define _ARP_H_ +extern int cifproxyarp __P((int, u_long)); +extern int sifproxyarp __P((int, u_long)); +#endif diff --git a/usr.sbin/ppp/async.c b/usr.sbin/ppp/async.c index 70c1a483df28..ea091fff68f3 100644 --- a/usr.sbin/ppp/async.c +++ b/usr.sbin/ppp/async.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: async.c,v 1.3 1995/04/16 12:06:39 amurai Exp $ + * $Id: async.c,v 1.4 1995/05/30 03:50:24 rgrimes Exp $ * */ #include "fsm.h" @@ -26,6 +26,7 @@ #include "lcpproto.h" #include "modem.h" #include "vars.h" +#include "os.h" #define HDLCSIZE (MAX_MRU*2+6) diff --git a/usr.sbin/ppp/auth.c b/usr.sbin/ppp/auth.c index 3d76d5cdd90e..654c7856d900 100644 --- a/usr.sbin/ppp/auth.c +++ b/usr.sbin/ppp/auth.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: auth.c,v 1.4 1995/05/30 03:50:25 rgrimes Exp $ + * $Id: auth.c,v 1.5 1995/09/02 17:20:49 amurai Exp $ * * TODO: * o Implement check against with registered IP addresses. @@ -26,20 +26,24 @@ #include "lcpproto.h" #include "ipcp.h" #include "vars.h" +#include "filter.h" #include "auth.h" +#include "chat.h" extern FILE *OpenSecret(); extern void CloseSecret(); LOCAL_AUTH_VALID -LocalAuthInit(void){ +LocalAuthInit(void) +{ char *p; if ( gethostname( VarShortHost, sizeof(VarShortHost))) { return(NOT_FOUND); } - if ( p = strchr( VarShortHost, '.' ) ) + p = strchr( VarShortHost, '.' ); + if (p) *p = '\0'; VarLocalAuth = LOCAL_NO_AUTH; @@ -64,7 +68,7 @@ LocalAuthValidate( char *fname, char *system, char *key) { continue; buff[strlen(buff)-1] = 0; bzero(vector, sizeof(vector)); - n = MakeArgs(buff, &vector); + n = MakeArgs(buff, vector); if (n < 1) continue; if (strcmp(vector[0], system) == 0) { @@ -98,7 +102,7 @@ char *fname, *system, *key; continue; buff[strlen(buff)-1] = 0; bzero(vector, sizeof(vector)); - n = MakeArgs(buff, &vector); + n = MakeArgs(buff, vector); if (n < 2) continue; if (strcmp(vector[0], system) == 0) { @@ -139,7 +143,7 @@ int len, setaddr; continue; buff[strlen(buff)-1] = 0; bzero(vector, sizeof(vector)); - n = MakeArgs(buff, &vector); + n = MakeArgs(buff, vector); if (n < 2) continue; if (strlen(vector[0]) == len && strncmp(vector[0], system, len) == 0) { diff --git a/usr.sbin/ppp/auth.h b/usr.sbin/ppp/auth.h index 952ff2e98b27..f3b9052606da 100644 --- a/usr.sbin/ppp/auth.h +++ b/usr.sbin/ppp/auth.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: auth.h,v 1.1 1995/02/27 03:17:51 amurai Exp $ + * $Id: auth.h,v 1.2 1995/05/30 03:50:26 rgrimes Exp $ * * TODO: */ @@ -39,4 +39,6 @@ extern void SendPapChallenge __P((int)); extern void SendChapChallenge __P((int)); extern void StopAuthTimer __P((struct authinfo *)); extern void StartAuthChallenge __P((struct authinfo *)); +extern LOCAL_AUTH_VALID LocalAuthInit __P((void)); +extern int AuthValidate __P((char *, char *, char *)); #endif diff --git a/usr.sbin/ppp/ccp.c b/usr.sbin/ppp/ccp.c index 45742474365d..d236c61ec232 100644 --- a/usr.sbin/ppp/ccp.c +++ b/usr.sbin/ppp/ccp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ccp.c,v 1.3 1995/05/30 03:50:27 rgrimes Exp $ + * $Id: ccp.c,v 1.4 1996/01/10 21:27:36 phk Exp $ * * TODO: * o Support other compression protocols @@ -28,6 +28,7 @@ #include "ccp.h" #include "phase.h" #include "vars.h" +#include "pred.h" #include "cdefs.h" extern void PutConfValue __P((void)); diff --git a/usr.sbin/ppp/ccp.h b/usr.sbin/ppp/ccp.h index a544430acc16..d19f39a3c6c2 100644 --- a/usr.sbin/ppp/ccp.h +++ b/usr.sbin/ppp/ccp.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id:$ + * $Id: ccp.h,v 1.2 1995/02/26 12:17:15 amurai Exp $ * * TODO: */ @@ -49,4 +49,10 @@ struct ccpstate { extern struct ccpstate CcpInfo; +void CcpRecvResetReq __P((struct fsm *)); +void CcpSendResetReq __P((struct fsm *)); +void CcpInput __P((struct mbuf *)); +void CcpUp __P((void)); +void CcpOpen __P((void)); +void CcpInit __P((void)); #endif diff --git a/usr.sbin/ppp/chat.h b/usr.sbin/ppp/chat.h new file mode 100644 index 000000000000..bdb6dd0765e6 --- /dev/null +++ b/usr.sbin/ppp/chat.h @@ -0,0 +1,29 @@ +/* + * Written by Toshiharu OHNO (tony-o@iij.ad.jp) + * + * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. + * + * Most of codes are derived from chat.c by Karl Fox (karl@MorningStar.Com). + * + * Chat -- a program for automatic session establishment (i.e. dial + * the phone and log in). + * + * This software is in the public domain. + * + * Please send all bug reports, requests for information, etc. to: + * + * Karl Fox + * Morning Star Technologies, Inc. + * 1760 Zollinger Road + * Columbus, OH 43221 + * (614)451-1883 + * + * $Id: chat.c,v 1.5 1995/09/02 17:20:50 amurai Exp $ + * + */ +#ifndef _CHAT_H_ +#define _CHAT_H_ +#include "cdefs.h" +extern char * ExpandString __P((char *, char *, int)); +extern int MakeArgs __P((char *, char **)); +#endif diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index c1ac81f6e15e..fc6b25ccf0dd 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: command.c,v 1.11 1996/01/10 21:27:40 phk Exp $ + * $Id: command.c,v 1.12 1996/01/11 05:58:59 peter Exp $ * */ #include @@ -30,6 +30,7 @@ #include "lcp.h" #include "ipcp.h" #include "modem.h" +#include "filter.h" #include "command.h" #include "hdlc.h" #include "vars.h" @@ -318,8 +319,8 @@ static int ShowAuthKey() static int ShowVersion() { - extern char *VarVersion[]; - extern char *VarLocalVersion[]; + extern char VarVersion[]; + extern char VarLocalVersion[]; printf("%s - %s \n", VarVersion, VarLocalVersion); return(1); @@ -833,7 +834,7 @@ int param; strncpy(VarDevice, *argv, sizeof(VarDevice)-1); break; case VAR_ACCMAP: - sscanf(*argv, "%x", &map); + sscanf(*argv, "%lx", &map); VarAccmap = map; break; case VAR_PHONE: diff --git a/usr.sbin/ppp/filter.h b/usr.sbin/ppp/filter.h index 9a5132bf2255..ca87e7ee4817 100644 --- a/usr.sbin/ppp/filter.h +++ b/usr.sbin/ppp/filter.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: filter.h,v 1.2 1995/02/26 12:17:26 amurai Exp $ + * $Id: filter.h,v 1.3 1995/03/11 15:18:41 amurai Exp $ * * TODO: */ @@ -79,4 +79,5 @@ struct filterent ofilters[MAXFILTERS]; struct filterent dfilters[MAXFILTERS]; struct filterent afilters[MAXFILTERS]; /* keep Alive packet filter */ +extern int ParseAddr __P((int, char **, struct in_addr *, struct in_addr *, int*)); #endif _FILTER_H_ diff --git a/usr.sbin/ppp/fsm.c b/usr.sbin/ppp/fsm.c index 8252b237c470..60f8484fe09c 100644 --- a/usr.sbin/ppp/fsm.c +++ b/usr.sbin/ppp/fsm.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: fsm.c,v 1.3 1995/05/30 03:50:32 rgrimes Exp $ + * $Id: fsm.c,v 1.4 1995/09/09 13:23:53 joerg Exp $ * * TODO: * o Refer loglevel for log output @@ -28,13 +28,14 @@ #include "lqr.h" #include "lcpproto.h" #include "lcp.h" +#include "ccp.h" void FsmSendConfigReq(struct fsm *fp); void FsmSendTerminateReq(struct fsm *fp); void FsmInitRestartCounter(struct fsm *fp); void FsmTimeout(struct fsm *fp); -char *StateNames[] = { +char const *StateNames[] = { "Initial", "Starting", "Closed", "Stopped", "Closing", "Stopping", "Req-Sent", "Ack-Rcvd", "Ack-Sent", "Opend", }; diff --git a/usr.sbin/ppp/fsm.h b/usr.sbin/ppp/fsm.h index e659ed6464a3..1ba710a69863 100644 --- a/usr.sbin/ppp/fsm.h +++ b/usr.sbin/ppp/fsm.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: fsm.h,v 1.2 1995/02/26 12:17:28 amurai Exp $ + * $Id: fsm.h,v 1.4 1995/02/27 03:17:58 amurai Exp $ * * TODO: */ @@ -116,7 +116,7 @@ u_char ReqBuff[200]; u_char *ackp, *nakp, *rejp; -extern char *StateNames[]; +extern char const *StateNames[]; extern void FsmInit __P((struct fsm *)); extern void NewState __P((struct fsm *, int)); extern void FsmOutput __P((struct fsm *, u_int, u_int, u_char *, int)); diff --git a/usr.sbin/ppp/hdlc.c b/usr.sbin/ppp/hdlc.c index 74fc55cf84b4..474cf987a2f0 100644 --- a/usr.sbin/ppp/hdlc.c +++ b/usr.sbin/ppp/hdlc.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: hdlc.c,v 1.5 1995/07/30 15:18:29 gpalmer Exp $ + * $Id: hdlc.c,v 1.6 1996/01/10 21:27:45 phk Exp $ * * TODO: */ @@ -27,6 +27,9 @@ #include "lcp.h" #include "lqr.h" #include "vars.h" +#include "pred.h" +#include "modem.h" +#include "ccp.h" struct hdlcstat { int badfcs; @@ -264,7 +267,7 @@ ReportProtStatus() printf(" Protocol in out Protocol in out\n"); do { statp++; - printf(" %-9s: %8u, %8u", + printf(" %-9s: %8lu, %8lu", statp->name, statp->in_count, statp->out_count); if (++cnt == 2) { printf("\n"); diff --git a/usr.sbin/ppp/hdlc.h b/usr.sbin/ppp/hdlc.h index e21fcdc6fe82..3da20ef73003 100644 --- a/usr.sbin/ppp/hdlc.h +++ b/usr.sbin/ppp/hdlc.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id:$ + * $Id: hdlc.h,v 1.2 1995/02/26 12:17:31 amurai Exp $ * * TODO: */ @@ -52,8 +52,10 @@ unsigned char EscMap[33]; void HdlcInit __P((void)); +void HdlcErrorCheck __P((void)); void HdlcInput __P((struct mbuf *bp)); void HdlcOutput __P((int pri, u_short proto, struct mbuf *bp)); void AsyncOutput __P((int pri, struct mbuf *bp, int proto)); - +u_short HdlcFcs __P((u_short, u_char *, int)); +void DecodePacket __P((u_short, struct mbuf *)); #endif diff --git a/usr.sbin/ppp/ip.c b/usr.sbin/ppp/ip.c index 1fbba1a7a1e9..6be717ab6187 100644 --- a/usr.sbin/ppp/ip.c +++ b/usr.sbin/ppp/ip.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ip.c,v 1.5 1995/09/17 16:14:46 amurai Exp $ + * $Id: ip.c,v 1.6 1996/01/10 21:27:50 phk Exp $ * * TODO: * o Return ICMP message for filterd packet @@ -31,11 +31,11 @@ #include #include #include +#include #include "vars.h" #include "filter.h" extern void SendPppFrame(); -extern int PacketCheck(); extern void LcpClose(); static struct pppTimer IdleTimer; @@ -341,7 +341,7 @@ struct mbuf *bp; /* IN: Pointer to IP pakcet */ */ nw = write(tun_out, tunbuff, nb); if (nw != nb) - fprintf(stderr, "wrote %d, got %d\r\n"); + fprintf(stderr, "wrote %d, got %d\r\n", nb, nw); pfree(bp); RestartIdleTimer(); diff --git a/usr.sbin/ppp/ip.h b/usr.sbin/ppp/ip.h new file mode 100644 index 000000000000..fcc461d469d2 --- /dev/null +++ b/usr.sbin/ppp/ip.h @@ -0,0 +1,29 @@ +/* + * User Process PPP + * + * Written by Toshiharu OHNO (tony-o@iij.ad.jp) + * + * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the Internet Initiative Japan, Inc. The name of the + * IIJ may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $Id: main.c,v 1.12 1996/01/10 21:27:53 phk Exp $ + * + */ + +#ifndef _IP_H_ +#define _IP_H_ +extern void IpStartOutput __P((void)); +extern int PacketCheck __P((char *, int , int)); +extern void IpEnqueue __P((int, char *, int)); +#endif diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c index ad70fd5d48a3..b36f30b1a654 100644 --- a/usr.sbin/ppp/ipcp.c +++ b/usr.sbin/ppp/ipcp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ipcp.c,v 1.5 1995/07/04 02:57:11 davidg Exp $ + * $Id: ipcp.c,v 1.6 1995/07/08 08:28:04 amurai Exp $ * * TODO: * o More RFC1772 backwoard compatibility @@ -120,9 +120,9 @@ ReportIpcpStatus() struct fsm *fp = &IpcpFsm; printf("%s [%s]\n", fp->name, StateNames[fp->state]); - printf(" his side: %s, %x\n", + printf(" his side: %s, %lx\n", inet_ntoa(icp->his_ipaddr), icp->his_compproto); - printf(" my side: %s, %x\n", + printf(" my side: %s, %lx\n", inet_ntoa(icp->want_ipaddr), icp->want_compproto); printf("connected: %d secs, idle: %d secs\n\n", ipConnectSecs, ipIdleSecs); printf("Defaults:\n"); diff --git a/usr.sbin/ppp/lcp.c b/usr.sbin/ppp/lcp.c index fa160af2e722..32da0e32e4ae 100644 --- a/usr.sbin/ppp/lcp.c +++ b/usr.sbin/ppp/lcp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: lcp.c,v 1.5 1995/07/08 05:09:57 amurai Exp $ + * $Id: lcp.c,v 1.6 1995/09/17 16:14:47 amurai Exp $ * * TODO: * o Validate magic number received from peer. @@ -30,10 +30,12 @@ #include "lcpproto.h" #include "os.h" #include "hdlc.h" +#include "ccp.h" #include "lqr.h" #include "phase.h" #include "vars.h" #include "auth.h" +#include extern void IpcpUp(); extern void IpcpOpen(); @@ -152,12 +154,12 @@ ReportLcpStatus() printf("%s [%s]\n", fp->name, StateNames[fp->state]); printf( - " his side: MRU %d, ACCMAP %08x, PROTOCOMP %d, ACFCOMP %d MAGIC %08x\n", + " his side: MRU %ld, ACCMAP %08lx, PROTOCOMP %d, ACFCOMP %d MAGIC %08lx\n", lcp->his_mru, lcp->his_accmap, lcp->his_protocomp, lcp->his_acfcomp, lcp->his_magic); printf( - " my side: MRU %d, ACCMAP %08x, PROTOCOMP %d, ACFCOMP %d MAGIC %08x\n", + " my side: MRU %ld, ACCMAP %08lx, PROTOCOMP %d, ACFCOMP %d MAGIC %08lx\n", lcp->want_mru, lcp->want_accmap, lcp->want_protocomp, lcp->want_acfcomp, lcp->want_magic); - printf("\nDefaults: MRU = %d, ACCMAP = %08x\t", VarMRU, VarAccmap); + printf("\nDefaults: MRU = %ld, ACCMAP = %08x\t", VarMRU, VarAccmap); printf("Open Mode: %s\n", (VarOpenMode == OPEN_ACTIVE)? "active" : "passive"); return(1); } @@ -173,7 +175,7 @@ GenerateMagic() time(&tl); gettimeofday(&tval, NULL); - tl += tval.tv_sec ^ tval.tv_usec + getppid(); + tl += (tval.tv_sec ^ tval.tv_usec) + getppid(); tl *= getpid(); return(tl); } @@ -220,13 +222,15 @@ int len; u_long val; { u_char *cp; + struct in_addr ina; cp = *cpp; *cp++ = type; *cp++ = len; if (len == 6) { if (type == TY_IPADDR) { + ina.s_addr = htonl(val); LogPrintf(LOG_LCP, " %s [%d] %s\n", - types[type], len, inet_ntoa(htonl(val))); + types[type], len, inet_ntoa(ina)); } else { LogPrintf(LOG_LCP, " %s [%d] %08x\n", types[type], len, val); } diff --git a/usr.sbin/ppp/log.h b/usr.sbin/ppp/log.h index 2c33c7ef7342..e958efcf8264 100644 --- a/usr.sbin/ppp/log.h +++ b/usr.sbin/ppp/log.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: log.h,v 1.2 1995/02/26 12:17:38 amurai Exp $ + * $Id: log.h,v 1.4 1995/02/27 03:18:16 amurai Exp $ * * TODO: */ @@ -51,4 +51,5 @@ extern void LogClose __P((void)); extern void logprintf __P((char *, ...)), LogPrintf __P((int, char *, ...)); extern void LogDumpBp __P((int level, char *header, struct mbuf *bp)); extern void LogDumpBuff __P((int level, char *header, u_char *ptr, int cnt)); +extern void ListLog __P((void)); #endif diff --git a/usr.sbin/ppp/lqr.c b/usr.sbin/ppp/lqr.c index eaa677cf9fc7..c6dde2ecc397 100644 --- a/usr.sbin/ppp/lqr.c +++ b/usr.sbin/ppp/lqr.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: lqr.c,v 1.3 1995/04/17 04:21:35 amurai Exp $ + * $Id: lqr.c,v 1.4 1995/05/30 03:50:44 rgrimes Exp $ * * o LQR based on RFC1333 * @@ -31,6 +31,7 @@ #include "hdlc.h" #include "lcp.h" #include "vars.h" +#include "main.h" struct pppTimer LqrTimer; diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index f771766d686f..c1c90be1f0b4 100644 --- a/usr.sbin/ppp/main.c +++ b/usr.sbin/ppp/main.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: main.c,v 1.11 1995/10/08 14:57:29 amurai Exp $ + * $Id: main.c,v 1.12 1996/01/10 21:27:53 phk Exp $ * * TODO: * o Add commands for traffic summary, version display, etc. @@ -37,11 +37,14 @@ #include "modem.h" #include "os.h" #include "hdlc.h" +#include "ccp.h" #include "lcp.h" #include "ipcp.h" #include "vars.h" #include "auth.h" #include "filter.h" +#include "systems.h" +#include "ip.h" #define LAUTH_M1 "Warning: No password entry for this host in ppp.secret\n" #define LAUTH_M2 "Warning: All manipulation is allowed by anyone in the world\n" @@ -377,7 +380,7 @@ char **argv; snprintf(pid_filename, sizeof (pid_filename), "%s/PPP.%s", _PATH_VARRUN, dstsystem); unlink(pid_filename); - sprintf(pid, "%d\n", getpid()); + sprintf(pid, "%lu\n", getpid()); if ((fd = open(pid_filename, O_RDWR|O_CREAT, 0666)) != -1) { @@ -565,7 +568,8 @@ int n; fp = *hp; if (DEV_IS_SYNC) fp++; - if (ptr = strstr((char *)cp, fp)) + ptr = strstr((char *)cp, fp); + if (ptr) break; } return((u_char *)ptr); diff --git a/usr.sbin/ppp/main.h b/usr.sbin/ppp/main.h new file mode 100644 index 000000000000..1f578821ea96 --- /dev/null +++ b/usr.sbin/ppp/main.h @@ -0,0 +1,27 @@ +/* + * User Process PPP + * + * Written by Toshiharu OHNO (tony-o@iij.ad.jp) + * + * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the Internet Initiative Japan, Inc. The name of the + * IIJ may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $Id: main.c,v 1.12 1996/01/10 21:27:53 phk Exp $ + * + */ + +#ifndef _MAIN_H_ +#define _MAIN_H_ +void Cleanup __P((int)); +#endif diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c index 1adca2523e4c..020da908c522 100644 --- a/usr.sbin/ppp/modem.c +++ b/usr.sbin/ppp/modem.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: modem.c,v 1.9 1995/09/02 17:20:53 amurai Exp $ + * $Id: modem.c,v 1.10 1996/01/10 21:27:55 phk Exp $ * * TODO: */ @@ -40,7 +40,6 @@ #endif extern int DoChat(); -extern void CloseModem(); static int mbits; /* Current DCD status */ static int connect_time; /* connection time */ diff --git a/usr.sbin/ppp/modem.h b/usr.sbin/ppp/modem.h index 53e3573f5f61..9cb6506f330e 100644 --- a/usr.sbin/ppp/modem.h +++ b/usr.sbin/ppp/modem.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: modem.h,v 1.2 1995/02/26 12:17:46 amurai Exp $ + * $Id: modem.h,v 1.4 1995/02/27 03:18:22 amurai Exp $ * * TODO: */ @@ -33,8 +33,13 @@ extern void DownModem __P((int)); extern void WriteModem __P((int, char *, int)); extern void ModemStartOutput __P((int)); extern int OpenModem __P((int)); +extern void CloseModem __P((void)); extern int ModemSpeed __P((void)); extern int ModemQlen __P((void)); extern int DialModem __P((void)); - +extern int SpeedToInt __P((speed_t)); +extern speed_t IntToSpeed __P((int)); +extern void ModemTimeout __P((void)); +extern void DownConnection __P((void)); +extern void ModemOutput __P((int, struct mbuf *)); #endif diff --git a/usr.sbin/ppp/os.c b/usr.sbin/ppp/os.c index 92acff6eb303..691e258ddc7e 100644 --- a/usr.sbin/ppp/os.c +++ b/usr.sbin/ppp/os.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: os.c,v 1.2 1995/02/26 12:17:48 amurai Exp $ + * $Id: os.c,v 1.3 1995/05/30 03:50:52 rgrimes Exp $ * */ #include "fsm.h" @@ -31,10 +31,14 @@ #include #include #include +#include #include #include "ipcp.h" #include "os.h" #include "vars.h" +#include "arp.h" +#include "systems.h" +#include "route.h" static struct ifaliasreq ifra; static struct ifreq ifrq; diff --git a/usr.sbin/ppp/pred.h b/usr.sbin/ppp/pred.h new file mode 100644 index 000000000000..e44a489b2055 --- /dev/null +++ b/usr.sbin/ppp/pred.h @@ -0,0 +1,29 @@ +/* + * Written by Toshiharu OHNO (tony-o@iij.ad.jp) + * + * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the Internet Initiative Japan. The name of the + * IIJ may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $Id: ccp.h,v 1.2 1995/02/26 12:17:15 amurai Exp $ + * + * TODO: + */ + +#ifndef _PRED_H_ +#define _PRED_H_ + +extern void Pred1Output __P((int, u_short, struct mbuf *bp)); +extern void Pred1Input __P((struct mbuf*)); +extern void Pred1Init __P((int)); +#endif diff --git a/usr.sbin/ppp/route.c b/usr.sbin/ppp/route.c index 84f3d627f41e..d5d4de97926a 100644 --- a/usr.sbin/ppp/route.c +++ b/usr.sbin/ppp/route.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: route.c,v 1.3 1995/05/30 03:50:56 rgrimes Exp $ + * $Id: route.c,v 1.4 1995/07/08 06:08:52 amurai Exp $ * */ #include @@ -234,7 +234,7 @@ ShowRoute() mask <<= 8; } } - printf("%08x ", mask); + printf("%08lx ", mask); p_flags(rtm->rtm_flags & (RTF_UP|RTF_GATEWAY|RTF_HOST), "%-6.6s "); printf("(%d)\n", rtm->rtm_index); } diff --git a/usr.sbin/ppp/route.h b/usr.sbin/ppp/route.h new file mode 100644 index 000000000000..4aba1af33d19 --- /dev/null +++ b/usr.sbin/ppp/route.h @@ -0,0 +1,27 @@ +/* + * User Process PPP + * + * Written by Toshiharu OHNO (tony-o@iij.ad.jp) + * + * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the Internet Initiative Japan, Inc. The name of the + * IIJ may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $Id: main.c,v 1.12 1996/01/10 21:27:53 phk Exp $ + * + */ + +#ifndef _ROUTE_H_ +#define _ROUTE_H_ +int GetIfIndex __P((char *)); +#endif diff --git a/usr.sbin/ppp/slcompress.c b/usr.sbin/ppp/slcompress.c index 5bf842a4dbc6..dfabb0b35eea 100644 --- a/usr.sbin/ppp/slcompress.c +++ b/usr.sbin/ppp/slcompress.c @@ -17,13 +17,13 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: slcompress.c,v 1.2 1995/02/26 12:17:57 amurai Exp $ + * $Id: slcompress.c,v 1.3 1995/05/30 03:50:57 rgrimes Exp $ * * Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989: * - Initial distribution. */ #ifndef lint -static char rcsid[] = "$Header"; +static char const rcsid[] = "$Id$"; #endif #include "defs.h" diff --git a/usr.sbin/ppp/systems.h b/usr.sbin/ppp/systems.h new file mode 100644 index 000000000000..b1953a4969eb --- /dev/null +++ b/usr.sbin/ppp/systems.h @@ -0,0 +1,28 @@ +/* + * User Process PPP + * + * Written by Toshiharu OHNO (tony-o@iij.ad.jp) + * + * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the Internet Initiative Japan, Inc. The name of the + * IIJ may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $Id: main.c,v 1.12 1996/01/10 21:27:53 phk Exp $ + * + */ + +#ifndef _SYSTEMS_H_ +#define _SYSTEMS_H_ +extern void GetUid __P((void)); +extern int SelectSystem __P((char *, char*)); +#endif diff --git a/usr.sbin/ppp/uucplock.c b/usr.sbin/ppp/uucplock.c index f6a029f4841f..5b1ffa2ab098 100644 --- a/usr.sbin/ppp/uucplock.c +++ b/usr.sbin/ppp/uucplock.c @@ -30,12 +30,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: uucplock.c,v 1.5 1995/05/30 03:51:00 rgrimes Exp $ + * $Id: uucplock.c,v 1.6 1996/01/10 21:28:03 phk Exp $ * */ #ifndef lint -static char sccsid[] = "@(#)uucplock.c 5.5 (Berkeley) 6/1/90"; +static char const sccsid[] = "@(#)uucplock.c 5.5 (Berkeley) 6/1/90"; #endif /* not lint */ #include @@ -112,6 +112,7 @@ uu_lock(ttyname) return(0); } +int uu_unlock(ttyname) char *ttyname; {