View | Details | Raw Unified | Return to bug 48361
Collapse All | Expand All

(-)httpd-2.3.4-alpha/server/listen.c.orig (+50 lines)
Lines 34-39 static ap_listen_rec *old_listeners; Link Here
34
static int ap_listenbacklog;
34
static int ap_listenbacklog;
35
static int send_buffer_size;
35
static int send_buffer_size;
36
static int receive_buffer_size;
36
static int receive_buffer_size;
37
static int qos_marking = 0;
37
38
38
/* TODO: make_sock is just begging and screaming for APR abstraction */
39
/* TODO: make_sock is just begging and screaming for APR abstraction */
39
static apr_status_t make_sock(apr_pool_t *p, ap_listen_rec *server)
40
static apr_status_t make_sock(apr_pool_t *p, ap_listen_rec *server)
Lines 122-127 static apr_status_t make_sock(apr_pool_t Link Here
122
            /* not a fatal error */
123
            /* not a fatal error */
123
        }
124
        }
124
    }
125
    }
126
    if (qos_marking) {
127
        stat = apr_socket_opt_set(s, APR_SO_IPTOS, qos_marking);
128
        if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) {
129
            ap_log_perror(APLOG_MARK, APLOG_WARNING, stat, p,
130
                          "make_sock: failed to set IP ToS for "
131
                          "address %pI, using default",
132
                          server->bind_addr);
133
            /* not a fatal error */
134
        }
135
    }
125
136
126
#if APR_TCP_NODELAY_INHERITED
137
#if APR_TCP_NODELAY_INHERITED
127
    ap_sock_disable_nagle(s);
138
    ap_sock_disable_nagle(s);
Lines 720-722 AP_DECLARE_NONSTD(const char *) ap_set_r Link Here
720
    receive_buffer_size = s;
731
    receive_buffer_size = s;
721
    return NULL;
732
    return NULL;
722
}
733
}
734
735
AP_DECLARE_NONSTD(const char *) ap_set_qos_marking(cmd_parms *cmd,
736
                                                   void *dummy,
737
                                                   const char *arg)
738
{
739
    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
740
    /* might be more legible to use netinet/ip.h constants here, but that
741
     * would be less portable for a long time to come.
742
     */
743
    static const char cs[8] = {0x00, 0x20, 0x40, 0x60, 0x80, 0xa0, 0xc0, 0xe0};
744
    static const char af[12] = {0x28, 0x30, 0x38,
745
                                0x48, 0x50, 0x58,
746
                                0x68, 0x70, 0x78,
747
                                0x88, 0x90, 0x98};
748
    static const char ef = 0xb8;
749
750
    if (err != NULL) {
751
        return err;
752
    }
753
754
#define __in_range(c,s,e) ((s) <= (c) && (c) <= (e))
755
756
    if (arg[0] == 'c' && arg[1] == 's' && __in_range(arg[2], '0', '7') &&
757
        arg[3] == '\0') {
758
	qos_marking = cs[arg[2] - '0'];
759
    } else if (arg[0] == 'a' && arg[1] == 'f' &&
760
               __in_range(arg[2], '1', '4') && __in_range(arg[3], '1', '3') &&
761
               arg[4] == '\0') {
762
	qos_marking = af[(3 * (arg[2] - '1')) + (arg[3] - '1')];
763
    } else if (arg[0] == 'e' && arg[1] == 'f' && arg[2] == '\0') {
764
	qos_marking = ef;
765
    } else {
766
        return "QoSMarking must be cs0..cs7, af11..af43, or ef";
767
    }
768
769
#undef __in_range
770
771
    return NULL;
772
}
(-)httpd-2.3.4-alpha/include/ap_listen.h.orig (-1 / +5 lines)
Lines 116-121 AP_DECLARE_NONSTD(const char *) ap_set_s Link Here
116
AP_DECLARE_NONSTD(const char *) ap_set_receive_buffer_size(cmd_parms *cmd,
116
AP_DECLARE_NONSTD(const char *) ap_set_receive_buffer_size(cmd_parms *cmd,
117
                                                           void *dummy,
117
                                                           void *dummy,
118
                                                           const char *arg);
118
                                                           const char *arg);
119
AP_DECLARE_NONSTD(const char *) ap_set_qos_marking(cmd_parms *cmd, void *dummy,
120
				    const char *arg);
119
121
120
#define LISTEN_COMMANDS	\
122
#define LISTEN_COMMANDS	\
121
AP_INIT_TAKE1("ListenBacklog", ap_set_listenbacklog, NULL, RSRC_CONF, \
123
AP_INIT_TAKE1("ListenBacklog", ap_set_listenbacklog, NULL, RSRC_CONF, \
Lines 125-131 AP_INIT_TAKE_ARGV("Listen", ap_set_liste Link Here
125
AP_INIT_TAKE1("SendBufferSize", ap_set_send_buffer_size, NULL, RSRC_CONF, \
127
AP_INIT_TAKE1("SendBufferSize", ap_set_send_buffer_size, NULL, RSRC_CONF, \
126
  "Send buffer size in bytes"), \
128
  "Send buffer size in bytes"), \
127
AP_INIT_TAKE1("ReceiveBufferSize", ap_set_receive_buffer_size, NULL, \
129
AP_INIT_TAKE1("ReceiveBufferSize", ap_set_receive_buffer_size, NULL, \
128
              RSRC_CONF, "Receive buffer size in bytes")
130
              RSRC_CONF, "Receive buffer size in bytes"), \
131
AP_INIT_TAKE1("QoSMarking", ap_set_qos_marking, NULL, RSRC_CONF, \
132
  "IP QoS marking as a DiffServ/DSCP code-point name")
129
133
130
#ifdef __cplusplus
134
#ifdef __cplusplus
131
}
135
}

Return to bug 48361