From pjchilds@al.imforei.apana.org.au  Mon Aug 12 06:19:47 1996
Received: from al.imforei.apana.org.au (root@al.imforei.apana.org.au [202.12.89.41])
          by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id GAA18463
          for <FreeBSD-gnats-submit@freebsd.org>; Mon, 12 Aug 1996 06:18:59 -0700 (PDT)
Received: (from pjchilds@localhost) by al.imforei.apana.org.au (8.7.5/8.7.3) id WAA26547; Mon, 12 Aug 1996 22:48:37 +0930 (CST)
Message-Id: <199608121318.WAA26547@al.imforei.apana.org.au>
Date: Mon, 12 Aug 1996 22:48:37 +0930 (CST)
From: Peter Childs <pjchilds@imforei.apana.org.au>
Reply-To: pjchilds@imforei.apana.org.au
To: FreeBSD-gnats-submit@freebsd.org
Subject: extentions to ijppp
X-Send-Pr-Version: 3.2

>Number:         1494
>Category:       bin
>Synopsis:       some patches to ijppp
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 12 06:20:01 PDT 1996
>Closed-Date:    Sun Oct 6 06:31:56 PDT 1996
>Last-Modified:  Tue Dec 24 13:32:48 PST 1996
>Originator:     Peter Childs
>Release:        FreeBSD 2.1-STABLE i386
>Organization:
Peter Childs  ---  http://www.imforei.apana.org.au/~pjchilds
  Finger pjchilds@al.imforei.apana.org.au for public PGP key
>Environment:

  2.1-stable system.  Should patch on 2.2-current with little problem. 

>Description:

  I'm no programmer for sure, but I wanted our dialup server (freebsd)
  to support Win95 clients out-of-the-box with no scripting, IP's,
  name-servers etc.    Using these patches to ijppp and mgetty+sendfax
  it is possible, while not interfering with the standard operation
  of ijppp.

  I'm not sure how much of this code really belongs in freebsd since
  it specifically is designed to deal with MS PPP clients, but for some
  the majority of their PPP clients are Win95 (ie. ISP)

  It allows negotiation of name servers and netbios nameservers with
  MS clients, and also a alternative method for authenticating PAP
  (from the password file)

>How-To-Repeat:

  patch < this-report

  Also i have added three files to the end (sample files)   This needs
  someone with a few hours to really look at it.   It works really 
  well for us and I'd hate to see this functionallity lost.

>Fix:
	
  Apply patch and make install.


diff -c 2.1-stable-ppp/Makefile ppp_plus/Makefile
*** 2.1-stable-ppp/Makefile	Tue Feb  6 08:06:15 1996
--- ppp_plus/Makefile	Mon Aug 12 21:03:47 1996
***************
*** 4,13 ****
  SRCS=	async.c auth.c ccp.c chap.c chat.c command.c filter.c fsm.c hdlc.c \
  	ip.c ipcp.c lcp.c lqr.c log.c main.c mbuf.c modem.c os.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
! LDADD += -lmd
  DPADD += ${LIBMD}
  MAN8=	ppp.8
  BINMODE=4555
--- 4,13 ----
  SRCS=	async.c auth.c ccp.c chap.c chat.c command.c filter.c fsm.c hdlc.c \
  	ip.c ipcp.c lcp.c lqr.c log.c main.c mbuf.c modem.c os.c \
  	pap.c pred.c route.c slcompress.c timer.c systems.c uucplock.c vars.c \
! 	vjcomp.c arp.c passwdauth.c
  #CFLAGS+= -DHAVE_SHELL_CMD_WITH_ANY_MODE
! CFLAGS += -Wall -DMSEXT -DPASSWDAUTH -DLOCALHACK
! LDADD += -lmd -lcrypt -lutil
  DPADD += ${LIBMD}
  MAN8=	ppp.8
  BINMODE=4555
diff -c 2.1-stable-ppp/command.c ppp_plus/command.c
*** 2.1-stable-ppp/command.c	Tue Jun 11 01:05:21 1996
--- ppp_plus/command.c	Mon Aug 12 22:01:45 1996
***************
*** 356,361 ****
--- 356,373 ----
    return(1);
  }
  
+ #ifdef MSEXT
+ static int ShowMSExt()
+ {
+   printf(" MS PPP extention values \n" );
+   printf("   Primary NS     : %s\n", inet_ntoa( ns_entries[0] ));
+   printf("   Secondary NS   : %s\n", inet_ntoa( ns_entries[1] ));
+   printf("   Primary NBNS   : %s\n", inet_ntoa( nbns_entries[0] ));
+   printf("   Secondary NBNS : %s\n", inet_ntoa( nbns_entries[1] ));
+ 
+   return(1);
+ }
+ #endif /* MSEXT */
  
  extern int ShowIfilter(), ShowOfilter(), ShowDfilter(), ShowAfilter();
  
***************
*** 398,403 ****
--- 410,419 ----
  	"Show Idle timeout value", StrNull},
    { "redial",   NULL,	  ShowRedial,		LOCAL_AUTH,
  	"Show Redial timeout value", StrNull},
+ #ifdef MSEXT
+   { "msext", 	NULL,	  ShowMSExt,		LOCAL_AUTH,
+ 	"Show MS PPP extention values", StrNull},
+ #endif /* MSEXT */
    { "version",  NULL,	  ShowVersion,		LOCAL_NO_AUTH | LOCAL_AUTH,
  	"Show version string", StrNull},
    { "help",     "?",      HelpCommand,		LOCAL_NO_AUTH | LOCAL_AUTH,
***************
*** 803,808 ****
--- 819,877 ----
    return(1);
  }
  
+ #ifdef MSEXT
+ 
+ void
+ SetMSEXT(pri_addr, sec_addr, argc, argv)
+ struct in_addr *pri_addr;
+ struct in_addr *sec_addr;
+ int argc;
+ char **argv;
+ {
+   int dummyint;
+   struct in_addr dummyaddr;
+ 
+   pri_addr->s_addr = sec_addr->s_addr = 0L;
+ 
+   if( argc > 0 ) {
+     ParseAddr(argc, argv++, pri_addr, &dummyaddr, &dummyint);
+     if( --argc > 0 ) 
+       ParseAddr(argc, argv++, sec_addr, &dummyaddr, &dummyint);
+     else
+       sec_addr->s_addr = pri_addr->s_addr;
+   }
+ 
+  /*
+   * if the primary/secondary ns entries are 0.0.0.0 we should 
+   * set them to either the localhost's ip, or the values in
+   * /etc/resolv.conf ??
+   *
+   * up to you if you want to implement this...
+   */
+ 
+ }
+ 
+ static int
+ SetNS(list, argc, argv)
+ struct cmdtab *list;
+ int argc;
+ char **argv;
+ {
+   SetMSEXT(&ns_entries[0], &ns_entries[1], argc, argv);
+   return(1);
+ }
+ 
+ static int
+ SetNBNS(list, argc, argv)
+ struct cmdtab *list;
+ int argc;
+ char **argv;
+ {
+   SetMSEXT(&nbns_entries[0], &nbns_entries[1], argc, argv);
+   return(1);
+ }
+ 
+ #endif /* MS_EXT */
  
  #define	VAR_AUTHKEY	0
  #define	VAR_DIAL	1
***************
*** 912,917 ****
--- 981,992 ----
  	"Set Idle timeout", StrValue},
    { "redial",   NULL,     SetRedialTimeout,	LOCAL_AUTH,
  	"Set Redial timeout", "value|random [dial_attempts]"},
+ #ifdef MSEXT
+   { "ns",	NULL,	  SetNS,		LOCAL_AUTH,
+ 	"Set NameServer", "pri-addr [sec-addr]"},
+   { "nbns",	NULL,	  SetNBNS,		LOCAL_AUTH,
+ 	"Set NetBIOS NameServer", "pri-addr [sec-addr]"},
+ #endif /* MSEXT */
    { "help",     "?",      HelpCommand,		LOCAL_AUTH | LOCAL_NO_AUTH,
  	"Display this message", StrNull, (void *)SetCommands},
    { NULL,       NULL,     NULL },
