Bug 230382 - www/thttpd REAL_IP patch is IPv4-only
Summary: www/thttpd REAL_IP patch is IPv4-only
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Alexey Dokuchaev
Depends on:
Blocks: 232348
  Show dependency treegraph
Reported: 2018-08-05 16:07 UTC by Bjoern A. Zeeb
Modified: 2020-02-11 07:08 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Bjoern A. Zeeb freebsd_committer 2018-08-05 16:07:04 UTC
In ports r377229 the thttps REAL_IP patch was added based on something from NginX if I understand the dead link reference correctly.  That cripples IPv6 ready software to IPv4 only.  Here's an entirely untested change to the diff you might want to apply:

                { // Use real IP if available
                cp = &buf[16];
                cp += strspn( cp, " \t" );
-               inet_aton( cp, &(hc->client_addr.sa_in.sin_addr) );
+#ifdef USE_IPV6
+               if (strchr(cp, '.') == NULL)
+                       inet_pton(AF_INET6, cp,
+                           &(hc->client_addr.sa_in6.sin6_addr) );
+               else
+                       inet_aton( cp, &(hc->client_addr.sa_in.sin_addr) );
Comment 1 commit-hook freebsd_committer 2020-02-11 07:07:30 UTC
A commit references this bug:

Author: danfe
Date: Tue Feb 11 07:07:14 UTC 2020
New revision: 525787
URL: https://svnweb.freebsd.org/changeset/ports/525787

  In r377229, the REAL_IP patch from NginX was added that puts X-Forwarded-For
  into Remote-Addr.  That cripples IPv6 ready software to IPv4 only, let's try
  to fix this.

  PR:		230382
  Submitted by:	bz

Comment 2 Alexey Dokuchaev freebsd_committer 2020-02-11 07:08:34 UTC
Applied in ports r525787, thanks!