<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:08:19 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CDRIVER-54] IPV6 compile-time flag</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-54</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description></description>
                <environment></environment>
        <key id="15495">CDRIVER-54</key>
            <summary>IPV6 compile-time flag</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="mira.carey@mongodb.com">Mira Carey</assignee>
                                    <reporter username="kbanker">Kyle Banker</reporter>
                        <labels>
                    </labels>
                <created>Wed, 6 Apr 2011 15:02:50 +0000</created>
                <updated>Wed, 3 May 2017 22:14:45 +0000</updated>
                            <resolved>Wed, 22 Jan 2014 21:06:44 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="741564" author="rudovichenko" created="Wed, 15 Oct 2014 12:09:52 +0000"  >&lt;p&gt;asdfsfd&lt;/p&gt;</comment>
                            <comment id="485995" author="christian.hergert@10gen.com" created="Wed, 22 Jan 2014 21:06:44 +0000"  >&lt;p&gt;Master now also has support for IPV6 literals such as:&lt;/p&gt;

&lt;p&gt;mongodb://&lt;span class=&quot;error&quot;&gt;&amp;#91;::1&amp;#93;&lt;/span&gt;:27017,&lt;span class=&quot;error&quot;&gt;&amp;#91;::2&amp;#93;&lt;/span&gt;:27017/?ssl=true&lt;/p&gt;</comment>
                            <comment id="485966" author="christian.hergert@10gen.com" created="Wed, 22 Jan 2014 20:46:51 +0000"  >&lt;p&gt;This is now fixed in the released mongo-c-driver as long as you use hostnames. For example, mongodb://localhost6/ works.&lt;/p&gt;

&lt;p&gt;What is still missing is URI parsing of IPV6 addresses using the &lt;span class=&quot;error&quot;&gt;&amp;#91;::1&amp;#93;&lt;/span&gt; style format.&lt;/p&gt;</comment>
                            <comment id="453924" author="christian.hergert@10gen.com" created="Fri, 8 Nov 2013 23:33:39 +0000"  >&lt;p&gt;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 &lt;a href=&quot;https://github.com/chergert/libmongoc&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/chergert/libmongoc&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="75651" author="spennig" created="Fri, 23 Dec 2011 14:36:11 +0000"  >&lt;p&gt;The patch&lt;/p&gt;</comment>
                            <comment id="75650" author="spennig" created="Fri, 23 Dec 2011 14:31:12 +0000"  >&lt;p&gt;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&apos;s probably a naive solution, put it fixed some problems I&apos;d had where I&apos;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.&lt;/p&gt;

&lt;p&gt;The patches follow. Please note I know even less Scons that &apos;C&apos;, so I&apos;ve forced #define _GNU_SOURCE 1 in the platform/linux/net.h, which is probably undesirable. &lt;/p&gt;

&lt;p&gt;Apologies in advance if this is not how JIRA / mongo works (and there&apos;s a better way to submit patches) ... all new to me.&lt;/p&gt;

&lt;p&gt;-jonathan&lt;/p&gt;


&lt;p&gt;&amp;#8212; platform/linux/net.orig.h   2011-12-23 14:16:22.907469604 +0000&lt;br/&gt;
+++ platform/linux/net.h        2011-12-23 14:08:12.856557766 +0000&lt;br/&gt;
@@ -22,6 +22,8 @@&lt;br/&gt;
 #ifndef &lt;em&gt;MONGO_NET_H&lt;/em&gt;&lt;br/&gt;
 #define &lt;em&gt;MONGO_NET_H&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;+#define _GNU_SOURCE 1&lt;br/&gt;
+&lt;br/&gt;
 #include &quot;mongo.h&quot;&lt;/p&gt;

&lt;p&gt; #include &amp;lt;arpa/inet.h&amp;gt;&lt;br/&gt;
@@ -33,6 +35,8 @@&lt;br/&gt;
 #include &amp;lt;netinet/tcp.h&amp;gt;&lt;br/&gt;
 #include &amp;lt;fcntl.h&amp;gt;&lt;br/&gt;
 #include &amp;lt;errno.h&amp;gt;&lt;br/&gt;
+#include &amp;lt;unistd.h&amp;gt;&lt;br/&gt;
+&lt;br/&gt;
 #define mongo_close_socket(sock) ( close(sock) )&lt;/p&gt;

