Procházet zdrojové kódy

misc/udp_proto.h: fix udp_checksum

ambrop7 před 15 roky
rodič
revize
92ba2abb5c
1 změnil soubory, kde provedl 3 přidání a 1 odebrání
  1. 3 1
      misc/udp_proto.h

+ 3 - 1
misc/udp_proto.h

@@ -77,7 +77,9 @@ static uint16_t udp_checksum (uint8_t *udp, uint16_t len, uint32_t source_addr,
         t += udp_checksum_summer((uint8_t *)&x, sizeof(x));
         t += udp_checksum_summer((uint8_t *)&x, sizeof(x));
     }
     }
     
     
-    t = (t&0xFFFF) + (t >> 16);
+    while (t >> 16) {
+        t = (t & 0xFFFF) + (t >> 16);
+    }
     
     
     if (t == 0) {
     if (t == 0) {
         t = ~t;
         t = ~t;