Edgewall Software

Ticket #5820 (new defect)

Opened 17 months ago

Last modified 6 months ago

standalone trac does not accept -b "::"

Reported by: sgala@… Owned by: jonas
Priority: low Milestone: 1.0
Component: web frontend/tracd Version: 0.11
Severity: normal Keywords: ipv6
Cc:

Description

(error is: socket.gaierror: (-9, "Address family for hostname not supported")

The way sockets are initialized is wrong. trac (or the underlying wsgi code for python 2.4) is assuming socket.AF_INET before even knowing the server address.

Standard code for initializing a ipv6 aware socket, that will work in ipv4-only machines (see U. Drepper tutorial) is:

>>> import socket
>>> gais = socket.getaddrinfo("::",8000, socket.AF_UNSPEC, socket.SOCK_STREAM) # host, port, af, tcp, ... 
>>> for gai in gais:
...   try:
...     sock = socket.socket(*gai[:2])
...     sock.bind(gai[4])
...     break
...   except:
...     continue
... else:
...   sock = None
...   raise "Error, couldn't bind"

or something similar. This code should work on any python having getaddrinfo, which means anything modern enough. In fact this code will try to bind in any different possibilities given.

None means localhost in the most general way (127.0.0.1 or ::1); "::" or "0.0.0.0" means any ipv6/ipv4 or any ipv4 address. For concrete addresses, getaddrinfo will parse and take care of the socket parameters.

Attachments

Change History

Changed 17 months ago by eblot

  • component changed from general to tracd

Changed 6 months ago by anonymous

someone should change this ticket to "tracd doesn't support IPv6" -b "::" doesn't ring a bell for most people... BTW this ticket is still valid for trac 0.11

Changed 6 months ago by Piotr Kuczynski <piotr.kuczynski@…>

  • keywords ipv6 added
  • priority changed from normal to low
  • version set to 0.11
  • milestone set to 1.0

Add/Change #5820 (standalone trac does not accept -b "::")

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from jonas. Next status will be 'new'
The owner will change from jonas to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.