Skip to content

Commit 302cbab

Browse files
bzbarsky-appleandy31415
authored and
Rawad Hilal
committed
Use the "right" byte-swapping function for port in Darwin DnssdImpl. (project-chip#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 05f9e27 commit 302cbab

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)