X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fipcp.c;h=d273f50d5534bf670e18beff9599c4f7066dc152;hb=33c08b5f78f41aab4d1172e66db7c1afe21b5f1c;hp=763018bbc4ca66009b096d8b2266ac275f13b125;hpb=875d9641d05b4fcb7e186f784c801962bb2670e5;p=ppp.git diff --git a/pppd/ipcp.c b/pppd/ipcp.c index 763018b..d273f50 100644 --- a/pppd/ipcp.c +++ b/pppd/ipcp.c @@ -17,9 +17,7 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#ifndef lint -static const char rcsid[] = "$Id: ipcp.c,v 1.48 1999/08/12 04:25:20 paulus Exp $"; -#endif +#define RCSID "$Id: ipcp.c,v 1.51 1999/11/15 01:51:51 paulus Exp $" /* * TODO: @@ -39,6 +37,8 @@ static const char rcsid[] = "$Id: ipcp.c,v 1.48 1999/08/12 04:25:20 paulus Exp $ #include "ipcp.h" #include "pathnames.h" +static const char rcsid[] = RCSID; + /* global vars */ ipcp_options ipcp_wantoptions[NUM_PPP]; /* Options that we want to request */ ipcp_options ipcp_gotoptions[NUM_PPP]; /* Options that peer ack'd */ @@ -264,7 +264,7 @@ setdnsaddr(argv) struct hostent *hp; dns = inet_addr(*argv); - if (dns == -1) { + if (dns == (u_int32_t) -1) { if ((hp = gethostbyname(*argv)) == NULL) { option_error("invalid address parameter '%s' for ms-dns option", *argv); @@ -296,7 +296,7 @@ setwinsaddr(argv) struct hostent *hp; wins = inet_addr(*argv); - if (wins == -1) { + if (wins == (u_int32_t) -1) { if ((hp = gethostbyname(*argv)) == NULL) { option_error("invalid address parameter '%s' for ms-wins option", *argv); @@ -1307,17 +1307,6 @@ ip_check_options() wo->ouraddr = local; } } - - if (demand && wo->hisaddr == 0) { - option_error("remote IP address required for demand-dialling\n"); - exit(1); - } -#if 0 - if (demand && wo->accept_remote) { - option_error("ipcp-accept-remote is incompatible with demand\n"); - exit(1); - } -#endif } @@ -1331,6 +1320,17 @@ ip_demand_conf(u) { ipcp_options *wo = &ipcp_wantoptions[u]; + if (wo->hisaddr == 0) { + /* make up an arbitrary address for the peer */ + wo->hisaddr = htonl(0x0a707070 + ifunit); + wo->accept_remote = 1; + } + if (wo->ouraddr == 0) { + /* make up an arbitrary address for us */ + wo->ouraddr = htonl(0x0a404040 + ifunit); + wo->accept_local = 1; + disable_defaultip = 1; /* don't tell the peer this address */ + } if (!sifaddr(u, wo->ouraddr, wo->hisaddr, GetMask(wo->ouraddr))) return 0; if (!sifup(u)) @@ -1545,6 +1545,7 @@ ipcp_down(f) if (demand) { sifnpmode(f->unit, PPP_IP, NPMODE_QUEUE); } else { + sifnpmode(f->unit, PPP_IP, NPMODE_DROP); sifdown(f->unit); ipcp_clear_addrs(f->unit, ipcp_gotoptions[f->unit].ouraddr, ipcp_hisoptions[f->unit].hisaddr);