From 485f592474900427073918c54f598c8260bba25d Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 22 Mar 1998 05:33:08 +0000 Subject: Merge ppp-2.3.3 changes onto mainline --- usr.sbin/pppd/args.h | 12 ----- usr.sbin/pppd/auth.c | 43 +++++++++++----- usr.sbin/pppd/callout.h | 18 ------- usr.sbin/pppd/chap.c | 7 ++- usr.sbin/pppd/chap_ms.c | 34 +++++++------ usr.sbin/pppd/chap_ms.h | 3 +- usr.sbin/pppd/demand.c | 4 +- usr.sbin/pppd/lcp.c | 18 +++---- usr.sbin/pppd/lock.c | 122 --------------------------------------------- usr.sbin/pppd/main.c | 21 +++++--- usr.sbin/pppd/options.c | 7 +-- usr.sbin/pppd/patchlevel.h | 6 +-- usr.sbin/pppd/ppp.h | 41 --------------- usr.sbin/pppd/sys-bsd.c | 19 ++++++- 14 files changed, 105 insertions(+), 250 deletions(-) delete mode 100644 usr.sbin/pppd/args.h delete mode 100644 usr.sbin/pppd/callout.h delete mode 100644 usr.sbin/pppd/lock.c delete mode 100644 usr.sbin/pppd/ppp.h diff --git a/usr.sbin/pppd/args.h b/usr.sbin/pppd/args.h deleted file mode 100644 index 81bd1e0..0000000 --- a/usr.sbin/pppd/args.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * neat macro from ka9q to "do the right thing" with ansi prototypes - * $Id$ - */ - -#ifndef __P -#ifdef __STDC__ -#define __P(x) x -#else -#define __P(x) () -#endif -#endif diff --git a/usr.sbin/pppd/auth.c b/usr.sbin/pppd/auth.c index 7248143..70b9ac2 100644 --- a/usr.sbin/pppd/auth.c +++ b/usr.sbin/pppd/auth.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: auth.c,v 1.20 1997/10/28 16:50:56 brian Exp $"; +static char rcsid[] = "$Id: auth.c,v 1.21 1997/12/13 05:27:29 jdp Exp $"; #endif #include @@ -46,6 +46,11 @@ static char rcsid[] = "$Id: auth.c,v 1.20 1997/10/28 16:50:56 brian Exp $"; #include #include #include +#include +#include +#if defined(_PATH_LASTLOG) && defined(_linux_) +#include +#endif #include #include @@ -100,7 +105,7 @@ char peer_authname[MAXNAMELEN]; /* Records which authentication operations haven't completed yet. */ static int auth_pending[NUM_PPP]; -/* Set if we have successfully called login() */ +/* Set if we have successfully called plogin() */ static int logged_in; /* Set if not wild or blank */ @@ -134,8 +139,8 @@ extern char *crypt __P((const char *, const char *)); static void network_phase __P((int)); static void check_idle __P((void *)); static void connect_time_expired __P((void *)); -static int ppplogin __P((char *, char *, char **, int *)); -static void ppplogout __P((void)); +static int plogin __P((char *, char *, char **, int *)); +static void plogout __P((void)); static int null_login __P((int)); static int get_pap_passwd __P((char *)); static int have_pap_secret __P((void)); @@ -147,9 +152,6 @@ static void free_wordlist __P((struct wordlist *)); static void auth_set_ip_addr __P((int)); static void auth_script __P((char *)); static void set_allowed_addrs __P((int, struct wordlist *)); -#ifdef CBCP_SUPPORT -static void callback_phase __P((int)); -#endif /* * An Open on LCP has requested a change from Dead to Establish phase. @@ -175,7 +177,7 @@ link_terminated(unit) if (phase == PHASE_DEAD) return; if (logged_in) - ppplogout(); + plogout(); phase = PHASE_DEAD; etime = time((time_t *) NULL); minutes = (etime-stime)/60; @@ -680,7 +682,7 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg, msglen) } if (uselogin && ret == UPAP_AUTHACK) { - ret = ppplogin(user, passwd, msg, msglen); + ret = plogin(user, passwd, msg, msglen); if (ret == UPAP_AUTHNAK) { syslog(LOG_WARNING, "PAP login failure for %s", user); } @@ -765,7 +767,7 @@ static int pam_conv(int num_msg, const struct pam_message **msg, #endif /* - * ppplogin - Check the user name and password against the system + * plogin - Check the user name and password against the system * password database, and login the user if OK. * * returns: @@ -777,7 +779,7 @@ static int pam_conv(int num_msg, const struct pam_message **msg, */ static int -ppplogin(user, passwd, msg, msglen) +plogin(user, passwd, msg, msglen) char *user; char *passwd; char **msg; @@ -912,6 +914,21 @@ ppplogin(user, passwd, msg, msglen) if (logout(tty)) /* Already entered (by login?) */ logwtmp(tty, "", ""); +#ifdef _PATH_LASTLOG + { + struct lastlog ll; + int fd; + + if ((fd = open(_PATH_LASTLOG, O_RDWR, 0)) >= 0) { + (void)lseek(fd, (off_t)(pw->pw_uid * sizeof(ll)), SEEK_SET); + memset((void *)&ll, 0, sizeof(ll)); + (void)time(&ll.ll_time); + (void)strncpy(ll.ll_line, tty, sizeof(ll.ll_line)); + (void)write(fd, (char *)&ll, sizeof(ll)); + (void)close(fd); + } + } +#endif logged_in = TRUE; memset((void *)&utmp, 0, sizeof(utmp)); @@ -925,10 +942,10 @@ ppplogin(user, passwd, msg, msglen) } /* - * ppplogout - Logout the user. + * plogout - Logout the user. */ static void -ppplogout() +plogout() { char *tty; diff --git a/usr.sbin/pppd/callout.h b/usr.sbin/pppd/callout.h deleted file mode 100644 index 662100b..0000000 --- a/usr.sbin/pppd/callout.h +++ /dev/null @@ -1,18 +0,0 @@ -/* Note: This is a copy of /usr/include/sys/callout.h with the c_func */ -/* member of struct callout changed from a pointer to a function of type int*/ -/* to a pointer to a function of type void (generic pointer) as per */ -/* ANSI C */ - -/* $Id$ */ - -#ifndef _ppp_callout_h -#define _ppp_callout_h - -struct callout { - int c_time; /* incremental time */ - caddr_t c_arg; /* argument to routine */ - void (*c_func)(); /* routine (changed to void (*)() */ - struct callout *c_next; -}; - -#endif /*!_ppp_callout_h*/ diff --git a/usr.sbin/pppd/chap.c b/usr.sbin/pppd/chap.c index 584b18b..c7ed461 100644 --- a/usr.sbin/pppd/chap.c +++ b/usr.sbin/pppd/chap.c @@ -34,7 +34,7 @@ */ #ifndef lint -static char rcsid[] = "$Id$"; +static char rcsid[] = "$Id: chap.c,v 1.8 1997/08/19 17:52:34 peter Exp $"; #endif /* @@ -587,9 +587,12 @@ ChapReceiveResponse(cstate, inp, id, len) } if (cstate->chal_interval != 0) TIMEOUT(ChapRechallenge, cstate, cstate->chal_interval); + syslog(LOG_NOTICE, "CHAP peer authentication succeeded for %s", + rhostname); } else { - syslog(LOG_ERR, "CHAP peer authentication failed"); + syslog(LOG_ERR, "CHAP peer authentication failed for remote host %s", + rhostname); cstate->serverstate = CHAPSS_BADAUTH; auth_peer_fail(cstate->unit, PPP_CHAP); } diff --git a/usr.sbin/pppd/chap_ms.c b/usr.sbin/pppd/chap_ms.c index a19c87d..744e14b 100644 --- a/usr.sbin/pppd/chap_ms.c +++ b/usr.sbin/pppd/chap_ms.c @@ -32,15 +32,18 @@ */ #ifndef lint -static char rcsid[] = "$Id$"; +static char rcsid[] = "$Id: chap_ms.c,v 1.3 1997/08/19 17:52:35 peter Exp $"; #endif #ifdef CHAPMS #include +#include +#include #include #include #include +#include #include "pppd.h" #include "chap.h" @@ -60,8 +63,14 @@ typedef struct { in case this struct gets padded. */ +static void ChallengeResponse __P((u_char *, u_char *, u_char *)); static void DesEncrypt __P((u_char *, u_char *, u_char *)); static void MakeKey __P((u_char *, u_char *)); +static u_char Get7Bits __P((u_char *, int)); +static void ChapMS_NT __P((char *, int, char *, int, MS_ChapResponse *)); +#ifdef MSLANMAN +static void ChapMS_LANMan __P((char *, int, char *, int, MS_ChapResponse *)); +#endif #ifdef USE_CRYPT static void Expand __P((u_char *, u_char *)); @@ -77,7 +86,7 @@ ChallengeResponse(challenge, pwHash, response) char ZPasswordHash[21]; BZERO(ZPasswordHash, sizeof(ZPasswordHash)); - BCOPY(pwHash, ZPasswordHash, 16); + BCOPY(pwHash, ZPasswordHash, MD4_SIGNATURE_SIZE); #if 0 log_packet(ZPasswordHash, sizeof(ZPasswordHash), "ChallengeResponse - ZPasswordHash", LOG_DEBUG); @@ -243,7 +252,8 @@ ChapMS_NT(rchallenge, rchallenge_len, secret, secret_len, response) MS_ChapResponse *response; { int i; - MDstruct md4Context; + MD4_CTX md4Context; + u_char hash[MD4_SIGNATURE_SIZE]; u_char unicodePassword[MAX_NT_PASSWORD * 2]; static int low_byte_first = -1; @@ -253,23 +263,19 @@ ChapMS_NT(rchallenge, rchallenge_len, secret, secret_len, response) for (i = 0; i < secret_len; i++) unicodePassword[i * 2] = (u_char)secret[i]; - MDbegin(&md4Context); - MDupdate(&md4Context, unicodePassword, secret_len * 2 * 8); /* Unicode is 2 bytes/char, *8 for bit count */ + MD4Init(&md4Context); + MD4Update(&md4Context, unicodePassword, secret_len * 2 * 8); /* Unicode is 2 bytes/char, *8 for bit count */ - if (low_byte_first == -1) - low_byte_first = (htons((unsigned short int)1) != 1); - if (low_byte_first == 0) - MDreverse(&md4Context); /* sfb 961105 */ + MD4Final(hash, &md4Context); /* Tell MD4 we're done */ - MDupdate(&md4Context, NULL, 0); /* Tell MD4 we're done */ - - ChallengeResponse(rchallenge, (char *)md4Context.buffer, response->NTResp); + ChallengeResponse(rchallenge, hash, response->NTResp); } #ifdef MSLANMAN static u_char *StdText = (u_char *)"KGS!@#$%"; /* key from rasapi32.dll */ -static ChapMS_LANMan(rchallenge, rchallenge_len, secret, secret_len, response) +static void +ChapMS_LANMan(rchallenge, rchallenge_len, secret, secret_len, response) char *rchallenge; int rchallenge_len; char *secret; @@ -278,7 +284,7 @@ static ChapMS_LANMan(rchallenge, rchallenge_len, secret, secret_len, response) { int i; u_char UcasePassword[MAX_NT_PASSWORD]; /* max is actually 14 */ - u_char PasswordHash[16]; + u_char PasswordHash[MD4_SIGNATURE_SIZE]; /* LANMan password is case insensitive */ BZERO(UcasePassword, sizeof(UcasePassword)); diff --git a/usr.sbin/pppd/chap_ms.h b/usr.sbin/pppd/chap_ms.h index f22607d..2fa7c93 100644 --- a/usr.sbin/pppd/chap_ms.h +++ b/usr.sbin/pppd/chap_ms.h @@ -19,11 +19,12 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id$ + * $Id: chap_ms.h,v 1.3 1997/08/19 17:52:35 peter Exp $ */ #ifndef __CHAPMS_INCLUDE__ +#define MD4_SIGNATURE_SIZE 16 /* 16 bytes in a MD4 message digest */ #define MAX_NT_PASSWORD 256 /* Maximum number of (Unicode) chars in an NT password */ void ChapMS __P((chap_state *, char *, int, char *, int)); diff --git a/usr.sbin/pppd/demand.c b/usr.sbin/pppd/demand.c index f44510f..af1a8bb 100644 --- a/usr.sbin/pppd/demand.c +++ b/usr.sbin/pppd/demand.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id$"; +static char rcsid[] = "$Id: demand.c,v 1.3 1997/08/19 17:52:36 peter Exp $"; #endif #include @@ -35,8 +35,8 @@ static char rcsid[] = "$Id$"; #include #include #include -#include #ifdef PPP_FILTER +#include #include #include #endif diff --git a/usr.sbin/pppd/lcp.c b/usr.sbin/pppd/lcp.c index 325806b..f4920ba 100644 --- a/usr.sbin/pppd/lcp.c +++ b/usr.sbin/pppd/lcp.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id$"; +static char rcsid[] = "$Id: lcp.c,v 1.7 1997/08/19 17:52:40 peter Exp $"; #endif /* @@ -266,7 +266,7 @@ lcp_lowerup(unit) */ ppp_set_xaccm(unit, xmit_accm[unit]); ppp_send_config(unit, PPP_MRU, 0xffffffff, 0, 0); - ppp_recv_config(unit, PPP_MRU, 0x00000000, + ppp_recv_config(unit, PPP_MRU, 0xffffffff, wo->neg_pcompression, wo->neg_accompression); peer_mru[unit] = PPP_MRU; lcp_allowoptions[unit].asyncmap = xmit_accm[unit][0]; @@ -785,7 +785,7 @@ lcp_nakci(f, p, len) */ if (go->neg_mru && go->mru != DEFMRU) { NAKCISHORT(CI_MRU, neg_mru, - if (cishort <= wo->mru || cishort < DEFMRU) + if (cishort <= wo->mru || cishort <= DEFMRU) try.mru = cishort; ); } @@ -1484,13 +1484,8 @@ lcp_up(f) ppp_send_config(f->unit, MIN(ao->mru, (ho->neg_mru? ho->mru: PPP_MRU)), (ho->neg_asyncmap? ho->asyncmap: 0xffffffff), ho->neg_pcompression, ho->neg_accompression); - /* - * If the asyncmap hasn't been negotiated, we really should - * set the receive asyncmap to ffffffff, but we set it to 0 - * for backwards contemptibility. - */ ppp_recv_config(f->unit, (go->neg_mru? MAX(wo->mru, go->mru): PPP_MRU), - (go->neg_asyncmap? go->asyncmap: 0x00000000), + (go->neg_asyncmap? go->asyncmap: 0xffffffff), go->neg_pcompression, go->neg_accompression); if (ho->neg_mru) @@ -1519,7 +1514,7 @@ lcp_down(f) ppp_send_config(f->unit, PPP_MRU, 0xffffffff, 0, 0); ppp_recv_config(f->unit, PPP_MRU, - (go->neg_asyncmap? go->asyncmap: 0x00000000), + (go->neg_asyncmap? go->asyncmap: 0xffffffff), go->neg_pcompression, go->neg_accompression); peer_mru[f->unit] = PPP_MRU; } @@ -1807,7 +1802,7 @@ LcpSendEchoRequest (f) * Detect the failure of the peer at this point. */ if (lcp_echo_fails != 0) { - if (lcp_echos_pending++ >= lcp_echo_fails) { + if (lcp_echos_pending >= lcp_echo_fails) { LcpLinkFailure(f); lcp_echos_pending = 0; } @@ -1821,6 +1816,7 @@ LcpSendEchoRequest (f) pktp = pkt; PUTLONG(lcp_magic, pktp); fsm_sdata(f, ECHOREQ, lcp_echo_number++ & 0xFF, pkt, pktp - pkt); + ++lcp_echos_pending; } } diff --git a/usr.sbin/pppd/lock.c b/usr.sbin/pppd/lock.c deleted file mode 100644 index 87c2984..0000000 --- a/usr.sbin/pppd/lock.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * lock.c - lock/unlock the serial device. - * - * This code is derived from chat.c. - */ - -static char rcsid[] = "$Id$"; - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef sun -# if defined(SUNOS) && SUNOS >= 41 -# ifndef HDB -# define HDB -# endif -# endif -#endif - -#ifndef LOCK_DIR -# if defined(__NetBSD__) || defined(__FreeBSD__) -# define PIDSTRING -# define LOCK_PREFIX "/var/spool/lock/LCK.." -# else -# ifdef HDB -# define PIDSTRING -# define LOCK_PREFIX "/usr/spool/locks/LCK.." -# else /* HDB */ -# define LOCK_PREFIX "/usr/spool/uucp/LCK.." -# endif /* HDB */ -# endif -#endif /* LOCK_DIR */ - -static char *lock_file; - -/* - * Create a lock file for the named lock device - */ -int -lock(dev) - char *dev; -{ - char hdb_lock_buffer[12]; - int fd, pid, n; - char *p; - - if ((p = strrchr(dev, '/')) != NULL) - dev = p + 1; - lock_file = malloc(strlen(LOCK_PREFIX) + strlen(dev) + 1); - if (lock_file == NULL) - novm("lock file name"); - strcat(strcpy(lock_file, LOCK_PREFIX), dev); - - while ((fd = open(lock_file, O_EXCL | O_CREAT | O_RDWR, 0644)) < 0) { - if (errno == EEXIST - && (fd = open(lock_file, O_RDONLY, 0)) >= 0) { - /* Read the lock file to find out who has the device locked */ -#ifdef PIDSTRING - n = read(fd, hdb_lock_buffer, 11); - if (n > 0) { - hdb_lock_buffer[n] = 0; - pid = atoi(hdb_lock_buffer); - } -#else - n = read(fd, &pid, sizeof(pid)); -#endif - if (n <= 0) { - syslog(LOG_ERR, "Can't read pid from lock file %s", lock_file); - close(fd); - } else { - if (kill(pid, 0) == -1 && errno == ESRCH) { - /* pid no longer exists - remove the lock file */ - if (unlink(lock_file) == 0) { - close(fd); - syslog(LOG_NOTICE, "Removed stale lock on %s (pid %d)", - dev, pid); - continue; - } else - syslog(LOG_WARNING, "Couldn't remove stale lock on %s", - dev); - } else - syslog(LOG_NOTICE, "Device %s is locked by pid %d", - dev, pid); - } - close(fd); - } else - syslog(LOG_ERR, "Can't create lock file %s: %m", lock_file); - free(lock_file); - lock_file = NULL; - return -1; - } - -# ifdef PIDSTRING - sprintf(hdb_lock_buffer, "%10d\n", getpid()); - write(fd, hdb_lock_buffer, 11); -# else - pid = getpid(); - write(fd, &pid, sizeof pid); -# endif - - close(fd); - return 0; -} - -/* - * Remove our lockfile - */ -unlock() -{ - if (lock_file) { - unlink(lock_file); - free(lock_file); - lock_file = NULL; - } -} - diff --git a/usr.sbin/pppd/main.c b/usr.sbin/pppd/main.c index a54c22e..26c648b 100644 --- a/usr.sbin/pppd/main.c +++ b/usr.sbin/pppd/main.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: main.c,v 1.14 1997/08/22 12:03:55 peter Exp $"; +static char rcsid[] = "$Id: main.c,v 1.15 1997/10/10 09:28:37 peter Exp $"; #endif #include @@ -40,8 +40,6 @@ static char rcsid[] = "$Id: main.c,v 1.14 1997/08/22 12:03:55 peter Exp $"; #include #include #include -#include -#include #include "pppd.h" #include "magic.h" @@ -70,7 +68,7 @@ extern char *strerror(); #endif /* interface vars */ -char ifname[IFNAMSIZ]; /* Interface name */ +char ifname[32]; /* Interface name */ int ifunit; /* Interface unit number */ char *progname; /* Name of this program */ @@ -165,7 +163,7 @@ main(argc, argv) int argc; char *argv[]; { - int i, n, nonblock, fdflags; + int i, n, fdflags; struct sigaction sa; FILE *pidfile; FILE *iffile; @@ -460,7 +458,15 @@ main(argc, argv) if (connector && connector[0]) { MAINDEBUG((LOG_INFO, "Connecting with <%s>", connector)); - /* set line speed, flow control, etc.; set CLOCAL for now */ + /* + * Set line speed, flow control, etc. + * On most systems we set CLOCAL for now so that we can talk + * to the modem before carrier comes up. But this has the + * side effect that we might miss it if CD drops before we + * get to clear CLOCAL below. On systems where we can talk + * successfully to the modem with CLOCAL clear and CD down, + * we can clear CLOCAL at this point. + */ set_up_tty(ttyfd, 1); /* drop dtr to hang up in case modem is off hook */ @@ -477,6 +483,7 @@ main(argc, argv) goto fail; } + syslog(LOG_INFO, "Serial connection established."); sleep(1); /* give it time to set up its terminal */ } @@ -613,7 +620,7 @@ main(argc, argv) break; if (!persist) - break; + die(1); if (demand) demand_discard(); diff --git a/usr.sbin/pppd/options.c b/usr.sbin/pppd/options.c index 0fc7ab0..4c55a77 100644 --- a/usr.sbin/pppd/options.c +++ b/usr.sbin/pppd/options.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: options.c,v 1.15 1997/10/10 06:02:56 peter Exp $"; +static char rcsid[] = "$Id: options.c,v 1.16 1997/10/10 09:28:37 peter Exp $"; #endif #include @@ -251,7 +251,7 @@ static int setipxcpfails __P((char **)); #endif /* IPX_CHANGE */ #ifdef MSLANMAN -static int setmslanman __P((void)); +static int setmslanman __P((char **)); #endif static int number_option __P((char *, u_int32_t *, int)); @@ -2527,7 +2527,8 @@ resetipxproto(argv) #ifdef MSLANMAN static int -setmslanman() +setmslanman(argv) + char **argv; { ms_lanman = 1; return (1); diff --git a/usr.sbin/pppd/patchlevel.h b/usr.sbin/pppd/patchlevel.h index d0e64b8..84e8828 100644 --- a/usr.sbin/pppd/patchlevel.h +++ b/usr.sbin/pppd/patchlevel.h @@ -1,6 +1,6 @@ -/* $Id: patchlevel.h,v 1.6 1997/08/19 17:52:44 peter Exp $ */ -#define PATCHLEVEL 1 +/* $Id: patchlevel.h,v 1.7 1997/08/22 12:03:57 peter Exp $ */ +#define PATCHLEVEL 3 #define VERSION "2.3" #define IMPLEMENTATION "" -#define DATE "27 June 97" +#define DATE "11 December 1997" diff --git a/usr.sbin/pppd/ppp.h b/usr.sbin/pppd/ppp.h deleted file mode 100644 index 4cb1e70..0000000 --- a/usr.sbin/pppd/ppp.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * ppp.h - PPP global declarations. - * - * Copyright (c) 1989 Carnegie Mellon University. - * All rights reserved. - * - * 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 Carnegie Mellon University. The name of the - * University 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$ - */ - -#ifndef __PPP_H__ -#define __PPP_H__ - -#define NPPP 1 /* One PPP interface supported (per process) */ - -/* - * Data Link Layer header = Address, Control, Protocol. - */ -#define ALLSTATIONS 0xff /* All-Stations Address */ -#define UI 0x03 /* Unnumbered Information */ -#define LCP 0xc021 /* Link Control Protocol */ -#define IPCP 0x8021 /* IP Control Protocol */ -#define UPAP 0xc023 /* User/Password Authentication Protocol */ -#define CHAP 0xc223 /* Crytpographic Handshake Protocol */ -#define LQR 0xc025 /* Link Quality Report protocol */ -#define IP_VJ_COMP 0x002d /* VJ TCP compressed IP packet */ -#define DLLHEADERLEN (sizeof (u_char) + sizeof (u_char) + sizeof (u_short)) -#define MTU 1500 /* Default MTU */ - -#endif /* __PPP_H__ */ diff --git a/usr.sbin/pppd/sys-bsd.c b/usr.sbin/pppd/sys-bsd.c index 53b8e75..2838bc3 100644 --- a/usr.sbin/pppd/sys-bsd.c +++ b/usr.sbin/pppd/sys-bsd.c @@ -21,8 +21,9 @@ */ #ifndef lint -static char rcsid[] = "$Id: sys-bsd.c,v 1.11 1997/08/19 17:52:47 peter Exp $"; +static char rcsid[] = "$Id: sys-bsd.c,v 1.12 1998/01/16 17:38:53 bde Exp $"; #endif +/* $NetBSD: sys-bsd.c,v 1.1.1.3 1997/09/26 18:53:04 christos Exp $ */ /* * TODO: @@ -62,8 +63,17 @@ static char rcsid[] = "$Id: sys-bsd.c,v 1.11 1997/08/19 17:52:47 peter Exp $"; #endif #if RTM_VERSION >= 3 +#include +#if defined(NetBSD) +#if (NetBSD >= 199703) +#include +#else /* NetBSD 1.2D or later */ +#include +#endif +#else #include #endif +#endif #include "pppd.h" #include "fsm.h" @@ -950,6 +960,7 @@ sifaddr(u, o, h, m) u_int32_t o, h, m; { struct ifaliasreq ifra; + struct ifreq ifr; strncpy(ifra.ifra_name, ifname, sizeof(ifra.ifra_name)); SET_SA_FAMILY(ifra.ifra_addr, AF_INET); @@ -961,6 +972,12 @@ sifaddr(u, o, h, m) ((struct sockaddr_in *) &ifra.ifra_mask)->sin_addr.s_addr = m; } else BZERO(&ifra.ifra_mask, sizeof(ifra.ifra_mask)); + BZERO(&ifr, sizeof(ifr)); + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + if (ioctl(sockfd, SIOCDIFADDR, (caddr_t) &ifr) < 0) { + if (errno != EADDRNOTAVAIL) + syslog(LOG_WARNING, "Couldn't remove interface address: %m"); + } if (ioctl(sockfd, SIOCAIFADDR, (caddr_t) &ifra) < 0) { if (errno != EEXIST) { syslog(LOG_ERR, "Couldn't set interface address: %m"); -- cgit v1.1