Beispiel #1
0
int
CcpStat(Context ctx, int ac, char *av[], void *arg)
{
  CcpState	const ccp = &ctx->bund->ccp;
  char		buf[64];

  Printf("[%s] %s [%s]\r\n", Pref(&ccp->fsm), Fsm(&ccp->fsm), FsmStateName(ccp->fsm.state));
  Printf("Enabled protocols:\r\n");
  OptStat(ctx, &ccp->options, gConfList);

#ifdef CCP_MPPC
  MppcStat(ctx, ac, av, arg);
#endif
  Printf("Outgoing compression:\r\n");
  Printf("\tProto\t: %s (%s)\r\n", !ccp->xmit ? "none" : ccp->xmit->name,
    (ccp->xmit && ccp->xmit->Describe) ? (*ccp->xmit->Describe)(ctx->bund, COMP_DIR_XMIT, buf, sizeof(buf)) : "");
  if (ccp->xmit && ccp->xmit->Stat)
    ccp->xmit->Stat(ctx, COMP_DIR_XMIT);
  Printf("\tResets\t: %d\r\n", ccp->xmit_resets);

  Printf("Incoming decompression:\r\n");
  Printf("\tProto\t: %s (%s)\r\n", !ccp->recv ? "none" : ccp->recv->name,
    (ccp->recv && ccp->recv->Describe) ? (*ccp->recv->Describe)(ctx->bund, COMP_DIR_RECV, buf, sizeof(buf)) : "");
  if (ccp->recv && ccp->recv->Stat)
    ccp->recv->Stat(ctx, COMP_DIR_RECV);
  Printf("\tResets\t: %d\r\n", ccp->recv_resets);

  return(0);
}
Beispiel #2
0
int
NatStat(Context ctx, int ac, char *av[], void *arg)
{
    NatState	const nat = &ctx->bund->iface.nat;
    char	buf[48];
    int k;

    Printf("NAT configuration:\r\n");
    Printf("\tAlias addresses : %s\r\n", 
	u_addrtoa(&nat->alias_addr,buf,sizeof(buf)));
    Printf("\tTarget addresses: %s\r\n", 
	u_addrtoa(&nat->target_addr,buf,sizeof(buf)));
#ifdef NG_NAT_DESC_LENGTH
    Printf("Redirect ports:\r\n");
    for (k=0;k<NM_PORT;k++) {
      if (nat->nrpt_id[k]) {
	struct protoent	*proto;
	char	li[15], ai[15], ri[15];
	inet_ntop(AF_INET, &nat->nrpt[k].local_addr, li, sizeof(li));
	inet_ntop(AF_INET, &nat->nrpt[k].alias_addr, ai, sizeof(ai));
	inet_ntop(AF_INET, &nat->nrpt[k].remote_addr, ri, sizeof(ri));
	proto = getprotobynumber(nat->nrpt[k].proto);
	Printf("\t%s %s:%d %s:%d %s:%d\r\n", proto->p_name,
	    ai, nat->nrpt[k].alias_port, li, nat->nrpt[k].local_port,
	    ri, nat->nrpt[k].remote_port);
      }
    }
    Printf("Redirect address:\r\n");
    for (k=0;k<NM_ADDR;k++) {
      if (nat->nrad_id[k]) {
	char	li[15], ai[15];
	inet_ntop(AF_INET, &nat->nrad[k].local_addr, li, sizeof(li));
	inet_ntop(AF_INET, &nat->nrad[k].alias_addr, ai, sizeof(ai));
	Printf("\t%s %s\r\n", ai, li);
      }
    }
    Printf("Redirect proto:\r\n");
    for (k=0;k<NM_PROTO;k++) {
      if (nat->nrpr_id[k]) {
	struct protoent	*proto;
	char	li[15], ai[15], ri[15];
	proto = getprotobynumber(nat->nrpr[k].proto);
	inet_ntop(AF_INET, &nat->nrpr[k].local_addr, li, sizeof(li));
	inet_ntop(AF_INET, &nat->nrpr[k].alias_addr, ai, sizeof(ai));
	inet_ntop(AF_INET, &nat->nrpr[k].remote_addr, ri, sizeof(ri));
	Printf("\t%s %s %s %s\r\n", proto->p_name, ai, li, ri);
      }
    }
#endif
    Printf("NAT options:\r\n");
    OptStat(ctx, &nat->options, gConfList);
    return(0);
}
Beispiel #3
0
int
WebStat(Context ctx, int ac, char *av[], void *arg)
{
  Web		w = &gWeb;
  char		addrstr[64];

  Printf("Web configuration:\r\n");
  Printf("\tState         : %s\r\n", w->srv ? "OPENED" : "CLOSED");
  Printf("\tIP-Address    : %s\r\n", u_addrtoa(&w->addr,addrstr,sizeof(addrstr)));
  Printf("\tPort          : %d\r\n", w->port);

  Printf("Web options:\r\n");
  OptStat(ctx, &w->options, gConfList);

  return 0;
}
Beispiel #4
0
int
Ipv6cpStat(Context ctx, int ac, char *av[], void *arg)
{
	Ipv6cpState const ipv6cp = &ctx->bund->ipv6cp;
	Fsm fp = &ipv6cp->fsm;

	Printf("[%s] %s [%s]\r\n", Pref(fp), Fsm(fp), FsmStateName(fp->state));
	Printf("Interface identificators:\r\n");
	Printf("\tSelf: %02x%02x:%02x%02x:%02x%02x:%02x%02x\r\n",
	    ipv6cp->myintid[0], ipv6cp->myintid[1], ipv6cp->myintid[2], ipv6cp->myintid[3],
	    ipv6cp->myintid[4], ipv6cp->myintid[5], ipv6cp->myintid[6], ipv6cp->myintid[7]);
	Printf("\tPeer: %02x%02x:%02x%02x:%02x%02x:%02x%02x\r\n",
	    ipv6cp->hisintid[0], ipv6cp->hisintid[1], ipv6cp->hisintid[2], ipv6cp->hisintid[3],
	    ipv6cp->hisintid[4], ipv6cp->hisintid[5], ipv6cp->hisintid[6], ipv6cp->hisintid[7]);
	Printf("IPV6CP Options:\r\n");
	OptStat(ctx, &ipv6cp->conf.options, gConfList);

	return (0);
}
Beispiel #5
0
int
IpcpStat(Context ctx, int ac, char *av[], void *arg)
{
#ifdef USE_NG_VJC
  char			path[NG_PATHSIZ];
#endif
  IpcpState		const ipcp = &ctx->bund->ipcp;
  Fsm			fp = &ipcp->fsm;
#ifdef USE_NG_VJC
  union {
      u_char		buf[sizeof(struct ng_mesg) + sizeof(struct slcompress)];
      struct ng_mesg	reply;
  }			u;
  struct slcompress	*const sls = (struct slcompress *)(void *)u.reply.data;
#endif
  char			buf[48];

  Printf("[%s] %s [%s]\r\n", Pref(fp), Fsm(fp), FsmStateName(fp->state));
  Printf("Allowed IP address ranges:\r\n");
    if (ipcp->conf.self_ippool[0]) {
	Printf("\tPeer: ippool %s\r\n",
	  ipcp->conf.self_ippool);
    } else {
	Printf("\tSelf: %s\r\n",
	    u_rangetoa(&ipcp->conf.self_allow,buf,sizeof(buf)));
    }
    if (ipcp->conf.ippool[0]) {
	Printf("\tPeer: ippool %s\r\n",
	  ipcp->conf.ippool);
    } else {
	Printf("\tPeer: %s\r\n",
	  u_rangetoa(&ipcp->conf.peer_allow,buf,sizeof(buf)));
    }
  Printf("IPCP Options:\r\n");
  OptStat(ctx, &ipcp->conf.options, gConfList);
  Printf("Current addressing:\r\n");
  Printf("\tSelf: %s\r\n", inet_ntoa(ipcp->want_addr));
  Printf("\tPeer: %s\r\n", inet_ntoa(ipcp->peer_addr));
#ifdef USE_NG_VJC
  Printf("Compression:\r\n");
  Printf("\tSelf: ");
  if (ipcp->want_comp.proto != 0)
    Printf("%s, %d compression channels, CID %scompressible\r\n",
      ProtoName(ntohs(ipcp->want_comp.proto)),
      ipcp->want_comp.maxchan + 1, ipcp->want_comp.compcid ? "" : "not ");
  else
    Printf("None\r\n");
  Printf("\tPeer: ");
  if (ipcp->peer_comp.proto != 0)
    Printf("%s, %d compression channels, CID %scompressible\n",
      ProtoName(ntohs(ipcp->peer_comp.proto)),
      ipcp->peer_comp.maxchan + 1, ipcp->peer_comp.compcid ? "" : "not ");
  else
    Printf("None\r\n");
#endif /* USE_NG_VJC */
  Printf("Server info we give to peer:\r\n");
  Printf("DNS servers : %15s", inet_ntoa(ipcp->conf.peer_dns[0]));
  Printf("  %15s\r\n", inet_ntoa(ipcp->conf.peer_dns[1]));
  Printf("NBNS servers: %15s", inet_ntoa(ipcp->conf.peer_nbns[0]));
  Printf("  %15s\r\n", inet_ntoa(ipcp->conf.peer_nbns[1]));
  Printf("Server info peer gave to us:\r\n");
  Printf("DNS servers : %15s", inet_ntoa(ipcp->want_dns[0]));
  Printf("  %15s\r\n", inet_ntoa(ipcp->want_dns[1]));
  Printf("NBNS servers: %15s", inet_ntoa(ipcp->want_nbns[0]));
  Printf("  %15s\r\n", inet_ntoa(ipcp->want_nbns[1]));

#ifdef USE_NG_VJC
  /* Get VJC state */
  snprintf(path, sizeof(path), "mpd%d-%s:%s", gPid, ctx->bund->name, NG_PPP_HOOK_VJC_IP);
  if (NgFuncSendQuery(path, NGM_VJC_COOKIE, NGM_VJC_GET_STATE,
      NULL, 0, &u.reply, sizeof(u), NULL) < 0)
    return(0);

  Printf("VJ Compression:\r\n");
  Printf("\tOut comp : %d\r\n", sls->sls_compressed);
  Printf("\tOut total: %d\r\n", sls->sls_packets);
  Printf("\tMissed   : %d\r\n", sls->sls_misses);
  Printf("\tSearched : %d\r\n", sls->sls_searches);
  Printf("\tIn comp  : %d\r\n", sls->sls_compressedin);
  Printf("\tIn uncomp: %d\r\n", sls->sls_uncompressedin);
  Printf("\tIn error : %d\r\n", sls->sls_errorin);
  Printf("\tIn tossed: %d\r\n", sls->sls_tossed);
#endif /* USE_NG_VJC */
  return(0);
}