From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Aug 14 07:40:02 2008 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 398E21065683 for ; Thu, 14 Aug 2008 07:40:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 11E588FC22 for ; Thu, 14 Aug 2008 07:40:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m7E7e173041435 for ; Thu, 14 Aug 2008 07:40:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m7E7e1SL041434; Thu, 14 Aug 2008 07:40:01 GMT (envelope-from gnats) Resent-Date: Thu, 14 Aug 2008 07:40:01 GMT Resent-Message-Id: <200808140740.m7E7e1SL041434@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Tilman Linneweh Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E8531065673 for ; Thu, 14 Aug 2008 07:34:23 +0000 (UTC) (envelope-from arved@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 29FFC8FC13 for ; Thu, 14 Aug 2008 07:34:23 +0000 (UTC) (envelope-from arved@FreeBSD.org) Received: from freefall.freebsd.org (arved@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m7E7YNAX035765 for ; Thu, 14 Aug 2008 07:34:23 GMT (envelope-from arved@freefall.freebsd.org) Received: (from arved@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m7E7YNLL035764; Thu, 14 Aug 2008 07:34:23 GMT (envelope-from arved) Message-Id: <200808140734.m7E7YNLL035764@freefall.freebsd.org> Date: Thu, 14 Aug 2008 07:34:23 GMT From: Tilman Linneweh To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/126527: www/lighttpd Add IPv6 support to mod_proxy X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Tilman Linneweh List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Aug 2008 07:40:02 -0000 >Number: 126527 >Category: ports >Synopsis: www/lighttpd Add IPv6 support to mod_proxy >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Aug 14 07:40:01 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Tilman Linneweh >Release: FreeBSD 7.0-STABLE i386 >Organization: >Environment: System: FreeBSD freefall.freebsd.org 7.0-STABLE FreeBSD 7.0-STABLE #34: Sat Apr 12 11:52:18 UTC 2008 simon@freefall.freebsd.org:/usr/src/sys/i386/compile/FREEFALL i386 >Description: lighttpd's mod_proxy does not support IPv6. There has been a patch in lighttpd's trac, which works fine for me: http://trac.lighttpd.net/trac/ticket/1537 >How-To-Repeat: >Fix: --- patch-mod_proxy.c begins here --- --- src/mod_proxy.c 2007-08-18 03:17:00.000000000 +0500 +++ src/mod_proxy.c 2008-01-27 20:32:05.514825062 +0400 @@ -356,6 +356,7 @@ static int proxy_establish_connection(server *srv, handler_ctx *hctx) { struct sockaddr *proxy_addr; struct sockaddr_in proxy_addr_in; + struct sockaddr_in6 proxy_addr_in6; socklen_t servlen; plugin_data *p = hctx->plugin_data; @@ -364,12 +365,20 @@ memset(&proxy_addr, 0, sizeof(proxy_addr)); - proxy_addr_in.sin_family = AF_INET; - proxy_addr_in.sin_addr.s_addr = inet_addr(host->host->ptr); - proxy_addr_in.sin_port = htons(host->port); - servlen = sizeof(proxy_addr_in); + if (strstr(host->host->ptr,":")) { + proxy_addr_in6.sin6_family = AF_INET6; + inet_pton(AF_INET6,host->host->ptr,(char *)&proxy_addr_in6.sin6_addr); + proxy_addr_in6.sin6_port = htons(host->port); + servlen = sizeof(proxy_addr_in6); + proxy_addr = (struct sockaddr *) &proxy_addr_in6; + } else { + proxy_addr_in.sin_family = AF_INET; + proxy_addr_in.sin_addr.s_addr = inet_addr(host->host->ptr); + proxy_addr_in.sin_port = htons(host->port); + servlen = sizeof(proxy_addr_in); + proxy_addr = (struct sockaddr *) &proxy_addr_in; + } - proxy_addr = (struct sockaddr *) &proxy_addr_in; if (-1 == connect(proxy_fd, proxy_addr, servlen)) { if (errno == EINPROGRESS || errno == EALREADY) { @@ -740,9 +749,16 @@ switch(hctx->state) { case PROXY_STATE_INIT: - if (-1 == (hctx->fd = socket(AF_INET, SOCK_STREAM, 0))) { + if (strstr(host->host->ptr,":")) { + if (-1 == (hctx->fd = socket(AF_INET6, SOCK_STREAM, 0))) { + log_error_write(srv, __FILE__, __LINE__, "ss", "socket failed: ", strerror(errno)); + return HANDLER_ERROR; + } + } else { + if (-1 == (hctx->fd = socket(AF_INET, SOCK_STREAM, 0))) { log_error_write(srv, __FILE__, __LINE__, "ss", "socket failed: ", strerror(errno)); return HANDLER_ERROR; + } } hctx->fde_ndx = -1; --- patch-mod_proxy.c ends here --- >Release-Note: >Audit-Trail: >Unformatted: