diff --git a/overlay_address.c b/overlay_address.c index 79fb18c4..836d75a3 100644 --- a/overlay_address.c +++ b/overlay_address.c @@ -194,10 +194,10 @@ int reachable_unicast(struct subscriber *subscriber, overlay_interface *interfac subscriber->reachable = REACHABLE_DIRECT; subscriber->address.sin_family = AF_INET; subscriber->address.sin_addr = addr; - subscriber->address.sin_port = port; + subscriber->address.sin_port = htons(port); // may be used in tests - DEBUGF("ADD DIRECT ROUTE TO %s via %s", alloca_tohex_sid(subscriber->sid), inet_ntoa(addr)); + DEBUGF("ADD DIRECT ROUTE TO %s via %s:%d", alloca_tohex_sid(subscriber->sid), inet_ntoa(addr), port); /* Pre-emptively check if we have their sas in memory, or send a request */ keyring_find_sas_public(keyring, subscriber->sid); diff --git a/overlay_packetformats.c b/overlay_packetformats.c index cb3a171d..36263b81 100644 --- a/overlay_packetformats.c +++ b/overlay_packetformats.c @@ -278,7 +278,7 @@ int packetOkOverlay(struct overlay_interface *interface,unsigned char *packet, s struct sockaddr_in *addr=(struct sockaddr_in *)recvaddr; // mark this subscriber as reachable directly via unicast. - reachable_unicast(f.source, interface, addr->sin_addr, addr->sin_port); + reachable_unicast(f.source, interface, addr->sin_addr, ntohs(addr->sin_port)); }