]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 2837] Allow a configurable DSCP value
authorHarlan Stenn <stenn@ntp.org>
Wed, 3 Jun 2015 09:30:35 +0000 (09:30 +0000)
committerHarlan Stenn <stenn@ntp.org>
Wed, 3 Jun 2015 09:30:35 +0000 (09:30 +0000)
bk: 556ec93b3y0FfQcVjiwv-X003v8hAA

ChangeLog
html/miscopt.html
include/ntp_io.h
ntpd/keyword-gen.c
ntpd/ntp_config.c
ntpd/ntp_io.c
ntpd/ntp_parser.y

index b880aaca2644dac92510e5e6b75006976b45a51e..60c1fe6ba7d275f6c824c3af3f792d9b0954a381 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,9 @@
 ---
 
 * [Bug 2824] Convert update-leap to perl. (also see 2769)
-* [Bug 2832] refclock_jjy.c supports the TDC-300
+* [Bug 2832] refclock_jjy.c supports the TDC-300.
 * [Bug 2834] Correct a broken html tag in html/refclock.html
+* [Bug 2837] Allow a configurable DSCP value.
 ---
 (4.2.8p3-RC1) 2015/05/12 Released by Harlan Stenn <stenn@ntp.org>
 
index 5750d17999d57100b2c5fa95e344e3fde0b763d7..14ab2759976a33302e9156a12083c14f05507508 100644 (file)
   <dd>The trap receiver will generally log event messages and other information from the server in a log file. While such monitor programs may also request their own trap dynamically, configuring a trap receiver will ensure that no messages are lost when the server is started.</dd>
   <dt id="ttl"><tt>ttl <i>hop</i> ...</tt></dt>
   <dd>This command specifies a list of TTL values in increasing order. up to 8 values can be specified. In manycast mode these values are used in turn in an expanding-ring search. The default is eight multiples of 32 starting at 31.</dd>
+  <dt id="dscp"><tt>dscp <i>dscp</i></tt></dt>
+  <dd>This command specifies the Differentiated Services Code Point (DSCP) value that is used in sent NTP packets.  The default value is 46 for Expedited Forwarding (EF).</dd>
 </dl>
 <hr>
 <script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
index 2cdca710873702ebc6f00fab830486b310c6bbc1..5950f0035d6bd6650eecbc97bd5bd1bb5c548d07 100644 (file)
@@ -80,6 +80,7 @@ typedef enum {
 } nic_rule_action;
 
 
+extern int     qos;
 SOCKET         move_fd(SOCKET fd);
 isc_boolean_t  get_broadcastclient_flag(void);
 extern int     is_ip_address(const char *, u_short, sockaddr_u *);
index 9ca7415f170cbe368e42d5f3bebb3f4636efea44..3576230383062e2217f7ef04b1238bf8aea5e889 100644 (file)
@@ -46,6 +46,7 @@ struct key_tok ntp_keywords[] = {
 { "ctl",               T_Ctl,                  FOLLBY_TOKEN },
 { "disable",           T_Disable,              FOLLBY_TOKEN },
 { "driftfile",         T_Driftfile,            FOLLBY_STRING },
+{ "dscp",              T_Dscp,                 FOLLBY_TOKEN },
 { "enable",            T_Enable,               FOLLBY_TOKEN },
 { "end",               T_End,                  FOLLBY_TOKEN },
 { "filegen",           T_Filegen,              FOLLBY_TOKEN },
index cd734c3266af4fea2adc65804e8a988169cc16b4..bff84066f1c6466479c853052abe04bafabf8fca 100644 (file)
@@ -3493,6 +3493,11 @@ config_vars(
                                stats_config(STATS_FREQ_FILE, curr_var->value.s);
                        break;
 
+               case T_Dscp:
+                       /* DSCP is in the upper 6 bits of the IP TOS/DS field */
+                       qos = curr_var->value.i << 2;
+                       break;
+
                case T_Ident:
                        sys_ident = curr_var->value.s;
                        break;
@@ -4291,7 +4296,6 @@ config_ntpd(
        )
 {
        config_nic_rules(ptree, input_from_files);
-       io_open_sockets();
        config_monitor(ptree);
        config_auth(ptree);
        config_tos(ptree);
@@ -4306,6 +4310,9 @@ config_ntpd(
        config_ttl(ptree);
        config_trap(ptree);
        config_vars(ptree);
+
+       io_open_sockets();
+
        config_other_modes(ptree);
        config_peers(ptree);
        config_unpeers(ptree);
index 1ee7098ae16438423f1e4b3d2044fbfaf2baf173..ad1b41e42eeb4e5896975d4862376d5a2b667053 100644 (file)
 
 extern int listen_to_virtual_ips;
 
+#ifndef IPTOS_DSCP_EF
+#define IPTOS_DSCP_EF 0xb8
+#endif
+int qos = IPTOS_DSCP_EF;       /* QoS RFC3246 */
+
 /*
  * NIC rule entry
  */
@@ -2842,11 +2847,6 @@ open_socket(
        int     on = 1;
        int     off = 0;
 
-#ifndef IPTOS_DSCP_EF
-#define IPTOS_DSCP_EF 0xb8
-#endif
-       int     qos = IPTOS_DSCP_EF;    /* QoS RFC3246 */
-
        if (IS_IPV6(addr) && !ipv6_works)
                return INVALID_SOCKET;
 
index 0a469adcc72d1e510f7b2d0f4cefdc13dd53905a..c64594c1c4407be4de2d3c1631ff93a35aad9193 100644 (file)
 %token <Double>        T_Double                /* not a token */
 %token <Integer>       T_Driftfile
 %token <Integer>       T_Drop
+%token <Integer>       T_Dscp
 %token <Integer>       T_Ellipsis      /* "..." not "ellipsis" */
 %token <Integer>       T_Enable
 %token <Integer>       T_End
 %type  <Attr_val>      log_config_command
 %type  <Attr_val_fifo> log_config_list
 %type  <Integer>       misc_cmd_dbl_keyword
+%type  <Integer>       misc_cmd_int_keyword
 %type  <Integer>       misc_cmd_str_keyword
 %type  <Integer>       misc_cmd_str_lcl_keyword
 %type  <Attr_val>      mru_option
@@ -1130,6 +1132,13 @@ miscellaneous_command
                        av = create_attr_dval($1, $2);
                        APPEND_G_FIFO(cfgt.vars, av);
                }
+       |       misc_cmd_int_keyword T_Integer
+               {
+                       attr_val *av;
+                       
+                       av = create_attr_ival($1, $2);
+                       APPEND_G_FIFO(cfgt.vars, av);
+               }
        |       misc_cmd_str_keyword T_String
                {
                        attr_val *av;
@@ -1199,6 +1208,10 @@ misc_cmd_dbl_keyword
        |       T_Tick
        ;
 
+misc_cmd_int_keyword
+       :       T_Dscp
+       ;
+
 misc_cmd_str_keyword
        :       T_Ident
        |       T_Leapfile