From 9be4164a6a772660090d2cca1a4501fa9c175735 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Tue, 8 Feb 1994 23:48:50 +0000 Subject: [PATCH] Changes to allow dynamic IP address assignment from the peer: added new options noipdefault, ipcp-accept-local, ipcp-accept-remote, and set the accept-local bit if we default the local IP address. --- pppd/options.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/pppd/options.c b/pppd/options.c index 1972516..4520f2d 100644 --- a/pppd/options.c +++ b/pppd/options.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: options.c,v 1.3 1994/01/10 00:19:28 paulus Exp $"; +static char rcsid[] = "$Id: options.c,v 1.4 1994/02/08 23:48:50 paulus Exp $"; #endif #include @@ -85,6 +85,7 @@ static int setproxyarp __ARGS((void)); static int setpersist __ARGS((void)); static int setdologin __ARGS((void)); static int setusehostname __ARGS((void)); +static int setnoipdflt __ARGS((void)); static int setlcptimeout __ARGS((char **)); static int setlcpterm __ARGS((char **)); static int setlcpconf __ARGS((char **)); @@ -98,6 +99,8 @@ static int setpapreqs __ARGS((char **)); static int setchaptimeout __ARGS((char **)); static int setchapchal __ARGS((char **)); static int setchapintv __ARGS((char **)); +static int setipcpaccl __ARGS((void)); +static int setipcpaccr __ARGS((void)); static int number_option __ARGS((char *, long *, int)); @@ -125,6 +128,7 @@ extern int uselogin; extern char our_name[]; extern char remote_name[]; int usehostname; +int disable_defaultip; /* * Valid arguments. @@ -172,6 +176,7 @@ static struct cmd { "proxyarp", 0, setproxyarp, /* Add proxy ARP entry */ "persist", 0, setpersist, /* Keep on reopening connection after close */ "login", 0, setdologin, /* Use system password database for UPAP */ + "noipdefault", 0, setnoipdflt, /* Don't use name for default IP adrs */ "lcp-restart", 1, setlcptimeout, /* Set timeout for LCP */ "lcp-max-terminate", 1, setlcpterm, /* Set max #xmits for term-reqs */ "lcp-max-configure", 1, setlcpconf, /* Set max #xmits for conf-reqs */ @@ -185,6 +190,8 @@ static struct cmd { "chap-restart", 1, setchaptimeout, /* Set timeout for CHAP */ "chap-max-challenge", 1, setchapchal, /* Set max #xmits for challenge */ "chap-interval", 1, setchapintv, /* Set interval for rechallenge */ + "ipcp-accept-local", 0, setipcpaccl, /* Accept peer's address for us */ + "ipcp-accept-remote", 0, setipcpaccr, /* Accept peer's address for it */ NULL }; @@ -925,6 +932,39 @@ setipaddr(arg) } +/* + * setnoipdflt - disable setipdefault() + */ +static int +setnoipdflt() +{ + disable_defaultip = 1; + return 1; +} + + +/* + * setipcpaccl - accept peer's idea of our address + */ +static int +setipcpaccl() +{ + ipcp_wantoptions[0].accept_local = 1; + return 1; +} + + +/* + * setipcpaccr - accept peer's idea of its address + */ +static int +setipcpaccr() +{ + ipcp_wantoptions[0].accept_remote = 1; + return 1; +} + + /* * setipdefault - default our local IP address based on our hostname. */ @@ -938,7 +978,7 @@ setipdefault() /* * If local IP address already given, don't bother. */ - if (wo->ouraddr != 0) + if (wo->ouraddr != 0 || disable_defaultip) return; /* @@ -946,6 +986,7 @@ setipdefault() * and take the first IP address as our local IP address. * If there isn't an IP address for our hostname, too bad. */ + wo->accept_local = 1; /* don't insist on this default value */ if ((hp = gethostbyname(hostname)) == NULL) return; local = *(long *)hp->h_addr; -- 2.39.2