More changes for CCP: additions for individiual link CCP.

This commit is contained in:
Michael Hipp 1998-03-25 13:13:40 +00:00
parent 1ac1d5592f
commit ba92453efb
6 changed files with 230 additions and 99 deletions

View File

@ -163,8 +163,13 @@ void link_terminated(int linkunit)
*/
void link_down(int unit)
{
if(link_lastlink(unit))
{
if(lns[unit].ccp_l_unit >= 0) {
(*ccp_link_protent.lowerdown)(lns[unit].ccp_l_unit);
(*ccp_link_protent.close)(lns[unit].ccp_l_unit,"link went down");
ccp_freeunit(lns[unit].ccp_l_unit);
lns[unit].ccp_l_unit = -1;
}
if(link_lastlink(unit)) {
if(lns[unit].ccp_unit >= 0) {
(*ccp_protent.lowerdown)(lns[unit].ccp_unit);
(*ccp_protent.close)(lns[unit].ccp_unit,"link went down");
@ -402,14 +407,27 @@ static void network_phase(int linkunit)
(*ipxcp_protent.lowerup)(lns[linkunit].ipxcp_unit);
(*ipxcp_protent.open)(lns[linkunit].ipxcp_unit);
}
if(ccp_link_protent.enabled_flag) {
syslog(LOG_NOTICE,"linkCCP enabled! Trying CCP.\n");
lns[linkunit].ccp_unit = ccp_getunit(linkunit,PPP_LINK_CCP);
(*ccp_link_protent.lowerup)(lns[linkunit].ccp_unit);
(*ccp_link_protent.open)(lns[linkunit].ccp_unit);
}
if(ccp_protent.enabled_flag) {
syslog(LOG_NOTICE,"CCP enabled! Trying CCP.\n");
lns[linkunit].ccp_unit = ccp_getunit(linkunit);
(*ccp_protent.lowerup)(lns[linkunit].ccp_unit);
(*ccp_protent.open)(lns[linkunit].ccp_unit);
syslog(LOG_NOTICE,"CCP enabled! Trying CCP.\n");
lns[linkunit].ccp_unit = ccp_getunit(linkunit,PPP_CCP);
(*ccp_protent.lowerup)(lns[linkunit].ccp_unit);
(*ccp_protent.open)(lns[linkunit].ccp_unit);
}
lns[linkunit].phase = PHASE_NETWORK;
}
if(ccp_link_protent.enabled_flag) {
syslog(LOG_NOTICE,"linkCCP enabled! Trying CCP.\n");
lns[linkunit].ccp_l_unit = ccp_getunit(linkunit,PPP_LINK_CCP);
(*ccp_link_protent.lowerup)(lns[linkunit].ccp_l_unit);
(*ccp_link_protent.open)(lns[linkunit].ccp_l_unit);
}
}
/*

View File

@ -51,11 +51,32 @@ static void ccp_close __P((int unit, char *));
static void ccp_lowerup __P((int unit));
static void ccp_lowerdown __P((int));
static void ccp_input __P((int unit, u_char *pkt, int len));
static void ccp_l_input __P((int unit, u_char *pkt, int len));
static void ccp_protrej __P((int unit));
static void ccp_l_protrej __P((int unit));
static int ccp_printpkt __P((u_char *pkt, int len,
void (*printer) __P((void *, char *, ...)),
void *arg));
static void ccp_datainput __P((int unit, u_char *pkt, int len));
static void ccp_l_datainput __P((int unit, u_char *pkt, int len));
struct protent ccp_link_protent = {
PPP_LINK_CCP,
ccp_init,
ccp_l_input,
ccp_l_protrej,
ccp_lowerup,
ccp_lowerdown,
ccp_open,
ccp_close,
ccp_printpkt,
ccp_l_datainput,
0, /* disabled */
"linkCCP",
NULL,
NULL,
NULL
};
struct protent ccp_protent = {
PPP_CCP,
@ -75,7 +96,6 @@ struct protent ccp_protent = {
NULL
};
fsm ccp_fsm[NUM_PPP];
ccp_options ccp_wantoptions[NUM_PPP]; /* what to request the peer to use */
ccp_options ccp_gotoptions[NUM_PPP]; /* what the peer agreed to do */
@ -140,10 +160,10 @@ static void ccp_init(int unit)
{
fsm *f = &ccp_fsm[unit];
memset(f,0,sizeof(fsm));
memset(f,0,sizeof(fsm));
f->unit = -1;
f->protocol = PPP_CCP;
f->protocol = PPP_CCP; /* we change this for link-CCP */
f->callbacks = &ccp_callbacks;
fsm_init(f);
@ -165,20 +185,25 @@ static void ccp_init(int unit)
ccp_allowoptions[unit].predictor_1 = 1;
}
int ccp_getunit(int linkunit)
int ccp_getunit(int linkunit,int protocol)
{
int i;
for(i=0;i<NUM_PPP;i++)
if(!ccp_fsm[i].inuse)
{
if(protocol != PPP_CCP && protocol != PPP_LINK_CCP)
return -1;
for(i=0;i<NUM_PPP;i++) {
if(!ccp_fsm[i].inuse) {
ccp_fsm[i].inuse = 1;
ccp_fsm[i].state = INITIAL;
ccp_fsm[i].flags = 0;
ccp_fsm[i].id = 0;
ccp_fsm[i].unit = linkunit;
syslog(LOG_NOTICE,"CCP: got ccp-unit %d for link %d",i,linkunit);
ccp_fsm[i].protocol = protocol;
syslog(LOG_NOTICE,"CCP: got ccp-unit %d for link %d (protocol: %#x)",i,linkunit,protocol);
return i;
}
}
syslog(LOG_ERR,"No more ccp_units available");
return -1;
}
@ -197,8 +222,8 @@ static void ccp_open(int unit)
{
fsm *f = &ccp_fsm[unit];
if (f->state != OPENED)
ccp_flags_set(unit, 1, 0);
if (f->state != OPENED)
ccp_flags_set(unit, 1, 0);
/*
* Find out which compressors the kernel supports before
@ -239,11 +264,10 @@ static void ccp_lowerdown(int unit)
/*
* ccp_input - process a received CCP packet.
*/
static void ccp_input(int linkunit,u_char *p,int len)
static void ccp_u_input(int unit,u_char *p,int len)
{
int unit = lns[linkunit].ccp_unit;
fsm *f = &ccp_fsm[unit];
fsm *f = &ccp_fsm[unit];
int oldstate;
/*
@ -262,11 +286,30 @@ static void ccp_input(int linkunit,u_char *p,int len)
ccp_close(unit,"No compression negotiated");
}
static void ccp_input(int linkunit,u_char *p,int len)
{
int unit = lns[linkunit].ccp_unit;
ccp_u_input(unit,p,len);
}
static void ccp_l_input(int linkunit,u_char *p,int len)
{
int unit = lns[linkunit].ccp_l_unit;
ccp_u_input(unit,p,len);
}
/*
* Handle a CCP-specific code.
*/
static int ccp_extcode(fsm *f,int code,int id,u_char *p,int len)
{
int unit;
if(f->protocol == PPP_CCP)
unit = lns[f->unit].ccp_unit;
else
unit = lns[f->unit].ccp_l_unit;
switch (code) {
case CCP_RESETREQ:
if (f->state != OPENED)
@ -277,8 +320,8 @@ static int ccp_extcode(fsm *f,int code,int id,u_char *p,int len)
break;
case CCP_RESETACK:
if (ccp_localstate[lns[f->unit].ccp_unit] & RACK_PENDING && id == f->reqid) {
ccp_localstate[lns[f->unit].ccp_unit] &= ~(RACK_PENDING | RREQ_REPEAT);
if (ccp_localstate[unit] & RACK_PENDING && id == f->reqid) {
ccp_localstate[unit] &= ~(RACK_PENDING | RREQ_REPEAT);
UNTIMEOUT(ccp_rack_timeout, (caddr_t) f);
}
break;
@ -293,6 +336,13 @@ static int ccp_extcode(fsm *f,int code,int id,u_char *p,int len)
/*
* ccp_protrej - peer doesn't talk CCP.
*/
static void ccp_l_protrej(int linkunit)
{
int unit = lns[linkunit].ccp_l_unit;
ccp_flags_set(unit, 0, 0);
fsm_lowerdown(&ccp_fsm[unit]);
}
static void ccp_protrej(int linkunit)
{
int unit = lns[linkunit].ccp_unit;
@ -305,12 +355,19 @@ static void ccp_protrej(int linkunit)
*/
static void ccp_resetci(fsm *f)
{
ccp_options *go = &ccp_gotoptions[lns[f->unit].ccp_unit];
ccp_options *go;
u_char opt_buf[16];
unsigned long protos[8] = {0,};
int i,j;
int i,j,unit;
ccp_get_compressors(lns[f->unit].ccp_unit,protos);
if(f->protocol == PPP_CCP)
unit = lns[f->unit].ccp_unit;
else
unit = lns[f->unit].ccp_l_unit;
go = &ccp_gotoptions[unit];
ccp_get_compressors(unit,protos);
syslog(LOG_NOTICE,"ccp_resetci!\n");
for(j=0;j<8;j++)
for(i=0;i<32;i++) {
@ -320,9 +377,9 @@ static void ccp_resetci(fsm *f)
}
/* copy config */
*go = ccp_wantoptions[lns[f->unit].ccp_unit];
*go = ccp_wantoptions[unit];
all_rejected[lns[f->unit].ccp_unit] = 0;
all_rejected[unit] = 0;
/*
* Check whether the kernel knows about the various
@ -332,7 +389,7 @@ static void ccp_resetci(fsm *f)
opt_buf[0] = CI_BSD_COMPRESS;
opt_buf[1] = CILEN_BSD_COMPRESS;
opt_buf[2] = BSD_MAKE_OPT(BSD_CURRENT_VERSION, BSD_MIN_BITS);
if (ccp_test(lns[f->unit].ccp_unit, opt_buf, CILEN_BSD_COMPRESS, 0) <= 0)
if (ccp_test(unit, opt_buf, CILEN_BSD_COMPRESS, 0) <= 0)
go->bsd_compress = 0;
}
if (go->deflate) {
@ -340,19 +397,19 @@ static void ccp_resetci(fsm *f)
opt_buf[1] = CILEN_DEFLATE;
opt_buf[2] = DEFLATE_MAKE_OPT(DEFLATE_MIN_SIZE);
opt_buf[3] = DEFLATE_CHK_SEQUENCE;
if (ccp_test(lns[f->unit].ccp_unit, opt_buf, CILEN_DEFLATE, 0) <= 0)
if (ccp_test(unit, opt_buf, CILEN_DEFLATE, 0) <= 0)
go->deflate = 0;
}
if (go->predictor_1) {
opt_buf[0] = CI_PREDICTOR_1;
opt_buf[1] = CILEN_PREDICTOR_1;
if (ccp_test(lns[f->unit].ccp_unit, opt_buf, CILEN_PREDICTOR_1, 0) <= 0)
if (ccp_test(unit, opt_buf, CILEN_PREDICTOR_1, 0) <= 0)
go->predictor_1 = 0;
}
if (go->predictor_2) {
opt_buf[0] = CI_PREDICTOR_2;
opt_buf[1] = CILEN_PREDICTOR_2;
if (ccp_test(lns[f->unit].ccp_unit, opt_buf, CILEN_PREDICTOR_2, 0) <= 0)
if (ccp_test(unit, opt_buf, CILEN_PREDICTOR_2, 0) <= 0)
go->predictor_2 = 0;
}
}
@ -362,7 +419,12 @@ static void ccp_resetci(fsm *f)
*/
static int ccp_cilen(fsm *f)
{
ccp_options *go = &ccp_gotoptions[lns[f->unit].ccp_unit];
ccp_options *go;
if(f->protocol == PPP_CCP)
go = &ccp_gotoptions[lns[f->unit].ccp_unit];
else
go = &ccp_gotoptions[lns[f->unit].ccp_l_unit];
return (go->bsd_compress? CILEN_BSD_COMPRESS: 0)
+ (go->deflate? CILEN_DEFLATE: 0)
@ -376,8 +438,16 @@ static int ccp_cilen(fsm *f)
static void ccp_addci(fsm *f,u_char *p,int *lenp)
{
int res;
ccp_options *go = &ccp_gotoptions[lns[f->unit].ccp_unit];
ccp_options *go;
u_char *p0 = p;
int unit;
if(f->protocol == PPP_CCP)
unit = lns[f->unit].ccp_unit;
else
unit = lns[f->unit].ccp_l_unit;
go = &ccp_gotoptions[unit];
/*
* Add the compression types that we can receive, in decreasing
@ -390,7 +460,7 @@ static void ccp_addci(fsm *f,u_char *p,int *lenp)
p[2] = DEFLATE_MAKE_OPT(go->deflate_size);
p[3] = DEFLATE_CHK_SEQUENCE;
for (;;) {
res = ccp_test(lns[f->unit].ccp_unit, p, CILEN_DEFLATE, 0);
res = ccp_test(unit, p, CILEN_DEFLATE, 0);
if (res > 0) {
p += CILEN_DEFLATE;
break;
@ -411,7 +481,7 @@ static void ccp_addci(fsm *f,u_char *p,int *lenp)
p += CILEN_BSD_COMPRESS; /* not the first option */
} else {
for (;;) {
res = ccp_test(lns[f->unit].ccp_unit, p, CILEN_BSD_COMPRESS, 0);
res = ccp_test(unit, p, CILEN_BSD_COMPRESS, 0);
if (res > 0) {
p += CILEN_BSD_COMPRESS;
break;
@ -429,7 +499,7 @@ static void ccp_addci(fsm *f,u_char *p,int *lenp)
if (go->predictor_1) {
p[0] = CI_PREDICTOR_1;
p[1] = CILEN_PREDICTOR_1;
if (p == p0 && ccp_test(lns[f->unit].ccp_unit, p, CILEN_PREDICTOR_1, 0) <= 0) {
if (p == p0 && ccp_test(unit, p, CILEN_PREDICTOR_1, 0) <= 0) {
go->predictor_1 = 0;
} else {
p += CILEN_PREDICTOR_1;
@ -438,7 +508,7 @@ static void ccp_addci(fsm *f,u_char *p,int *lenp)
if (go->predictor_2) {
p[0] = CI_PREDICTOR_2;
p[1] = CILEN_PREDICTOR_2;
if (p == p0 && ccp_test(lns[f->unit].ccp_unit, p, CILEN_PREDICTOR_2, 0) <= 0) {
if (p == p0 && ccp_test(unit, p, CILEN_PREDICTOR_2, 0) <= 0) {
go->predictor_2 = 0;
} else {
p += CILEN_PREDICTOR_2;
@ -456,8 +526,14 @@ static void ccp_addci(fsm *f,u_char *p,int *lenp)
*/
static int ccp_ackci(fsm *f,u_char *p,int len)
{
ccp_options *go = &ccp_gotoptions[lns[f->unit].ccp_unit];
ccp_options *go;
u_char *p0 = p;
if(f->protocol == PPP_CCP)
go = &ccp_gotoptions[lns[f->unit].ccp_unit];
else
go = &ccp_gotoptions[lns[f->unit].ccp_l_unit];
if (go->deflate) {
if (len < CILEN_DEFLATE
|| p[0] != CI_DEFLATE || p[1] != CILEN_DEFLATE
@ -512,10 +588,16 @@ static int ccp_ackci(fsm *f,u_char *p,int len)
*/
static int ccp_nakci(fsm *f,u_char *p,int len)
{
ccp_options *go = &ccp_gotoptions[lns[f->unit].ccp_unit];
ccp_options *go;
ccp_options no; /* options we've seen already */
ccp_options try; /* options to ask for next time */
if(f->protocol == PPP_CCP)
go = &ccp_gotoptions[lns[f->unit].ccp_unit];
else
go = &ccp_gotoptions[lns[f->unit].ccp_l_unit];
memset(&no, 0, sizeof(no));
try = *go;
@ -570,8 +652,16 @@ static int ccp_nakci(fsm *f,u_char *p,int len)
*/
static int ccp_rejci(fsm *f,u_char *p,int len)
{
ccp_options *go = &ccp_gotoptions[lns[f->unit].ccp_unit];
ccp_options *go;
ccp_options try; /* options to request next time */
int unit;
if(f->protocol == PPP_CCP)
unit = lns[f->unit].ccp_unit;
else
unit = lns[f->unit].ccp_l_unit;
go = &ccp_gotoptions[unit];
try = *go;
@ -579,7 +669,7 @@ static int ccp_rejci(fsm *f,u_char *p,int len)
* Cope with empty configure-rejects by ceasing to send
* configure-requests.
*/
if (len == 0 && all_rejected[lns[f->unit].ccp_unit])
if (len == 0 && all_rejected[unit])
return -1;
if (go->deflate && len >= CILEN_DEFLATE
@ -631,8 +721,16 @@ static int ccp_reqci(fsm *f,u_char *p,int *lenp,int dont_nak)
int ret, newret, res;
u_char *p0, *retp;
int len, clen, type, nb;
ccp_options *ho = &ccp_hisoptions[lns[f->unit].ccp_unit];
ccp_options *ao = &ccp_allowoptions[lns[f->unit].ccp_unit];
int unit;
ccp_options *ho,*ao;
if(f->protocol == PPP_CCP)
unit = lns[f->unit].ccp_unit;
else
unit = lns[f->unit].ccp_l_unit;
ho = &ccp_hisoptions[unit];
ao = &ccp_allowoptions[unit];
ret = CONFACK;
retp = p0 = p;
@ -742,7 +840,7 @@ static int ccp_reqci(fsm *f,u_char *p,int *lenp,int dont_nak)
}
ho->predictor_1 = 1;
if (p == p0 && ccp_test(lns[f->unit].ccp_unit, p, CILEN_PREDICTOR_1, 1) <= 0) {
if (p == p0 && ccp_test(unit, p, CILEN_PREDICTOR_1, 1) <= 0) {
newret = CONFREJ;
}
break;
@ -754,7 +852,7 @@ static int ccp_reqci(fsm *f,u_char *p,int *lenp,int dont_nak)
}
ho->predictor_2 = 1;
if (p == p0 && ccp_test(lns[f->unit].ccp_unit, p, CILEN_PREDICTOR_2, 1) <= 0) {
if (p == p0 && ccp_test(unit, p, CILEN_PREDICTOR_2, 1) <= 0) {
newret = CONFREJ;
}
break;
@ -782,7 +880,7 @@ static int ccp_reqci(fsm *f,u_char *p,int *lenp,int dont_nak)
if (ret != CONFACK) {
if (ret == CONFREJ && *lenp == retp - p0)
all_rejected[lns[f->unit].ccp_unit] = 1;
all_rejected[unit] = 1;
else
*lenp = retp - p0;
}
@ -828,11 +926,20 @@ static char *method_name(ccp_options *opt,ccp_options *opt2)
*/
static void ccp_up(fsm *f)
{
ccp_options *go = &ccp_gotoptions[lns[f->unit].ccp_unit];
ccp_options *ho = &ccp_hisoptions[lns[f->unit].ccp_unit];
char method1[64];
int unit;
ccp_options *go;
ccp_options *ho;
char method1[64];
if(f->protocol == PPP_CCP)
unit = lns[f->unit].ccp_unit;
else
unit = lns[f->unit].ccp_l_unit;
ccp_flags_set(lns[f->unit].ccp_unit, 1, 1);
go = &ccp_gotoptions[unit];
ho = &ccp_hisoptions[unit];
ccp_flags_set(unit, 1, 1);
if (ANY_COMPRESS(*go)) {
if (ANY_COMPRESS(*ho)) {
if (go->method == ho->method) {
@ -856,10 +963,17 @@ static void ccp_up(fsm *f)
*/
static void ccp_down(fsm *f)
{
if (ccp_localstate[lns[f->unit].ccp_unit] & RACK_PENDING)
int unit;
if(f->protocol == PPP_CCP)
unit = lns[f->unit].ccp_unit;
else
unit = lns[f->unit].ccp_l_unit;
if (ccp_localstate[unit] & RACK_PENDING)
UNTIMEOUT(ccp_rack_timeout, (caddr_t) f);
ccp_localstate[lns[f->unit].ccp_unit] = 0;
ccp_flags_set(lns[f->unit].ccp_unit, 1, 0);
ccp_localstate[unit] = 0;
ccp_flags_set(unit, 1, 0);
}
/*
@ -965,23 +1079,11 @@ static int ccp_printpkt(u_char *p,int plen,void (*printer)(void*,char*,...),void
}
/*
* We have received a packet that the decompressor failed to
* decompress. Here we would expect to issue a reset-request, but
* Motorola has a patent on resetting the compressor as a result of
* detecting an error in the decompressed data after decompression.
* (See US patent 5,130,993; international patent publication number
* WO 91/10289; Australian patent 73296/91.)
*
* So we ask the kernel whether the error was detected after
* decompression; if it was, we take CCP down, thus disabling
* compression :-(, otherwise we issue the reset-request.
*/
static void ccp_datainput(int linkunit,u_char *pkt,int len)
static void ccp_u_datainput(int unit,u_char *pkt,int len)
{
int unit = lns[linkunit].ccp_unit;
fsm *f;
fsm *f = &ccp_fsm[unit];
f = &ccp_fsm[unit];
if (f->state == OPENED) {
if (ccp_fatal_error(unit)) {
/*
@ -1005,18 +1107,36 @@ static void ccp_datainput(int linkunit,u_char *pkt,int len)
}
}
static void ccp_l_datainput(int linkunit,u_char *pkt,int len)
{
int unit = lns[linkunit].ccp_l_unit;
ccp_u_datainput(unit,pkt,len);
}
static void ccp_datainput(int linkunit,u_char *pkt,int len)
{
int unit = lns[linkunit].ccp_unit;
ccp_u_datainput(unit,pkt,len);
}
/*
* Timeout waiting for reset-ack.
*/
static void ccp_rack_timeout(caddr_t arg)
{
fsm *f = (fsm *) arg;
int unit;
if (f->state == OPENED && ccp_localstate[lns[f->unit].ccp_unit] & RREQ_REPEAT) {
if(f->protocol == PPP_CCP)
unit = lns[f->unit].ccp_unit;
else
unit = lns[f->unit].ccp_l_unit;
if (f->state == OPENED && ccp_localstate[unit] & RREQ_REPEAT) {
fsm_sdata(f, CCP_RESETREQ, f->reqid, NULL, 0);
TIMEOUT(ccp_rack_timeout, (caddr_t) f, RACKTIMEOUT);
ccp_localstate[lns[f->unit].ccp_unit] &= ~RREQ_REPEAT;
ccp_localstate[unit] &= ~RREQ_REPEAT;
} else
ccp_localstate[lns[f->unit].ccp_unit] &= ~RACK_PENDING;
ccp_localstate[unit] &= ~RACK_PENDING;
}

View File

@ -45,4 +45,5 @@ extern ccp_options ccp_allowoptions[];
extern ccp_options ccp_hisoptions[];
extern struct protent ccp_protent;
extern struct protent ccp_link_protent;

View File

@ -53,7 +53,7 @@ struct isdn_ppp_comp_data {
int num;
unsigned char options[ISDN_PPP_COMP_MAX_OPTIONS];
int optlen;
int xmit;
int flags;
};
#endif
@ -79,6 +79,7 @@ struct link_struct {
int lcp_unit;
int ipcp_unit;
int ccp_unit;
int ccp_l_unit;
int chap_unit;
int upap_unit;
int cbcp_unit;
@ -230,7 +231,7 @@ u_int32_t GetMask (u_int32_t); /* get netmask for address */
void die (int);
void check_access (FILE *, char *);
int ccp_getunit(int);
int ccp_getunit(int,int);
int ipcp_getunit(int);
int lcp_getunit(int);
void ccp_freeunit(int);

View File

@ -96,14 +96,14 @@ char *no_ppp_msg = "Sorry - this system lacks PPP kernel support.\n"
"Check whether you configured at least the ippp0 device!\n";
/* prototypes */
static void hup __P((int));
static void term __P((int));
static void chld __P((int));
static void toggle_debug __P((int));
static void open_ccp __P((int));
static void bad_signal __P((int));
static void get_input __P((int));
static void connect_time_expired __P((caddr_t));
static void hup(int);
static void term(int);
static void chld(int);
static void toggle_debug(int);
static void reload_param(int);
static void bad_signal(int);
static void get_input(int);
static void connect_time_expired(caddr_t);
static int init_unit(int);
static int exit_unit(int);
@ -131,6 +131,7 @@ struct protent *protocols[] = {
&cbcp_protent,
&ipcp_protent,
&ccp_protent,
&ccp_link_protent,
&ipxcp_protent,
NULL
};
@ -170,14 +171,11 @@ void main(int argc,char **argv)
lns[i].bundle_next = &lns[i];
lns[i].ifname[0] = 0;
lns[i].ifunit = -1;
#if 0
lns[i].open_ccp_flag = 0;
#endif
lns[i].phase = PHASE_WAIT;
lns[i].fd = -1;
lns[i].logged_in = 0;
lns[i].lcp_unit = lns[i].ipcp_unit = lns[i].ccp_unit = -1;
lns[i].cbcp_unit = -1;
lns[i].cbcp_unit = lns[i].ccp_l_unit = -1;
lns[i].ipxcp_unit = -1;
lns[i].unit = i;
lns[i].chap_unit = lns[i].upap_unit = -1;
@ -326,7 +324,7 @@ void main(int argc,char **argv)
SIGNAL(SIGCHLD, chld);
SIGNAL(SIGUSR1, toggle_debug); /* Toggle debug flag */
SIGNAL(SIGUSR2, open_ccp); /* Reopen CCP */
SIGNAL(SIGUSR2, reload_param); /* reload parameters */
/*
* Install a handler for other signals which would otherwise
@ -412,15 +410,6 @@ void main(int argc,char **argv)
}
get_input(i);
}
#if 0
if (lns[i].open_ccp_flag) { /* ugly: set by SIGUSR2 signal for all units */
if (lns[i].phase == PHASE_NETWORK) {
ccp_fsm[lns[i].ccp_unit].flags = OPT_RESTART; /* clears OPT_SILENT */
(*ccp_protent.open)(lns[i].ccp_unit);
}
lns[i].open_ccp_flag = 0;
}
#endif
}
reap_kids(); /* Don't leave dead kids lying around */
for(i=0;i<numdev;i++)
@ -885,12 +874,9 @@ static void toggle_debug(int sig)
/*
* open_ccp - Catch SIGUSR2 signal.
*
* Try to (re)negotiate compression on all links (ugly).
* reload param - Catch SIGUSR2 signal.
*/
/*ARGSUSED*/
static void open_ccp(int sig)
static void reload_param(int sig)
{
reload_config();
}

View File

@ -413,7 +413,12 @@ int ccp_test (int ccp_unit, u_char *opt_ptr, int opt_len, int for_transmit)
return -1;
}
memcpy(data.options,opt_ptr+2,data.optlen);
data.xmit = for_transmit;
data.flags = 0;
if(for_transmit)
data.flags |= IPPP_COMP_FLAG_XMIT;
if(ccp_fsm[ccp_unit].protocol == PPP_LINK_CCP)
data.flags |= IPPP_COMP_FLAG_LINK;
if (ioctl(lns[linkunit].fd, PPPIOCSCOMPRESSOR, (caddr_t) &data) >= 0)
return 1;