mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-02-21 09:39:58 +00:00
demand support is now a compile-time option
Obviously, it requires some wiring to know if there is new activity on a not-yet established PPP interface with the default route already set. I don't think any lwIP user will ever need that, all should know when to bring the link up and down.
This commit is contained in:
parent
ee5fca7a2b
commit
8b866beaeb
@ -199,8 +199,10 @@ struct protent ccp_protent = {
|
|||||||
ccp_option_list,
|
ccp_option_list,
|
||||||
NULL,
|
NULL,
|
||||||
#endif /* PPP_OPTIONS */
|
#endif /* PPP_OPTIONS */
|
||||||
|
#if DEMAND_SUPPORT
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
|
#endif /* DEMAND_SUPPORT */
|
||||||
};
|
};
|
||||||
|
|
||||||
fsm ccp_fsm[NUM_PPP];
|
fsm ccp_fsm[NUM_PPP];
|
||||||
|
@ -669,8 +669,10 @@ struct protent chap_protent = {
|
|||||||
chap_option_list,
|
chap_option_list,
|
||||||
NULL, /* check_options */
|
NULL, /* check_options */
|
||||||
#endif /* PPP_OPTIONS */
|
#endif /* PPP_OPTIONS */
|
||||||
|
#if DEMAND_SUPPORT
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
|
#endif /* DEMAND_SUPPORT */
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* PPP_SUPPORT && CHAP_SUPPORT */
|
#endif /* PPP_SUPPORT && CHAP_SUPPORT */
|
||||||
|
@ -29,8 +29,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "lwip/opt.h"
|
#include "lwip/opt.h"
|
||||||
|
#if PPP_SUPPORT && DEMAND_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
#define RCSID "$Id: demand.c,v 1.20 2005/08/25 12:14:18 paulus Exp $"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -466,3 +465,5 @@ active_packet(p, len)
|
|||||||
}
|
}
|
||||||
return 0; /* not a supported protocol !!?? */
|
return 0; /* not a supported protocol !!?? */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* PPP_SUPPORT && DEMAND_SUPPORT */
|
||||||
|
@ -122,8 +122,10 @@ struct protent eap_protent = {
|
|||||||
eap_option_list, /* list of command-line options */
|
eap_option_list, /* list of command-line options */
|
||||||
NULL, /* check requested options; assign defaults */
|
NULL, /* check requested options; assign defaults */
|
||||||
#endif /* PPP_OPTIONS */
|
#endif /* PPP_OPTIONS */
|
||||||
|
#if DEMAND_SUPPORT
|
||||||
NULL, /* configure interface for demand-dial */
|
NULL, /* configure interface for demand-dial */
|
||||||
NULL /* say whether to bring up link for this pkt */
|
NULL /* say whether to bring up link for this pkt */
|
||||||
|
#endif /* DEMAND_SUPPORT */
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef USE_SRP
|
#ifdef USE_SRP
|
||||||
|
@ -118,8 +118,10 @@ struct protent ecp_protent = {
|
|||||||
ecp_option_list,
|
ecp_option_list,
|
||||||
NULL,
|
NULL,
|
||||||
#endif /* PPP_OPTIONS */
|
#endif /* PPP_OPTIONS */
|
||||||
|
#if DEMAND_SUPPORT
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
|
#endif /* DEMAND_SUPPORT */
|
||||||
};
|
};
|
||||||
|
|
||||||
fsm ecp_fsm[NUM_PPP];
|
fsm ecp_fsm[NUM_PPP];
|
||||||
|
@ -259,8 +259,10 @@ static void ipcp_protrej __P((int));
|
|||||||
static int ipcp_printpkt __P((u_char *, int,
|
static int ipcp_printpkt __P((u_char *, int,
|
||||||
void (*) __P((void *, char *, ...)), void *));
|
void (*) __P((void *, char *, ...)), void *));
|
||||||
static void ip_check_options __P((void));
|
static void ip_check_options __P((void));
|
||||||
|
#if DEMAND_SUPPORT
|
||||||
static int ip_demand_conf __P((int));
|
static int ip_demand_conf __P((int));
|
||||||
static int ip_active_pkt __P((u_char *, int));
|
static int ip_active_pkt __P((u_char *, int));
|
||||||
|
#endif /* DEMAND_SUPPORT */
|
||||||
static void create_resolv __P((u_int32_t, u_int32_t));
|
static void create_resolv __P((u_int32_t, u_int32_t));
|
||||||
|
|
||||||
struct protent ipcp_protent = {
|
struct protent ipcp_protent = {
|
||||||
@ -281,8 +283,10 @@ struct protent ipcp_protent = {
|
|||||||
ipcp_option_list,
|
ipcp_option_list,
|
||||||
ip_check_options,
|
ip_check_options,
|
||||||
#endif /* PPP_OPTIONS */
|
#endif /* PPP_OPTIONS */
|
||||||
|
#if DEMAND_SUPPORT
|
||||||
ip_demand_conf,
|
ip_demand_conf,
|
||||||
ip_active_pkt
|
ip_active_pkt
|
||||||
|
#endif /* DEMAND_SUPPORT */
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t, bool));
|
static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t, bool));
|
||||||
@ -1724,6 +1728,7 @@ ip_check_options()
|
|||||||
}
|
}
|
||||||
#endif /* UNUSED */
|
#endif /* UNUSED */
|
||||||
|
|
||||||
|
#if DEMAND_SUPPORT
|
||||||
/*
|
/*
|
||||||
* ip_demand_conf - configure the interface as though
|
* ip_demand_conf - configure the interface as though
|
||||||
* IPCP were up, for use with dial-on-demand.
|
* IPCP were up, for use with dial-on-demand.
|
||||||
@ -1765,7 +1770,7 @@ ip_demand_conf(u)
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif /* DEMAND_SUPPORT */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ipcp_up - IPCP has come UP.
|
* ipcp_up - IPCP has come UP.
|
||||||
@ -1837,6 +1842,7 @@ ipcp_up(f)
|
|||||||
/* set tcp compression */
|
/* set tcp compression */
|
||||||
sifvjcomp(f->unit, ho->neg_vj, ho->cflag, ho->maxslotindex);
|
sifvjcomp(f->unit, ho->neg_vj, ho->cflag, ho->maxslotindex);
|
||||||
|
|
||||||
|
#if DEMAND_SUPPORT
|
||||||
/*
|
/*
|
||||||
* If we are doing dial-on-demand, the interface is already
|
* If we are doing dial-on-demand, the interface is already
|
||||||
* configured, so we put out any saved-up packets, then set the
|
* configured, so we put out any saved-up packets, then set the
|
||||||
@ -1883,7 +1889,9 @@ ipcp_up(f)
|
|||||||
demand_rexmit(PPP_IP,go->ouraddr);
|
demand_rexmit(PPP_IP,go->ouraddr);
|
||||||
sifnpmode(f->unit, PPP_IP, NPMODE_PASS);
|
sifnpmode(f->unit, PPP_IP, NPMODE_PASS);
|
||||||
|
|
||||||
} else {
|
} else
|
||||||
|
#endif /* DEMAND_SUPPORT */
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* Set IP addresses and (if specified) netmask.
|
* Set IP addresses and (if specified) netmask.
|
||||||
*/
|
*/
|
||||||
@ -1978,13 +1986,16 @@ ipcp_down(f)
|
|||||||
* because print_link_stats() sets link_stats_valid
|
* because print_link_stats() sets link_stats_valid
|
||||||
* to 0 (zero) */
|
* to 0 (zero) */
|
||||||
|
|
||||||
|
#if DEMAND_SUPPORT
|
||||||
/*
|
/*
|
||||||
* If we are doing dial-on-demand, set the interface
|
* If we are doing dial-on-demand, set the interface
|
||||||
* to queue up outgoing packets (for now).
|
* to queue up outgoing packets (for now).
|
||||||
*/
|
*/
|
||||||
if (demand) {
|
if (demand) {
|
||||||
sifnpmode(f->unit, PPP_IP, NPMODE_QUEUE);
|
sifnpmode(f->unit, PPP_IP, NPMODE_QUEUE);
|
||||||
} else {
|
} else
|
||||||
|
#endif /* DEMAND_SUPPORT */
|
||||||
|
{
|
||||||
sifnpmode(f->unit, PPP_IP, NPMODE_DROP);
|
sifnpmode(f->unit, PPP_IP, NPMODE_DROP);
|
||||||
sifdown(f->unit);
|
sifdown(f->unit);
|
||||||
ipcp_clear_addrs(f->unit, ipcp_gotoptions[f->unit].ouraddr,
|
ipcp_clear_addrs(f->unit, ipcp_gotoptions[f->unit].ouraddr,
|
||||||
@ -2188,6 +2199,7 @@ ipcp_printpkt(p, plen, printer, arg)
|
|||||||
#define TCP_HDRLEN 20
|
#define TCP_HDRLEN 20
|
||||||
#define TH_FIN 0x01
|
#define TH_FIN 0x01
|
||||||
|
|
||||||
|
#if DEMAND_SUPPORT
|
||||||
/*
|
/*
|
||||||
* We use these macros because the IP header may be at an odd address,
|
* We use these macros because the IP header may be at an odd address,
|
||||||
* and some compilers might use word loads to get th_off or ip_hl.
|
* and some compilers might use word loads to get th_off or ip_hl.
|
||||||
@ -2224,3 +2236,4 @@ ip_active_pkt(pkt, len)
|
|||||||
return 0;
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif /* DEMAND_SUPPORT */
|
||||||
|
@ -285,8 +285,10 @@ struct protent lcp_protent = {
|
|||||||
lcp_option_list,
|
lcp_option_list,
|
||||||
NULL,
|
NULL,
|
||||||
#endif /* PPP_OPTIONS */
|
#endif /* PPP_OPTIONS */
|
||||||
|
#if DEMAND_SUPPORT
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
|
#endif /* DEMAND_SUPPORT */
|
||||||
};
|
};
|
||||||
|
|
||||||
int lcp_loopbackfail = DEFLOOPBACKFAIL;
|
int lcp_loopbackfail = DEFLOOPBACKFAIL;
|
||||||
|
@ -102,7 +102,9 @@ int maxconnect = 0; /* Maximum connect time */
|
|||||||
//char passwd[MAXSECRETLEN]; /* Password for PAP */
|
//char passwd[MAXSECRETLEN]; /* Password for PAP */
|
||||||
bool persist = 0; /* Reopen link after it goes down */
|
bool persist = 0; /* Reopen link after it goes down */
|
||||||
char our_name[MAXNAMELEN]; /* Our name for authentication purposes */
|
char our_name[MAXNAMELEN]; /* Our name for authentication purposes */
|
||||||
|
#if DEMAND_SUPPORT
|
||||||
bool demand = 0; /* do dial-on-demand */
|
bool demand = 0; /* do dial-on-demand */
|
||||||
|
#endif /* DEMAND_SUPPORT */
|
||||||
char *ipparam = NULL; /* Extra parameter for ip up/down scripts */
|
char *ipparam = NULL; /* Extra parameter for ip up/down scripts */
|
||||||
int idle_time_limit = 0; /* Disconnect if idle for this many seconds */
|
int idle_time_limit = 0; /* Disconnect if idle for this many seconds */
|
||||||
int holdoff = 30; /* # seconds to pause before reconnecting */
|
int holdoff = 30; /* # seconds to pause before reconnecting */
|
||||||
|
@ -436,10 +436,12 @@ struct protent {
|
|||||||
/* Check requested options, assign defaults */
|
/* Check requested options, assign defaults */
|
||||||
void (*check_options) __P((void));
|
void (*check_options) __P((void));
|
||||||
#endif /* PPP_OPTIONS */
|
#endif /* PPP_OPTIONS */
|
||||||
|
#if DEMAND_SUPPORT
|
||||||
/* Configure interface for demand-dial */
|
/* Configure interface for demand-dial */
|
||||||
int (*demand_conf) __P((int unit));
|
int (*demand_conf) __P((int unit));
|
||||||
/* Say whether to bring up link for this pkt */
|
/* Say whether to bring up link for this pkt */
|
||||||
int (*active_pkt) __P((u_char *pkt, int len));
|
int (*active_pkt) __P((u_char *pkt, int len));
|
||||||
|
#endif /* DEMAND_SUPPORT */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Table of pointers to supported protocols */
|
/* Table of pointers to supported protocols */
|
||||||
|
@ -105,8 +105,10 @@ struct protent pap_protent = {
|
|||||||
pap_option_list,
|
pap_option_list,
|
||||||
NULL,
|
NULL,
|
||||||
#endif /* PPP_OPTIONS */
|
#endif /* PPP_OPTIONS */
|
||||||
|
#if DEMAND_SUPPORT
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
|
#endif /* DEMAND_SUPPORT */
|
||||||
};
|
};
|
||||||
|
|
||||||
upap_state upap[NUM_PPP]; /* UPAP state; one for each unit */
|
upap_state upap[NUM_PPP]; /* UPAP state; one for each unit */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user