From a1cdd9887d5caf99cffb4e24b9914d658aa8eff2 Mon Sep 17 00:00:00 2001 From: brian Date: Thu, 8 Jun 2000 20:07:48 +0000 Subject: Allow ``set urgent none'' to disable all urgent ports and IPTOS_LOWDELAY prioritisation. Requested by: luigi --- usr.sbin/ppp/command.c | 8 ++++++++ usr.sbin/ppp/ip.c | 4 ++-- usr.sbin/ppp/ipcp.c | 4 +++- usr.sbin/ppp/ipcp.h | 3 +++ usr.sbin/ppp/ppp.8 | 8 +++++++- usr.sbin/ppp/ppp.8.m4 | 8 +++++++- 6 files changed, 30 insertions(+), 5 deletions(-) (limited to 'usr.sbin/ppp') diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index ed53202..e648d66 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -1855,9 +1855,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 +1873,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); diff --git a/usr.sbin/ppp/ip.c b/usr.sbin/ppp/ip.c index fd651b5..9552ccc 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 fad81c9..f7a632a 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 38583d8..da9bb2f 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 c70a8e4..fe64202 100644 --- a/usr.sbin/ppp/ppp.8 +++ b/usr.sbin/ppp/ppp.8 @@ -4695,7 +4695,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 ... @@ -4734,6 +4734,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 diff --git a/usr.sbin/ppp/ppp.8.m4 b/usr.sbin/ppp/ppp.8.m4 index c70a8e4..fe64202 100644 --- a/usr.sbin/ppp/ppp.8.m4 +++ b/usr.sbin/ppp/ppp.8.m4 @@ -4695,7 +4695,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 ... @@ -4734,6 +4734,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 -- cgit v1.1