You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Jeff Trawick <tr...@attglobal.net> on 2003/05/26 01:18:29 UTC
Re: [PATCH] apr_os_sock_put() fixup
weigelt@metux.de wrote:
> hi folks,
>
> here's an little patch for fixing address problems when using
> apr_os_sock_put(). it fetches the socket addresses w/ getsockname()
> and getpeername() and puts them into the apr-socket structure.
1) apr_os_sock_put() should not be changed to do those syscalls. Some
callers use apr_os_sock_put() to make sockets and never need the local
or remote names, and they shouldn't suffer the syscalls.
2) apr_os_sock_put() remembers that it doesn't know the remote and local
names, so if the app ever queries for such info apr will do the
getsockname() or getpeername() then. So I wonder why you need to modify
apr_os_sock_put() in the first place. Maybe you found a hole in the
existing logic to make the syscall if/when such info is queried? If so,
maybe that is what needs some changes.
3) Check out apr_os_sock_make(), which allows the caller to specify the
remote and/or local address if for some reason you need the info known
at the time the apr_socket_t is created. The app would have to make the
call(s), but if you're an Apache MPM don't you already know that
information?
Re: [PATCH] apr_os_sock_put() fixup
Posted by Jeff Trawick <tr...@attglobal.net>.
weigelt@metux.de wrote:
> On Sun, May 25, 2003 at 07:18:29PM -0400, Jeff Trawick wrote:
>
> hi,
>
> <snip>
>
>>2) apr_os_sock_put() remembers that it doesn't know the remote and local
>>names, so if the app ever queries for such info apr will do the
>>getsockname() or getpeername() then. So I wonder why you need to modify
>>apr_os_sock_put() in the first place.
>
> We had the problem that requests coming from sockets created w/
> apr_os_sock_put() are not logged correctly.
Here is why I think it should work okay... perhaps some debugging on
your side will show which assumption is incorrect.
1) apr_os_sock_put() sets the local_interface_unknown flag to 1
2) Apache's core_create_conn() hook is called as a create_connection()
hook. It fills out c->local_addr by calling apr_socket_addr_get().
3) apr_socket_addr_get() sees that the local_interface_unknown flag in
the socket is 1, so it calls get_local_addr() which calls getsockname()
and all is well.
4) Apache's core_create_conn() calls apr_sockaddr_ip_get() passing in
c->local_addr, and fills in c->local_ip which is what the logging code uses.
So see where we deviate with muxmpm and we should be able to figure out
what to fix.
> (please have a look at our muxmpm code)
sorry, can't find it now, don't have time anyway :(
Re: [PATCH] apr_os_sock_put() fixup
Posted by we...@metux.de.
On Sun, May 25, 2003 at 07:18:29PM -0400, Jeff Trawick wrote:
hi,
<snip>
> 2) apr_os_sock_put() remembers that it doesn't know the remote and local
> names, so if the app ever queries for such info apr will do the
> getsockname() or getpeername() then. So I wonder why you need to modify
> apr_os_sock_put() in the first place.
We had the problem that requests coming from sockets created w/
apr_os_sock_put() are not logged correctly.
(please have a look at our muxmpm code)
cu
--
---------------------------------------------------------------------
Enrico Weigelt == metux ITS
Webhosting ab 5 EUR/Monat. UUCP, rawIP und vieles mehr.
phone: +49 36207 519931 www: http://www.metux.de/
fax: +49 36207 519932 email: contact@metux.de
cellphone: +49 174 7066481 smsgate: sms.weigelt@metux.de
---------------------------------------------------------------------
Diese Mail wurde mit UUCP versandt. http://www.metux.de/uucp/