Fix #2192 - honor addr%scopeid ipv6 notation

This commit is contained in:
cpq committed 2023-09-29 15:49:47 +01:00
1 parent a628a05efb
commit 46ecb07fc8
6 files changed
+74 -39

No files matched your search

+2
View File
@@ -62,6 +62,7 @@ static socklen_t tousa(struct mg_addr *a, union usa *usa) {
if (a->is_ip6) {
usa->sin.sin_family = AF_INET6;
usa->sin6.sin6_port = a->port;
usa->sin6.sin6_scope_id = a->scope_id;
memcpy(&usa->sin6.sin6_addr, a->ip, sizeof(a->ip));
len = sizeof(usa->sin6);
}
@@ -77,6 +78,7 @@ static void tomgaddr(union usa *usa, struct mg_addr *a, bool is_ip6) {
if (is_ip6) {
memcpy(a->ip, &usa->sin6.sin6_addr, sizeof(a->ip));
a->port = usa->sin6.sin6_port;
a->scope_id = (uint8_t) usa->sin6.sin6_scope_id;
}
#endif
}