&lt;p&gt; #if defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) || _POSIX_C_SOURCE &amp;gt;= 1&lt;br/&gt;
&amp;#8212; platform/linux/net.orig.c   2011-12-23 14:16:14.817344493 +0000&lt;br/&gt;
+++ platform/linux/net.c        2011-12-23 14:18:22.129313328 +0000&lt;br/&gt;
@@ -49,10 +49,10 @@&lt;br/&gt;
     return MONGO_OK;&lt;br/&gt;
 }&lt;/p&gt;

&lt;p&gt;-static int mongo_create_socket( mongo *conn ) {&lt;br/&gt;
+static int mongo_create_socket( mongo *conn, int sock_type ) {&lt;br/&gt;
     int fd;&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;if( ( fd = socket( AF_INET, SOCK_STREAM, 0 ) ) == -1 ) {&lt;br/&gt;
+    if( ( fd = socket( sock_type, SOCK_STREAM, 0 ) ) == -1 ) 
{
         conn-&amp;gt;err = MONGO_CONN_NO_SOCKET;
         return MONGO_ERROR;
     }
&lt;p&gt;@@ -113,28 +113,29 @@&lt;br/&gt;
     int flag = 1;&lt;br/&gt;
     char port_str&lt;span class=&quot;error&quot;&gt;&amp;#91;12&amp;#93;&lt;/span&gt;;&lt;br/&gt;
     int ret;&lt;br/&gt;
-&lt;br/&gt;
+    &lt;br/&gt;
     conn-&amp;gt;sock = 0;&lt;br/&gt;
     conn-&amp;gt;connected = 0;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;     memset( &amp;amp;hints, 0, sizeof( hints ) );&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;hints.ai_family = AF_INET;&lt;br/&gt;
+    hints.ai_family = AF_UNSPEC;&lt;br/&gt;
     hints.ai_socktype = SOCK_STREAM;&lt;br/&gt;
-&lt;/li&gt;
	&lt;li&gt;if( mongo_create_socket( conn ) != MONGO_OK )&lt;/li&gt;
	&lt;li&gt;return MONGO_ERROR;&lt;br/&gt;
-&lt;/li&gt;
	&lt;li&gt;if( getaddrinfo( host, port_str, &amp;amp;hints, &amp;amp;addrs ) != 0 ) {&lt;br/&gt;
+    sprintf(port_str,&quot;%d&quot;,port);&lt;br/&gt;
+    &lt;br/&gt;
+    if( (ret = getaddrinfo( host, port_str, &amp;amp;hints, &amp;amp;addrs )) != 0 ) 
{


         bson_errprintf( &quot;getaddrinfo failed: %s&quot;, gai_strerror( ret ) );
         conn-&amp;gt;err = MONGO_CONN_ADDR_FAIL;
         return MONGO_ERROR;
     }&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;+    if( mongo_create_socket(conn, addrs-&amp;gt;ai_family) != MONGO_OK )&lt;br/&gt;
+        return MONGO_ERROR;&lt;br/&gt;
+    &lt;br/&gt;
     if ( connect( conn-&amp;gt;sock, addrs-&amp;gt;ai_addr, addrs-&amp;gt;ai_addrlen ) == -1 ) &lt;/p&gt;
{
         mongo_close_socket( conn-&amp;gt;sock );
         freeaddrinfo( addrs );
         conn-&amp;gt;err = MONGO_CONN_FAIL;
-        return MONGO_ERROR:
+        return MONGO_ERROR;
     }

&lt;p&gt;     setsockopt( conn-&amp;gt;sock, IPPROTO_TCP, TCP_NODELAY, ( char * )&amp;amp;flag, sizeof( flag ) );&lt;br/&gt;
@@ -152,7 +153,7 @@&lt;br/&gt;
     socklen_t addressSize;&lt;br/&gt;
     int flag = 1;&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;if( mongo_create_socket( conn ) != MONGO_OK )&lt;br/&gt;
+    if( mongo_create_socket(conn, AF_INET) != MONGO_OK )&lt;br/&gt;
         return MONGO_ERROR;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;     memset( sa.sin_zero , 0 , sizeof( sa.sin_zero ) );&lt;/p&gt;


</comment>
                    </comments>
                    <attachments>
                            <attachment id="14236" name="mongo-c-ipv6.dif" size="2420" author="spennig" created="Fri, 23 Dec 2011 14:36:11 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrggzj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9690</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="62">Sprint 3</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>