+
+ auto scopeId = getScopeId();
+ if (scopeId != 0) {
+ auto len = strlen(buffer);
+ buffer[len] = '%';
+ if (!if_indextoname(scopeId, buffer + len + 1)) {
+ throw IPAddressFormatException(to<std::string>(
+ "Invalid scope for address with hex ",
+ "'",
+ detail::Bytes::toHex(bytes(), 16),
+ "%",
+ scopeId,
+ "'",
+ " with error ",
+ strerror(errno)));
+ }
+ }
+
+ return string(buffer);