diff -c 2.1-stable-ppp/ipcp.c ppp_plus/ipcp.c
*** 2.1-stable-ppp/ipcp.c	Tue Feb  6 08:06:26 1996
--- ppp_plus/ipcp.c	Mon Aug 12 21:04:57 1996
***************
*** 43,48 ****
--- 43,52 ----
  struct ipcpstate IpcpInfo;
  struct in_range DefMyAddress, DefHisAddress, DefTriggerAddress;
  
+ #ifdef MSEXT
+ struct in_addr ns_entries[2], nbns_entries[2];
+ #endif /* MSEXT */
+ 
  static void IpcpSendConfigReq __P((struct fsm *));
  static void IpcpSendTerminateAck __P((struct fsm *));
  static void IpcpSendTerminateReq __P((struct fsm *));
***************
*** 310,316 ****
    int type, length;
    u_long *lp, compproto;
    struct compreq *pcomp;
!   struct in_addr ipaddr, dstipaddr;
    char tbuff[100];
  
    ackp = AckBuff;
--- 314,320 ----
    int type, length;
    u_long *lp, compproto;
    struct compreq *pcomp;
!   struct in_addr ipaddr, dstipaddr, dnsstuff, ms_info_req;
    char tbuff[100];
  
    ackp = AckBuff;
***************
*** 452,457 ****
--- 456,557 ----
  	break;
        }
        break;
+ 
+  /*
+   * MS extensions for MS's PPP 
+   */
+ 
+ #ifdef MSEXT
+     case TY_PRIMARY_DNS:   /* MS PPP DNS negotiation hack */
+     case TY_SECONDARY_DNS:
+       if( !Enabled( ConfMSExt ) ) {
+ 	LogPrintf( LOG_LCP, "MS NS req - rejected - msext disabled\n" );
+ 	IpcpInfo.my_reject |= ( 1 << type );
+ 	bcopy(cp, rejp, length);
+ 	rejp += length;
+ 	break;
+       }
+       switch( mode ){
+       case MODE_REQ:
+ 	lp = (u_long *)(cp + 2);
+ 	dnsstuff.s_addr = *lp;
+ 	ms_info_req.s_addr = ns_entries[((type - TY_PRIMARY_DNS)?1:0)].s_addr;
+ 	if( dnsstuff.s_addr != ms_info_req.s_addr )
+ 	{
+ 	  /*
+ 	   So the client has got the DNS stuff wrong (first request)
+ 	   so well tell 'em how it is           
+ 	  */
+ 	  bcopy( cp, nakp, 2 );  /* copy first two (type/length) */
+ 	  LogPrintf( LOG_LCP, "MS NS req %d:%s->%s - nak\n",
+ 		type,
+ 		inet_ntoa( dnsstuff ),
+ 		inet_ntoa( ms_info_req ));
+ 	  bcopy( &ms_info_req, nakp+2, length );
+ 	  nakp += length;
+ 	  break;
+ 	}
+ 	  /*
+ 	   Otherwise they have it right (this time) so we send
+ 	   a ack packet back confirming it... end of story
+ 	  */
+ 	LogPrintf( LOG_LCP, "MS NS req %d:%s ok - ack\n",
+ 		type,
+ 		inet_ntoa( ms_info_req ));
+ 	bcopy( cp, ackp, length );
+ 	ackp += length;
+ 	break;
+       case MODE_NAK: /* what does this mean?? */
+ 	LogPrintf(LOG_LCP, "MS NS req %d - NAK??\n", type );
+ 	break;
+       case MODE_REJ: /* confused?? me to :) */
+ 	LogPrintf(LOG_LCP, "MS NS req %d - REJ??\n", type );
+ 	break;
+       }
+       break;
+ 
+     case TY_PRIMARY_NBNS:   /* MS PPP NetBIOS nameserver hack */
+     case TY_SECONDARY_NBNS:
+     if( !Enabled( ConfMSExt ) ) {
+       LogPrintf( LOG_LCP, "MS NBNS req - rejected - msext disabled\n" );
+       IpcpInfo.my_reject |= ( 1 << type );
+       bcopy( cp, rejp, length );
+       rejp += length;
+       break;
+     }
+       switch( mode ){
+       case MODE_REQ:
+ 	lp = (u_long *)(cp + 2);
+ 	dnsstuff.s_addr = *lp;
+ 	ms_info_req.s_addr = nbns_entries[((type - TY_PRIMARY_NBNS)?1:0)].s_addr;
+ 	if( dnsstuff.s_addr != ms_info_req.s_addr )
+ 	{
+ 	  bcopy( cp, nakp, 2 );
+ 	  bcopy( &ms_info_req.s_addr , nakp+2, length );
+ 	  LogPrintf( LOG_LCP, "MS NBNS req %d:%s->%s - nak\n",
+ 		type,
+ 		inet_ntoa( dnsstuff ),
+ 		inet_ntoa( ms_info_req ));
+ 	  nakp += length;
+ 	  break;
+ 	}
+ 	LogPrintf( LOG_LCP, "MS NBNS req %d:%s ok - ack\n",
+ 		type,
+ 		inet_ntoa( ms_info_req ));
+ 	bcopy( cp, ackp, length );
+ 	ackp += length;
+ 	break;
+       case MODE_NAK:
+ 	LogPrintf( LOG_LCP, "MS NBNS req %d - NAK??\n", type );
+ 	break;
+       case MODE_REJ:
+ 	LogPrintf( LOG_LCP, "MS NBNS req %d - REJ??\n", type );
+ 	break;
+       }
+       break;
+ 
+ #endif /* MSEXT */
+ 
      default:
        IpcpInfo.my_reject |= (1 << type);
        bcopy(cp, rejp, length);
diff -c 2.1-stable-ppp/ipcp.h ppp_plus/ipcp.h
*** 2.1-stable-ppp/ipcp.h	Sun Aug 27 00:18:55 1995
--- ppp_plus/ipcp.h	Mon Aug 12 21:01:21 1996
***************
*** 29,34 ****
--- 29,45 ----
  #define	TY_COMPPROTO	2
  #define	TY_IPADDR	3
  
