You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Isabel Drost (JIRA)" <ji...@apache.org> on 2009/09/21 11:18:16 UTC

[jira] Created: (ZOOKEEPER-530) Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size

Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size
-------------------------------------------------------------------------------------------------

                 Key: ZOOKEEPER-530
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-530
             Project: Zookeeper
          Issue Type: Bug
          Components: c client
    Affects Versions: 3.2.1, 3.2.0
            Reporter: Isabel Drost


I tried to run zookeeper c-client on a machine with IPv6 enabled. When connecting to the IPv6 address a connect(...) gave a "Address family not supported by protocol" error. The reason was, that a few lines earlier, the socket was opened with PF_INET instead of PF_INET6. Changing that the following way:

{code}
           if (zh->addrs[zh->connect_index].sa_family == AF_INET) {
            	zh->fd = socket(PF_INET, SOCK_STREAM, 0);
            } else {
            	zh->fd = socket(PF_INET6, SOCK_STREAM, 0);
            }
{code}

turned the error message into "Invalid argument". 

When printing out sizeof(struct sockaddr), sizeof(struct sockaddr_in) and sizeof(struct sockaddr_in6) I got sockaddr: 16, sockaddr_in: 16 and sockaddr_in6: 28. 

So in the code calling 

{code}
           connect(zh->fd, &zh->addrs[zh->connect_index], sizeof(struct sockaddr_in));
{code}

the parameter address_len is too small.

Same applies to how IPv6 addresses are handled in the function getaddrs(zhandle_t *zh).

(Big Thanks+kiss to Thilo Fromm for helping me debug this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-530) Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size

Posted by "Isabel Drost (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-530?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Isabel Drost updated ZOOKEEPER-530:
-----------------------------------

    Attachment: ZOOKEEPER-530.patch

Changed error code and error message.

> Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size
> -------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-530
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-530
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.2.0, 3.2.1
>            Reporter: Isabel Drost
>            Assignee: Isabel Drost
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-530.patch, ZOOKEEPER-530.patch
>
>
> I tried to run zookeeper c-client on a machine with IPv6 enabled. When connecting to the IPv6 address a connect(...) gave a "Address family not supported by protocol" error. The reason was, that a few lines earlier, the socket was opened with PF_INET instead of PF_INET6. Changing that the following way:
> {code}
>            if (zh->addrs[zh->connect_index].sa_family == AF_INET) {
>             	zh->fd = socket(PF_INET, SOCK_STREAM, 0);
>             } else {
>             	zh->fd = socket(PF_INET6, SOCK_STREAM, 0);
>             }
> {code}
> turned the error message into "Invalid argument". 
> When printing out sizeof(struct sockaddr), sizeof(struct sockaddr_in) and sizeof(struct sockaddr_in6) I got sockaddr: 16, sockaddr_in: 16 and sockaddr_in6: 28. 
> So in the code calling 
> {code}
>            connect(zh->fd, &zh->addrs[zh->connect_index], sizeof(struct sockaddr_in));
> {code}
> the parameter address_len is too small.
> Same applies to how IPv6 addresses are handled in the function getaddrs(zhandle_t *zh).
> (Big Thanks+kiss to Thilo Fromm for helping me debug this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-530) Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12768354#action_12768354 ] 

Hadoop QA commented on ZOOKEEPER-530:
-------------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12422653/ZOOKEEPER-530.patch
  against trunk revision 826787.

    +1 @author.  The patch does not contain any @author tags.

    -1 tests included.  The patch doesn't appear to include any new or modified tests.
                        Please justify why no tests are needed for this patch.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    +1 findbugs.  The patch does not introduce any new Findbugs warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

    +1 core tests.  The patch passed core unit tests.

    +1 contrib tests.  The patch passed contrib unit tests.

Test results: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/34/testReport/
Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/34/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/34/console

This message is automatically generated.

> Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size
> -------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-530
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-530
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.2.0, 3.2.1
>            Reporter: Isabel Drost
>            Assignee: Isabel Drost
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-530.patch, ZOOKEEPER-530.patch
>
>
> I tried to run zookeeper c-client on a machine with IPv6 enabled. When connecting to the IPv6 address a connect(...) gave a "Address family not supported by protocol" error. The reason was, that a few lines earlier, the socket was opened with PF_INET instead of PF_INET6. Changing that the following way:
> {code}
>            if (zh->addrs[zh->connect_index].sa_family == AF_INET) {
>             	zh->fd = socket(PF_INET, SOCK_STREAM, 0);
>             } else {
>             	zh->fd = socket(PF_INET6, SOCK_STREAM, 0);
>             }
> {code}
> turned the error message into "Invalid argument". 
> When printing out sizeof(struct sockaddr), sizeof(struct sockaddr_in) and sizeof(struct sockaddr_in6) I got sockaddr: 16, sockaddr_in: 16 and sockaddr_in6: 28. 
> So in the code calling 
> {code}
>            connect(zh->fd, &zh->addrs[zh->connect_index], sizeof(struct sockaddr_in));
> {code}
> the parameter address_len is too small.
> Same applies to how IPv6 addresses are handled in the function getaddrs(zhandle_t *zh).
> (Big Thanks+kiss to Thilo Fromm for helping me debug this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-530) Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12765950#action_12765950 ] 

Hadoop QA commented on ZOOKEEPER-530:
-------------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12420179/ZOOKEEPER-530.patch
  against trunk revision 824981.

    +1 @author.  The patch does not contain any @author tags.

    -1 tests included.  The patch doesn't appear to include any new or modified tests.
                        Please justify why no tests are needed for this patch.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    +1 findbugs.  The patch does not introduce any new Findbugs warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

    +1 core tests.  The patch passed core unit tests.

    +1 contrib tests.  The patch passed contrib unit tests.

Test results: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/26/testReport/
Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/26/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/26/console

This message is automatically generated.

> Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size
> -------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-530
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-530
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.2.0, 3.2.1
>            Reporter: Isabel Drost
>            Assignee: Isabel Drost
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-530.patch
>
>
> I tried to run zookeeper c-client on a machine with IPv6 enabled. When connecting to the IPv6 address a connect(...) gave a "Address family not supported by protocol" error. The reason was, that a few lines earlier, the socket was opened with PF_INET instead of PF_INET6. Changing that the following way:
> {code}
>            if (zh->addrs[zh->connect_index].sa_family == AF_INET) {
>             	zh->fd = socket(PF_INET, SOCK_STREAM, 0);
>             } else {
>             	zh->fd = socket(PF_INET6, SOCK_STREAM, 0);
>             }
> {code}
> turned the error message into "Invalid argument". 
> When printing out sizeof(struct sockaddr), sizeof(struct sockaddr_in) and sizeof(struct sockaddr_in6) I got sockaddr: 16, sockaddr_in: 16 and sockaddr_in6: 28. 
> So in the code calling 
> {code}
>            connect(zh->fd, &zh->addrs[zh->connect_index], sizeof(struct sockaddr_in));
> {code}
> the parameter address_len is too small.
> Same applies to how IPv6 addresses are handled in the function getaddrs(zhandle_t *zh).
> (Big Thanks+kiss to Thilo Fromm for helping me debug this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-530) Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12765651#action_12765651 ] 

Patrick Hunt commented on ZOOKEEPER-530:
----------------------------------------

Isabel, is this ready for review? Please click the "submit patch" link if so. 

Also, is there some test we can add for this? Or we just need to run the existing tests on IPv6?


> Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size
> -------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-530
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-530
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.2.0, 3.2.1
>            Reporter: Isabel Drost
>            Assignee: Isabel Drost
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-530.patch
>
>
> I tried to run zookeeper c-client on a machine with IPv6 enabled. When connecting to the IPv6 address a connect(...) gave a "Address family not supported by protocol" error. The reason was, that a few lines earlier, the socket was opened with PF_INET instead of PF_INET6. Changing that the following way:
> {code}
>            if (zh->addrs[zh->connect_index].sa_family == AF_INET) {
>             	zh->fd = socket(PF_INET, SOCK_STREAM, 0);
>             } else {
>             	zh->fd = socket(PF_INET6, SOCK_STREAM, 0);
>             }
> {code}
> turned the error message into "Invalid argument". 
> When printing out sizeof(struct sockaddr), sizeof(struct sockaddr_in) and sizeof(struct sockaddr_in6) I got sockaddr: 16, sockaddr_in: 16 and sockaddr_in6: 28. 
> So in the code calling 
> {code}
>            connect(zh->fd, &zh->addrs[zh->connect_index], sizeof(struct sockaddr_in));
> {code}
> the parameter address_len is too small.
> Same applies to how IPv6 addresses are handled in the function getaddrs(zhandle_t *zh).
> (Big Thanks+kiss to Thilo Fromm for helping me debug this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-530) Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-530?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mahadev konar updated ZOOKEEPER-530:
------------------------------------

    Fix Version/s: 3.3.0
         Assignee: Isabel Drost

> Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size
> -------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-530
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-530
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.2.0, 3.2.1
>            Reporter: Isabel Drost
>            Assignee: Isabel Drost
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-530.patch
>
>
> I tried to run zookeeper c-client on a machine with IPv6 enabled. When connecting to the IPv6 address a connect(...) gave a "Address family not supported by protocol" error. The reason was, that a few lines earlier, the socket was opened with PF_INET instead of PF_INET6. Changing that the following way:
> {code}
>            if (zh->addrs[zh->connect_index].sa_family == AF_INET) {
>             	zh->fd = socket(PF_INET, SOCK_STREAM, 0);
>             } else {
>             	zh->fd = socket(PF_INET6, SOCK_STREAM, 0);
>             }
> {code}
> turned the error message into "Invalid argument". 
> When printing out sizeof(struct sockaddr), sizeof(struct sockaddr_in) and sizeof(struct sockaddr_in6) I got sockaddr: 16, sockaddr_in: 16 and sockaddr_in6: 28. 
> So in the code calling 
> {code}
>            connect(zh->fd, &zh->addrs[zh->connect_index], sizeof(struct sockaddr_in));
> {code}
> the parameter address_len is too small.
> Same applies to how IPv6 addresses are handled in the function getaddrs(zhandle_t *zh).
> (Big Thanks+kiss to Thilo Fromm for helping me debug this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-530) Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12768416#action_12768416 ] 

Mahadev konar commented on ZOOKEEPER-530:
-----------------------------------------

+1 the patch looks good.... 

> Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size
> -------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-530
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-530
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.2.0, 3.2.1
>            Reporter: Isabel Drost
>            Assignee: Isabel Drost
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-530.patch, ZOOKEEPER-530.patch
>
>
> I tried to run zookeeper c-client on a machine with IPv6 enabled. When connecting to the IPv6 address a connect(...) gave a "Address family not supported by protocol" error. The reason was, that a few lines earlier, the socket was opened with PF_INET instead of PF_INET6. Changing that the following way:
> {code}
>            if (zh->addrs[zh->connect_index].sa_family == AF_INET) {
>             	zh->fd = socket(PF_INET, SOCK_STREAM, 0);
>             } else {
>             	zh->fd = socket(PF_INET6, SOCK_STREAM, 0);
>             }
> {code}
> turned the error message into "Invalid argument". 
> When printing out sizeof(struct sockaddr), sizeof(struct sockaddr_in) and sizeof(struct sockaddr_in6) I got sockaddr: 16, sockaddr_in: 16 and sockaddr_in6: 28. 
> So in the code calling 
> {code}
>            connect(zh->fd, &zh->addrs[zh->connect_index], sizeof(struct sockaddr_in));
> {code}
> the parameter address_len is too small.
> Same applies to how IPv6 addresses are handled in the function getaddrs(zhandle_t *zh).
> (Big Thanks+kiss to Thilo Fromm for helping me debug this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-530) Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size

Posted by "Isabel Drost (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-530?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Isabel Drost updated ZOOKEEPER-530:
-----------------------------------

    Attachment: ZOOKEEPER-530.patch

These changes fix the problem for me.

> Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size
> -------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-530
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-530
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.2.0, 3.2.1
>            Reporter: Isabel Drost
>         Attachments: ZOOKEEPER-530.patch
>
>
> I tried to run zookeeper c-client on a machine with IPv6 enabled. When connecting to the IPv6 address a connect(...) gave a "Address family not supported by protocol" error. The reason was, that a few lines earlier, the socket was opened with PF_INET instead of PF_INET6. Changing that the following way:
> {code}
>            if (zh->addrs[zh->connect_index].sa_family == AF_INET) {
>             	zh->fd = socket(PF_INET, SOCK_STREAM, 0);
>             } else {
>             	zh->fd = socket(PF_INET6, SOCK_STREAM, 0);
>             }
> {code}
> turned the error message into "Invalid argument". 
> When printing out sizeof(struct sockaddr), sizeof(struct sockaddr_in) and sizeof(struct sockaddr_in6) I got sockaddr: 16, sockaddr_in: 16 and sockaddr_in6: 28. 
> So in the code calling 
> {code}
>            connect(zh->fd, &zh->addrs[zh->connect_index], sizeof(struct sockaddr_in));
> {code}
> the parameter address_len is too small.
> Same applies to how IPv6 addresses are handled in the function getaddrs(zhandle_t *zh).
> (Big Thanks+kiss to Thilo Fromm for helping me debug this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-530) Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12768642#action_12768642 ] 

