View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000616 | LDMud 3.3 | Networking | public | 2009-03-15 08:47 | 2021-04-08 21:34 |
Reporter | fufu | Assigned To | fufu | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.3.718 | ||||
Summary | 0000616: IPv6 support is broken. | ||||
Description | Basically the implementation doesn't deal very well with the fact that it may encounter both IPv4 and IPv6 addresses when IPv6 support is enabled. As a result, using ldmud with IPv6 is slightly tricky. In particular ldmud is currently sensitive to the order of entries in /etc/hosts, and __HOST_IP_NUMBER__ is formatted wrong. (In Wunderland we get "8b12:b56::" as __HOST_IP_NUMBER__ -- 8b.12.0b.56 is its IPv4 address in hex.) I'm attaching a patch for these two problems, but I don't want to apply it. The proper fix, I think, is to teach ldmud to cope with several address families simultaneously, and that's what I'm planning to do. | ||||
Tags | No tags attached. | ||||
Attached Files | ipv6-bandaid.patch (2,387 bytes)
commit ae37faa3d620928c478b85ceaac571a2467ec305 Author: Bertram Felgenhauer <int-e@gmx.de> Date: Sun Feb 8 21:49:28 2009 +0100 some USE_IPV6 cleanups - if gethostbyname returns an IPv4 address for our host, convert it to IPv6 - use proper structs for IPv6 addresses (template and local name) Note: This patch is by no means comprehensive. The whole IPv6 support needs a review. diff --git a/src/comm.c b/src/comm.c index 0cd14c4..aa487b6 100644 --- a/src/comm.c +++ b/src/comm.c @@ -352,12 +352,20 @@ static char host_name[MAXHOSTNAMELEN+1]; /* This computer's hostname, used for query_host_name() efun. */ +#ifdef USE_IPV6 +static struct in6_addr host_ip_number; +#else static struct in_addr host_ip_number; +#endif /* This computer's numeric IP address only, used for * the query_host_ip_number() efun. */ +#ifdef USE_IPV6 +static struct sockaddr_in6 host_ip_addr_template; +#else static struct sockaddr_in host_ip_addr_template; +#endif /* The template address of this computer. It is copied locally * and augmented with varying port numbers to open the driver's ports. */ @@ -514,8 +522,7 @@ static INLINE ssize_t comm_send_buf(char *msg, size_t size, interactive_t *ip); static inline void CREATE_IPV6_MAPPED(struct in_addr *v6, uint32 v4) { v6->s6_addr32[0] = 0; v6->s6_addr32[1] = 0; - v6->s6_addr32[2] = 0x0000ffff; - v6->s6_addr32[2] = 0xffff0000; + v6->s6_addr32[2] = htonl(0x0000ffff); v6->s6_addr32[3] = v4; } @@ -1001,9 +1008,17 @@ initialize_host_ip_number (const char *hname, const char * haddr) , time_stamp(), host_name); exit(1); } +#ifdef USE_IPV6 + if (hp->h_addrtype == AF_INET6) { + memcpy(&host_ip_addr_template.sin_addr, hp->h_addr, (size_t)hp->h_length); + host_ip_number = host_ip_addr_template.sin_addr; + } else { + CREATE_IPV6_MAPPED(&host_ip_number, *(uint32_t *)hp->h_addr); + } +#else memcpy(&host_ip_addr_template.sin_addr, hp->h_addr, (size_t)hp->h_length); - host_ip_addr_template.sin_family = (unsigned short)hp->h_addrtype; host_ip_number = host_ip_addr_template.sin_addr; +#endif /* Now set the template to the proper _ANY value */ memset(&host_ip_addr_template.sin_addr, 0, sizeof(host_ip_addr_template.sin_addr)); | ||||
|
See @3023/8dcd3287f by Gnomi, which implements a better bandaid: it looks up the IPv6 address of the host if available, and falls back on an IPv6-mapped IPv4 address otherwise. When I wrote about dealing with several address families simultaneously, I suspect I wanted to render IPv4 addresses without the ::ffff: prefix, so that using a driver with IPv6 support from an IPv4 host would be just like running a driver without IPv6 support. But by now people will either have disabled IPv6 support or adapted the mudlib to cope with the prefixes... I don't want to change anything in this area anymore. |
Date Modified | Username | Field | Change |
---|---|---|---|
2009-03-15 08:47 | fufu | New Issue | |
2009-03-15 08:47 | fufu | Status | new => assigned |
2009-03-15 08:47 | fufu | Assigned To | => fufu |
2009-03-15 08:47 | fufu | File Added: ipv6-bandaid.patch | |
2009-05-05 13:50 | zesstra | Project | LDMud => LDMud 3.3 |
2009-05-23 15:29 | fufu | Relationship added | related to 0000425 |
2021-04-08 21:32 | fufu | Note Added: 0002573 | |
2021-04-08 21:34 | fufu | Status | assigned => resolved |
2021-04-08 21:34 | fufu | Resolution | open => fixed |