+ /* MS PPP NameServer and NetBIOS NameServer stuff */
+ 
+ #ifdef MSEXT
+ 
+ #define TY_PRIMARY_DNS		129
+ #define TY_PRIMARY_NBNS		130
+ #define TY_SECONDARY_DNS	131
+ #define TY_SECONDARY_NBNS	132
+ 
+ #endif /* MSEXT */
+ 
  struct ipcpstate {
    struct  in_addr his_ipaddr;	/* IP address he is willing to use */
    u_long  his_compproto;
***************
*** 57,62 ****
--- 68,78 ----
  extern struct in_range DefMyAddress;
  extern struct in_range DefHisAddress;
  extern struct in_range DefTriggerAddress;
+ 
+ #ifdef MSEXT
+ extern struct in_addr ns_entries[2];
+ extern struct in_addr nbns_entries[2];
+ #endif /* MSEXT */
  
  extern void IpcpInit __P((void));
  extern void IpcpDefAddress __P((void));
diff -c 2.1-stable-ppp/os.c ppp_plus/os.c
*** 2.1-stable-ppp/os.c	Tue Jun  4 12:09:00 1996
--- ppp_plus/os.c	Mon Aug 12 22:06:49 1996
***************
*** 259,279 ****
  OpenTunnel(ptun)
  int *ptun;
  {
    int s;
!   char *cp;
!   char *suffix = "0123456789";
    char ifname[IFNAMSIZ];
!   char devname[12];
  
!   strcpy(devname, "/dev/tun0");
!   for (cp = suffix; *cp; cp++) {
!     devname[8] = *cp;
      tun_out = open(devname, O_RDWR);
!     if (tun_out >= 0)
        break;
    }
!   *ptun = cp - suffix;
!   if (*cp == '\0') {
      fprintf(stderr, "No tunnel device is available.\n");
      return(-1);
    }
--- 259,292 ----
  OpenTunnel(ptun)
  int *ptun;
  {
+ 
+ #define MAX_TUN 256
+ 
+ /* MAX_TUN is set at an arbitrarily large value  *
+  * as the loop aborts when it reaches the first  *
+  * 'Device not configured' (ENXIO), or the third *
+  * 'No such file or directory' (ENOENT) error.   */
+ 
    int s;
!   int cp, enoentcount = 0;
    char ifname[IFNAMSIZ];
!   char devname[16];
  
!   for(cp = 0; cp <= MAX_TUN; cp++ ) {
!     sprintf( devname, "/dev/tun%d", cp );
      tun_out = open(devname, O_RDWR);
!     if( tun_out >= 0 )
        break;
+     if( errno == ENXIO )
+       cp=MAX_TUN+1;
+     else if( errno == ENOENT ) {
+       enoentcount++;
+       if( enoentcount > 2 )
+ 	cp=MAX_TUN+1;
+     }  
    }
!   *ptun = cp;
!   if( cp > MAX_TUN ) {
      fprintf(stderr, "No tunnel device is available.\n");
      return(-1);
    }
diff -c 2.1-stable-ppp/pap.c ppp_plus/pap.c
*** 2.1-stable-ppp/pap.c	Tue Feb  6 08:06:31 1996
--- ppp_plus/pap.c	Mon Aug 12 21:09:43 1996
***************
*** 111,116 ****
--- 111,125 ----
  #ifdef DEBUG
    logprintf("name: %s (%d), key: %s (%d)\n", name, nlen, key, klen);
  #endif
+ 
+ #ifdef PASSWDAUTH
+   if( Enabled( ConfPasswdAuth ) )
+   {
+     LogPrintf( LOG_LCP, "PasswdAuth enabled - calling\n" );
+     return PasswdAuth( name, key );
+   }
+ #endif /* PASSWDAUTH */
+ 
    return(AuthValidate(SECRETFILE, name, key));
  }
  
Only in ppp_plus/: passwdauth.c
Only in ppp_plus/: passwdauth.h
diff -c 2.1-stable-ppp/ppp.8 ppp_plus/ppp.8
*** 2.1-stable-ppp/ppp.8	Tue Feb  6 08:06:32 1996
--- ppp_plus/ppp.8	Mon Aug 12 22:04:21 1996
***************
*** 6,12 ****
  .Sh NAME
  .Nm ppp
  .Nd
! Point to Point Protocol (aka iijppp)
  .Sh SYNOPSIS
  .Nm
  .Op Fl auto \*(Ba Fl direct Fl dedicated
--- 6,12 ----
  .Sh NAME
  .Nm ppp
  .Nd
! Point to Point Protocol (aka iijppp) 
  .Sh SYNOPSIS
   .Nm
  .Op Fl auto \*(Ba Fl direct Fl dedicated
***************
*** 59,65 ****
   
  .It Supports PAP and CHAP authentication.
  
- 
  .It Supports Proxy Arp.
  When
  .Em PPP
--- 59,64 ----
***************
*** 100,105 ****
--- 99,110 ----
  .Em all
  data flowing through the link, thus reducing overhead to a minimum.
  
+ .It Supports Microsofts IPCP extentions.
+ Name Server Addresses and NetBIOS Name Server Addresses can be negotiated
+ with clients using the Microsoft
+ .Em PPP
+ stack (ie. Win95, WinNT)
+ 
  .It Runs under BSDI-1.1 and FreeBSD.
  
  .El
***************
*** 420,426 ****
  .Pa /etc/ppp/ppp.conf.filter.example .
  
  
! .Sh RECEIVING INCOMING PPP CONNECTIONS
  
  To handle an incoming
  .Em PPP
--- 425,431 ----
  .Pa /etc/ppp/ppp.conf.filter.example .
  
  
! .Sh RECEIVING INCOMING PPP CONNECTIONS (Method 1)
  
  To handle an incoming
  .Em PPP
***************
*** 468,475 ****
  
  (You can specify a label name for further control.)
  
- .El
- 
  .Pp
  Direct mode (
  .Fl direct )
--- 473,478 ----
***************
*** 477,483 ****
  .Nm
  work with stdin and stdout.  You can also telnet to port 3000 to get
  command mode control in the same manner as client-side
! .Nm .
  
  .Sh SETTING IDLE, LINE QUALITY REQUEST, RETRY TIMER
  
--- 480,541 ----
  .Nm
  work with stdin and stdout.  You can also telnet to port 3000 to get
  command mode control in the same manner as client-side
! .Nm.
! 
! .It
! Optional support for Microsoft's IPCP Name Server and NetBIOS
! Name Server negotiation can be enabled use
! .Dq enable msext
! and 
! .Dq set ns pri-addr [sec-addr]
! along with
! .Dq set nbns pri-addr [sec-addr]
! in your ppp.conf file
! 
! .El
! 
! .Sh RECEIVING INCOMING PPP CONNECTIONS (Method 2)
! 
! This method differs in that it recommends the use of 
! .Em mgetty+sendfax
! to handle the modem connections.  The latest version 0.99
! can be compiled with the
! .Dq AUTO_PPP
! option to allow detection of clients speaking PPP to the login
! prompt.
! 
! Follow these steps:
! 
! .Bl -enum
! .It
! Get, configure, and install mgetty+sendfax v0.99 or later (beta)
! making sure you have used the AUTO_PPP option.
! .It
! Edit
! .Pa /etc/ttys
! to enable a mgetty on the port where the modem is attached.
! 
! For example:
! 
! .Dl cuaa1  "/usr/local/sbin/mgetty -s 57600"       dialup on
! 
! .It
! Prepare an account for the incoming user.
! .Bd -literal
! Pfred:xxxx:66:66:Fred's PPP:/home/ppp:/etc/ppp/ppp-dialup
! .Ed
! 
! .It
! Examine the files
! .Pa /etc/ppp/sample.ppp-dialup
! .Pa /etc/ppp/sample.ppp-pap-dialup
! and
! .Pa /etc/ppp/sample.ppp.conf
! for ideas.   ppp-pap-dialup is supposed to be called from
! .Pa /usr/local/etc/mgetty+sendfax/login.conf
! from a line like
! 
! .Dl /AutoPPP/ -     -       /etc/ppp/ppp-pap-dialup
  
  .Sh SETTING IDLE, LINE QUALITY REQUEST, RETRY TIMER
  
diff -c 2.1-stable-ppp/route.c ppp_plus/route.c
*** 2.1-stable-ppp/route.c	Tue Feb  6 08:06:33 1996
--- ppp_plus/route.c	Mon Aug 12 22:07:07 1996
***************
*** 251,257 ****
  {
    struct rt_msghdr *rtm;
    struct sockaddr *sa;
!   struct in_addr dstnet, gateway;
    int needed;
    char *sp, *cp, *ep;
    u_long mask;
--- 251,257 ----
  {
    struct rt_msghdr *rtm;
    struct sockaddr *sa;
!   struct in_addr dstnet, gateway, maddr;
    int needed;
    char *sp, *cp, *ep;
    u_long mask;
***************
*** 339,345 ****
          gateway.s_addr = INADDR_ANY;
          mask = INADDR_ANY;
        }
!       OsSetRoute(RTM_DELETE, dstnet, gateway, htonl(mask));
      }
  #ifdef DEBUG
      else if (rtm->rtm_index == IfIndex) {
--- 339,346 ----
          gateway.s_addr = INADDR_ANY;
          mask = INADDR_ANY;
        }
!       maddr.s_addr = htonl(mask);
!       OsSetRoute(RTM_DELETE, dstnet, gateway, maddr);
      }
  #ifdef DEBUG
      else if (rtm->rtm_index == IfIndex) {
***************
*** 350,363 ****
    free(sp);
  }
  
  int
  GetIfIndex(name)
  char *name;
  {
    struct ifreq *ifrp;
    int s, len, elen, index;
    struct ifconf ifconfs;
!   struct ifreq reqbuf[32];
  
    s = socket(AF_INET, SOCK_DGRAM, 0);
    if (s < 0) {
--- 351,370 ----
    free(sp);
  }
  
+  /*
+   * 960603 - Modified to use dynamic buffer allocator as in ifconfig
+   */
+ 
  int
  GetIfIndex(name)
  char *name;
  {
+   char *buffer;
    struct ifreq *ifrp;
    int s, len, elen, index;
    struct ifconf ifconfs;
!   /* struct ifreq reqbuf[256]; -- obsoleted :) */
!   int oldbufsize, bufsize = sizeof(struct ifreq);
  
    s = socket(AF_INET, SOCK_DGRAM, 0);
    if (s < 0) {
***************
*** 365,376 ****
      return(-1);
    }
  
!   ifconfs.ifc_len = sizeof(reqbuf);
!   ifconfs.ifc_buf = (caddr_t)reqbuf;
!   if (ioctl(s, SIOCGIFCONF, &ifconfs) < 0) {
!     perror("IFCONF");
!     return(-1);
!   }
  
    ifrp = ifconfs.ifc_req;
  
--- 372,398 ----
      return(-1);
    }
  
!   buffer = malloc(bufsize);	/* allocate first buffer */
!   ifconfs.ifc_len = bufsize;	/* Initial setting */
!   /*
!    * Iterate through here until we don't get many more data 
!    */
! 
!   do {
! 	oldbufsize = ifconfs.ifc_len;
! 	bufsize += 1+sizeof(struct ifreq);
! 	buffer = realloc((void *)buffer, bufsize);	/* Make it bigger */
! #ifdef DEBUG
! 	logprintf ("Growing buffer to %d\n", bufsize);
! #endif
! 	ifconfs.ifc_len = bufsize;
! 	ifconfs.ifc_buf = buffer;
!   	if (ioctl(s, SIOCGIFCONF, &ifconfs) < 0) {
! 	    perror("IFCONF");
! 	    free(buffer);
! 	    return(-1);
! 	}
!   } while (ifconfs.ifc_len > oldbufsize);
  
    ifrp = ifconfs.ifc_req;
  
***************
*** 384,389 ****
--- 406,412 ----
  #endif
        if (strcmp(ifrp->ifr_name, name) == 0) {
          IfIndex = index;
+ 	free(buffer);
          return(index);
        }
        index++;
***************
*** 395,399 ****
--- 418,423 ----
    }
  
    close(s);
+   free(buffer);
    return(-1);
  }
Only in ppp_plus/: sample.ppp-dialup
Only in ppp_plus/: sample.ppp-pap-dialup
Only in ppp_plus/: sample.ppp.conf
diff -c 2.1-stable-ppp/vars.c ppp_plus/vars.c
*** 2.1-stable-ppp/vars.c	Tue Feb  6 08:06:34 1996
--- ppp_plus/vars.c	Mon Aug 12 22:08:15 1996
***************
*** 32,38 ****
  char VarLocalVersion[] = "$Date: 1996/02/05 17:03:24 $";
  
  /*
!  * Order of conf option is important. See vars.h.
   */
  struct confdesc pppConfs[] = {
    { "vjcomp",    CONF_ENABLE,  CONF_ACCEPT },
--- 32,39 ----
  char VarLocalVersion[] = "$Date: 1996/02/05 17:03:24 $";
  
  /*
!  * Order of conf option is important. See vars.h.  basically its
!  * myside, hisside
   */
  struct confdesc pppConfs[] = {
    { "vjcomp",    CONF_ENABLE,  CONF_ACCEPT },
***************
*** 42,48 ****
    { "acfcomp",   CONF_ENABLE,  CONF_ACCEPT },
    { "protocomp", CONF_ENABLE,  CONF_ACCEPT },
    { "pred1",	 CONF_ENABLE,  CONF_ACCEPT },
!   { "proxy",	 CONF_DISABLE, CONF_DENY },
    { NULL },
  };
  
--- 43,51 ----
    { "acfcomp",   CONF_ENABLE,  CONF_ACCEPT },
    { "protocomp", CONF_ENABLE,  CONF_ACCEPT },
    { "pred1",	 CONF_ENABLE,  CONF_ACCEPT },
!   { "proxy",	 CONF_DISABLE, CONF_DENY   },
!   { "msext",	 CONF_DISABLE, CONF_ACCEPT },
!   { "passwdauth",CONF_ENABLE,  CONF_DENY   },
    { NULL },
  };
  
diff -c 2.1-stable-ppp/vars.h ppp_plus/vars.h
*** 2.1-stable-ppp/vars.h	Tue Feb  6 08:06:35 1996
--- ppp_plus/vars.h	Mon Aug 12 22:06:07 1996
***************
*** 44,50 ****
  #define	ConfProtocomp	5
  #define	ConfPred1	6
  #define	ConfProxy	7
! #define	MAXCONFS	8
  
  #define	Enabled(x)	(pppConfs[x].myside & CONF_ENABLE)
  #define	Acceptable(x)	(pppConfs[x].hisside & CONF_ACCEPT)
--- 44,52 ----
  #define	ConfProtocomp	5
  #define	ConfPred1	6
  #define	ConfProxy	7
! #define ConfMSExt	8
! #define ConfPasswdAuth	9
! #define	MAXCONFS	10
  
  #define	Enabled(x)	(pppConfs[x].myside & CONF_ENABLE)
  #define	Acceptable(x)	(pppConfs[x].hisside & CONF_ACCEPT)
[file sample.ppp-dialup]
#!/bin/sh -
## 
## Copyright (c) 1995 Mark Newton
## All rights reserved.
## 
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions
## are met:
## 1. Redistributions of source code must retain the above copyright
##    notice, this list of conditions and the following disclaimer.
## 2. Redistributions in binary form must reproduce the above copyright
##    notice, this list of conditions and the following disclaimer in the
##    documentation and/or other materials provided with the distribution.
## 
## THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
## ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
## ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
## OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
## LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
## OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
## 
##	 @(#)ppp-shell.sh	1.03 951019
## 

IDENT=`echo $0 | sed -e 's/^.*-\(.*\)$/\1/'`
echo IDENT is now $IDENT
CALLEDAS="$IDENT"
TTY=`tty`

if [ x$IDENT = xdialup ]; then
    IDENT=`basename $TTY`
fi

echo "PPP for $CALLEDAS on $TTY"
echo "Starting PPP for $IDENT"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~"

exec /usr/sbin/ppp -direct $IDENT


[file sample.ppp-pap-dialup]
#!/bin/sh -
## 
## Copyright (c) 1995 Mark Newton
## All rights reserved.
## 
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions
## are met:
## 1. Redistributions of source code must retain the above copyright
##    notice, this list of conditions and the following disclaimer.
## 2. Redistributions in binary form must reproduce the above copyright
##    notice, this list of conditions and the following disclaimer in the
##    documentation and/or other materials provided with the distribution.
## 
## THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
## ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
## ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
## OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
## LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
## OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
## 
##	 @(#)ppp-shell.sh	1.03 951019
## 

IDENT=`echo $0 | sed -e 's/^.*-\(.*\)$/\1/'`
CALLEDAS="$IDENT"
TTY=`tty`

#  echo calledas: $CALLEDAS, ident: $IDENT, tty=$TTY
#  exit

if [ x$IDENT = xdialup ]; then
    IDENT=`basename $TTY`
fi

echo "PPP for $CALLEDAS on $TTY"
echo "Starting PPP for $IDENT"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~"

exec /usr/sbin/ppp -direct pap$IDENT


[file sample.ppp.conf]
#############################################################################
#
# My ppp.conf (pjchilds@imforei.apana.org.au)
#
#############################################################################

# default is to enable my extentions to ppp to have Microsoft clients
# negotiate nameservers and netbios nameservers

default:
 set debug phase lcp chat
 set timeout 0
 enable msext
 set ns 10.20.30.40 1.2.3.4
 set nbns 11.22.33.44

# standard dial-in PPP where authentication is done via a 
# "login: password:" arrangement - usually a script handles that on
# the client side

cuaa1: 
 disable passwdauth
 set ifaddr my.ip.addr his.ip.addr
 enable proxy

cuaa2:
 disable passwdauth
 set ifaddr my.ip.addr his.ip.addr2
 enable proxy

# dial-in PPP where mgetty has "auto" detected PPP packets and ran
#   /usr/sbin/ppp -direct pap(line)
# we enable pap to authenticate the user, and enable passwdauth 
# (another modification) to use the password file to authenticate
# the user, and log them on to the system 

papcuaa1:
 enable pap
 enable passwdauth
 set ifaddr my.ip.addr his.ip.addr
 enable proxy

>Release-Note:
>Audit-Trail:

From: Peter Childs <pjchilds@imforei.apana.org.au>
To: FreeBSD-gnats-submit@freefall.freebsd.org
Cc:  Subject: Re: bin/1494: some patches to ijppp
Date: Thu, 3 Oct 1996 17:54:48 +0930 (CST)

  Patches under this report were from a 2.1-stable system.
 
  As I feel there is no chance ever getting these patches into 2.1.5-stable
  i include the "diff" against 2.2-current's ijppp, in the hope that
  some kind individual will see the benifit (no more NT servers doing
  dialup PPP) and commit them.
 
  With this patch Win95 clients only need username,password,phonenumber.
  No scripts, no ip's, out-of-the-box.
 
  There are also a couple of new files for using entries in the password
  file and pap authentication so you don't have to use the
  /etc/ppp/pap.secrets file.. (yuk!)  This is optional (see Makefile)
 
  Fix: patch < this-latest-patch-on-a-freebsd-current-system
  extract "passwdauth.h" and "passwdauth.c" from this file..
  cvs commit :)
 
 -- passwdauth.c
 /*
  *
  * passwdauth.c  - pjchilds@imforei.apana.org.au
  *
  * authenticate user via the password file
  *
  */
 
 #include <sys/types.h>
 #include <utmp.h>
 #include <time.h>
 #include <pwd.h>
 #include "fsm.h"
 #include "passwdauth.h"
 
 int
 PasswdAuth(name, key)
 char *name, *key;
 {
   static int logged_in = 0;
   struct passwd *pwd;
   char *salt, *ep;
   struct utmp utmp;
 
 #ifdef DEBUG
   logprintf( "passwdauth called with name= %s, key= %s\n", name, key );
 #endif /* DEBUG */
 
   if(( pwd = getpwnam( name ) ))
     salt = pwd->pw_passwd;
   else
   {
     endpwent();
     LogPrintf( LOG_LCP, "PasswdAuth - user (%s) not in passwd file\n", name );
     return 0; /* false - failed to authenticate (password not in file) */
   }
 
 #ifdef LOCALHACK
   /*
    * All our PPP usernames start with 'P' so i check that here... if you
    * don't do this i suggest all your PPP users be members of a group
    * and you check the guid
    */
 
   if( name[0] != 'P' )
   { 
     LogPrintf( LOG_LCP, "PasswdAuth - user (%s) not a PPP user\n", name );
     endpwent();
     return 0;
   }
 
 #endif /* LOCALHACK */
 
   ep = crypt( key, salt );
 
   /* strcmp returns 0 if same */
   if( strcmp( ep, pwd->pw_passwd ) != 0 )
   {
     LogPrintf( LOG_LCP, "PasswdAuth - user (%s,%s) authentication failed\n",
 	name, key );
     endpwent();
     return 0;  /* false - failed to authenticate (didn't match up) */
   }
 
   /*
    * now we log them in... we have a static login flag so we don't
    * do it twice :)
    */
 
   if( ! logged_in )
   {
     (void)time(&utmp.ut_time);
     (void)strncpy(utmp.ut_name, name, sizeof(utmp.ut_name));
 
 #ifdef LOCALHACK
 
     /* we trim the first three characters off here.. see sample.ppp.conf */
     (void)strncpy(utmp.ut_line, (char *)(dstsystem + 3), sizeof(utmp.ut_line));
 
 #else
 
     (void)strncpy(utmp.ut_line, dstsystem, sizeof(utmp.ut_line));
 
 #endif /* LOCALHACK */
 
     (void)strcpy(utmp.ut_host, "auto-ppp" );
     login(&utmp);
     (void)setlogin( pwd->pw_name );
 
     LogPrintf( LOG_LCP, "PasswdAuth has logged in user %s\n", name );
 
     logged_in = 1;
   }
 
   endpwent();
 
   return 1;
 }
 
 -- dev/ppp-plus-current/passwdauth.h
 /*
  * passwdauth.h
  *
  */
 
 #ifndef _PASSWDAUTH_H_
 #define _PASSWDAUTH_H_
 
 extern int PasswdAuth __P((char *, char *));
 
 #endif
 
 --
 
 diff -c ppp-current/Makefile ppp-plus-current/Makefile
 *** ppp-current/Makefile	Mon Mar  4 21:08:41 1996
 --- ppp-plus-current/Makefile	Fri Sep  6 23:58:13 1996
 ***************
 *** 4,13 ****
   SRCS=	async.c auth.c ccp.c chap.c chat.c command.c filter.c fsm.c hdlc.c \
   	ip.c ipcp.c lcp.c lqr.c log.c main.c mbuf.c modem.c os.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 -DUSE_PERROR
 ! LDADD += -lmd
   DPADD += ${LIBMD}
   MAN8=	ppp.8
   BINMODE=4555
 --- 4,13 ----
   SRCS=	async.c auth.c ccp.c chap.c chat.c command.c filter.c fsm.c hdlc.c \
   	ip.c ipcp.c lcp.c lqr.c log.c main.c mbuf.c modem.c os.c \
   	pap.c pred.c route.c slcompress.c timer.c systems.c uucplock.c vars.c \
 ! 	vjcomp.c arp.c passwdauth.c
   #CFLAGS+= -DHAVE_SHELL_CMD_WITH_ANY_MODE
 ! CFLAGS += -Wall -DUSE_PERROR -DMSEXT -DPASSWDAUTH -DLOCALHACK
 ! LDADD += -lmd -lcrypt -lutil
   DPADD += ${LIBMD}
   MAN8=	ppp.8
   BINMODE=4555
 diff -c ppp-current/command.c ppp-plus-current/command.c
 *** ppp-current/command.c	Mon Jun 10 06:10:58 1996
 --- ppp-plus-current/command.c	Sat Sep  7 00:00:37 1996
 ***************
 *** 360,365 ****
 --- 360,377 ----
     return(1);
   }
   
 + #ifdef MSEXT
 + static int ShowMSExt()
 + {
 +   printf(" MS PPP extention values \n" );
 +   printf("   Primary NS     : %s\n", inet_ntoa( ns_entries[0] ));
 +   printf("   Secondary NS   : %s\n", inet_ntoa( ns_entries[1] ));
 +   printf("   Primary NBNS   : %s\n", inet_ntoa( nbns_entries[0] ));
 +   printf("   Secondary NBNS : %s\n", inet_ntoa( nbns_entries[1] ));
 + 
 +   return(1);
 + }
 + #endif /* MSEXT */
   
   extern int ShowIfilter(), ShowOfilter(), ShowDfilter(), ShowAfilter();
   
 ***************
 *** 402,407 ****
 --- 414,423 ----
   	"Show Idle timeout value", StrNull},
     { "redial",   NULL,	  ShowRedial,		LOCAL_AUTH,
   	"Show Redial timeout value", StrNull},
 + #ifdef MSEXT
 +   { "msext", 	NULL,	  ShowMSExt,		LOCAL_AUTH,
 + 	"Show MS PPP extention values", StrNull},
 + #endif /* MSEXT */
     { "version",  NULL,	  ShowVersion,		LOCAL_NO_AUTH | LOCAL_AUTH,
   	"Show version string", StrNull},
     { "help",     "?",      HelpCommand,		LOCAL_NO_AUTH | LOCAL_AUTH,
 ***************
 *** 807,812 ****
 --- 823,881 ----
     return(1);
   }
   
 + #ifdef MSEXT
 + 
 + void
 + SetMSEXT(pri_addr, sec_addr, argc, argv)
 + struct in_addr *pri_addr;
 + struct in_addr *sec_addr;
 + int argc;
 + char **argv;
 + {
 +   int dummyint;
 +   struct in_addr dummyaddr;
 + 
 +   pri_addr->s_addr = sec_addr->s_addr = 0L;
 + 
 +   if( argc > 0 ) {
 +     ParseAddr(argc, argv++, pri_addr, &dummyaddr, &dummyint);
 +     if( --argc > 0 ) 
 +       ParseAddr(argc, argv++, sec_addr, &dummyaddr, &dummyint);
 +     else
 +       sec_addr->s_addr = pri_addr->s_addr;
 +   }
 + 
 +  /*
 +   * if the primary/secondary ns entries are 0.0.0.0 we should 
 +   * set them to either the localhost's ip, or the values in
 +   * /etc/resolv.conf ??
 +   *
 +   * up to you if you want to implement this...
 +   */
 + 
 + }
 + 
 + static int
 + SetNS(list, argc, argv)
 + struct cmdtab *list;
 + int argc;
 + char **argv;
 + {
 +   SetMSEXT(&ns_entries[0], &ns_entries[1], argc, argv);
 +   return(1);
 + }
 + 
 + static int
 + SetNBNS(list, argc, argv)
 + struct cmdtab *list;
 + int argc;
 + char **argv;
 + {
 +   SetMSEXT(&nbns_entries[0], &nbns_entries[1], argc, argv);
 +   return(1);
 + }
 + 
 + #endif /* MS_EXT */
   
   #define	VAR_AUTHKEY	0
   #define	VAR_DIAL	1
 ***************
 *** 918,923 ****
 --- 987,998 ----
   	"Set Idle timeout", StrValue},
     { "redial",   NULL,     SetRedialTimeout,	LOCAL_AUTH,
   	"Set Redial timeout", "value|random [dial_attempts]"},
 + #ifdef MSEXT
 +   { "ns",	NULL,	  SetNS,		LOCAL_AUTH,
 + 	"Set NameServer", "pri-addr [sec-addr]"},
 +   { "nbns",	NULL,	  SetNBNS,		LOCAL_AUTH,
 + 	"Set NetBIOS NameServer", "pri-addr [sec-addr]"},
 + #endif /* MSEXT */
     { "help",     "?",      HelpCommand,		LOCAL_AUTH | LOCAL_NO_AUTH,
   	"Display this message", StrNull, (void *)SetCommands},
     { NULL,       NULL,     NULL },
 diff -c ppp-current/ipcp.c ppp-plus-current/ipcp.c
 *** ppp-current/ipcp.c	Sun May 12 06:18:26 1996
 --- ppp-plus-current/ipcp.c	Sat Sep  7 00:04:23 1996
 ***************
 *** 43,48 ****
 --- 43,52 ----
   struct ipcpstate IpcpInfo;
   struct in_range DefMyAddress, DefHisAddress, DefTriggerAddress;
   
 + #ifdef MSEXT
 + struct in_addr ns_entries[2], nbns_entries[2];
 + #endif /* MSEXT */
 + 
   static void IpcpSendConfigReq __P((struct fsm *));
   static void IpcpSendTerminateAck __P((struct fsm *));
   static void IpcpSendTerminateReq __P((struct fsm *));
 ***************
 *** 310,316 ****
     int type, length;
     u_long *lp, compproto;
     struct compreq *pcomp;
 !   struct in_addr ipaddr, dstipaddr;
     char tbuff[100];
   
     ackp = AckBuff;
 --- 314,320 ----
     int type, length;
     u_long *lp, compproto;
     struct compreq *pcomp;
 !   struct in_addr ipaddr, dstipaddr, dnsstuff, ms_info_req;
     char tbuff[100];
   
     ackp = AckBuff;
 ***************
 *** 452,457 ****
 --- 456,557 ----
   	break;
         }
         break;
 + 
 +  /*
 +   * MS extensions for MS's PPP 
 +   */
 + 
 + #ifdef MSEXT
 +     case TY_PRIMARY_DNS:   /* MS PPP DNS negotiation hack */
 +     case TY_SECONDARY_DNS:
 +       if( !Enabled( ConfMSExt ) ) {
 + 	LogPrintf( LOG_LCP, "MS NS req - rejected - msext disabled\n" );
 + 	IpcpInfo.my_reject |= ( 1 << type );
 + 	bcopy(cp, rejp, length);
 + 	rejp += length;
 + 	break;
 +       }
 +       switch( mode ){
 +       case MODE_REQ:
 + 	lp = (u_long *)(cp + 2);
 + 	dnsstuff.s_addr = *lp;
 + 	ms_info_req.s_addr = ns_entries[((type - TY_PRIMARY_DNS)?1:0)].s_addr;
 + 	if( dnsstuff.s_addr != ms_info_req.s_addr )
 + 	{
 + 	  /*
 + 	   So the client has got the DNS stuff wrong (first request)
 + 	   so well tell 'em how it is           
 + 	  */
 + 	  bcopy( cp, nakp, 2 );  /* copy first two (type/length) */
 + 	  LogPrintf( LOG_LCP, "MS NS req %d:%s->%s - nak\n",
 + 		type,
 + 		inet_ntoa( dnsstuff ),
 + 		inet_ntoa( ms_info_req ));
 + 	  bcopy( &ms_info_req, nakp+2, length );
 + 	  nakp += length;
 + 	  break;
 + 	}
 + 	  /*
 + 	   Otherwise they have it right (this time) so we send
 + 	   a ack packet back confirming it... end of story
 + 	  */
 + 	LogPrintf( LOG_LCP, "MS NS req %d:%s ok - ack\n",
 + 		type,
 + 		inet_ntoa( ms_info_req ));
 + 	bcopy( cp, ackp, length );
 + 	ackp += length;
 + 	break;
 +       case MODE_NAK: /* what does this mean?? */
 + 	LogPrintf(LOG_LCP, "MS NS req %d - NAK??\n", type );
 + 	break;
 +       case MODE_REJ: /* confused?? me to :) */
 + 	LogPrintf(LOG_LCP, "MS NS req %d - REJ??\n", type );
 + 	break;
 +       }
 +       break;
 + 
 +     case TY_PRIMARY_NBNS:   /* MS PPP NetBIOS nameserver hack */
 +     case TY_SECONDARY_NBNS:
 +     if( !Enabled( ConfMSExt ) ) {
 +       LogPrintf( LOG_LCP, "MS NBNS req - rejected - msext disabled\n" );
 +       IpcpInfo.my_reject |= ( 1 << type );
 +       bcopy( cp, rejp, length );
 +       rejp += length;
 +       break;
 +     }
 +       switch( mode ){
 +       case MODE_REQ:
 + 	lp = (u_long *)(cp + 2);
 + 	dnsstuff.s_addr = *lp;
 + 	ms_info_req.s_addr = nbns_entries[((type - TY_PRIMARY_NBNS)?1:0)].s_addr;
 + 	if( dnsstuff.s_addr != ms_info_req.s_addr )
 + 	{
 + 	  bcopy( cp, nakp, 2 );
 + 	  bcopy( &ms_info_req.s_addr , nakp+2, length );
 + 	  LogPrintf( LOG_LCP, "MS NBNS req %d:%s->%s - nak\n",
 + 		type,
 + 		inet_ntoa( dnsstuff ),
 + 		inet_ntoa( ms_info_req ));
 + 	  nakp += length;
 + 	  break;
 + 	}
 + 	LogPrintf( LOG_LCP, "MS NBNS req %d:%s ok - ack\n",
 + 		type,
 + 		inet_ntoa( ms_info_req ));
 + 	bcopy( cp, ackp, length );
 + 	ackp += length;
 + 	break;
 +       case MODE_NAK:
 + 	LogPrintf( LOG_LCP, "MS NBNS req %d - NAK??\n", type );
 + 	break;
 +       case MODE_REJ:
 + 	LogPrintf( LOG_LCP, "MS NBNS req %d - REJ??\n", type );
 + 	break;
 +       }
 +       break;
 + 
 + #endif /* MSEXT */
 + 
       default:
         IpcpInfo.my_reject |= (1 << type);
         bcopy(cp, rejp, length);
 diff -c ppp-current/ipcp.h ppp-plus-current/ipcp.h
 *** ppp-current/ipcp.h	Sat Jul  8 17:58:10 1995
 --- ppp-plus-current/ipcp.h	Sat Sep  7 00:04:23 1996
 ***************
 *** 29,34 ****
 --- 29,45 ----
   #define	TY_COMPPROTO	2
   #define	TY_IPADDR	3
   
 + /* MS PPP NameServer and NetBIOS NameServer stuff */
 + 
 + #ifdef MSEXT
 + 
 + #define TY_PRIMARY_DNS		129
 + #define TY_PRIMARY_NBNS		130
 + #define TY_SECONDARY_DNS	131
 + #define TY_SECONDARY_NBNS	132
 + 
 + #endif /* MSEXT */
 + 
   struct ipcpstate {
     struct  in_addr his_ipaddr;	/* IP address he is willing to use */
     u_long  his_compproto;
 ***************
 *** 57,62 ****
 --- 68,78 ----
   extern struct in_range DefMyAddress;
   extern struct in_range DefHisAddress;
   extern struct in_range DefTriggerAddress;
 + 
 + #ifdef MSEXT
 + extern struct in_addr ns_entries[2];
 + extern struct in_addr nbns_entries[2];
 + #endif /* MSEXT */
   
   extern void IpcpInit __P((void));
   extern void IpcpDefAddress __P((void));
 diff -c ppp-current/pap.c ppp-plus-current/pap.c
 *** ppp-current/pap.c	Sun May 12 06:18:38 1996
 --- ppp-plus-current/pap.c	Sat Sep  7 00:07:12 1996
 ***************
 *** 111,116 ****
 --- 111,125 ----
   #ifdef DEBUG
     logprintf("name: %s (%d), key: %s (%d)\n", name, nlen, key, klen);
   #endif
 + 
 + #ifdef PASSWDAUTH
 +   if( Enabled( ConfPasswdAuth ) )
 +   {
 +     LogPrintf( LOG_LCP, "PasswdAuth enabled - calling\n" );
 +     return PasswdAuth( name, key );
 +   }
 + #endif /* PASSWDAUTH */
 + 
     return(AuthValidate(SECRETFILE, name, key));
   }
   
 Only in ppp-plus-current: passwdauth.c
 Only in ppp-plus-current: passwdauth.h
 diff -c ppp-current/ppp.8 ppp-plus-current/ppp.8
 *** ppp-current/ppp.8	Sun May 12 06:18:40 1996
 --- ppp-plus-current/ppp.8	Sat Sep  7 00:17:25 1996
 ***************
 *** 6,12 ****
   .Sh NAME
   .Nm ppp
   .Nd
 ! Point to Point Protocol (aka iijppp)
   .Sh SYNOPSIS
   .Nm
   .Op Fl auto | Fl direct | Fl dedicated
 --- 6,12 ----
   .Sh NAME
   .Nm ppp
   .Nd
 ! Point to Point Protocol (aka iijppp) 
   .Sh SYNOPSIS
   .Nm
   .Op Fl auto | Fl direct | Fl dedicated
 ***************
 *** 60,66 ****
    
   .It Supports PAP and CHAP authentication.
   
 - 
   .It Supports Proxy Arp.
   When
   .Em PPP
 --- 60,65 ----
 ***************
 *** 101,106 ****
 --- 100,111 ----
   .Em all
   data flowing through the link, thus reducing overhead to a minimum.
   
 + .It Supports Microsofts IPCP extentions.
 + Name Server Addresses and NetBIOS Name Server Addresses can be negotiated
 + with clients using the Microsoft
 + .Em PPP
 + stack (ie. Win95, WinNT)
 + 
   .It Runs under BSDI-1.1 and FreeBSD.
   
   .El
 ***************
 *** 421,427 ****
   .Pa /etc/ppp/ppp.conf.filter.example .
   
   
 ! .Sh RECEIVING INCOMING PPP CONNECTIONS
   
   To handle an incoming
   .Em PPP
 --- 426,432 ----
   .Pa /etc/ppp/ppp.conf.filter.example .
   
   
 ! .Sh RECEIVING INCOMING PPP CONNECTIONS (Method 1)
   
   To handle an incoming
   .Em PPP
 ***************
 *** 469,476 ****
   
   (You can specify a label name for further control.)
   
 - .El
 - 
   .Pp
   Direct mode (
   .Fl direct )
 --- 474,479 ----
 ***************
 *** 478,484 ****
   .Nm
   work with stdin and stdout.  You can also telnet to port 3000 to get
   command mode control in the same manner as client-side
 ! .Nm .
   
   .Sh SETTING IDLE, LINE QUALITY REQUEST, RETRY TIMER
   
 --- 481,542 ----
   .Nm
   work with stdin and stdout.  You can also telnet to port 3000 to get
   command mode control in the same manner as client-side
 ! .Nm.
 ! 
 ! .It
 ! Optional support for Microsoft's IPCP Name Server and NetBIOS
 ! Name Server negotiation can be enabled use
 ! .Dq enable msext
 ! and 
 ! .Dq set ns pri-addr [sec-addr]
 ! along with
 ! .Dq set nbns pri-addr [sec-addr]
 ! in your ppp.conf file
 ! 
 ! .El
 ! 
 ! .Sh RECEIVING INCOMING PPP CONNECTIONS (Method 2)
 ! 
 ! This method differs in that it recommends the use of 
 ! .Em mgetty+sendfax
 ! to handle the modem connections.  The latest version 0.99
 ! can be compiled with the
 ! .Dq AUTO_PPP
 ! option to allow detection of clients speaking PPP to the login
 ! prompt.
 ! 
 ! Follow these steps:
 ! 
 ! .Bl -enum
 ! .It
 ! Get, configure, and install mgetty+sendfax v0.99 or later (beta)
 ! making sure you have used the AUTO_PPP option.
 ! .It
 ! Edit
 ! .Pa /etc/ttys
 ! to enable a mgetty on the port where the modem is attached.
 ! 
 ! For example:
 ! 
 ! .Dl cuaa1  "/usr/local/sbin/mgetty -s 57600"       dialup on
 ! 
 ! .It
 ! Prepare an account for the incoming user.
 ! .Bd -literal
 ! Pfred:xxxx:66:66:Fred's PPP:/home/ppp:/etc/ppp/ppp-dialup
 ! .Ed
 ! 
 ! .It
 ! Examine the files
 ! .Pa /etc/ppp/sample.ppp-dialup
 ! .Pa /etc/ppp/sample.ppp-pap-dialup
 ! and
 ! .Pa /etc/ppp/sample.ppp.conf
 ! for ideas.   ppp-pap-dialup is supposed to be called from
 ! .Pa /usr/local/etc/mgetty+sendfax/login.conf
 ! from a line like
 ! 
 ! .Dl /AutoPPP/ -     -       /etc/ppp/ppp-pap-dialup
   
   .Sh SETTING IDLE, LINE QUALITY REQUEST, RETRY TIMER
   
 diff -c ppp-current/route.c ppp-plus-current/route.c
 *** ppp-current/route.c	Tue Aug 13 18:49:45 1996
 --- ppp-plus-current/route.c	Sat Sep  7 00:10:56 1996
 ***************
 *** 351,364 ****
     free(sp);
   }
   
   int
   GetIfIndex(name)
   char *name;
   {
     struct ifreq *ifrp;
     int s, len, elen, index;
     struct ifconf ifconfs;
 !   struct ifreq reqbuf[32];
   
     s = socket(AF_INET, SOCK_DGRAM, 0);
     if (s < 0) {
 --- 351,370 ----
     free(sp);
   }
   
 +  /*
 +   * 960603 - Modified to use dynamic buffer allocator as in ifconfig
 +   */
 + 
   int
   GetIfIndex(name)
   char *name;
   {
 +   char *buffer;
     struct ifreq *ifrp;
     int s, len, elen, index;
     struct ifconf ifconfs;
 !   /* struct ifreq reqbuf[256]; -- obsoleted :) */
 !   int oldbufsize, bufsize = sizeof(struct ifreq);
   
     s = socket(AF_INET, SOCK_DGRAM, 0);
     if (s < 0) {
 ***************
 *** 366,377 ****
       return(-1);
     }
   
 !   ifconfs.ifc_len = sizeof(reqbuf);
 !   ifconfs.ifc_buf = (caddr_t)reqbuf;
 !   if (ioctl(s, SIOCGIFCONF, &ifconfs) < 0) {
 !     perror("IFCONF");
 !     return(-1);
 !   }
   
     ifrp = ifconfs.ifc_req;
   
 --- 372,398 ----
       return(-1);
     }
   
 !   buffer = malloc(bufsize);   /* allocate first buffer */
 !   ifconfs.ifc_len = bufsize;  /* Initial setting */
 !   /*
 !    * Iterate through here until we don't get many more data 
 !    */
 ! 
 !   do {
 !       oldbufsize = ifconfs.ifc_len;
 !       bufsize += 1+sizeof(struct ifreq);
 !       buffer = realloc((void *)buffer, bufsize);      /* Make it bigger */
 ! #ifdef DEBUG
 !       logprintf ("Growing buffer to %d\n", bufsize);
 ! #endif
 !       ifconfs.ifc_len = bufsize;
 !       ifconfs.ifc_buf = buffer;
 !       if (ioctl(s, SIOCGIFCONF, &ifconfs) < 0) {
 !           perror("IFCONF");
 !           free(buffer);
 !           return(-1);
 !       }
 !   } while (ifconfs.ifc_len > oldbufsize);
   
     ifrp = ifconfs.ifc_req;
   
 ***************
 *** 385,390 ****
 --- 406,412 ----
   #endif
         if (strcmp(ifrp->ifr_name, name) == 0) {
           IfIndex = index;
 +       free(buffer);
           return(index);
         }
         index++;
 ***************
 *** 396,400 ****
 --- 418,423 ----
     }
   
     close(s);
 +   free(buffer);
     return(-1);
   }
 Only in ppp-plus-current: sample.ppp-dialup
 Only in ppp-plus-current: sample.ppp-pap-dialup
 Only in ppp-plus-current: sample.ppp.conf
 Only in ppp-plus-current: uucplock.c
 diff -c ppp-current/vars.c ppp-plus-current/vars.c
 *** ppp-current/vars.c	Thu Jan 11 07:58:04 1996
 --- ppp-plus-current/vars.c	Sat Sep  7 00:14:28 1996
 ***************
 *** 42,48 ****
     { "acfcomp",   CONF_ENABLE,  CONF_ACCEPT },
     { "protocomp", CONF_ENABLE,  CONF_ACCEPT },
     { "pred1",	 CONF_ENABLE,  CONF_ACCEPT },
 !   { "proxy",	 CONF_DISABLE, CONF_DENY },
     { NULL },
   };
   
 --- 42,50 ----
     { "acfcomp",   CONF_ENABLE,  CONF_ACCEPT },
     { "protocomp", CONF_ENABLE,  CONF_ACCEPT },
     { "pred1",	 CONF_ENABLE,  CONF_ACCEPT },
 !   { "proxy",	 CONF_DISABLE, CONF_DENY   },
 !   { "msext",     CONF_DISABLE, CONF_ACCEPT },
 !   { "passwdauth",CONF_ENABLE,  CONF_DENY   },
     { NULL },
   };
   
 diff -c ppp-current/vars.h ppp-plus-current/vars.h
 *** ppp-current/vars.h	Fri Mar  8 23:52:23 1996
 --- ppp-plus-current/vars.h	Sat Sep  7 00:15:51 1996
 ***************
 *** 44,50 ****
   #define	ConfProtocomp	5
   #define	ConfPred1	6
   #define	ConfProxy	7
 ! #define	MAXCONFS	8
   
   #define	Enabled(x)	(pppConfs[x].myside & CONF_ENABLE)
   #define	Acceptable(x)	(pppConfs[x].hisside & CONF_ACCEPT)
 --- 44,52 ----
   #define	ConfProtocomp	5
   #define	ConfPred1	6
   #define	ConfProxy	7
 ! #define ConfMSExt	8
 ! #define ConfPasswdAuth	9
 ! #define	MAXCONFS	10
   
   #define	Enabled(x)	(pppConfs[x].myside & CONF_ENABLE)
   #define	Acceptable(x)	(pppConfs[x].hisside & CONF_ACCEPT)

