Example #1
0
static u_char *
IpcpBuildConfigReq(Fsm fp, u_char *cp)
{
    Bund 	b = (Bund)fp->arg;
    IpcpState	const ipcp = &b->ipcp;

    /* Put in my desired IP address */
    if (!IPCP_REJECTED(ipcp, TY_IPADDR) || ipcp->want_addr.s_addr == 0)
	cp = FsmConfValue(cp, TY_IPADDR, 4, &ipcp->want_addr.s_addr);

#ifdef USE_NG_VJC
    /* Put in my requested compression protocol */
    if (ipcp->want_comp.proto != 0 && !IPCP_REJECTED(ipcp, TY_COMPPROTO))
	cp = FsmConfValue(cp, TY_COMPPROTO, 4, &ipcp->want_comp);
#endif

  /* Request peer's DNS and NBNS servers */
  {
    const int	sopts[2][2] = { { IPCP_CONF_REQPRIDNS, IPCP_CONF_REQSECDNS },
				{ IPCP_CONF_REQPRINBNS, IPCP_CONF_REQSECNBNS }};
    const int	nopts[2][2] = { { TY_PRIMARYDNS, TY_SECONDARYDNS }, 
				{ TY_PRIMARYNBNS, TY_SECONDARYNBNS } };
    struct in_addr	*vals[2] = { ipcp->want_dns, ipcp->want_nbns };
    int			sopt, pri;

    for (sopt = 0; sopt < 2; sopt++) {
      for (pri = 0; pri < 2; pri++) {
	const int	opt = nopts[sopt][pri];

	/* Add option if we desire it and it hasn't been rejected */
	if (Enabled(&ipcp->conf.options, sopts[sopt][pri])
	    && !IPCP_REJECTED(ipcp, opt)) {
	  cp = FsmConfValue(cp, opt, 4, &vals[sopt][pri]);
	}
      }
    }
  }

/* Done */

  return(cp);
}
Example #2
0
static u_char *
Ipv6cpBuildConfigReq(Fsm fp, u_char *cp)
{
	Bund b = (Bund) fp->arg;
	Ipv6cpState const ipv6cp = &b->ipv6cp;

	cp = FsmConfValue(cp, TY_INTIDENT, 8, ipv6cp->myintid);

/* Done */

	return (cp);
}