Browse Source

Changed IPv4 typo

OptoCloud 3 years ago
parent
commit
f4f81d0426
1 changed files with 6 additions and 3 deletions
  1. 6 3
      include/enet.h

+ 6 - 3
include/enet.h

@@ -202,6 +202,9 @@
 #define ENET_MIN(x, y) ((x) < (y) ? (x) : (y))
 
 #define ENET_IPV6           1
+const struct in6_addr enet_v4_anyaddr   = {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}};
+const struct in6_addr enet_v4_noaddr    = {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}};
+const struct in6_addr enet_v4_localhost = {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01 }}};
 const struct in6_addr enet_v6_anyaddr   = {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}};
 const struct in6_addr enet_v6_noaddr    = {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}};
 const struct in6_addr enet_v6_localhost = {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}};
@@ -1203,12 +1206,12 @@ extern "C" {
 
     inline void enet_inaddr_map4to6(struct in_addr in, struct in6_addr *out)
     {
-        if (in.s_addr == 0x00000000) {
+        if (in.s_addr == 0x00000000) { /* 0.0.0.0 */
             *out = enet_v6_anyaddr;
-        } else if (in.s_addr == 0xFFFFFFFF) {
+        } else if (in.s_addr == 0xFFFFFFFF) { /* 255.255.255.255 */
             *out = enet_v6_noaddr;
         } else {
-            *out = enet_v6_anyaddr;
+            *out = enet_v4_anyaddr;
             out->s6_addr[10] = 0xFF;
             out->s6_addr[11] = 0xFF;
             out->s6_addr[12] = ((uint8_t *)&in.s_addr)[0];