From: Peter Childs <pjchilds@imforei.apana.org.au>
To: jkh@time.cdrom.com (Jordan K. Hubbard)
Cc: FreeBSD-gnats-submit@freefall.freebsd.org
Subject: Re: bin/1494: some patches to ijppp
Date: Thu, 3 Oct 1996 19:38:54 +0930 (CST)

 > What's your confidence level with this stuff?  Have you had any other
 > folks in the FreeBSD community BETA testing it?
 
  Got a machine with 38 serial ports running it :)  I've installed it
  on two other public access sites over here, and my own machine.
  I've had a few people grab it via ftp.. and haven't had any
  problems...  I just added the stuff from the (rejected) proposal
  MS's has got on its web site somewhere.
 
 > I can sense some very understandable frustration here, but you also
 > have to try and see this from my perspective - I'd *love* to put a
 > potentially nice, new feature like this into 2.1.6's PPP, but what if
 > it then breaks the whole show?  They're not going to scream at you,
 > they're going to scream at *me* and anything you can point to which
 > might increase my confidence level would make me more willing, in
 > turn, to take the risk (even if only with 2.2).
 
  Grin.. ijppp is written very well.  There are some parts to the 
  patch you could leave out if you were unsure.  The 2.1.5 ppp
  from memory has a big bogus "limited to 10 interfaces" bug...
 
  The patch addresses a few areas...
 
   . The ms extentions - trival
 
    This isn't going to break anything.  It adds a few bits to
    the negotiation phase.  It can be selectively enabled or
    disabled in the ppp.conf file.
 
   . The pap password stuff - hmmm...
 
    Well i personally probably wouldn't be stuffed compiling this
    in by default, but i'd leave the code there so that others can
    see that using a nasty big plain text /etc/ppp/pap.secrets
    file is necessary.
 
    . Changes to the GetIfIndex(name) function...
 
    Someone else posted these somewhere.. they work here and it
    make sense rather than dynamically allocated stuff.
 
  2.1.5-stable is the stable tree.. but 2.2-current is the development
  tree.  Stick it in 2.2 and see how it goes... Since i wrote it I haven't
  had one bug.. but that's mainly due to the great initial coding of
  ijppp.
 
  A quick scan of the "ms extension" patch shows that it doesn't use
  malloc, recursion, or anything nasty that could explode...
 
  Regards,
    Peter
 
 --
  Peter Childs  ---  http://www.imforei.apana.org.au/~pjchilds
   Finger pjchilds@al.imforei.apana.org.au for public PGP key
          Drag me, drop me, treat me like an object!
