aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ppp
diff options
context:
space:
mode:
authorBrian Somers <brian@FreeBSD.org>2000-06-08 20:07:48 +0000
committerBrian Somers <brian@FreeBSD.org>2000-06-08 20:07:48 +0000
commit4c24043766dd1a839825a5f6245d57ddc32b6376 (patch)
tree5907a50ea7d2440b1a051baa0c84c07e5dff7b8f /usr.sbin/ppp
parentec8146d60d736351396d1dd81cd0f43a72315b31 (diff)
downloadsrc-4c24043766dd1a839825a5f6245d57ddc32b6376.tar.gz
src-4c24043766dd1a839825a5f6245d57ddc32b6376.zip
Allow ``set urgent none'' to disable all urgent ports and IPTOS_LOWDELAY
prioritisation. Requested by: luigi
Notes
Notes: svn path=/head/; revision=61430
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r--usr.sbin/ppp/command.c8
-rw-r--r--usr.sbin/ppp/ip.c4
-rw-r--r--usr.sbin/ppp/ipcp.c4
-rw-r--r--usr.sbin/ppp/ipcp.h3
-rw-r--r--usr.sbin/ppp/ppp.88
-rw-r--r--usr.sbin/ppp/ppp.8.m48
6 files changed, 30 insertions, 5 deletions
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c
index ed532028b59b..e648d66a5afa 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 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 c70a8e4c072a..fe64202e56c3 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 c70a8e4c072a..fe64202e56c3 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