ccp->his_reject |= (1 << type); ccp->my_proto = -1;
ccp->his_reject |= (1 << opt->hdr.id); ccp->my_proto = -1;
CcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,                struct fsm_decode *dec){  /* Deal with incoming data */  struct ccp *ccp = fsm2ccp(fp);  int type, length, f;  const char *end;  if (mode_type == MODE_REQ)    ccp->in.algorithm = -1;	/* In case we've received two REQs in a row */  while (plen >= sizeof(struct fsmconfig)) {    type = *cp;    length = cp[1];    if (length == 0) {      log_Printf(LogCCP, "%s: CCP size zero\n", fp->link->name);      break;    }    if (length > sizeof(struct lcp_opt)) {      length = sizeof(struct lcp_opt);      log_Printf(LogCCP, "%s: Warning: Truncating length to %d\n",                fp->link->name, length);    }    for (f = NALGORITHMS-1; f > -1; f--)      if (algorithm[f]->id == type)        break;    end = f == -1 ? "" : (*algorithm[f]->Disp)((struct lcp_opt *)cp);    if (end == NULL)      end = "";    log_Printf(LogCCP, " %s[%d] %s\n", protoname(type), length, end);    if (f == -1) {      /* Don't understand that :-( */      if (mode_type == MODE_REQ) {        ccp->my_reject |= (1 << type);        memcpy(dec->rejend, cp, length);        dec->rejend += length;      }    } else {      struct ccp_opt *o;      switch (mode_type) {      case MODE_REQ:	if (IsAccepted(ccp->cfg.neg[algorithm[f]->Neg]) &&            (*algorithm[f]->Usable)(fp) &&            ccp->in.algorithm == -1) {	  memcpy(&ccp->in.opt, cp, length);          switch ((*algorithm[f]->i.Set)(&ccp->in.opt, &ccp->cfg)) {          case MODE_REJ:	    memcpy(dec->rejend, &ccp->in.opt, ccp->in.opt.len);	    dec->rejend += ccp->in.opt.len;            break;          case MODE_NAK:	    memcpy(dec->nakend, &ccp->in.opt, ccp->in.opt.len);	    dec->nakend += ccp->in.opt.len;            break;          case MODE_ACK:	    memcpy(dec->ackend, cp, length);	    dec->ackend += length;	    ccp->his_proto = type;            ccp->in.algorithm = f;		/* This one'll do :-) */            break;          }	} else {	  memcpy(dec->rejend, cp, length);	  dec->rejend += length;	}	break;      case MODE_NAK:        for (o = ccp->out.opt; o != NULL; o = o->next)          if (o->val.id == cp[0])            break;        if (o == NULL)          log_Printf(LogCCP, "%s: Warning: Ignoring peer NAK of unsent"                     " option\n", fp->link->name);        else {	  memcpy(&o->val, cp, length);          if ((*algorithm[f]->o.Set)(&o->val, &ccp->cfg) == MODE_ACK)            ccp->my_proto = algorithm[f]->id;          else {	    ccp->his_reject |= (1 << type);	    ccp->my_proto = -1;            if (algorithm[f]->Required(fp)) {              log_Printf(LogWARN, "%s: Cannot understand peers (required)"                         " %s negotiation\n", fp->link->name,                         protoname(algorithm[f]->id));              fsm_Close(&fp->link->lcp.fsm);            }          }        }        break;      case MODE_REJ:	ccp->his_reject |= (1 << type);	ccp->my_proto = -1;        if (algorithm[f]->Required(fp)) {          log_Printf(LogWARN, "%s: Peer rejected (required) %s negotiation\n",                     fp->link->name, protoname(algorithm[f]->id));          fsm_Close(&fp->link->lcp.fsm);        }	break;      }    }    plen -= cp[1];    cp += cp[1];  }  if (mode_type != MODE_NOP) {    if (dec->rejend != dec->rej) {      /* rejects are preferred */      dec->ackend = dec->ack;      dec->nakend = dec->nak;      if (ccp->in.state == NULL) {        ccp->his_proto = -1;        ccp->in.algorithm = -1;      }    } else if (dec->nakend != dec->nak) {      /* then NAKs */      dec->ackend = dec->ack;      if (ccp->in.state == NULL) {        ccp->his_proto = -1;        ccp->in.algorithm = -1;      }    }  }}