State-Changed-From-To: open->closed 
State-Changed-By: jkh 
State-Changed-When: Sun Oct 6 06:31:56 PDT 1996 
State-Changed-Why:  
Committed. 

From: "Jordan K. Hubbard" <jkh@time.cdrom.com>
To: Peter Childs <pjchilds@imforei.apana.org.au>
Cc: FreeBSD-gnats-submit@freefall.freebsd.org
Subject: Re: bin/1494: some patches to ijppp 
Date: Sun, 06 Oct 1996 06:33:16 -0700

 Only in ppp-plus-current: sample.ppp-dialup
 Only in ppp-plus-current: sample.ppp-pap-dialup
 Only in ppp-plus-current: sample.ppp.conf
 Only in ppp-plus-current: uucplock.c
 
 You want to submit this stuff too?
 
 					Jordan

From: Peter Childs <pjchilds@imforei.apana.org.au>
To: jkh@time.cdrom.com (Jordan K. Hubbard)
Cc: pjchilds@imforei.apana.org.au, FreeBSD-gnats-submit@freefall.freebsd.org
Subject: Re: bin/1494: some patches to ijppp
Date: Mon, 7 Oct 1996 04:11:29 +0930 (CST)

 > Only in ppp-plus-current: sample.ppp-dialup
 > Only in ppp-plus-current: sample.ppp-pap-dialup
 > Only in ppp-plus-current: sample.ppp.conf
 > Only in ppp-plus-current: uucplock.c
 > 
 > You want to submit this stuff too?
 
  uucplock.c isn't required.. its part of the startslip ??
  ( ie. From makefile .PATH: ${.CURDIR}/../../sbin/startslip )
 
  sample.ppp-dialup, sample.ppp-pap-dialup and sample.ppp.conf
  are all appended to the end of the inital PR report.
 
  Regards,
    Peter
 
 -- 
  Peter Childs  ---  http://www.imforei.apana.org.au/~pjchilds
   Finger pjchilds@al.imforei.apana.org.au for public PGP key
          Drag me, drop me, treat me like an object!
>Unformatted:
