diff options
| author | Brian Somers <brian@FreeBSD.org> | 2000-06-15 17:09:11 +0000 |
|---|---|---|
| committer | Brian Somers <brian@FreeBSD.org> | 2000-06-15 17:09:11 +0000 |
| commit | 89a9e458b5d9adc8bb0be78b99274cf04ef78011 (patch) | |
| tree | 4179f277d32962443d969430169dece3d740f4cd | |
| parent | 33e0743f832d3aaea137a9f7c77d02b3ad346e15 (diff) | |
Notes
| -rw-r--r-- | usr.sbin/ppp/bundle.c | 9 | ||||
| -rw-r--r-- | usr.sbin/ppp/bundle.h | 1 | ||||
| -rw-r--r-- | usr.sbin/ppp/command.c | 16 | ||||
| -rw-r--r-- | usr.sbin/ppp/defs.h | 1 | ||||
| -rw-r--r-- | usr.sbin/ppp/ip.c | 4 | ||||
| -rw-r--r-- | usr.sbin/ppp/ipcp.c | 4 | ||||
| -rw-r--r-- | usr.sbin/ppp/ipcp.h | 3 | ||||
| -rw-r--r-- | usr.sbin/ppp/ppp.8 | 47 |
8 files changed, 71 insertions, 14 deletions
diff --git a/usr.sbin/ppp/bundle.c b/usr.sbin/ppp/bundle.c index 5c3011ca4021..66efa93efb08 100644 --- a/usr.sbin/ppp/bundle.c +++ b/usr.sbin/ppp/bundle.c @@ -440,6 +440,7 @@ bundle_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n) struct bundle *bundle = descriptor2bundle(d); struct datalink *dl; int result, nlinks; + u_short ifqueue; size_t queued; result = 0; @@ -454,7 +455,8 @@ bundle_UpdateSet(struct fdescriptor *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 < 30) { + ifqueue = nlinks > bundle->cfg.ifqueue ? nlinks : bundle->cfg.ifqueue; + if (queued < ifqueue) { /* Not enough - select() for more */ if (bundle->choked.timer.state == TIMER_RUNNING) timer_Stop(&bundle->choked.timer); /* Not needed any more */ @@ -806,6 +808,7 @@ bundle_Create(const char *prefix, int type, int unit) OPT_THROUGHPUT | OPT_UTMP; *bundle.cfg.label = '\0'; bundle.cfg.mtu = DEF_MTU; + bundle.cfg.ifqueue = DEF_IFQUEUE; bundle.cfg.choked.timeout = CHOKED_TIMEOUT; bundle.phys_type.all = type; bundle.phys_type.open = 0; @@ -1156,8 +1159,10 @@ bundle_ShowStatus(struct cmdargs const *arg) prompt_Printf(arg->prompt, ", up time %d:%02d:%02d", secs / 3600, (secs / 60) % 60, secs % 60); } + prompt_Printf(arg->prompt, "\n Queued: %u of %u\n", + ip_QueueLen(&arg->bundle->ncp.ipcp), arg->bundle->cfg.ifqueue); - prompt_Printf(arg->prompt, "\n\nDefaults:\n"); + prompt_Printf(arg->prompt, "\nDefaults:\n"); prompt_Printf(arg->prompt, " Label: %s\n", arg->bundle->cfg.label); prompt_Printf(arg->prompt, " Auth name: %s\n", arg->bundle->cfg.auth.name); diff --git a/usr.sbin/ppp/bundle.h b/usr.sbin/ppp/bundle.h index 594045e6a72f..7007d78228b6 100644 --- a/usr.sbin/ppp/bundle.h +++ b/usr.sbin/ppp/bundle.h @@ -101,6 +101,7 @@ struct bundle { unsigned opt; /* Uses OPT_ bits from above */ char label[50]; /* last thing `load'ed */ u_short mtu; /* Interface mtu */ + u_short ifqueue; /* Interface queue size */ struct { int timeout; /* How long to leave the output queue choked */ diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index ed532028b59b..afd88656d7ab 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -131,6 +131,7 @@ #define VAR_CRTSCTS 32 #define VAR_URGENTPORTS 33 #define VAR_LOGOUT 34 +#define VAR_IFQUEUE 35 /* ``accept|deny|disable|enable'' masks */ #define NEG_HISMASK (1) @@ -1646,6 +1647,11 @@ SetVariable(struct cmdargs const *arg) cx->cfg.script.hangup[sizeof cx->cfg.script.hangup - 1] = '\0'; break; + case VAR_IFQUEUE: + long_val = atol(argp); + arg->bundle->cfg.ifqueue = long_val < 0 ? 0 : long_val; + break; + case VAR_LOGOUT: strncpy(cx->cfg.script.logout, argp, sizeof cx->cfg.script.logout - 1); cx->cfg.script.logout[sizeof cx->cfg.script.logout - 1] = '\0'; @@ -1855,9 +1861,11 @@ SetVariable(struct cmdargs const *arg) case VAR_URGENTPORTS: if (arg->argn == arg->argc) { + ipcp_SetUrgentTOS(&arg->bundle->ncp.ipcp); ipcp_ClearUrgentTcpPorts(&arg->bundle->ncp.ipcp); ipcp_ClearUrgentUdpPorts(&arg->bundle->ncp.ipcp); } else if (!strcasecmp(arg->argv[arg->argn], "udp")) { + ipcp_SetUrgentTOS(&arg->bundle->ncp.ipcp); if (arg->argn == arg->argc - 1) ipcp_ClearUrgentUdpPorts(&arg->bundle->ncp.ipcp); else for (f = arg->argn + 1; f < arg->argc; f++) @@ -1871,7 +1879,13 @@ SetVariable(struct cmdargs const *arg) ipcp_ClearUrgentUdpPorts(&arg->bundle->ncp.ipcp); ipcp_AddUrgentUdpPort(&arg->bundle->ncp.ipcp, atoi(arg->argv[f])); } + } else if (arg->argn == arg->argc - 1 && + !strcasecmp(arg->argv[arg->argn], "none")) { + ipcp_ClearUrgentTcpPorts(&arg->bundle->ncp.ipcp); + ipcp_ClearUrgentUdpPorts(&arg->bundle->ncp.ipcp); + ipcp_ClearUrgentTOS(&arg->bundle->ncp.ipcp); } else { + ipcp_SetUrgentTOS(&arg->bundle->ncp.ipcp); first = arg->argn; if (!strcasecmp(arg->argv[first], "tcp") && ++first == arg->argc) ipcp_ClearUrgentTcpPorts(&arg->bundle->ncp.ipcp); @@ -1946,6 +1960,8 @@ static struct cmdtab const SetCommands[] = { "hangup script", "set hangup chat-script", (const void *) VAR_HANGUP}, {"ifaddr", NULL, SetInterfaceAddr, LOCAL_AUTH, "destination address", "set ifaddr [src-addr [dst-addr [netmask [trg-addr]]]]"}, + {"ifqueue", NULL, SetVariable, LOCAL_AUTH, "interface queue", + "set ifqueue packets", (const void *)VAR_IFQUEUE}, {"ipcpretry", "ipcpretries", SetVariable, LOCAL_AUTH, "IPCP retries", "set ipcpretry value [attempts]", (const void *)VAR_IPCPRETRY}, {"lcpretry", "lcpretries", SetVariable, LOCAL_AUTH | LOCAL_CX, "LCP retries", diff --git a/usr.sbin/ppp/defs.h b/usr.sbin/ppp/defs.h index cb704d8b9773..402bd1888d7f 100644 --- a/usr.sbin/ppp/defs.h +++ b/usr.sbin/ppp/defs.h @@ -59,6 +59,7 @@ #define DEF_FSMRETRY 3 /* FSM retry frequency */ #define DEF_FSMTRIES 5 /* Default max retries */ #define DEF_FSMAUTHTRIES 3 /* Default max auth retries */ +#define DEF_IFQUEUE 30 /* Default interface queue size */ #define CONFFILE "ppp.conf" #define LINKUPFILE "ppp.linkup" diff --git a/usr.sbin/ppp/ip.c b/usr.sbin/ppp/ip.c index fd651b58ce4c..9552ccc3d887 100644 --- a/usr.sbin/ppp/ip.c +++ b/usr.sbin/ppp/ip.c @@ -475,7 +475,7 @@ PacketCheck(struct bundle *bundle, char *cp, int nb, struct filter *filter) case IPPROTO_UDP: uh = (struct udphdr *) ptop; - if (pip->ip_tos == IPTOS_LOWDELAY) + if (pip->ip_tos == IPTOS_LOWDELAY && bundle->ncp.ipcp.cfg.urgent.tos) pri++; if ((ntohs(pip->ip_off) & IP_OFFMASK) == 0 && @@ -545,7 +545,7 @@ PacketCheck(struct bundle *bundle, char *cp, int nb, struct filter *filter) case IPPROTO_TCP: th = (struct tcphdr *) ptop; - if (pip->ip_tos == IPTOS_LOWDELAY) + if (pip->ip_tos == IPTOS_LOWDELAY && bundle->ncp.ipcp.cfg.urgent.tos) pri++; if ((ntohs(pip->ip_off) & IP_OFFMASK) == 0 && diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c index fad81c99dc01..f7a632a590a4 100644 --- a/usr.sbin/ppp/ipcp.c +++ b/usr.sbin/ppp/ipcp.c @@ -503,8 +503,9 @@ ipcp_Show(struct cmdargs const *arg) prompt_Printf(arg->prompt, ", "); prompt_Printf(arg->prompt, "%u", ipcp->cfg.urgent.udp.port[p]); } + prompt_Printf(arg->prompt, "\n TOS: %s\n\n", + ipcp->cfg.urgent.tos ? "yes" : "no"); - prompt_Printf(arg->prompt, "\n\n"); throughput_disp(&ipcp->throughput, arg->prompt); return 0; @@ -571,6 +572,7 @@ ipcp_Init(struct ipcp *ipcp, struct bundle *bundle, struct link *l, ipcp->cfg.urgent.tcp.port = (u_short *)malloc(NDEFTCPPORTS * sizeof(u_short)); memcpy(ipcp->cfg.urgent.tcp.port, default_urgent_tcp_ports, NDEFTCPPORTS * sizeof(u_short)); + ipcp->cfg.urgent.tos = 1; ipcp->cfg.urgent.udp.nports = ipcp->cfg.urgent.udp.maxports = NDEFUDPPORTS; ipcp->cfg.urgent.udp.port = (u_short *)malloc(NDEFUDPPORTS * sizeof(u_short)); diff --git a/usr.sbin/ppp/ipcp.h b/usr.sbin/ppp/ipcp.h index 38583d87ce66..da9bb2fa26e2 100644 --- a/usr.sbin/ppp/ipcp.h +++ b/usr.sbin/ppp/ipcp.h @@ -77,6 +77,7 @@ struct ipcp { struct { struct port_range tcp, udp; /* The range of urgent ports */ + unsigned tos : 1; /* Urgent IPTOS_LOWDELAY packets ? */ } urgent; struct fsm_retry fsm; /* How often/frequently to resend requests */ @@ -163,3 +164,5 @@ extern void ipcp_LoadDNS(struct ipcp *); ipcp_ClearUrgentPorts(&(ipcp)->cfg.urgent.tcp) #define ipcp_ClearUrgentUdpPorts(ipcp) \ ipcp_ClearUrgentPorts(&(ipcp)->cfg.urgent.udp) +#define ipcp_ClearUrgentTOS(ipcp) (ipcp)->cfg.urgent.tos = 0; +#define ipcp_SetUrgentTOS(ipcp) (ipcp)->cfg.urgent.tos = 1; diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8 index 245a862252da..092505fb4736 100644 --- a/usr.sbin/ppp/ppp.8 +++ b/usr.sbin/ppp/ppp.8 @@ -2115,8 +2115,8 @@ Please refer to .Pa /usr/share/examples/ppp/ppp.conf.sample and .Pa /usr/share/examples/ppp/ppp.linkup.sample -for some real examples. The pmdemand label should be appropriate for most -ISPs. +for some real examples. +The pmdemand label should be appropriate for most ISPs. .Sh LOGGING FACILITY .Nm is able to generate the following log info either via @@ -2822,13 +2822,15 @@ and the .Dv MAC address of the local network in which .Dv HISADDR -appears. This allows other machines connecteed to the LAN to talk to -the peer as if the peer itself was connected to the LAN. The proxy entry -cannot be made unless +appears. +This allows other machines connecteed to the LAN to talk to +the peer as if the peer itself was connected to the LAN. +The proxy entry cannot be made unless .Dv HISADDR is an address from a LAN. .It proxyall -Default: Disabled. Enabling this will tell +Default: Disabled. +Enabling this will tell .Nm to add proxy arp entries for every IP address in all class C or smaller subnets routed via the tun interface. @@ -3183,8 +3185,9 @@ This is useful if you want to support protocols such as RPC and LPD which require connections to come from a well known port. .It nat target Op Ar address -Set the given target address or clear it if no address is given. The target -address is used by libalias to specify how to NAT incoming packets by default. +Set the given target address or clear it if no address is given. +The target address is used by libalias to specify how to NAT incoming +packets by default. If a target address is not set or if .Dq default is given, packets are not altered and are allowed to route to the internal @@ -4528,6 +4531,26 @@ In all cases, if the interface is already configured, .Nm will try to maintain the interface IP numbers so that any existing bound sockets will remain valid. +.It set ifqueue Ar packets +Set the maximum number of packets that +.Nm +will read from the tunnel interface while data cannot be sent to any of +the available links. +This queue limit is necessary to flow control outgoing data as the tunnel +interface is likely to be far faster than the combined links available to +.Nm ppp . +.Pp +If +.Ar packets +is set to a value less than the number of links, +.Nm +will read up to that value regardless. +This prevents any possible latency problems. +.Pp +The default value for +.Ar packets +is +.Dq 30 . .It set ccpretry|ccpretries Oo Ar timeout .Op Ar reqtries Op Ar trmtries .Oc @@ -5009,7 +5032,7 @@ is specified, will never idle out before the link has been up for at least that number of seconds. .It set urgent Xo -.Op tcp|udp +.Op tcp|udp|none .Oo Op +|- Ns .Ar port .Oc No ... @@ -5051,6 +5074,12 @@ the current list is adjusted, otherwise the list is reassigned. 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. +.Pp +If +.Dq none +is specified, all priority port lists are disabled and even +.Dv IPTOS_LOWDELAY +packets are not prioritised. .It set vj slotcomp on|off This command tells .Nm |