Hudson commented on ZOOKEEPER-530:
----------------------------------

Integrated in ZooKeeper-trunk #505 (See [http://hudson.zones.apache.org/hudson/job/ZooKeeper-trunk/505/])
    . Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size (isabel drost via mahadev)


> Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size
> -------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-530
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-530
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.2.0, 3.2.1
>            Reporter: Isabel Drost
>            Assignee: Isabel Drost
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-530.patch, ZOOKEEPER-530.patch, ZOOKEEPER-530_spaces.patch
>
>
> I tried to run zookeeper c-client on a machine with IPv6 enabled. When connecting to the IPv6 address a connect(...) gave a "Address family not supported by protocol" error. The reason was, that a few lines earlier, the socket was opened with PF_INET instead of PF_INET6. Changing that the following way:
> {code}
>            if (zh->addrs[zh->connect_index].sa_family == AF_INET) {
>             	zh->fd = socket(PF_INET, SOCK_STREAM, 0);
>             } else {
>             	zh->fd = socket(PF_INET6, SOCK_STREAM, 0);
>             }
> {code}
> turned the error message into "Invalid argument". 
> When printing out sizeof(struct sockaddr), sizeof(struct sockaddr_in) and sizeof(struct sockaddr_in6) I got sockaddr: 16, sockaddr_in: 16 and sockaddr_in6: 28. 
> So in the code calling 
> {code}
>            connect(zh->fd, &zh->addrs[zh->connect_index], sizeof(struct sockaddr_in));
> {code}
> the parameter address_len is too small.
> Same applies to how IPv6 addresses are handled in the function getaddrs(zhandle_t *zh).
> (Big Thanks+kiss to Thilo Fromm for helping me debug this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-530) Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size

Posted by "Isabel Drost (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-530?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Isabel Drost updated ZOOKEEPER-530:
-----------------------------------

    Status: Patch Available  (was: Open)

> Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size
> -------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-530
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-530
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.2.1, 3.2.0
>            Reporter: Isabel Drost
>            Assignee: Isabel Drost
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-530.patch
>
>
> I tried to run zookeeper c-client on a machine with IPv6 enabled. When connecting to the IPv6 address a connect(...) gave a "Address family not supported by protocol" error. The reason was, that a few lines earlier, the socket was opened with PF_INET instead of PF_INET6. Changing that the following way:
> {code}
>            if (zh->addrs[zh->connect_index].sa_family == AF_INET) {
>             	zh->fd = socket(PF_INET, SOCK_STREAM, 0);
>             } else {
>             	zh->fd = socket(PF_INET6, SOCK_STREAM, 0);
>             }
> {code}
> turned the error message into "Invalid argument". 
> When printing out sizeof(struct sockaddr), sizeof(struct sockaddr_in) and sizeof(struct sockaddr_in6) I got sockaddr: 16, sockaddr_in: 16 and sockaddr_in6: 28. 
> So in the code calling 
> {code}
>            connect(zh->fd, &zh->addrs[zh->connect_index], sizeof(struct sockaddr_in));
> {code}
> the parameter address_len is too small.
> Same applies to how IPv6 addresses are handled in the function getaddrs(zhandle_t *zh).
> (Big Thanks+kiss to Thilo Fromm for helping me debug this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-530) Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12767637#action_12767637 ] 

Mahadev konar commented on ZOOKEEPER-530:
-----------------------------------------

Isabel, the patch looks good. thanks for the fix. 

One thing I noticed in the patch is this -

{code}
	zh->fd = socket(zh->addrs[zh->connect_index].ss_family, SOCK_STREAM, 0);
			if (zh->fd < 0) {
				return api_epilog(zh,handle_socket_error_msg(zh,__LINE__,
				            ZCONNECTIONLOSS,"connect() call failed"));
			}
{code}

