[CDRIVER-54] IPV6 compile-time flag Created: 06/Apr/11 Updated: 03/May/17 Resolved: 22/Jan/14 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Kyle Banker | Assignee: | Mira Carey |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Comments |
| Comment by Ruslan Udovichenko [ 15/Oct/14 ] |
|
asdfsfd |
| Comment by Christian Hergert [ 22/Jan/14 ] |
|
Master now also has support for IPV6 literals such as: mongodb://[::1]:27017,[::2]:27017/?ssl=true |
| Comment by Christian Hergert [ 22/Jan/14 ] |
|
This is now fixed in the released mongo-c-driver as long as you use hostnames. For example, mongodb://localhost6/ works. What is still missing is URI parsing of IPV6 addresses using the [::1] style format. |
| Comment by Christian Hergert [ 08/Nov/13 ] |
|
The new C driver uses getaddrinfo as well, so this will be obsolete with the release of it. For those that want to be early testers, you need libbson and https://github.com/chergert/libmongoc. |
| Comment by Jonathan Hudson [ 23/Dec/11 ] |
|
The patch |
| Comment by Jonathan Hudson [ 23/Dec/11 ] |
|
I locally patched my C api source to (a) use getaddrinfo() (b) fix up some bugs / omissions in the extant use of getaddrinfo() and (c) create either an AF_INET of AF_INET6 socket depending of the result back from getaddrinfo(). It's probably a naive solution, put it fixed some problems I'd had where I'd defined a replica set with hostnames, and then use the C api (which only worked with IPv4 addresses). It may also address thus unresolved ticket. The patches follow. Please note I know even less Scons that 'C', so I've forced #define _GNU_SOURCE 1 in the platform/linux/net.h, which is probably undesirable. Apologies in advance if this is not how JIRA / mongo works (and there's a better way to submit patches) ... all new to me. -jonathan — platform/linux/net.orig.h 2011-12-23 14:16:22.907469604 +0000 +#define _GNU_SOURCE 1 #include <arpa/inet.h> #if defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) || _POSIX_C_SOURCE >= 1 -static int mongo_create_socket( mongo *conn ) {
memset( &hints, 0, sizeof( hints ) );
+ if( mongo_create_socket(conn, addrs->ai_family) != MONGO_OK ) setsockopt( conn->sock, IPPROTO_TCP, TCP_NODELAY, ( char * )&flag, sizeof( flag ) );
memset( sa.sin_zero , 0 , sizeof( sa.sin_zero ) ); |