Bug 42848

Summary: add IP TOS support to apr_socket_opt_set()
Product: APR Reporter: Jeremy Jackson <jerj>
Component: APRAssignee: Apache Portable Runtime bugs mailinglist <bugs>
Status: NEW ---    
Severity: enhancement CC: philipp, poeml
Priority: P2 Keywords: PatchAvailable
Version: HEAD   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Bug Depends on:    
Bug Blocks: 48361, 49553, 49997    
Attachments: Patch to add SOL_IP/IP_TOS support to apr_socket_opt_set()
Patch to have mod_ftp use the apr_socket_opt_set() interface for IP ToS
Patch to add SOL_IP/IP_TOS support to apr_socket_opt_set()
Patch to add SOL_IP/IP_TOS support to apr_socket_opt_set()
Add QoS support to APR.
Add QoS support to APR.
Updated patch for QoS support including autoconf hooks

Description Jeremy Jackson 2007-07-10 16:01:01 UTC
The original author in the URL requires APR support to port mod_iptos to
Apache2.  I am also interested in this for making mod_php5 able to alter it the
IP_TOS/DiffServ values of the http connection it's output is using.
Comment 1 Jeremy Jackson 2007-07-10 16:01:54 UTC
There is a patch but I am not the original author, see URL for details.
Comment 2 Philip Prindeville 2009-12-09 17:26:31 UTC
Created attachment 24685 [details]
Patch to add SOL_IP/IP_TOS support to apr_socket_opt_set()

I couldn't find the originally mentioned patch in the comments (seems to be an invalid link).
Comment 3 William A. Rowe Jr. 2009-12-09 18:18:03 UTC
This is only reasonable to consider if we map the solaris equivilants and truly
offer portable TOS control.  Of course; whos do we 'advertise' in terms of
the API?

mod_ftp already supports both API's but didn't attempt to abstract it; c.f.

http://svn.apache.org/repos/asf/httpd/mod_ftp/trunk/modules/ftp/ftp_data_connection.c
Comment 4 Philip Prindeville 2009-12-09 21:50:48 UTC
Created attachment 24687 [details]
Patch to have mod_ftp use the apr_socket_opt_set() interface for IP ToS
Comment 5 William A. Rowe Jr. 2010-03-22 04:28:16 UTC
Added to STATUS; note the reporter mixed up my reference, it is a pointer to
provide BOTH TOS control API's, not a request for the patch to use this 1/2
of an implementation :)

Will work up the proper patch, just placing this in STATUS so it isn't dropped.
Comment 6 Philip Prindeville 2010-03-22 05:35:57 UTC
(In reply to comment #5)
> Added to STATUS; note the reporter mixed up my reference, it is a pointer to
> provide BOTH TOS control API's, not a request for the patch to use this 1/2
> of an implementation :)
> 
> Will work up the proper patch, just placing this in STATUS so it isn't dropped.

Not quite sure what you're saying.

ToS (i.e. the dangerously obsolete RFC-791 meaning of the ToS and precedence bits) and QoS both use the same API.

The only difference is what bits are passed in this 8-bit field, and how the underlying network fabric chooses to interpret them.

Note also that the bit 0x02 (IPTOS_LOWCOST) may not be supported by a lot of Linuxen: as per RFC 3168, section 5, the low-order 2 bits of the ip_tos field are reserved now for Explicit Congestion Notification, and are ignored (actually, "clobbered" if set) by Linux 2.6.20 and later.

So to reiterate, there's one API, because only one is needed. There is no point in having two, because interpretation of the bits as QoS or ToS isn't done on the end-system, it's done in the network fabric... well beyond the reach of any OS API.
Comment 7 William A. Rowe Jr. 2010-03-22 06:06:06 UTC
The Network behavior is identically.

The C preprocessor constant names vary, you can refer to Stevens, UNIX Network
Programming for reference.  Or you could have just stolen the config detection
code and conditionals I already researched, and pointed you to in mod_ftp.
But arguing against compile portability in a portability library doesn't help :-/
Comment 8 Philip Prindeville 2010-03-22 06:14:10 UTC
(In reply to comment #7)
> The Network behavior is identically.
> 
> The C preprocessor constant names vary, you can refer to Stevens, UNIX Network
> Programming for reference.  Or you could have just stolen the config detection
> code and conditionals I already researched, and pointed you to in mod_ftp.
> But arguing against compile portability in a portability library doesn't help
> :-/

So, again, I wasn't arguing.  I was trying to figure out what you were saying.

Hence starting with, "Not quite sure what you're saying."

Ok, I think I understand.  You're worried about the SOL_IP vs. IPPROTO_IP issue in Linux vs. BSD.
Comment 9 Philip Prindeville 2010-03-22 06:15:19 UTC
Created attachment 25156 [details]
Patch to add SOL_IP/IP_TOS support to apr_socket_opt_set()

Redone for Solaris/BSD portability.
Comment 10 Philip Prindeville 2010-03-22 07:34:31 UTC
Hmmm...  See also:

https://sourceforge.net/tracker/?func=detail&atid=350976&aid=2915224&group_id=976

for at least one way to add autoconf support for detecting SOL_IP.  Though I suspect there's a simpler way to do it with just AC_TRY_CPP().
Comment 11 William A. Rowe Jr. 2010-03-22 07:46:48 UTC
Warning; comment #10  references GPL code.  Dropping consideration of this
submission; contributions must be compatible with the Apache License.

reverting to the originally proposed
http://qaix.com/apache-http-server/569-729-patch-add-ip-tos-support-read.shtml
plus mod_ftp's support of solaris+linux.
Comment 12 Philip Prindeville 2010-03-30 04:54:44 UTC
Created attachment 25211 [details]
Patch to add SOL_IP/IP_TOS support to apr_socket_opt_set()
Comment 13 Philip Prindeville 2010-07-04 15:49:19 UTC
Can you please update this bug report with a list of all blocking issues?
Comment 14 Philip Prindeville 2010-07-05 02:07:37 UTC
Created attachment 25699 [details]
Add QoS support to APR.

As per William's comments that this previously didn't compile under Solaris (which doesn't have self-including header files).
Comment 15 Philip Prindeville 2010-07-05 02:18:00 UTC
Created attachment 25700 [details]
Add QoS support to APR.
Comment 16 Philip Prindeville 2011-10-16 20:15:47 UTC
Created attachment 27793 [details]
Updated patch for QoS support including autoconf hooks

Updating for the last year's worth of changes on trunk...
Comment 17 William A. Rowe Jr. 2016-12-02 21:44:17 UTC
Offered a /bump on dev@apr in anticipation of a 1.6.0 tag.

Re-reviewing, myself.