Parent Directory
|
Revision Log
| Links to HEAD: | (view) (annotate) |
| Sticky Revision: |
Don't require all listeners to be created equal ...
Introduce a new set of APIs to allow MPMs to be proper modules instead of integral parts which share global variables, functions, and macros with the rest of httpd. Converted now: prefork, worker, event, simple, WinNT* *WinNT hasn't been built or tested, and relies on a hack to include the WinNT mpm.h to disable Unixy MPM support routines in mpm_common.c
revert 730949, accf_map member should never have been or be NULL
* APR_TCP_DEFER_ACCEPT is always defined. So this is pointless.
* Handle the case where conf->accf_map is NULL gracefully instead of segfaulting
Set Listen protocol to "https" if port is set to 443 and no proto is specified
(as documented but not implemented). PR 46066 [Dan Poirier <poirier pobox.com>]
core: Fix address-in-use startup failure on some platforms caused by attempting to set up an IPv4 listener which overlaps with an existing IPv6 listener. The failure occurred on the second pass of the open-logs hook in a configuration such as the following: Listen 8080 Listen 0.0.0.0:8081 Listen [::]:8081 During the first pass, the two port 8081 listen recs were adjacent and existing logic prevented binding to 0.0.0.0:8081. On the second pass, they were not adjacent and we then tried to bind to 0.0.0.0:8081, leading to failure on some platforms (seen on SLES 9 and Ubuntu 7.10, not seen on many other Unix-ish platforms). Leave a note about other unhandled configurations.
Remove all references to CORE_PRIVATE.
* server/listen.c (ap_apply_accept_filter): Bump TCP_DEFER_ACCEPT argument to 30 units-of-unspecified-nature. Submitted by: Dean Gaudet <dean arctic.org>
PR#37680: fix socket block/nonblock on restart/graceful Patch submitted by Darius Davis (darius-abz free-range.com.au)
Fix address-in-use startup failure caused by corruption of the list of listen sockets in some configurations with multiple generic Listen directives. The logic in error is that which prunes out generic IPv4 listening sockets when we already have a v4-mapped generic IPv6 listening socket for the same port.
update license header text
Update the copyright year in all .c, .h and .xml files
No functional Change: Removing trailing whitespace. This also means that "blank" lines consisting of just spaces or tabs are now really blank lines
Remove a call to strerror(). Possibly a leftover from prior debugging code.
* server/listen.c (open_listeners): Avoid shadowing the 'next' variable at function-scope.
* server/listen.c (open_listeners): If 0.0.0.0 is found before [::] for the same port, switch them so that the bind to [::] is attempted first. Submitted by: colm, jorton
* server/listen.c (IS_INADDR_ANY, IS_IN6ADDR_ANY): New macros. (open_listeners): Simplify using the new macros; no functional change.
Correct the function prototype/declaration
Provide a function for closing all of the listeners.
* This is useful for properly implementing a graceful stop and restart
where we want child processess to be able to carry on serving a request
but "de-listen" from a port. So that another instance entirely can be
started in our place, or to unbind from a "Listen" directive an admin
has removed from the configuration.
Merge the listen-protocol sandbox branch to trunk.
I will be adding documentation for the new directives hopefully in the next day or so.
* server/core.c: Added 'Protocol' to the core module config
Added ap_{set,get}_server_protocol API.
Added new directive: 'AcceptFilter'.
Enable 'httpready' by default on systems that support it. Use dataready filters for others.
* server/listen.c: Attempt to inherit protocols from Listener Records to Server configs.
The 'Listen' directive can now optionally take a protocol arg
Move bits that determined which accept filter is applied to core.c.
Added bits to find the correct accept filter based on the core's configuration.
* include/{ap_listen.h,http_core.h}: Add Protocol to respective structures.
* include/http_core.h: Add the accf_map table to the core_server_config structure
* include/ap_mmn.h: Minor MMN Bump for the new interfacces.
* modules/ssl/ssl_engine_init.c: Use the new protocol framework to enable mod_ssl for 'https' websites.
* server/listen.c: Remove the unused port parameter from open_listeners, and update the comment to reflect reality.
Add ReceiveBufferSize directive to control the TCP receive buffer. Submitted by: Eric Covener <covener gmail.com> Reviewed by: Justin Erenkrantz (with minor formatting tweaks)
Update copyright year to 2005 and standardize on current copyright owner line.
* Add bits to use APR_TCP_DEFER_ACCEPT * Log Warnings when adding defer accept or an accept filter fails.
Fix gcc "no previous prototype" warnings after reorganisation: * server/core_filters.c (ap_core_input_filter, ap_core_output_filter, ap_net_time_filter): Renamed to add ap_ prefixes for global symbols. * include/ap_listen.h: Don't export ap_listen_open at all, it's not used outside server/listen.c any more. * server/listen.c (open_listeners): Renamed from ap_listen_open.
Declare the ap_set_listen* functions with AP_DECLARE_NONSTD for Win32 support. (I think this is what is needed for Win32, but I'm not quite sure.)
Properly export ap_listen_* functions. * server/listen.c: Add AP_DECLARE as appropriate. * include/ap_listen.h: Add AP_DECLARE as appropriate.
general property cleanup
Fix crash when Apache was started with no Listen directives. Submitted by: Michael Corcoran <mcorcoran warpsolutions.com> Reviewed by: Jeff Trawick
*) SECURITY: CAN-2004-0174 (cve.mitre.org)
Fix starvation issue on listening sockets where a short-lived
connection on a rarely-accessed listening socket will cause a
child to hold the accept mutex and block out new connections until
another connection arrives on that rarely-accessed listening socket.
With Apache 2.x there is no performance concern about enabling the
logic for platforms which don't need it, so it is enabled everywhere
except for Win32. [Jeff Trawick]
(already in 2.0.49, propagating to mirrors now)
fix name of The Apache Software Foundation
fix copyright dates according to the first check in
apply Apache License, Version 2.0
FreeBSD: Use the httpready accept filter instead of dataready on newer levels of the OS. Submitted by: Paul Querna <chip force-elite.com> Reviewed by: Jeff Trawick
update license to 2004.
stop using apr_sockaddr_port_get() accessor function, as it will disappear from APR 1.0 API shortly
Setting lr = NULL on line 399 leads the the loop closing early (see line 343) and the ap_listeners list being nonsense. End result is a segfault if something is already listening on :: on our port when httpd is started. Submitted by: Colm MacCarthaigh <colm@stdlib.net>
switch to APR 1.0 API (which is still in flux) because of the changes to the argument lists of apr_mmap_dup and apr_socket_create, 2.1-dev won't build with apr and apr-util's 0.9 branch anymore
* listen.c (ap_listen_open): Avoid casts when checking for :: and 0.0.0.0 to fix build on FreeBSD 4.2, and fix logic. Reviewed by: Colm MacCarthaigh
Fixup IPv6 Listen statements on Linux by attempting to bind in the order that getaddrinfo() returned to us and skipping binding to IPv4 addresses if the previous bind was to an IPv6 of the same address and port. Justin made some style changes, added a (struct in6_addr*) to make it compile on *BSD as well as an attempt to make the addition of the listener to the list a little more efficient. Submitted by: Colm MacCarthaigh <colm@stdlib.net> Reviewed by: Justin Erenkrantz
Change Listen directive to bind to all addresses returned by apr_sockaddr_info_get when a hostname is not specified.
More fun with IPv6 Listen statements. - Remove the default_family declaration as it is no longer used. - Fix segfault if checking NULL sa->hostname. - Cycle through the bind_addr list if we get an error creating an IPv6 socket and we're IPv6 enabled and the binding address is NULL. The odds are that we just can't support IPv6. (The twist is that apr_sockaddr_info_get should return bind_addr's for IPv6 and IPv4. This strikes me as slightly more elegant than the find_default_family hack.) This should get us working on Linux and Netware again.
Correct failure with Listen directives on machines with IPv6 enabled by removing find_default_family() and letting APR determine what should be done without a hostname. This patch requires the corollary APR patch to properly call getaddrinfo(). (Justin modified Colm's patch to always walk the old listeners even when we have an address. That part of the patch wasn't really relevant.) Submitted by: Colm MacC�rthaigh <colm@stdlib.net> Reviewed by: Justin Erenkrantz
Quit registering *two* cleanups listening sockets prior to exec. We open them once, register a cleanup only once. Submitted by: Jeff Trawick Reviewed by: FirstBill, OtherBill
finished that boring job: update license to 2003. Happy New Year! ;-))
Fix critical bug in new --enable-v4-mapped configure option implementation which broke IPv4 listening sockets on systems with IPV6_V6ONLY socket option. That option should only be done on IPv6 listening sockets. Submitted by: hiroyuki hanai <hanai@imgsrc.co.jp>] Reviewed by: Jeff Trawick
Add --[enable|disable]-v4-mapped configure option to control
whether or not Apache expects to handle IPv4 connections
on IPv6 listening sockets. Either setting will work on
systems with the IPV6_V6ONLY socket option. --enable-v4-mapped
must be used on systems that always allow IPv4 connections on
IPv6 listening sockets.
Note: As the ssl config file is not automatically generated and
it is expected to require editing anyway to work, the only
change there was to suggest the required Listen statements
in a comment.
PR: PR 14037 (Bugzilla), PR 7492 (Gnats), various dups of these PRs
Restore the ability to specify host names on Listen directives.
We needed to compare on the value we pass to apr_sockaddr_info_get(),
not the IP address string. Sometimes this is an IP address string
and sometimes it is a host name. Otherwise, on the second pass
through this code we won't find the existing listen_rec for a Listen
directive which had a host name, and we'll create a new listen_rec
and try to bind again to the same addr/port.
PR: 11030
Helped immensely by: David Shane Holden <dpejesh@yahoo.com>,
who debugged it and submitted a patch which
showed the problem; a much simpler change was
committed though
When deciding on the default address family for listening sockets, make sure we can actually bind to an AF_INET6 socket before deciding that we should default to AF_INET6. This fixes a startup problem on certain levels of OpenUNIX. PR: 10235
http occurances to update for apr_socket_opt_get/set
Remove unnecessary includes of apr_lock.h
Don't allow initialization to succeed if we can't get a socket corresponding to one of the Listen statements.
Here's the patch that really sucks. old_listeners points to an array of apr_socket objects already destroyed by their cleanups, and in any case they now live in invalid memory. Extend their lifetimes. This implies that the process pool grows on every restart for no good reason. One possible solution is to let the old pconf survive until the new pconf is alive. Another is to create the listeners in a subpool of process->pool, destroyed after the old_listeners are closed. Either which way, a better solution exists, but this closes the immediate bug. [How haven't we been segfaulting in unix on restarts before this patch, gurus?]
Our ap_listeners were binding to IIS sockets, other Apache instances' listeners, the bottoms of peoples' shoes, etc. Wait to set SO_REUSEADDR on Win32 until the parent is certain the port is all ours.
Update our copyright for this year.
simplify the way we find the family of an apr_sockaddr_t
Torch a stale commented out line.
Sander's Stylistic Submission (de-tab) PR: Obtained from: Submitted by: Reviewed by:
restore the SO_REUSEADDR for listening sockets; it is absolutely required on most (all?) platforms, regardless of what code changes might be required to work around the ability on Windows to inadvertently have more than one server listening on the same ports
This change keeps the server from allowing multiple instances to bind to the same port. Previously, this was necessary, because the Windows MPM was binding to the socket in both the parent and child. Today's code passes the attached socket to the child from the parent, so we don't need to re-attach in the child.
This patch allows the prefork MPM to print messages to the console if it can't open a socket for some reason.
Remove more spmt_os2 MPM leftovers.
Making sure that the global variables have been initialized to avoid linker problems at least on NetWare Submitted by: Pavel Novy
Fix segfault when restarting worker MPM. We can not examine the POD as a normal listener. There was an additional bug than what Ian submitted to fix listen.c (i.e. check sa for null): make_pipe_of_death does not zero out lr->bind_addr (since it uses apr_palloc). So, on Solaris, the first time through, bind_addr was probably 0, but the second time, not (pools!). (This caused Aaron's analysis that the patch worked the first time, but not the second time.) Submitted by: Ian Holsman Reviewed by: Justin Erenkrantz, Aaron Bannert
Clean up style (tabs->spaces, etc, etc, etc.).
Allow modules that add sockets to the ap_listeners list to
define the function that should be used to accept on that
socket. Each MPM can define their own function to use for
the accept function with the MPM_ACCEPT_FUNC macro. This
also abstracts out all of the Unix accept error handling
logic, which has become out of synch across Unix MPMs.
The code flow is much easier now for different transports:
1) During pre-config, post-config or while parsing the config
file, add a socket to the ap_listeners list, making sure to
define an accept function at the same time.
2) MPMs find the correct listener, and call the accept function
that was defined in step 1.
3) That accept function returns a void pointer, which is passed
to the create_connection hook.
4) create_connection adds the correct low-level filters.
Exit when we can't listen on any of the configured ports. This is the same behavior as 1.3, and it avoids having the MPMs to deal with bogus ap_listen_rec structures. This also backs out some circumventions I and Greg Ames had added to prefork; these are no longer necessary because of this change.
Remove the Port directive. In it's place, the Listen directive is now a required directive, which tells Apache what port to listen on. The ServerName directive has also been extended to accept an optional port. If the port is specified to the ServerName, the server will report that port whenever it reports the port that it is listening on. This change was made to ease configuration errors that stem from having a Port directive, and a Listen directive. In that situation, the server would only listen to the port specified by the Listen command, which caused a lot of confusion to users.
Begin to sanitize the MPM configuration directives. Now, all MPMs use the same functions for all common MPM directives. This should make it easier to catch all bugs in these directives once. Everybody should check their favorite MPM to ensure that it still compiles, and that these directives work. This is a big patch, and although it looks good, and things compiled for me, that is no garauntee that it will work on all platforms. :-) Submitted by: Cody Sherr <csherr@covalent.net>
Close a major resource leak. Everytime we had issued a graceful restart, we leaked a socket descriptor. The listening sockets should not be set inheritable, at least not at this point. We only want some of the httpd children to inherit the socket. Namely, those that will be actually serving requests. Any other child process (piped logs), should not be inheriting the sockets. PR: 7891
Terniaries are broken under MSVC, they never did resolve how to resolve the type of an obvious conversion like this one. Even casting the const to an apr_port_t doesn't solve it.
PR:
Omitted the arg
rbb's names still need work :)
Changes to back out inherit flag from apr_os_sock_make() and apr_socket_create()
Added an inherit flag to apr_socket_create and other socket creation functions. This allows APR programs to specify that a socket should be passed to any child processes that are created. The inherit flag is only meaningful if programs use apr_process_create(). This also adds a couple of macros that allow APR types to set and unset the inherit flag. This also fixes Apache to use the new API.
Now that APR knows when TCP_NODELAY is inherited, use its setting to know when to set that option on the listening socket. (not that I understand to start with why we bother saving this minimal pathlength when it isn't inherited)
Add the code to actually enable accept filters in 2.0
*) Reimplement the Windows MPM (mpm_winnt.c) to eliminate calling
DuplicateHandle on an IOCompletionPort (a practice which
MS "discourages"). The new model does not rely on associating
the completion port with the listening sockets, thus the
completion port can be completely managed within the child
process. A dedicated thread accepts connections off the network,
then calls PostQueuedCompletionStatus() to wake up worker
threads blocked on the completion port.
[Bill Stoddard]
Fix a Windows seg fault on startup when multiple listen directives are being used. The pool pointer in the local address field in apr_sock_t is not initialized until a request is received. in general, we should not rely on the addressed in apr_sock_t when doing work on the listen_recs.
Update copyright to 2001
*) continued header revamping *) torch some headers (and some libs) from the autoconf stuff
renaming various functions for consistency sake see: http://apr.apache.org/~dougm/apr_rename.pl PR: Obtained from: Submitted by: Reviewed by:
Stop leaking sockets. This is a minimal leak, but it was there. Basically, we were creating a socket_t, but never assigning a port or IP address to it. We then re-read the config file, and search the list of allocated sockets for the socket that we have already allocated for this port, but we never find the port and address, because we never stored them in the socket_t. This was keeping the Listen directive from working properly.
Modify a couple of calls to ap_log_error with a NULL server to use ap_log_perror, and pass a pool. The keeps us from seg faulting if the error log hasn't been opened yet.
When the platform supports IPv6 (according to APR) and the system is configured to support IPv6, Apache gets IPv6 listening sockets unless the Listen statement says otherwise (i.e., Listen specifies an IPv4 numeric address string or a hostname which resolves to an IPv4 address).
Call ap_log_error() instead of ap_log_rerror() from alloc_listener(). This bug, introduced in a recent commit, caused a segfault when the hostname couldn't be resolved.
tweak the responsibilities of make_sock() and alloc_listener() because we need to resolve the hostname (i.e., call apr_getaddrinfo()) before creating the socket so that we get a socket of the appropriate family also, simplify some of the address displays in some error logs
use apr_parse_addr_port() in ap_set_listener(); this allows IPv6 numeric address strings to be specified (though we wouldn't get an IPv6 socket for it at the moment) consolidate the use of APR_ANYADDR and make a note about its protocol dependence
Include mpm.h so that we know which MPM is being built and therefore when to export ap_listen_open().
Remove an unused header
updates to changed interfaces to apr_set_port(), apr_get_port(), apr_set_ipaddr(), and apr_get_ipaddr()
Change apr_bind() to take apr_sockaddr_t.
Clean up compiler warnings
Change the code to reflect the recent API changes... Alter http_vhost.c to use the new apr_get_inaddr fucntion. Old code is still there just in case it breaks. can someone check it who knows this stuff?
This adds the APR_LOCAL/APR_REMOTE to APR and changes the apr_get/set_port functions to use it. This is onyl the start and I'll pause a while before I continue in case people really hate this. The patch can be backed out and all evidence will be removed, but I think this makes maintaining/developing the code easier in the long term.
Start of moving to apr_port_t in the server code. This will probably the first of a few...
Add back the ap_disable_nagle call in make_sock. However, this is a performance enhancement only on platforms where turning off nagle is inherited by accepted sockets. Because this is not always true, in order to have the disable_nagle call active, the macro DISABLE_NAGLE_INHERITED must be defined. PR: 6531
Change prefork to use the same listen api as the rest of the unix mpms (ap_setup_listeners). This eliminates the need to force a recompile of listen.c when you switch to/from using prefork.
prefix libapr functions and types with apr_
Move all APR functions related to strings to their own directory, and create a new header for those functions. This is the first step to removing the apr/lib directory completely, and moving those files/functions to descriptive directories.
OS/2: Put back creation of listeners in main thread in spmt_os2 MPM.
Fix the prefork MPM to make it compile and work again out-of-the-box.
Move setup_listeners to listen.c. This renames it to ap_setup_listeners, and removes the duplicated code from all effected MPMs. The only this doesn't touch, is Windows. That MPM was using a different setup_listeners. If one of the Windows guys would like to modify the WinNT MPM to use the same setup_lsiteners, that would be VERY cool.
More consification, correct command initialisation.
Protect system header files with the appropriate macros.
Change ap_context_t to ap_pool_t. This compiles, runs, and serves pages on Linux, but probably breaks somewhere.
Update to Apache Software License version 1.1
change the error message logged for a bind() failure so that it shows the interface and port number; it is now very similar to the error message used in 1.3
Fix all the License issues. Including: s/Apache Group/Apache Software Foundation/ s/1999/2000/ s/Sascha's license/ASF license
Include ap_config.h before httpd.h, this ensures that AP_USE_HSREGEX is defined correctly in all C files.
Finish the commits for the change in the header files. Basically, this hides all of the Apache macros that modules don't need access to. This should have been committed with the modules, but I wasn't paying attention to the directory I was in when I ran the commit. Submitted by: Manoj Kasichainula and Ryan Bloom
Get rid of an implicit malloc, by making ap_create_tcp_socket use the process context.
Enhancements for APR network_io. Adds separate local/remote access methods for a socket's port, IP address and sockaddr_in. Updates for Apache code to use these, allowing the correct IP address of clients to be logged.
Add a status value to ap_log_error and ap_log_rerror. This allows us to use apr_status codes in our error logs. The main advantage of this, is portable error codes. Now, Windows will finally be able to use errno!
I cannot solve this right now. But this variable sure was uninitialized
Bring network code to the parameter order spec. This means contexts go last, and result parameters go first. Also fixed a small bug in the Makefile. We should be removing the libs dir when we do a distclean, we are now.
I think this was missed earlier, and as BeOS doesn't define SO_SNDBUF it was stopping the build. APR_SO_SNDBUF is defined and so all is well again.
Well this was thought provoking. Drive out the use of malloc in two places. In listen.c, using the global process pool instead. That changes the API into listen so that a process is passed in rather than the config pool. That's all was easy. The pain is propogating a change into all N of the mpm, they are all similar but different in their use of listen.c There is a lot to dislike about similar but code scattered code. I changed the N setup_listener routines, they now take only the server since they can dig the config and global pool out of there. Free today: ap_setup_prelinked_modules now takes the process so it can allocate it's table in the process's pool rathern than use malloc.
First patch to re-order function parameters. This one gets the low hanging fruit, and moves most of the result parameters to the first argument. Future patches in this series will move the rest of the result parameters to the beginning of the list, and will move the context's to the end of the list
Restarts were hosed after the APR changes because we were opening sockets even when we had them open already. So, for now, add an "active" flag that indicates whether the socket stored in the listen_rec is an actual open socket yet.
Make ap_getipaddr threadsafe.
Remove all of the calls to functions like "ap_popenf". These functions were moved down to APR, but they are being removed. They are not portable, and were only moved down for backwards compatability. With this change, they can be safely removed, which is the next commit on it's way. Submitted by: Ryan Bloom and Paul Reder
Changed pools to contexts. Tested with prefork and pthread mpm's. I'll check this out tomorrow and make sure everything was checked in correctly.
Forgot listen.c in the earlier AcceptEx patch to winnt.c. Enable winnt mpm to detech OS at runtime.
some bug fixes from David Submitted by: David Reid <beos@server1.jetnet.co.uk>
Change method of checking for active FDs after poll() in the pthread MPM. The new method doesn't require any changes to the listen abstraction.
Updated the pthread MPM to work with the rest of the code
- ap_listen.h: interface to Listen, ListenBackLog and SendBufferSize directives - I didn't update mpmt_pthread with this change, it shouldn't be hard to fix. - maybe this isn't the best way to abstract listen... but it gets a little bit of the job done
This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.
| apache@apache.org | ViewVC Help |
| Powered by ViewVC 1.1.2 |