* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#define RCSID "$Id: ipcp.c,v 1.62 2002/12/04 23:03:32 paulus Exp $"
+#define RCSID "$Id: ipcp.c,v 1.65 2004/01/13 03:59:06 paulus Exp $"
/*
* TODO:
static int proxy_arp_set[NUM_PPP]; /* Have created proxy arp entry */
static bool usepeerdns; /* Ask peer for DNS addrs */
static int ipcp_is_up; /* have called np_up() */
+static int ipcp_is_open; /* haven't called np_finished() */
static bool ask_for_local; /* request our address from peer */
static char vj_value[8]; /* string form of vj option value */
static char netmask_str[20]; /* string form of netmask value */
int unit;
{
fsm_open(&ipcp_fsm[unit]);
+ ipcp_is_open = 1;
}
* If they want to negotiate about IP addresses, we comply.
* If they want us to ask for compression, we refuse.
*/
- while (len > CILEN_VOID) {
+ while (len >= CILEN_VOID) {
GETCHAR(citype, p);
GETCHAR(cilen, p);
- if( (len -= cilen) < 0 )
+ if ( cilen < CILEN_VOID || (len -= cilen) < 0 )
goto bad;
next = p + cilen - 2;
script_setenv("IPLOCAL", ip_ntoa(go->ouraddr), 0);
script_setenv("IPREMOTE", ip_ntoa(ho->hisaddr), 1);
+ if (go->dnsaddr[0])
+ script_setenv("DNS1", ip_ntoa(go->dnsaddr[0]), 0);
+ if (go->dnsaddr[1])
+ script_setenv("DNS2", ip_ntoa(go->dnsaddr[1]), 0);
if (usepeerdns && (go->dnsaddr[0] || go->dnsaddr[1])) {
script_setenv("USEPEERDNS", "1", 0);
- if (go->dnsaddr[0])
- script_setenv("DNS1", ip_ntoa(go->dnsaddr[0]), 0);
- if (go->dnsaddr[1])
- script_setenv("DNS2", ip_ntoa(go->dnsaddr[1]), 0);
create_resolv(go->dnsaddr[0], go->dnsaddr[1]);
}
ipcp_finished(f)
fsm *f;
{
- np_finished(f->unit, PPP_IP);
+ if (ipcp_is_open) {
+ ipcp_is_open = 0;
+ np_finished(f->unit, PPP_IP);
+ }
}