there is a new error check, which is a good thing, but can the error be changed to ZSYSTEMERROR, the log message to socket() call failed?




> Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size
> -------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-530
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-530
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.2.0, 3.2.1
>            Reporter: Isabel Drost
>            Assignee: Isabel Drost
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-530.patch
>
>
> I tried to run zookeeper c-client on a machine with IPv6 enabled. When connecting to the IPv6 address a connect(...) gave a "Address family not supported by protocol" error. The reason was, that a few lines earlier, the socket was opened with PF_INET instead of PF_INET6. Changing that the following way:
> {code}
>            if (zh->addrs[zh->connect_index].sa_family == AF_INET) {
>             	zh->fd = socket(PF_INET, SOCK_STREAM, 0);
>             } else {
>             	zh->fd = socket(PF_INET6, SOCK_STREAM, 0);
>             }
> {code}
> turned the error message into "Invalid argument". 
> When printing out sizeof(struct sockaddr), sizeof(struct sockaddr_in) and sizeof(struct sockaddr_in6) I got sockaddr: 16, sockaddr_in: 16 and sockaddr_in6: 28. 
> So in the code calling 
> {code}
>            connect(zh->fd, &zh->addrs[zh->connect_index], sizeof(struct sockaddr_in));
> {code}
> the parameter address_len is too small.
> Same applies to how IPv6 addresses are handled in the function getaddrs(zhandle_t *zh).
> (Big Thanks+kiss to Thilo Fromm for helping me debug this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-530) Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-530?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mahadev konar updated ZOOKEEPER-530:
------------------------------------

    Attachment: ZOOKEEPER-530_spaces.patch

one minor change ... there were tabs in the patch . I just changed it to spaces... will commit it... 

> Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size
> -------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-530
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-530
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.2.0, 3.2.1
>            Reporter: Isabel Drost
>            Assignee: Isabel Drost
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-530.patch, ZOOKEEPER-530.patch, ZOOKEEPER-530_spaces.patch
>
>
> I tried to run zookeeper c-client on a machine with IPv6 enabled. When connecting to the IPv6 address a connect(...) gave a "Address family not supported by protocol" error. The reason was, that a few lines earlier, the socket was opened with PF_INET instead of PF_INET6. Changing that the following way:
> {code}
>            if (zh->addrs[zh->connect_index].sa_family == AF_INET) {
>             	zh->fd = socket(PF_INET, SOCK_STREAM, 0);
>             } else {
>             	zh->fd = socket(PF_INET6, SOCK_STREAM, 0);
>             }
> {code}
> turned the error message into "Invalid argument". 
> When printing out sizeof(struct sockaddr), sizeof(struct sockaddr_in) and sizeof(struct sockaddr_in6) I got sockaddr: 16, sockaddr_in: 16 and sockaddr_in6: 28. 
> So in the code calling 
> {code}
>            connect(zh->fd, &zh->addrs[zh->connect_index], sizeof(struct sockaddr_in));
> {code}
> the parameter address_len is too small.
> Same applies to how IPv6 addresses are handled in the function getaddrs(zhandle_t *zh).
> (Big Thanks+kiss to Thilo Fromm for helping me debug this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-530) Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size

Posted by "Isabel Drost (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12757854#action_12757854 ] 

Isabel Drost commented on ZOOKEEPER-530:
----------------------------------------

Just found with man 7 ipv6:

NOTES
The sockaddr_in6 structure is bigger than the generic sockaddr.  Programs that assume that all address types can be stored safely in a struct sockaddr need to be changed to use struct sockaddr_storage for that instead.

> Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size
> -------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-530
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-530
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.2.0, 3.2.1
>            Reporter: Isabel Drost
>
> I tried to run zookeeper c-client on a machine with IPv6 enabled. When connecting to the IPv6 address a connect(...) gave a "Address family not supported by protocol" error. The reason was, that a few lines earlier, the socket was opened with PF_INET instead of PF_INET6. Changing that the following way:
> {code}
>            if (zh->addrs[zh->connect_index].sa_family == AF_INET) {
>             	zh->fd = socket(PF_INET, SOCK_STREAM, 0);
>             } else {
>             	zh->fd = socket(PF_INET6, SOCK_STREAM, 0);
>             }
> {code}
> turned the error message into "Invalid argument". 
> When printing out sizeof(struct sockaddr), sizeof(struct sockaddr_in) and sizeof(struct sockaddr_in6) I got sockaddr: 16, sockaddr_in: 16 and sockaddr_in6: 28. 
> So in the code calling 
> {code}
>            connect(zh->fd, &zh->addrs[zh->connect_index], sizeof(struct sockaddr_in));
> {code}
> the parameter address_len is too small.
> Same applies to how IPv6 addresses are handled in the function getaddrs(zhandle_t *zh).
> (Big Thanks+kiss to Thilo Fromm for helping me debug this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-530) Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-530?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt updated ZOOKEEPER-530:
-----------------------------------

    Status: Patch Available  (was: Open)

> Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size
> -------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-530
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-530
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.2.1, 3.2.0
>            Reporter: Isabel Drost
>            Assignee: Isabel Drost
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-530.patch, ZOOKEEPER-530.patch
>
>
> I tried to run zookeeper c-client on a machine with IPv6 enabled. When connecting to the IPv6 address a connect(...) gave a "Address family not supported by protocol" error. The reason was, that a few lines earlier, the socket was opened with PF_INET instead of PF_INET6. Changing that the following way:
> {code}
>            if (zh->addrs[zh->connect_index].sa_family == AF_INET) {
>             	zh->fd = socket(PF_INET, SOCK_STREAM, 0);
>             } else {
>             	zh->fd = socket(PF_INET6, SOCK_STREAM, 0);
>             }
> {code}
> turned the error message into "Invalid argument". 
> When printing out sizeof(struct sockaddr), sizeof(struct sockaddr_in) and sizeof(struct sockaddr_in6) I got sockaddr: 16, sockaddr_in: 16 and sockaddr_in6: 28. 
> So in the code calling 
> {code}
>            connect(zh->fd, &zh->addrs[zh->connect_index], sizeof(struct sockaddr_in));
> {code}
> the parameter address_len is too small.
> Same applies to how IPv6 addresses are handled in the function getaddrs(zhandle_t *zh).
> (Big Thanks+kiss to Thilo Fromm for helping me debug this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-530) Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size

Posted by "Isabel Drost (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12765945#action_12765945 ] 

Isabel Drost commented on ZOOKEEPER-530:
----------------------------------------

As explained above, I just tried to use the c-client on a 64bit system with IPv6 support (SuSE 10.3), when connecting to the server I got the errors from above - not consistently though: Whenever the client decided to connect to the IPv4 address all would work fine. So running the existing tests on a IPv6 only, 64bit system should do the trick, I do not know what a test that checks exactly that scenario might look like.

> Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size
> -------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-530
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-530
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.2.0, 3.2.1
>            Reporter: Isabel Drost
>            Assignee: Isabel Drost
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-530.patch
>
>
> I tried to run zookeeper c-client on a machine with IPv6 enabled. When connecting to the IPv6 address a connect(...) gave a "Address family not supported by protocol" error. The reason was, that a few lines earlier, the socket was opened with PF_INET instead of PF_INET6. Changing that the following way:
> {code}
>            if (zh->addrs[zh->connect_index].sa_family == AF_INET) {
>             	zh->fd = socket(PF_INET, SOCK_STREAM, 0);
>             } else {
>             	zh->fd = socket(PF_INET6, SOCK_STREAM, 0);
>             }
> {code}
> turned the error message into "Invalid argument". 
> When printing out sizeof(struct sockaddr), sizeof(struct sockaddr_in) and sizeof(struct sockaddr_in6) I got sockaddr: 16, sockaddr_in: 16 and sockaddr_in6: 28. 
> So in the code calling 
> {code}
>            connect(zh->fd, &zh->addrs[zh->connect_index], sizeof(struct sockaddr_in));
> {code}
> the parameter address_len is too small.
> Same applies to how IPv6 addresses are handled in the function getaddrs(zhandle_t *zh).
> (Big Thanks+kiss to Thilo Fromm for helping me debug this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-530) Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-530?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mahadev konar updated ZOOKEEPER-530:
------------------------------------

      Resolution: Fixed
    Release Note: get the c client working with IPV6.
    Hadoop Flags: [Reviewed]
          Status: Resolved  (was: Patch Available)

I just committed this.

> Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size
> -------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-530
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-530
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.2.0, 3.2.1
>            Reporter: Isabel Drost
>            Assignee: Isabel Drost
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-530.patch, ZOOKEEPER-530.patch, ZOOKEEPER-530_spaces.patch
>
>
> I tried to run zookeeper c-client on a machine with IPv6 enabled. When connecting to the IPv6 address a connect(...) gave a "Address family not supported by protocol" error. The reason was, that a few lines earlier, the socket was opened with PF_INET instead of PF_INET6. Changing that the following way:
> {code}
>            if (zh->addrs[zh->connect_index].sa_family == AF_INET) {
>             	zh->fd = socket(PF_INET, SOCK_STREAM, 0);
>             } else {
>             	zh->fd = socket(PF_INET6, SOCK_STREAM, 0);
>             }
> {code}
> turned the error message into "Invalid argument". 
> When printing out sizeof(struct sockaddr), sizeof(struct sockaddr_in) and sizeof(struct sockaddr_in6) I got sockaddr: 16, sockaddr_in: 16 and sockaddr_in6: 28. 
> So in the code calling 
> {code}
>            connect(zh->fd, &zh->addrs[zh->connect_index], sizeof(struct sockaddr_in));
> {code}
> the parameter address_len is too small.
> Same applies to how IPv6 addresses are handled in the function getaddrs(zhandle_t *zh).
> (Big Thanks+kiss to Thilo Fromm for helping me debug this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-530) Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12757948#action_12757948 ] 

Patrick Hunt commented on ZOOKEEPER-530:
----------------------------------------

Thanks for the patch!

> Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size
> -------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-530
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-530
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.2.0, 3.2.1
>            Reporter: Isabel Drost
>            Assignee: Isabel Drost
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-530.patch
>
>
> I tried to run zookeeper c-client on a machine with IPv6 enabled. When connecting to the IPv6 address a connect(...) gave a "Address family not supported by protocol" error. The reason was, that a few lines earlier, the socket was opened with PF_INET instead of PF_INET6. Changing that the following way:
> {code}
>            if (zh->addrs[zh->connect_index].sa_family == AF_INET) {
>             	zh->fd = socket(PF_INET, SOCK_STREAM, 0);
>             } else {
>             	zh->fd = socket(PF_INET6, SOCK_STREAM, 0);
>             }
> {code}
> turned the error message into "Invalid argument". 
> When printing out sizeof(struct sockaddr), sizeof(struct sockaddr_in) and sizeof(struct sockaddr_in6) I got sockaddr: 16, sockaddr_in: 16 and sockaddr_in6: 28. 
> So in the code calling 
> {code}
>            connect(zh->fd, &zh->addrs[zh->connect_index], sizeof(struct sockaddr_in));
> {code}
> the parameter address_len is too small.
> Same applies to how IPv6 addresses are handled in the function getaddrs(zhandle_t *zh).
> (Big Thanks+kiss to Thilo Fromm for helping me debug this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-530) Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-530?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt updated ZOOKEEPER-530:
-----------------------------------

    Status: Open  (was: Patch Available)

> Memory corruption: Zookeeper c client IPv6 implementation does not honor struct sockaddr_in6 size
> -------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-530
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-530
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.2.1, 3.2.0
>            Reporter: Isabel Drost
>            Assignee: Isabel Drost
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-530.patch, ZOOKEEPER-530.patch
>
>
> I tried to run zookeeper c-client on a machine with IPv6 enabled. When connecting to the IPv6 address a connect(...) gave a "Address family not supported by protocol" error. The reason was, that a few lines earlier, the socket was opened with PF_INET instead of PF_INET6. Changing that the following way:
> {code}
>            if (zh->addrs[zh->connect_index].sa_family == AF_INET) {
>             	zh->fd = socket(PF_INET, SOCK_STREAM, 0);
>             } else {
>             	zh->fd = socket(PF_INET6, SOCK_STREAM, 0);
>             }
> {code}
> turned the error message into "Invalid argument". 
> When printing out sizeof(struct sockaddr), sizeof(struct sockaddr_in) and sizeof(struct sockaddr_in6) I got sockaddr: 16, sockaddr_in: 16 and sockaddr_in6: 28. 
> So in the code calling 
> {code}
>            connect(zh->fd, &zh->addrs[zh->connect_index], sizeof(struct sockaddr_in));
> {code}
> the parameter address_len is too small.
> Same applies to how IPv6 addresses are handled in the function getaddrs(zhandle_t *zh).
> (Big Thanks+kiss to Thilo Fromm for helping me debug this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.