Skip to content

Commit 2634901

Browse files
bzbarsky-appleandy31415
authored andcommitted
Use the "right" byte-swapping function for port in Darwin DnssdImpl. (#23894)
The incoming port is in host byte order and we are converting to network byte order, so should use htons (which happens to do the same thing as ntohs, so no behavior change). Co-authored-by: Andrei Litvin <andy314@gmail.com>
1 parent 6d9a5af commit 2634901

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/platform/Darwin/DnssdImpl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ CHIP_ERROR Register(void * context, DnssdPublishCallback callback, uint32_t inte
198198
sdCtx->mHostNameRegistrar.Init(hostname, addressType, interfaceId);
199199

200200
DNSServiceRef sdRef;
201-
auto err = DNSServiceRegister(&sdRef, kRegisterFlags, interfaceId, name, type, kLocalDot, hostname, ntohs(port), record.size(),
201+
auto err = DNSServiceRegister(&sdRef, kRegisterFlags, interfaceId, name, type, kLocalDot, hostname, htons(port), record.size(),
202202
record.data(), OnRegister, sdCtx);
203203
VerifyOrReturnError(kDNSServiceErr_NoError == err, sdCtx->Finalize(err));
204204

0 commit comments

Comments
 (0)