mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-04 12:52:15 +00:00
Allow ``set urgent none'' to disable all urgent ports and IPTOS_LOWDELAY
prioritisation. Requested by: luigi
This commit is contained in:
parent
ec8146d60d
commit
4c24043766
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=61430
@ -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);
|
||||
|
@ -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 &&
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user