1. 12 7月, 2013 2 次提交
    • A
      Fixed compareStringObject() and introduced collateStringObject(). · 81e55ec0
      antirez 提交于
      compareStringObject was not always giving the same result when comparing
      two exact strings, but encoded as integers or as sds strings, since it
      switched to strcmp() when at least one of the strings were not sds
      encoded.
      
      For instance the two strings "123" and "123\x00456", where the first
      string was integer encoded, would result into the old implementation of
      compareStringObject() to return 0 as if the strings were equal, while
      instead the second string is "greater" than the first in a binary
      comparison.
      
      The same compasion, but with "123" encoded as sds string, would instead
      return a value < 0, as it is correct. It is not impossible that the
      above caused some obscure bug, since the comparison was not always
      deterministic, and compareStringObject() is used in the implementation
      of skiplists, hash tables, and so forth.
      
      At the same time, collateStringObject() was introduced by this commit, so
      that can be used by SORT command to return sorted strings usign
      collation instead of binary comparison. See next commit.
      81e55ec0
    • S
      Merge pull request #1192 from badboy/ipv6-rediscli · 2ed64e1f
      Salvatore Sanfilippo 提交于
      Wrap IPv6 in brackets in the prompt.
      2ed64e1f
  2. 11 7月, 2013 4 次提交
  3. 10 7月, 2013 3 次提交
  4. 09 7月, 2013 6 次提交
  5. 08 7月, 2013 25 次提交
    • A
      Fix old anetPeerToString() API call in replication.c · 90038906
      antirez 提交于
      90038906
    • A
      Revert "Document port6 and bind6 config options." · c76df730
      antirez 提交于
      IPv6 support is not going to use IPv6 specific options, just it will be
      possible to specify all the ipv4 / ipv6 addresses of the interfaces to
      bind, otherwise connections will be accepted from all the interfaces in
      both IPv4 and IPv6 addresses.
      
      This reverts commit 93570e17.
      c76df730
    • G
      Add IPv6 support to sentinel.c. · e04fdf26
      Geoff Garside 提交于
      This has been done by exposing the anetSockName() function anet.c
      to be used when the sentinel is publishing its existence to the masters.
      
      This implementation is very unintelligent as it will likely break if used
      with IPv6 as the nested colons will break any parsing of the PUBLISH string
      by the master.
      e04fdf26
    • G
      a68e3d4c
    • G
      1ca4008d
    • G
      Document port6 and bind6 config options. · 93570e17
      Geoff Garside 提交于
      Add commented port6 and bind6 options to default redis.conf file.
      93570e17
    • G
      Add anetTcp6Server() function. · 56df8271
      Geoff Garside 提交于
      Refactor the common code from anetTcpServer into internal function which
      can be used by both anetTcpServer and anetTcp6Server.
      56df8271
    • G
      Add static anetV6Only() function. · 72a39226
      Geoff Garside 提交于
      This function sets the IPV6_V6ONLY option to 1 to use separate stack
      IPv6 sockets.
      72a39226
    • G
      Change anetTcpGenericConnect to use AF_UNSPEC. · 62a3b7e3
      Geoff Garside 提交于
      This allows anetTcpGenericConnect to try to connect to AF_INET6
      addresses in addition to any resolved AF_INET addresses.
      62a3b7e3
    • G
      Mark places that might want changing for IPv6. · ca78446c
      Geoff Garside 提交于
      Any places which I feel might want to be updated to work differently
      with IPv6 have been marked with a comment starting "IPV6:".
      
      Currently the only comments address places where an IP address is
      combined with a port using the standard : separated form. These may want
      to be changed when printing IPv6 addresses to wrap the address in []
      such as
      
      	[2001:db8::c0:ffee]:6379
      
      instead of
      
      	2001:db8::c0:ffee:6379
      
      as the latter format is a technically valid IPv6 address and it is hard
      to distinguish the IPv6 address component from the port unless you know
      the port is supposed to be there.
      ca78446c
    • G
      Expand ip char buffers which are too small for v6. · 96b02dc0
      Geoff Garside 提交于
      Increase the size of character buffers being used to store printable IP
      addresses so that they can safely store IPv6 addresses.
      96b02dc0
    • G
      Mark ip string buffers which could be reduced. · f7d9a92d
      Geoff Garside 提交于
      In two places buffers have been created with a size of 128 bytes which
      could be reduced to INET6_ADDRSTRLEN to still hold a full IP address.
      These places have been marked as they are presently big enough to handle
      the needs of storing a printable IPv6 address.
      f7d9a92d
    • G
      Update clusterCommand to handle AF_INET6 addresses · e6bf4c26
      Geoff Garside 提交于
      Changes the sockaddr_in to a sockaddr_storage. Attempts to convert the
      IP address into an AF_INET or AF_INET6 before returning an "Invalid IP
      address" error. Handles converting the sockaddr from either AF_INET or
      AF_INET6 back into a string for storage in the clusterNode ip field.
      e6bf4c26
    • G
      Update node2IpString to handle AF_INET6 addresses. · 5be83eec
      Geoff Garside 提交于
      Change the sockaddr_in to sockaddr_storage which is capable of storing
      both AF_INET and AF_INET6 sockets. Uses the sockaddr_storage ss_family
      to correctly return the printable IP address and port.
      
      Function makes the assumption that the buffer is of at least
      REDIS_CLUSTER_IPLEN bytes in size.
      5be83eec
    • G
      Update REDIS_CLUSTER_IPLEN to INET6_ADDRSTRLEN. · 6181455a
      Geoff Garside 提交于
      Change REDIS_CLUSTER_IPLEN to INET6_ADDRSTRLEN so that the clusterNode
      ip character buffer is big enough to hold an IPv6 address.
      6181455a
    • G
      Update anetPeerToString to handle AF_INET6 addrs. · 23f4d905
      Geoff Garside 提交于
      Change the sockaddr_in to sockaddr_storage which is capable of storing
      both AF_INET and AF_INET6 sockets. Uses the sockaddr_storage ss_family
      to correctly return the printable IP address and port.
      23f4d905
    • G
      Update anetTcpAccept to handle AF_INET6 addresses. · fa723d98
      Geoff Garside 提交于
      Change the sockaddr_in to sockaddr_storage which is capable of storing
      both AF_INET and AF_INET6 sockets. Uses the sockaddr_storage ss_family
      to correctly return the printable IP address and port.
      fa723d98
    • G
      Update anetResolve to resolve AF_INET6 as well. · e7b34e8d
      Geoff Garside 提交于
      Change the getaddrinfo(3) hints family from AF_INET to AF_UNSPEC to
      allow resolution of IPv6 addresses as well as IPv4 addresses. The
      function will return the IP address of whichever address family is
      preferenced by the operating system. Most current operating systems
      will preference AF_INET6 over AF_INET.
      
      Unfortunately without attempting to establish a connection to the
      remote address we can't know if the host is capable of using the
      returned IP address. It might be desirable to have anetResolve
      accept an additional argument specifying the AF_INET/AF_INET6 address
      the caller would like to receive. Currently though it does not appear
      as though the anetResolve function is ever used within Redis.
      e7b34e8d
    • G
      Update calls to anetResolve to include buffer size · 2345cee3
      Geoff Garside 提交于
      2345cee3
    • G
      Update calls to anetPeerToString to include ip_len. · ee5a6df1
      Geoff Garside 提交于
      ee5a6df1
    • G
      Add missing includes for getpeername. · b39e827d
      Geoff Garside 提交于
      getpeername(2) requires <sys/socket.h> which on some systems also
      requires <sys/types.h>. Include both to avoid compilation warnings.
      b39e827d
    • G
      Add macro to define clusterNode.ip buffer size. · 9cfa02fe
      Geoff Garside 提交于
      Add REDIS_CLUSTER_IPLEN macro to define the size of the clusterNode ip
      character array. Additionally use this macro in inet_ntop(3) calls where
      the size of the array was being defined manually.
      
      The REDIS_CLUSTER_IPLEN is defined as INET_ADDRSTRLEN which defines the
      correct size of a buffer to store an IPv4 address in. The
      INET_ADDRSTRLEN macro itself is defined in the <netinet/in.h> header
      file and should be portable across the majority of systems.
      9cfa02fe
    • G
      Fix cluster.c inet_ntop use of sizeof(n->ip). · 6e894f02
      Geoff Garside 提交于
      Using sizeof with an array will only return expected results if the
      array is created in the scope of the function where sizeof is used. This
      commit changes the inet_ntop calls so that they use the fixed buffer
      value as defined in redis.h which is 16.
      6e894f02
    • G
      Use inet_pton(3) in clusterCommand. · 693b6405
      Geoff Garside 提交于
      Replace inet_aton(3) call with the more future proof inet_pton(3)
      function which is capable of handling additional address families.
      693b6405
    • G
      Use inet_ntop(3) in nodeIp2String & clusterCommand · a6ea707c
      Geoff Garside 提交于
      Replace inet_ntoa(3) calls with the more future proof inet_ntop(3)
      function which is capable of handling additional address families.
      a6ea707c