Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Aug 1996 22:48:37 +0930 (CST)
From:      Peter Childs <pjchilds@imforei.apana.org.au>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/1494: extentions to ijppp
Message-ID:  <199608121318.WAA26547@al.imforei.apana.org.au>
Resent-Message-ID: <199608121320.GAA18570@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         1494
>Category:       bin
>Synopsis:       some patches to ijppp
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 12 06:20:01 PDT 1996
>Last-Modified:
>Originator:     Peter Childs
>Organization:
Peter Childs  ---  http://www.imforei.apana.org.au/~pjchilds
  Finger pjchilds@al.imforei.apana.org.au for public PGP key
>Release:        FreeBSD 2.1-STABLE i386
>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

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199608121318.WAA26547>