Skip to content

Commit f36887f

Browse files
committed
net: rename CNetAddr scopeId to m_scope_id, improve code doc
1 parent 5cb5fd3 commit f36887f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/netaddress.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ CNetAddr::CNetAddr(const struct in_addr& ipv4Addr)
281281
CNetAddr::CNetAddr(const struct in6_addr& ipv6Addr, const uint32_t scope)
282282
{
283283
SetLegacyIPv6(Span<const uint8_t>(reinterpret_cast<const uint8_t*>(&ipv6Addr), sizeof(ipv6Addr)));
284-
scopeId = scope;
284+
m_scope_id = scope;
285285
}
286286

287287
bool CNetAddr::IsBindAny() const
@@ -918,7 +918,7 @@ bool CService::GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const
918918
memset(paddrin6, 0, *addrlen);
919919
if (!GetIn6Addr(&paddrin6->sin6_addr))
920920
return false;
921-
paddrin6->sin6_scope_id = scopeId;
921+
paddrin6->sin6_scope_id = m_scope_id;
922922
paddrin6->sin6_family = AF_INET6;
923923
paddrin6->sin6_port = htons(port);
924924
return true;

src/netaddress.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,11 @@ class CNetAddr
130130
*/
131131
Network m_net{NET_IPV6};
132132

133-
uint32_t scopeId{0}; // for scoped/link-local ipv6 addresses
133+
/**
134+
* Scope id if scoped/link-local IPV6 address.
135+
* See https://tools.ietf.org/html/rfc4007
136+
*/
137+
uint32_t m_scope_id{0};
134138

135139
public:
136140
CNetAddr();
@@ -388,7 +392,7 @@ class CNetAddr
388392
"Address too long: %u > %u", address_size, MAX_ADDRV2_SIZE));
389393
}
390394

391-
scopeId = 0;
395+
m_scope_id = 0;
392396

393397
if (SetNetFromBIP155Network(bip155_net, address_size)) {
394398
m_addr.resize(address_size);

0 commit comments

Comments
 (0)