]> git.scottworley.com Git - tattlekey/commitdiff
client: net: Fix port byte order
authorScott Worley <scottworley@scottworley.com>
Sun, 8 Oct 2023 04:34:50 +0000 (21:34 -0700)
committerScott Worley <scottworley@scottworley.com>
Wed, 11 Oct 2023 01:48:07 +0000 (18:48 -0700)
Docs ( https://www.nongnu.org/lwip/2_0_x/group__udp__raw.html ) say
"ipaddr & port are expected to be in the same byte order as in the pcb,"
which apparently means _don't_ run it through htons().

client/net.c

index da33727bbb9e00b0bde4bb7f9a6f59a3856026ba..c692a12fa562f7e0147efb4c6a691d64ff027192 100644 (file)
@@ -23,7 +23,7 @@ static void initialize_the_pcb() {
   if (ip4addr_aton(tattle_server_ip_address, &ipaddr) == 0)
     signal_error_by_blinking();
 
   if (ip4addr_aton(tattle_server_ip_address, &ipaddr) == 0)
     signal_error_by_blinking();
 
-  if (udp_connect(the_pcb, &ipaddr, htons(tattle_port)) != ERR_OK)
+  if (udp_connect(the_pcb, &ipaddr, tattle_port) != ERR_OK)
     signal_error_by_blinking();
 }
 
     signal_error_by_blinking();
 }