Bugzilla – Attachment 1808 Details for
Bug 1733
Enhance support for QoS (ToS) by supporting DSCP/CS and adding option
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
QoS fix for DSCP/CS markings
openssh-qos.patch (text/plain), 14.33 KB, created by
Philip Prindeville
on 2010-03-10 14:39:30 AEDT
(
hide
)
Description:
QoS fix for DSCP/CS markings
Filename:
MIME Type:
Creator:
Philip Prindeville
Created:
2010-03-10 14:39:30 AEDT
Size:
14.33 KB
patch
obsolete
>? .ssh-keyscan.c.swp >Index: defines.h >=================================================================== >RCS file: /cvs/openssh/defines.h,v >retrieving revision 1.159 >diff -u -p -r1.159 defines.h >--- defines.h 13 Jan 2010 23:44:34 -0000 1.159 >+++ defines.h 10 Mar 2010 03:29:58 -0000 >@@ -50,6 +50,35 @@ enum > # define IPTOS_MINCOST IPTOS_LOWCOST > #endif /* IPTOS_LOWDELAY */ > >+/* in glibc 2.12 */ >+#ifndef IPTOS_CLASS_CS0 >+#define IPTOS_CLASS_CS0 0x00 >+#define IPTOS_CLASS_CS1 0x20 >+#define IPTOS_CLASS_CS2 0x40 >+#define IPTOS_CLASS_CS3 0x60 >+#define IPTOS_CLASS_CS4 0x80 >+#define IPTOS_CLASS_CS5 0xa0 >+#define IPTOS_CLASS_CS6 0xc0 >+#define IPTOS_CLASS_CS7 0xe0 >+#endif >+ >+/* in glibc 2.11 */ >+#ifndef IPTOS_DSCP_AF11 >+#define IPTOS_DSCP_AF11 0x28 >+#define IPTOS_DSCP_AF12 0x30 >+#define IPTOS_DSCP_AF13 0x38 >+#define IPTOS_DSCP_AF21 0x48 >+#define IPTOS_DSCP_AF22 0x50 >+#define IPTOS_DSCP_AF23 0x58 >+#define IPTOS_DSCP_AF31 0x68 >+#define IPTOS_DSCP_AF32 0x70 >+#define IPTOS_DSCP_AF33 0x78 >+#define IPTOS_DSCP_AF41 0x88 >+#define IPTOS_DSCP_AF42 0x90 >+#define IPTOS_DSCP_AF43 0x98 >+#define IPTOS_DSCP_EF 0xb8 >+#endif >+ > #ifndef MAXPATHLEN > # ifdef PATH_MAX > # define MAXPATHLEN PATH_MAX >Index: packet.c >=================================================================== >RCS file: /cvs/openssh/packet.c,v >retrieving revision 1.169 >diff -u -p -r1.169 packet.c >--- packet.c 2 Oct 2009 01:49:04 -0000 1.169 >+++ packet.c 10 Mar 2010 03:29:59 -0000 >@@ -78,6 +78,7 @@ > #include "misc.h" > #include "ssh.h" > #include "roaming.h" >+#include "readconf.h" > > #ifdef PACKET_DEBUG > #define DBG(x) x >@@ -87,6 +88,8 @@ > > #define PACKET_MAX_SIZE (256 * 1024) > >+extern Options options; >+ > struct packet_state { > u_int32_t seqnr; > u_int32_t packets; >@@ -1728,11 +1731,9 @@ packet_not_very_much_data_to_write(void) > } > > static void >-packet_set_tos(int interactive) >+packet_set_tos(int tos) > { > #if defined(IP_TOS) && !defined(IP_TOS_IS_BROKEN) >- int tos = interactive ? IPTOS_LOWDELAY : IPTOS_THROUGHPUT; >- > if (!packet_connection_is_on_socket() || > !packet_connection_is_ipv4()) > return; >@@ -1746,7 +1747,7 @@ packet_set_tos(int interactive) > /* Informs that the current session is interactive. Sets IP flags for that. */ > > void >-packet_set_interactive(int interactive) >+packet_set_interactive(int interactive, u_char qos[2]) > { > if (active_state->set_interactive_called) > return; >@@ -1759,7 +1760,7 @@ packet_set_interactive(int interactive) > if (!packet_connection_is_on_socket()) > return; > set_nodelay(active_state->connection_in); >- packet_set_tos(interactive); >+ packet_set_tos(interactive ? qos[1] : qos[0]); > } > > /* Returns true if the current connection is interactive. */ >Index: packet.h >=================================================================== >RCS file: /cvs/openssh/packet.h,v >retrieving revision 1.54 >diff -u -p -r1.54 packet.h >--- packet.h 5 Jul 2009 21:11:13 -0000 1.54 >+++ packet.h 10 Mar 2010 03:29:59 -0000 >@@ -31,7 +31,7 @@ u_int packet_get_encryption_key(u_char > void packet_set_protocol_flags(u_int); > u_int packet_get_protocol_flags(void); > void packet_start_compression(int); >-void packet_set_interactive(int); >+void packet_set_interactive(int, u_char []); > int packet_is_interactive(void); > void packet_set_server(void); > void packet_set_authenticated(void); >Index: readconf.c >=================================================================== >RCS file: /cvs/openssh/readconf.c,v >retrieving revision 1.162 >diff -u -p -r1.162 readconf.c >--- readconf.c 11 Feb 2010 22:21:03 -0000 1.162 >+++ readconf.c 10 Mar 2010 03:29:59 -0000 >@@ -131,6 +131,7 @@ typedef enum { > oSendEnv, oControlPath, oControlMaster, oHashKnownHosts, > oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand, > oVisualHostKey, oUseRoaming, oZeroKnowledgePasswordAuthentication, >+ oUseQoS, > oDeprecated, oUnsupported > } OpCodes; > >@@ -231,6 +232,7 @@ static struct { > { "permitlocalcommand", oPermitLocalCommand }, > { "visualhostkey", oVisualHostKey }, > { "useroaming", oUseRoaming }, >+ { "useqos", oUseQoS}, > #ifdef JPAKE > { "zeroknowledgepasswordauthentication", > oZeroKnowledgePasswordAuthentication }, >@@ -323,6 +325,49 @@ parse_token(const char *cp, const char * > return oBadOption; > } > >+struct { >+ const char *name; >+ int value; >+} qos[] = { >+ { "cs0", IPTOS_CLASS_CS0 }, >+ { "cs1", IPTOS_CLASS_CS1 }, >+ { "cs2", IPTOS_CLASS_CS2 }, >+ { "cs3", IPTOS_CLASS_CS3 }, >+ { "cs4", IPTOS_CLASS_CS4 }, >+ { "cs5", IPTOS_CLASS_CS5 }, >+ { "cs6", IPTOS_CLASS_CS6 }, >+ { "cs7", IPTOS_CLASS_CS7 }, >+ { "af11", IPTOS_DSCP_AF11 }, >+ { "af12", IPTOS_DSCP_AF12 }, >+ { "af13", IPTOS_DSCP_AF13 }, >+ { "af21", IPTOS_DSCP_AF21 }, >+ { "af22", IPTOS_DSCP_AF22 }, >+ { "af23", IPTOS_DSCP_AF23 }, >+ { "af31", IPTOS_DSCP_AF31 }, >+ { "af32", IPTOS_DSCP_AF32 }, >+ { "af33", IPTOS_DSCP_AF33 }, >+ { "af41", IPTOS_DSCP_AF41 }, >+ { "af42", IPTOS_DSCP_AF42 }, >+ { "af43", IPTOS_DSCP_AF43 }, >+ { "ef", IPTOS_DSCP_EF }, >+ { "lowdelay", IPTOS_LOWDELAY }, >+ { "throughput", IPTOS_THROUGHPUT }, >+ { "reliability", IPTOS_RELIABILITY }, >+ { "lowcost", IPTOS_LOWCOST }, >+ { "mincost", IPTOS_MINCOST }, >+ { NULL, -1 }, >+}; >+ >+static int parse_qos(const char *cp) >+{ >+ u_int i; >+ >+ for (i = 0; qos[i].name; i++) >+ if (strcasecmp(cp, qos[i].name) == 0) >+ return qos[i].value; >+ return -1; >+} >+ > /* > * Processes a single option line as used in the configuration files. This > * only sets those values that have not already been set. >@@ -921,6 +966,27 @@ parse_int: > intptr = &options->use_roaming; > goto parse_flag; > >+ case oUseQoS: >+ arg = strdelim(&s); >+ if (arg == NULL || *arg == '\0') >+ fatal("%.200s line %d: Missing non-interactive QoS argument.", >+ filename, linenum); >+ >+ arg2 = strdelim(&s); >+ if (arg2 == NULL || *arg2 == '\0') >+ fatal("%.200s line %d: Missing interactive QoS argument.", >+ filename, linenum); >+ >+ value = parse_qos(arg); >+ value2 = parse_qos(arg2); >+ if (value == -1 || value2 == -1) >+ fatal("%.200s line %d: Bad QoS argument.", >+ filename, linenum); >+ >+ options->use_qos[0] = value; >+ options->use_qos[1] = value2; >+ break; >+ > case oDeprecated: > debug("%s line %d: Deprecated option \"%s\"", > filename, linenum, keyword); >@@ -1071,6 +1137,8 @@ initialize_options(Options * options) > options->local_command = NULL; > options->permit_local_command = -1; > options->use_roaming = -1; >+ options->use_qos[0] = -1; >+ options->use_qos[1] = -1; > options->visual_host_key = -1; > options->zero_knowledge_password_authentication = -1; > } >@@ -1219,6 +1287,10 @@ fill_default_options(Options * options) > /* options->hostname will be set in the main program if appropriate */ > /* options->host_key_alias should not be set by default */ > /* options->preferred_authentications will be set in ssh */ >+ if (options->use_qos[0] == -1) >+ options->use_qos[0] = IPTOS_THROUGHPUT; >+ if (options->use_qos[1] == -1) >+ options->use_qos[1] = IPTOS_LOWDELAY; > } > > /* >Index: readconf.h >=================================================================== >RCS file: /cvs/openssh/readconf.h,v >retrieving revision 1.74 >diff -u -p -r1.74 readconf.h >--- readconf.h 11 Feb 2010 22:21:03 -0000 1.74 >+++ readconf.h 10 Mar 2010 03:29:59 -0000 >@@ -125,6 +125,8 @@ typedef struct { > > int use_roaming; > >+ u_char use_qos[2]; >+ > } Options; > > #define SSHCTL_MASTER_NO 0 >Index: servconf.c >=================================================================== >RCS file: /cvs/openssh/servconf.c,v >retrieving revision 1.199 >diff -u -p -r1.199 servconf.c >--- servconf.c 4 Mar 2010 10:53:35 -0000 1.199 >+++ servconf.c 10 Mar 2010 03:29:59 -0000 >@@ -131,6 +131,8 @@ initialize_server_options(ServerOptions > options->zero_knowledge_password_authentication = -1; > options->revoked_keys_file = NULL; > options->trusted_user_ca_keys = NULL; >+ options->use_qos[0] = -1; >+ options->use_qos[1] = -1; > } > > void >@@ -265,6 +267,10 @@ fill_default_server_options(ServerOption > options->permit_tun = SSH_TUNMODE_NO; > if (options->zero_knowledge_password_authentication == -1) > options->zero_knowledge_password_authentication = 0; >+ if (options->use_qos[0] == -1) >+ options->use_qos[0] = IPTOS_THROUGHPUT; >+ if (options->use_qos[1] == -1) >+ options->use_qos[1] = IPTOS_LOWDELAY; > > /* Turn privilege separation on by default */ > if (use_privsep == -1) >@@ -310,7 +316,7 @@ typedef enum { > sMatch, sPermitOpen, sForceCommand, sChrootDirectory, > sUsePrivilegeSeparation, sAllowAgentForwarding, > sZeroKnowledgePasswordAuthentication, sHostCertificate, >- sRevokedKeys, sTrustedUserCAKeys, >+ sRevokedKeys, sTrustedUserCAKeys, sUseQoS, > sDeprecated, sUnsupported > } ServerOpCodes; > >@@ -432,6 +438,7 @@ static struct { > { "hostcertificate", sHostCertificate, SSHCFG_GLOBAL }, > { "revokedkeys", sRevokedKeys, SSHCFG_ALL }, > { "trustedusercakeys", sTrustedUserCAKeys, SSHCFG_ALL }, >+ { "useqos", sUseQoS, SSHCFG_ALL }, > { NULL, sBadOption, 0 } > }; > >@@ -467,6 +474,49 @@ parse_token(const char *cp, const char * > return sBadOption; > } > >+struct { >+ const char *name; >+ int value; >+} qos[] = { >+ { "cs0", IPTOS_CLASS_CS0 }, >+ { "cs1", IPTOS_CLASS_CS1 }, >+ { "cs2", IPTOS_CLASS_CS2 }, >+ { "cs3", IPTOS_CLASS_CS3 }, >+ { "cs4", IPTOS_CLASS_CS4 }, >+ { "cs5", IPTOS_CLASS_CS5 }, >+ { "cs6", IPTOS_CLASS_CS6 }, >+ { "cs7", IPTOS_CLASS_CS7 }, >+ { "af11", IPTOS_DSCP_AF11 }, >+ { "af12", IPTOS_DSCP_AF12 }, >+ { "af13", IPTOS_DSCP_AF13 }, >+ { "af21", IPTOS_DSCP_AF21 }, >+ { "af22", IPTOS_DSCP_AF22 }, >+ { "af23", IPTOS_DSCP_AF23 }, >+ { "af31", IPTOS_DSCP_AF31 }, >+ { "af32", IPTOS_DSCP_AF32 }, >+ { "af33", IPTOS_DSCP_AF33 }, >+ { "af41", IPTOS_DSCP_AF41 }, >+ { "af42", IPTOS_DSCP_AF42 }, >+ { "af43", IPTOS_DSCP_AF43 }, >+ { "ef", IPTOS_DSCP_EF }, >+ { "lowdelay", IPTOS_LOWDELAY }, >+ { "throughput", IPTOS_THROUGHPUT }, >+ { "reliability", IPTOS_RELIABILITY }, >+ { "lowcost", IPTOS_LOWCOST }, >+ { "mincost", IPTOS_MINCOST }, >+ { NULL, -1 }, >+}; >+ >+static int parse_qos(const char *cp) >+{ >+ u_int i; >+ >+ for (i = 0; qos[i].name; i++) >+ if (strcasecmp(cp, qos[i].name) == 0) >+ return qos[i].value; >+ return -1; >+} >+ > char * > derelativise_path(const char *path) > { >@@ -661,8 +711,8 @@ process_server_config_line(ServerOptions > const char *filename, int linenum, int *activep, const char *user, > const char *host, const char *address) > { >- char *cp, **charptr, *arg, *p; >- int cmdline = 0, *intptr, value, n; >+ char *cp, **charptr, *arg, *arg2, *p; >+ int cmdline = 0, *intptr, value, value2, n; > SyslogFacility *log_facility_ptr; > LogLevel *log_level_ptr; > ServerOpCodes opcode; >@@ -1335,6 +1385,27 @@ process_server_config_line(ServerOptions > case sRevokedKeys: > charptr = &options->revoked_keys_file; > goto parse_filename; >+ >+ case sUseQoS: >+ arg = strdelim(&cp); >+ if (arg == NULL || *arg == '\0') >+ fatal("%.200s line %d: Missing non-interactive QoS argument.", >+ filename, linenum); >+ >+ arg2 = strdelim(&cp); >+ if (arg2 == NULL || *arg2 == '\0') >+ fatal("%.200s line %d: Missing interactive QoS argument.", >+ filename, linenum); >+ >+ value = parse_qos(arg); >+ value2 = parse_qos(arg2); >+ if (value == -1 || value2 == -1) >+ fatal("%.200s line %d: Bad QoS argument.", >+ filename, linenum); >+ >+ options->use_qos[0] = value; >+ options->use_qos[1] = value2; >+ break; > > case sDeprecated: > logit("%s line %d: Deprecated option %s", >Index: servconf.h >=================================================================== >RCS file: /cvs/openssh/servconf.h,v >retrieving revision 1.84 >diff -u -p -r1.84 servconf.h >--- servconf.h 4 Mar 2010 10:53:35 -0000 1.84 >+++ servconf.h 10 Mar 2010 03:29:59 -0000 >@@ -156,6 +156,8 @@ typedef struct { > char *chroot_directory; > char *revoked_keys_file; > char *trusted_user_ca_keys; >+ >+ u_char use_qos[2]; > } ServerOptions; > > void initialize_server_options(ServerOptions *); >Index: session.c >=================================================================== >RCS file: /cvs/openssh/session.c,v >retrieving revision 1.393 >diff -u -p -r1.393 session.c >--- session.c 7 Mar 2010 12:05:17 -0000 1.393 >+++ session.c 10 Mar 2010 03:30:00 -0000 >@@ -579,7 +579,7 @@ do_exec_no_pty(Session *s, const char *c > > s->pid = pid; > /* Set interactive/non-interactive mode. */ >- packet_set_interactive(s->display != NULL); >+ packet_set_interactive(s->display != NULL, options.use_qos); > > /* > * Clear loginmsg, since it's the child's responsibility to display >@@ -738,7 +738,7 @@ do_exec_pty(Session *s, const char *comm > > /* Enter interactive session. */ > s->ptymaster = ptymaster; >- packet_set_interactive(1); >+ packet_set_interactive(1, options.use_qos); > if (compat20) { > session_set_fds(s, ptyfd, fdout, -1, 1); > } else { >Index: ssh.c >=================================================================== >RCS file: /cvs/openssh/ssh.c,v >retrieving revision 1.327 >diff -u -p -r1.327 ssh.c >--- ssh.c 26 Feb 2010 20:55:06 -0000 1.327 >+++ ssh.c 10 Mar 2010 03:30:00 -0000 >@@ -1111,7 +1111,7 @@ ssh_session(void) > } > } > /* Tell the packet module whether this is an interactive session. */ >- packet_set_interactive(interactive); >+ packet_set_interactive(interactive, options.use_qos); > > /* Request authentication agent forwarding if appropriate. */ > check_agent_present(); >@@ -1205,7 +1205,7 @@ ssh_session2_setup(int id, void *arg) > client_session2_setup(id, tty_flag, subsystem_flag, getenv("TERM"), > NULL, fileno(stdin), &command, environ); > >- packet_set_interactive(interactive); >+ packet_set_interactive(interactive, options.use_qos); > } > > /* open new channel for a session */ >Index: ssh_config >=================================================================== >RCS file: /cvs/openssh/ssh_config,v >retrieving revision 1.28 >diff -u -p -r1.28 ssh_config >--- ssh_config 12 Jan 2010 08:40:27 -0000 1.28 >+++ ssh_config 10 Mar 2010 03:30:00 -0000 >@@ -45,3 +45,4 @@ > # PermitLocalCommand no > # VisualHostKey no > # ProxyCommand ssh -q -W %h:%p gateway.example.com >+# UseQoS throughput lowdelay >Index: sshd_config >=================================================================== >RCS file: /cvs/openssh/sshd_config,v >retrieving revision 1.83 >diff -u -p -r1.83 sshd_config >--- sshd_config 11 Oct 2009 10:51:09 -0000 1.83 >+++ sshd_config 10 Mar 2010 03:30:00 -0000 >@@ -107,6 +107,9 @@ > # no default banner path > #Banner none > >+# traditional ToS (deprecated: consider using af12 and cs2) >+#UseQoS throughput lowdelay >+ > # override default of no subsystems > Subsystem sftp /usr/libexec/sftp-server >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1733
:
1808
|
1809
|
1810
|
1880
|
1949