Explorar o código

IP4.h: hostmask() needs to use htonl()

An IPv4 address is bigendian...
H. Peter Anvin hai 1 ano
pai
achega
528c0fe2a8
Modificáronse 5 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      esp32/max80/IP4.h
  2. BIN=BIN
      esp32/output/max80.ino.bin
  3. BIN=BIN
      fpga/output/max80.fw
  4. BIN=BIN
      fpga/output/v1.fw
  5. BIN=BIN
      fpga/output/v2.fw

+ 1 - 1
esp32/max80/IP4.h

@@ -17,7 +17,7 @@ private:
 	uint32_t l;
     };
     static constexpr uint32_t hostmask(unsigned int n) {
-	return n >= 32 ? 0 : ((uint32_t)1 << n)-1;
+	return n >= 32 ? 0 : htonl(((uint32_t)1 << n)-1);
     }
 public:
     constexpr IP4() : l{0} { }

BIN=BIN
esp32/output/max80.ino.bin


BIN=BIN
fpga/output/max80.fw


BIN=BIN
fpga/output/v1.fw


BIN=BIN
fpga/output/v2.fw