mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-05 12:56:08 +00:00
o Split the two IPCP queues into three - one for FSM data
(LCP/CCP/IPCP), one for urgent IP traffic and one for everything else. o Add the ``set urgent'' command for adjusting the list of urgent port numbers. The default urgent ports are 21, 22, 23, 513, 514, 543 and 544 (Ports 80 and 81 have been removed from the default priority list). o Increase the buffered packet threshold from 20 to 30. o Report the number of packets in the IP output queue and the list of urgent ports under ``show ipcp''.
This commit is contained in:
parent
20d6e5fe6e
commit
442f849547
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=50867
@ -411,7 +411,7 @@ bundle_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n)
|
||||
if (r && (bundle->phase == PHASE_NETWORK ||
|
||||
bundle->phys_type.all & PHYS_AUTO)) {
|
||||
/* enough surplus so that we can tell if we're getting swamped */
|
||||
if (queued < 20) {
|
||||
if (queued < 30) {
|
||||
/* Not enough - select() for more */
|
||||
if (bundle->choked.timer.state == TIMER_RUNNING)
|
||||
timer_Stop(&bundle->choked.timer); /* Not needed any more */
|
||||
@ -789,6 +789,8 @@ bundle_Destroy(struct bundle *bundle)
|
||||
while (dl)
|
||||
dl = datalink_Destroy(dl);
|
||||
|
||||
ipcp_Destroy(&bundle->ncp.ipcp);
|
||||
|
||||
close(bundle->dev.fd);
|
||||
bundle_UnlockTun(bundle);
|
||||
|
||||
|
@ -203,7 +203,7 @@ cbcp_Output(struct cbcp *cbcp, u_char code, struct cbcp_data *data)
|
||||
memcpy(MBUF_CTOP(bp) + sizeof *head, data, data->length);
|
||||
log_DumpBp(LogDEBUG, "cbcp_Output", bp);
|
||||
link_PushPacket(&cbcp->p->link, bp, cbcp->p->dl->bundle,
|
||||
PRI_LINK, PROTO_CBCP);
|
||||
LINK_QUEUES(&cbcp->p->link) - 1, PROTO_CBCP);
|
||||
}
|
||||
|
||||
static const char *
|
||||
|
@ -104,7 +104,7 @@ ChapOutput(struct physical *physical, u_int code, u_int id,
|
||||
else
|
||||
log_Printf(LogPHASE, "Chap Output: %s (%s)\n", chapcodes[code], text);
|
||||
link_PushPacket(&physical->link, bp, physical->dl->bundle,
|
||||
PRI_LINK, PROTO_CHAP);
|
||||
LINK_QUEUES(&physical->link) - 1, PROTO_CHAP);
|
||||
}
|
||||
|
||||
static char *
|
||||
|
@ -122,6 +122,7 @@
|
||||
#define VAR_CD 30
|
||||
#define VAR_PARITY 31
|
||||
#define VAR_CRTSCTS 32
|
||||
#define VAR_URGENTPORTS 33
|
||||
|
||||
/* ``accept|deny|disable|enable'' masks */
|
||||
#define NEG_HISMASK (1)
|
||||
@ -1375,7 +1376,7 @@ static int
|
||||
SetVariable(struct cmdargs const *arg)
|
||||
{
|
||||
long long_val, param = (long)arg->cmd->args;
|
||||
int mode, dummyint;
|
||||
int mode, dummyint, f;
|
||||
const char *argp;
|
||||
struct datalink *cx = arg->cx; /* LOCAL_CX uses this */
|
||||
const char *err = NULL;
|
||||
@ -1787,6 +1788,21 @@ SetVariable(struct cmdargs const *arg)
|
||||
log_Printf(LogWARN, err);
|
||||
}
|
||||
break;
|
||||
|
||||
case VAR_URGENTPORTS:
|
||||
if (arg->argn == arg->argc)
|
||||
ipcp_ClearUrgentPorts(&arg->bundle->ncp.ipcp);
|
||||
else for (f = arg->argn; f < arg->argc; f++)
|
||||
if (*arg->argv[f] == '+')
|
||||
ipcp_AddUrgentPort(&arg->bundle->ncp.ipcp, atoi(arg->argv[f] + 1));
|
||||
else if (*arg->argv[f] == '-')
|
||||
ipcp_RemoveUrgentPort(&arg->bundle->ncp.ipcp, atoi(arg->argv[f] + 1));
|
||||
else {
|
||||
if (f == arg->argn)
|
||||
ipcp_ClearUrgentPorts(&arg->bundle->ncp.ipcp);
|
||||
ipcp_AddUrgentPort(&arg->bundle->ncp.ipcp, atoi(arg->argv[f]));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return err ? 1 : 0;
|
||||
@ -1802,6 +1818,8 @@ static struct cmdtab const SetCommands[] = {
|
||||
{"autoload", NULL, SetVariable, LOCAL_AUTH,
|
||||
"auto link [de]activation", "set autoload maxtime maxload mintime minload",
|
||||
(const void *)VAR_AUTOLOAD},
|
||||
{"bandwidth", NULL, mp_SetDatalinkBandwidth, LOCAL_AUTH | LOCAL_CX,
|
||||
"datalink bandwidth", "set bandwidth value"},
|
||||
{"callback", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX,
|
||||
"callback control", "set callback [none|auth|cbcp|"
|
||||
"E.164 *|number[,number]...]...", (const void *)VAR_CALLBACK},
|
||||
@ -1893,10 +1911,10 @@ static struct cmdtab const SetCommands[] = {
|
||||
"STOPPED timeouts", "set stopped [LCPseconds [CCPseconds]]"},
|
||||
{"timeout", NULL, SetVariable, LOCAL_AUTH, "Idle timeout",
|
||||
"set timeout idletime", (const void *)VAR_IDLETIMEOUT},
|
||||
{"urgent", NULL, SetVariable, LOCAL_AUTH,
|
||||
"urgent ports", "set urgent [+|-]port...", (const void *)VAR_URGENTPORTS},
|
||||
{"vj", NULL, ipcp_vjset, LOCAL_AUTH,
|
||||
"vj values", "set vj slots|slotcomp [value]"},
|
||||
{"bandwidth", NULL, mp_SetDatalinkBandwidth, LOCAL_AUTH | LOCAL_CX,
|
||||
"datalink bandwidth", "set bandwidth value"},
|
||||
{"help", "?", HelpCommand, LOCAL_AUTH | LOCAL_NO_AUTH,
|
||||
"Display this message", "set help|? [command]", SetCommands},
|
||||
{NULL, NULL, NULL},
|
||||
|
@ -206,7 +206,8 @@ fsm_Output(struct fsm *fp, u_int code, u_int id, u_char *ptr, int count,
|
||||
if (count)
|
||||
memcpy(MBUF_CTOP(bp) + sizeof(struct fsmheader), ptr, count);
|
||||
log_DumpBp(LogDEBUG, "fsm_Output", bp);
|
||||
link_PushPacket(fp->link, bp, fp->bundle, PRI_LINK, fp->proto);
|
||||
link_PushPacket(fp->link, bp, fp->bundle, LINK_QUEUES(fp->link) - 1,
|
||||
fp->proto);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -941,9 +942,9 @@ FsmRecvResetReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
|
||||
{
|
||||
(*fp->fn->RecvResetReq)(fp);
|
||||
/*
|
||||
* All sendable compressed packets are queued in the PRI_NORMAL modem
|
||||
* output queue.... dump 'em to the priority queue so that they arrive
|
||||
* at the peer before our ResetAck.
|
||||
* All sendable compressed packets are queued in the first (lowest
|
||||
* priority) modem output queue.... dump 'em to the priority queue
|
||||
* so that they arrive at the peer before our ResetAck.
|
||||
*/
|
||||
link_SequenceQueue(fp->link);
|
||||
fsm_Output(fp, CODE_RESETACK, lhp->id, NULL, 0, MB_CCPOUT);
|
||||
|
@ -43,19 +43,6 @@
|
||||
#define MAX_MTU 2048
|
||||
#define MIN_MTU 296
|
||||
|
||||
/*
|
||||
* Output priority
|
||||
*/
|
||||
/* PRI_NORMAL and PRI_FAST have meaning only on the IP queue.
|
||||
* All IP frames have the same priority once they are compressed.
|
||||
* IP frames stay on the IP queue till they can be sent on the
|
||||
* link. They are compressed at that time.
|
||||
*/
|
||||
#define PRI_NORMAL 0 /* Normal priority */
|
||||
#define PRI_FAST 1 /* Fast (interractive) */
|
||||
#define PRI_LINK 1 /* Urgent (LQR packets) */
|
||||
#define PRI_MAX 1
|
||||
|
||||
struct physical;
|
||||
struct link;
|
||||
struct lcp;
|
||||
|
@ -68,13 +68,6 @@
|
||||
#include "tun.h"
|
||||
#include "ip.h"
|
||||
|
||||
static const u_short interactive_ports[32] = {
|
||||
544, 513, 514, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
80, 81, 0, 0, 0, 21, 22, 23, 0, 0, 0, 0, 0, 0, 0, 543,
|
||||
};
|
||||
|
||||
#define INTERACTIVE(p) (interactive_ports[(p) & 0x1F] == (p))
|
||||
|
||||
static const char *TcpFlags[] = { "FIN", "SYN", "RST", "PSH", "ACK", "URG" };
|
||||
|
||||
static __inline int
|
||||
@ -319,7 +312,7 @@ PacketCheck(struct bundle *bundle, char *cp, int nb, struct filter *filter)
|
||||
struct icmp *icmph;
|
||||
char *ptop;
|
||||
int mask, len, n;
|
||||
int pri = PRI_NORMAL;
|
||||
int pri = 0;
|
||||
int logit, loglen;
|
||||
char logbuf[200];
|
||||
|
||||
@ -394,11 +387,12 @@ PacketCheck(struct bundle *bundle, char *cp, int nb, struct filter *filter)
|
||||
case IPPROTO_TCP:
|
||||
th = (struct tcphdr *) ptop;
|
||||
if (pip->ip_tos == IPTOS_LOWDELAY)
|
||||
pri = PRI_FAST;
|
||||
else if ((ntohs(pip->ip_off) & IP_OFFMASK) == 0) {
|
||||
if (INTERACTIVE(ntohs(th->th_sport)) || INTERACTIVE(ntohs(th->th_dport)))
|
||||
pri = PRI_FAST;
|
||||
}
|
||||
pri++;
|
||||
else if ((ntohs(pip->ip_off) & IP_OFFMASK) == 0 &&
|
||||
ipcp_IsUrgentPort(&bundle->ncp.ipcp, ntohs(th->th_sport),
|
||||
ntohs(th->th_dport)))
|
||||
pri++;
|
||||
|
||||
if (logit && loglen < sizeof logbuf) {
|
||||
len = ntohs(pip->ip_len) - (pip->ip_hl << 2) - (th->th_off << 2);
|
||||
snprintf(logbuf + loglen, sizeof logbuf - loglen,
|
||||
@ -505,7 +499,7 @@ ip_Enqueue(struct ipcp *ipcp, int pri, char *ptr, int count)
|
||||
{
|
||||
struct mbuf *bp;
|
||||
|
||||
if (pri < 0 || pri > sizeof ipcp->Queue / sizeof ipcp->Queue[0])
|
||||
if (pri < 0 || pri >= IPCP_QUEUES(ipcp))
|
||||
log_Printf(LogERROR, "Can't store in ip queue %d\n", pri);
|
||||
else {
|
||||
/*
|
||||
@ -518,7 +512,7 @@ ip_Enqueue(struct ipcp *ipcp, int pri, char *ptr, int count)
|
||||
bp->offset += 4;
|
||||
bp->cnt -= 6;
|
||||
memcpy(MBUF_CTOP(bp), ptr, count);
|
||||
mbuf_Enqueue(&ipcp->Queue[pri], bp);
|
||||
mbuf_Enqueue(ipcp->Queue + pri, bp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -527,7 +521,7 @@ ip_DeleteQueue(struct ipcp *ipcp)
|
||||
{
|
||||
struct mqueue *queue;
|
||||
|
||||
for (queue = ipcp->Queue; queue < ipcp->Queue + PRI_MAX; queue++)
|
||||
for (queue = ipcp->Queue; queue < ipcp->Queue + IPCP_QUEUES(ipcp); queue++)
|
||||
while (queue->top)
|
||||
mbuf_Free(mbuf_Dequeue(queue));
|
||||
}
|
||||
@ -538,7 +532,7 @@ ip_QueueLen(struct ipcp *ipcp)
|
||||
struct mqueue *queue;
|
||||
int result = 0;
|
||||
|
||||
for (queue = ipcp->Queue; queue < ipcp->Queue + PRI_MAX; queue++)
|
||||
for (queue = ipcp->Queue; queue < ipcp->Queue + IPCP_QUEUES(ipcp); queue++)
|
||||
result += queue->qlen;
|
||||
|
||||
return result;
|
||||
@ -556,17 +550,19 @@ ip_PushPacket(struct link *l, struct bundle *bundle)
|
||||
if (ipcp->fsm.state != ST_OPENED)
|
||||
return 0;
|
||||
|
||||
for (queue = &ipcp->Queue[PRI_FAST]; queue >= ipcp->Queue; queue--)
|
||||
queue = ipcp->Queue + IPCP_QUEUES(ipcp) - 1;
|
||||
do {
|
||||
if (queue->top) {
|
||||
bp = mbuf_Contiguous(mbuf_Dequeue(queue));
|
||||
cnt = mbuf_Length(bp);
|
||||
pip = (struct ip *)MBUF_CTOP(bp);
|
||||
if (!FilterCheck(pip, &bundle->filter.alive))
|
||||
bundle_StartIdleTimer(bundle);
|
||||
link_PushPacket(l, bp, bundle, PRI_NORMAL, PROTO_IP);
|
||||
link_PushPacket(l, bp, bundle, 0, PROTO_IP);
|
||||
ipcp_AddOutOctets(ipcp, cnt);
|
||||
return 1;
|
||||
}
|
||||
} while (queue-- != ipcp->Queue);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -82,12 +82,96 @@
|
||||
#include "prompt.h"
|
||||
#include "route.h"
|
||||
#include "iface.h"
|
||||
#include "ip.h"
|
||||
|
||||
#undef REJECTED
|
||||
#define REJECTED(p, x) ((p)->peer_reject & (1<<(x)))
|
||||
#define issep(ch) ((ch) == ' ' || (ch) == '\t')
|
||||
#define isip(ch) (((ch) >= '0' && (ch) <= '9') || (ch) == '.')
|
||||
|
||||
static u_short default_urgent_ports[] = {
|
||||
21, /* ftp */
|
||||
22, /* ssh */
|
||||
23, /* telnet */
|
||||
513, /* login */
|
||||
514, /* shell */
|
||||
543, /* klogin */
|
||||
544 /* kshell */
|
||||
};
|
||||
|
||||
#define NDEFPORTS (sizeof default_urgent_ports / sizeof default_urgent_ports[0])
|
||||
|
||||
int
|
||||
ipcp_IsUrgentPort(struct ipcp *ipcp, u_short src, u_short dst)
|
||||
{
|
||||
int f;
|
||||
|
||||
for (f = 0; f < ipcp->cfg.urgent.nports; f++)
|
||||
if (ipcp->cfg.urgent.port[f] == src || ipcp->cfg.urgent.port[f] == dst)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
ipcp_AddUrgentPort(struct ipcp *ipcp, u_short port)
|
||||
{
|
||||
u_short *newport;
|
||||
int p;
|
||||
|
||||
if (ipcp->cfg.urgent.nports == ipcp->cfg.urgent.maxports) {
|
||||
ipcp->cfg.urgent.maxports += 10;
|
||||
newport = (u_short *)realloc(ipcp->cfg.urgent.port,
|
||||
ipcp->cfg.urgent.maxports * sizeof(u_short));
|
||||
if (newport == NULL) {
|
||||
log_Printf(LogERROR, "ipcp_AddUrgentPort: realloc: %s\n",
|
||||
strerror(errno));
|
||||
ipcp->cfg.urgent.maxports -= 10;
|
||||
return;
|
||||
}
|
||||
ipcp->cfg.urgent.port = newport;
|
||||
}
|
||||
|
||||
for (p = 0; p < ipcp->cfg.urgent.nports; p++)
|
||||
if (ipcp->cfg.urgent.port[p] == port) {
|
||||
log_Printf(LogWARN, "%u: Port already set to urgent\n", port);
|
||||
break;
|
||||
} else if (ipcp->cfg.urgent.port[p] > port) {
|
||||
memmove(ipcp->cfg.urgent.port + p + 1, ipcp->cfg.urgent.port + p,
|
||||
(ipcp->cfg.urgent.nports - p) * sizeof(u_short));
|
||||
ipcp->cfg.urgent.port[p] = port;
|
||||
ipcp->cfg.urgent.nports++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (p == ipcp->cfg.urgent.nports)
|
||||
ipcp->cfg.urgent.port[ipcp->cfg.urgent.nports++] = port;
|
||||
}
|
||||
|
||||
void
|
||||
ipcp_RemoveUrgentPort(struct ipcp *ipcp, u_short port)
|
||||
{
|
||||
int p;
|
||||
|
||||
for (p = 0; p < ipcp->cfg.urgent.nports; p++)
|
||||
if (ipcp->cfg.urgent.port[p] == port) {
|
||||
if (p != ipcp->cfg.urgent.nports - 1)
|
||||
memmove(ipcp->cfg.urgent.port + p, ipcp->cfg.urgent.port + p + 1,
|
||||
(ipcp->cfg.urgent.nports - p - 1) * sizeof(u_short));
|
||||
ipcp->cfg.urgent.nports--;
|
||||
return;
|
||||
}
|
||||
|
||||
if (p == ipcp->cfg.urgent.nports)
|
||||
log_Printf(LogWARN, "%u: Port not set to urgent\n", port);
|
||||
}
|
||||
|
||||
void
|
||||
ipcp_ClearUrgentPorts(struct ipcp *ipcp)
|
||||
{
|
||||
ipcp->cfg.urgent.nports = 0;
|
||||
}
|
||||
|
||||
struct compreq {
|
||||
u_short proto;
|
||||
u_char slots;
|
||||
@ -268,6 +352,7 @@ int
|
||||
ipcp_Show(struct cmdargs const *arg)
|
||||
{
|
||||
struct ipcp *ipcp = &arg->bundle->ncp.ipcp;
|
||||
int p;
|
||||
|
||||
prompt_Printf(arg->prompt, "%s [%s]\n", ipcp->fsm.name,
|
||||
State2Nam(ipcp->fsm.state));
|
||||
@ -276,6 +361,7 @@ ipcp_Show(struct cmdargs const *arg)
|
||||
inet_ntoa(ipcp->peer_ip), vj2asc(ipcp->peer_compproto));
|
||||
prompt_Printf(arg->prompt, " My side: %s, %s\n",
|
||||
inet_ntoa(ipcp->my_ip), vj2asc(ipcp->my_compproto));
|
||||
prompt_Printf(arg->prompt, " Queued packets: %d\n", ip_QueueLen(ipcp));
|
||||
}
|
||||
|
||||
if (ipcp->route) {
|
||||
@ -315,7 +401,17 @@ ipcp_Show(struct cmdargs const *arg)
|
||||
inet_ntoa(ipcp->cfg.ns.nbns[0]));
|
||||
prompt_Printf(arg->prompt, "%s\n", inet_ntoa(ipcp->cfg.ns.nbns[1]));
|
||||
|
||||
prompt_Printf(arg->prompt, "\n");
|
||||
prompt_Printf(arg->prompt, " Urgent ports: ");
|
||||
if (ipcp->cfg.urgent.nports == 0)
|
||||
prompt_Printf(arg->prompt, "none");
|
||||
else
|
||||
for (p = 0; p < ipcp->cfg.urgent.nports; p++) {
|
||||
if (p)
|
||||
prompt_Printf(arg->prompt, ", ");
|
||||
prompt_Printf(arg->prompt, "%u", ipcp->cfg.urgent.port[p]);
|
||||
}
|
||||
|
||||
prompt_Printf(arg->prompt, "\n\n");
|
||||
throughput_disp(&ipcp->throughput, arg->prompt);
|
||||
|
||||
return 0;
|
||||
@ -378,6 +474,11 @@ ipcp_Init(struct ipcp *ipcp, struct bundle *bundle, struct link *l,
|
||||
ipcp->cfg.ns.nbns[0].s_addr = INADDR_ANY;
|
||||
ipcp->cfg.ns.nbns[1].s_addr = INADDR_ANY;
|
||||
|
||||
ipcp->cfg.urgent.nports = ipcp->cfg.urgent.maxports = NDEFPORTS;
|
||||
ipcp->cfg.urgent.port = (u_short *)malloc(NDEFPORTS * sizeof(u_short));
|
||||
memcpy(ipcp->cfg.urgent.port, default_urgent_ports,
|
||||
NDEFPORTS * sizeof(u_short));
|
||||
|
||||
ipcp->cfg.fsm.timeout = DEF_FSMRETRY;
|
||||
ipcp->cfg.fsm.maxreq = DEF_FSMTRIES;
|
||||
ipcp->cfg.fsm.maxtrm = DEF_FSMTRIES;
|
||||
@ -390,6 +491,16 @@ ipcp_Init(struct ipcp *ipcp, struct bundle *bundle, struct link *l,
|
||||
ipcp_Setup(ipcp, INADDR_NONE);
|
||||
}
|
||||
|
||||
void
|
||||
ipcp_Destroy(struct ipcp *ipcp)
|
||||
{
|
||||
if (ipcp->cfg.urgent.maxports) {
|
||||
ipcp->cfg.urgent.nports = ipcp->cfg.urgent.maxports = 0;
|
||||
free(ipcp->cfg.urgent.port);
|
||||
ipcp->cfg.urgent.port = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ipcp_SetLink(struct ipcp *ipcp, struct link *l)
|
||||
{
|
||||
|
@ -69,6 +69,12 @@ struct ipcp {
|
||||
struct in_addr nbns[2]; /* NetBIOS NS addresses offered */
|
||||
} ns;
|
||||
|
||||
struct {
|
||||
unsigned nports; /* How many urgent ports */
|
||||
unsigned maxports; /* How many allocated urgent ports */
|
||||
u_short *port; /* The urgent ports */
|
||||
} urgent;
|
||||
|
||||
struct fsm_retry fsm; /* How often/frequently to resend requests */
|
||||
} cfg;
|
||||
|
||||
@ -93,10 +99,11 @@ struct ipcp {
|
||||
u_int32_t my_reject; /* Request codes I have rejected */
|
||||
|
||||
struct pppThroughput throughput; /* throughput statistics */
|
||||
struct mqueue Queue[PRI_FAST + 1]; /* Output packet queues */
|
||||
struct mqueue Queue[3]; /* Output packet queues */
|
||||
};
|
||||
|
||||
#define fsm2ipcp(fp) (fp->proto == PROTO_IPCP ? (struct ipcp *)fp : NULL)
|
||||
#define IPCP_QUEUES(ipcp) (sizeof ipcp->Queue / sizeof ipcp->Queue[0])
|
||||
|
||||
struct bundle;
|
||||
struct link;
|
||||
@ -104,6 +111,7 @@ struct cmdargs;
|
||||
|
||||
extern void ipcp_Init(struct ipcp *, struct bundle *, struct link *,
|
||||
const struct fsm_parent *);
|
||||
extern void ipcp_Destroy(struct ipcp *);
|
||||
extern void ipcp_Setup(struct ipcp *, u_int32_t);
|
||||
extern void ipcp_SetLink(struct ipcp *, struct link *);
|
||||
|
||||
@ -116,4 +124,8 @@ extern int ipcp_UseHisaddr(struct bundle *, const char *, int);
|
||||
extern int ipcp_vjset(struct cmdargs const *);
|
||||
extern void ipcp_CleanInterface(struct ipcp *);
|
||||
extern int ipcp_InterfaceUp(struct ipcp *);
|
||||
extern int ipcp_IsUrgentPort(struct ipcp *, u_short, u_short);
|
||||
extern void ipcp_AddUrgentPort(struct ipcp *, u_short);
|
||||
extern void ipcp_RemoveUrgentPort(struct ipcp *, u_short);
|
||||
extern void ipcp_ClearUrgentPorts(struct ipcp *);
|
||||
extern struct in_addr addr2mask(struct in_addr);
|
||||
|
@ -82,17 +82,23 @@ link_AddOutOctets(struct link *l, int n)
|
||||
void
|
||||
link_SequenceQueue(struct link *l)
|
||||
{
|
||||
struct mqueue *queue, *highest;
|
||||
|
||||
log_Printf(LogDEBUG, "link_SequenceQueue\n");
|
||||
while (l->Queue[PRI_NORMAL].qlen)
|
||||
mbuf_Enqueue(l->Queue + PRI_LINK, mbuf_Dequeue(l->Queue + PRI_NORMAL));
|
||||
|
||||
highest = LINK_HIGHQ(l);
|
||||
for (queue = l->Queue; queue < highest; queue++)
|
||||
while (queue->qlen)
|
||||
mbuf_Enqueue(highest, mbuf_Dequeue(queue));
|
||||
}
|
||||
|
||||
void
|
||||
link_DeleteQueue(struct link *l)
|
||||
{
|
||||
struct mqueue *queue;
|
||||
struct mqueue *queue, *highest;
|
||||
|
||||
for (queue = l->Queue; queue < l->Queue + LINK_QUEUES; queue++)
|
||||
highest = LINK_HIGHQ(l);
|
||||
for (queue = l->Queue; queue <= highest; queue++)
|
||||
while (queue->top)
|
||||
mbuf_Free(mbuf_Dequeue(queue));
|
||||
}
|
||||
@ -102,7 +108,7 @@ link_QueueLen(struct link *l)
|
||||
{
|
||||
int i, len;
|
||||
|
||||
for (i = 0, len = 0; i < LINK_QUEUES; i++)
|
||||
for (i = 0, len = 0; i < LINK_QUEUES(l); i++)
|
||||
len += l->Queue[i].qlen;
|
||||
|
||||
return len;
|
||||
@ -115,7 +121,7 @@ link_QueueBytes(struct link *l)
|
||||
struct mbuf *m;
|
||||
|
||||
bytes = 0;
|
||||
for (i = 0, len = 0; i < LINK_QUEUES; i++) {
|
||||
for (i = 0, len = 0; i < LINK_QUEUES(l); i++) {
|
||||
len = l->Queue[i].qlen;
|
||||
m = l->Queue[i].top;
|
||||
while (len--) {
|
||||
@ -133,7 +139,7 @@ link_Dequeue(struct link *l)
|
||||
int pri;
|
||||
struct mbuf *bp;
|
||||
|
||||
for (bp = (struct mbuf *)0, pri = LINK_QUEUES - 1; pri >= 0; pri--)
|
||||
for (bp = NULL, pri = LINK_QUEUES(l) - 1; pri >= 0; pri--)
|
||||
if (l->Queue[pri].qlen) {
|
||||
bp = mbuf_Dequeue(l->Queue + pri);
|
||||
log_Printf(LogDEBUG, "link_Dequeue: Dequeued from queue %d,"
|
||||
@ -208,7 +214,7 @@ link_PushPacket(struct link *l, struct mbuf *bp, struct bundle *b, int pri,
|
||||
* packet (as we do with ``pull''s).
|
||||
*/
|
||||
|
||||
if(pri < 0 || pri >= LINK_QUEUES)
|
||||
if(pri < 0 || pri >= LINK_QUEUES(l))
|
||||
pri = 0;
|
||||
|
||||
for (layer = l->nlayers; layer && bp; layer--)
|
||||
|
@ -31,7 +31,6 @@
|
||||
#define PHYSICAL_LINK 1
|
||||
#define LOGICAL_LINK 2
|
||||
|
||||
#define LINK_QUEUES (PRI_MAX + 1)
|
||||
#define NPROTOSTAT 13
|
||||
|
||||
struct bundle;
|
||||
@ -43,7 +42,7 @@ struct link {
|
||||
const char *name; /* Points to datalink::name */
|
||||
int len; /* full size of parent struct */
|
||||
struct pppThroughput throughput; /* Link throughput statistics */
|
||||
struct mqueue Queue[LINK_QUEUES]; /* Our output queue of mbufs */
|
||||
struct mqueue Queue[2]; /* Our output queue of mbufs */
|
||||
|
||||
u_long proto_in[NPROTOSTAT]; /* outgoing protocol stats */
|
||||
u_long proto_out[NPROTOSTAT]; /* incoming protocol stats */
|
||||
@ -55,6 +54,9 @@ struct link {
|
||||
int nlayers;
|
||||
};
|
||||
|
||||
#define LINK_QUEUES(link) (sizeof (link)->Queue / sizeof (link)->Queue[0])
|
||||
#define LINK_HIGHQ(link) ((link)->Queue + LINK_QUEUES(link) - 1)
|
||||
|
||||
extern void link_AddInOctets(struct link *, int);
|
||||
extern void link_AddOutOctets(struct link *, int);
|
||||
|
||||
|
@ -139,7 +139,8 @@ SendLqrData(struct lcp *lcp)
|
||||
bp = mbuf_Alloc(sizeof(struct lqrdata) + extra, MB_LQROUT);
|
||||
bp->cnt -= extra;
|
||||
bp->offset += extra;
|
||||
link_PushPacket(lcp->fsm.link, bp, lcp->fsm.bundle, PRI_LINK, PROTO_LQR);
|
||||
link_PushPacket(lcp->fsm.link, bp, lcp->fsm.bundle,
|
||||
LINK_QUEUES(lcp->fsm.link) - 1, PROTO_LQR);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -628,7 +628,7 @@ mp_Output(struct mp *mp, struct bundle *bundle, struct link *l,
|
||||
mp->out.seq, mbuf_Length(mo), l->name);
|
||||
mp->out.seq = inc_seq(mp->peer_is12bit, mp->out.seq);
|
||||
|
||||
link_PushPacket(l, mo, bundle, PRI_NORMAL, PROTO_MP);
|
||||
link_PushPacket(l, mo, bundle, LINK_QUEUES(l) - 1, PROTO_MP);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -94,7 +94,8 @@ pap_Req(struct authinfo *authp)
|
||||
cp += namelen;
|
||||
*cp++ = keylen;
|
||||
memcpy(cp, bundle->cfg.auth.key, keylen);
|
||||
link_PushPacket(&authp->physical->link, bp, bundle, PRI_LINK, PROTO_PAP);
|
||||
link_PushPacket(&authp->physical->link, bp, bundle,
|
||||
LINK_QUEUES(&authp->physical->link) - 1, PROTO_PAP);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -118,7 +119,7 @@ SendPapCode(struct authinfo *authp, int code, const char *message)
|
||||
log_Printf(LogPHASE, "Pap Output: %s\n", papcodes[code]);
|
||||
|
||||
link_PushPacket(&authp->physical->link, bp, authp->physical->dl->bundle,
|
||||
PRI_LINK, PROTO_PAP);
|
||||
LINK_QUEUES(&authp->physical->link) - 1, PROTO_PAP);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3626,9 +3626,9 @@ has read a certain number of packets from the local network for transmission,
|
||||
but cannot send the data due to link failure (the peer is busy etc.).
|
||||
.Nm
|
||||
will not read packets indefinitely. Instead, it reads up to
|
||||
.Em 20
|
||||
.Em 30
|
||||
packets (or
|
||||
.Em 20 No +
|
||||
.Em 30 No +
|
||||
.Em nlinks No *
|
||||
.Em 2
|
||||
packets in multi-link mode), then stops reading the network interface
|
||||
@ -4499,6 +4499,32 @@ is specified,
|
||||
.Nm
|
||||
will never idle out before the link has been up for at least that number
|
||||
of seconds.
|
||||
.It set urgent Xo
|
||||
.Oo Op +|- Ns
|
||||
.Ar port
|
||||
.Oc No ...
|
||||
.Xc
|
||||
This command controls the ports that
|
||||
.Nm
|
||||
prioritizes when transmitting data. The default priority ports are ports
|
||||
21 (ftp control), 22 (ssh), 23 (telnet), 513 (login), 514 (shell),
|
||||
543 (klogin) and 544 (kshell). See
|
||||
.Xr services 5
|
||||
for details.
|
||||
.Pp
|
||||
If no
|
||||
.Ar port Ns No s
|
||||
are given, the priority port list is cleared. If the first
|
||||
.Ar port
|
||||
argument is prefixed with a plus
|
||||
.Pq Dq \&+
|
||||
or a minus
|
||||
.Pq Dq \&- ,
|
||||
the current list is adjusted, otherwise the list is reassigned.
|
||||
.Ar port Ns No s
|
||||
prefixed with a plus or not prefixed at all are added to the list and
|
||||
.Ar port Ns No s
|
||||
prefixed with a minus are removed from the list.
|
||||
.It set vj slotcomp on|off
|
||||
This command tells
|
||||
.Nm
|
||||
|
@ -3626,9 +3626,9 @@ has read a certain number of packets from the local network for transmission,
|
||||
but cannot send the data due to link failure (the peer is busy etc.).
|
||||
.Nm
|
||||
will not read packets indefinitely. Instead, it reads up to
|
||||
.Em 20
|
||||
.Em 30
|
||||
packets (or
|
||||
.Em 20 No +
|
||||
.Em 30 No +
|
||||
.Em nlinks No *
|
||||
.Em 2
|
||||
packets in multi-link mode), then stops reading the network interface
|
||||
@ -4499,6 +4499,32 @@ is specified,
|
||||
.Nm
|
||||
will never idle out before the link has been up for at least that number
|
||||
of seconds.
|
||||
.It set urgent Xo
|
||||
.Oo Op +|- Ns
|
||||
.Ar port
|
||||
.Oc No ...
|
||||
.Xc
|
||||
This command controls the ports that
|
||||
.Nm
|
||||
prioritizes when transmitting data. The default priority ports are ports
|
||||
21 (ftp control), 22 (ssh), 23 (telnet), 513 (login), 514 (shell),
|
||||
543 (klogin) and 544 (kshell). See
|
||||
.Xr services 5
|
||||
for details.
|
||||
.Pp
|
||||
If no
|
||||
.Ar port Ns No s
|
||||
are given, the priority port list is cleared. If the first
|
||||
.Ar port
|
||||
argument is prefixed with a plus
|
||||
.Pq Dq \&+
|
||||
or a minus
|
||||
.Pq Dq \&- ,
|
||||
the current list is adjusted, otherwise the list is reassigned.
|
||||
.Ar port Ns No s
|
||||
prefixed with a plus or not prefixed at all are added to the list and
|
||||
.Ar port Ns No s
|
||||
prefixed with a minus are removed from the list.
|
||||
.It set vj slotcomp on|off
|
||||
This command tells
|
||||
.Nm
|
||||
|
Loading…
Reference in New Issue
Block a user