ithewei 6 vuotta sitten
vanhempi
commit
961ccbe086
2 muutettua tiedostoa jossa 5 lisäystä ja 6 poistoa
  1. 0 1
      base/hsocket.c
  2. 5 5
      base/netinet.h

+ 0 - 1
base/hsocket.c

@@ -77,7 +77,6 @@ error:
 int Ping(const char* host, int cnt) {
     static uint16_t seq = 0;
     char ip[64] = {0};
-    int ttl = 0;
     uint64_t start_tick, end_tick;
     uint64_t start_hrtime, end_hrtime;
     int timeout = 0;

+ 5 - 5
base/netinet.h

@@ -19,11 +19,11 @@ typedef struct icmp     icmp;
 // sizeof(iphdr_t) = 20
 typedef struct iphdr {
 #if BYTE_ORDER == LITTLE_ENDIAN
-    unsigned int ihl:4; // ip header length
-    unsigned int version:4;
+    uint8_t     ihl:4; // ip header length
+    uint8_t     version:4;
 #elif BYTE_ORDER == BIG_ENDIAN
-    unsigned int version:4;
-    unsigned int ihl:4;
+    uint8_t     version:4;
+    uint8_t     ihl:4;
 #else
 #error "BYTE_ORDER undefined!"
 #endif
@@ -111,7 +111,7 @@ typedef struct icmphdr {
             uint16_t    reserved;
             uint16_t    mtu;
         } frag;
-    }
+    } un;
 } icmphdr_t;
 
 typedef struct icmp {