File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 1
- '2.3.9032 '
1
+ '2.3.9033 '
Original file line number Diff line number Diff line change @@ -2320,18 +2320,24 @@ procedure NetAddrFlush(const hostname: RawUtf8);
2320
2320
function TNetAddr.SetFromIP4 (const address: RawUtf8;
2321
2321
noNewSocketIP4Lookup: boolean): boolean;
2322
2322
begin
2323
- result := false;
2323
+ // allow to bind to any IPv6 address
2324
+ if address = c6AnyHost then // ::
2325
+ begin
2326
+ PSockAddrIn6(@Addr)^.sin6_family := AF_INET6; // keep all sin6_addr[] = 0
2327
+ result := true;
2328
+ exit;
2329
+ end ;
2324
2330
// caller did set addr4.sin_port and other fields to 0
2331
+ result := false;
2325
2332
with PSockAddr(@Addr)^ do
2326
2333
if (address = cLocalhost) or
2327
- (address = c6Localhost) or
2334
+ (address = c6Localhost) or // ::1
2328
2335
PropNameEquals(address, ' localhost' ) then
2329
2336
PCardinal(@sin_addr)^ := cLocalhost32 // 127.0.0.1
2330
2337
else if (address = cBroadcast) or
2331
2338
(address = c6Broadcast) then
2332
2339
PCardinal(@sin_addr)^ := cardinal(-1 ) // 255.255.255.255
2333
- else if (address = cAnyHost) or
2334
- (address = c6AnyHost) then
2340
+ else if address = cAnyHost then
2335
2341
// keep 0.0.0.0 for bind - but connect would redirect to 127.0.0.1
2336
2342
else if NetIsIP4(pointer(address), @sin_addr) or
2337
2343
GetKnownHost(address, PCardinal(@sin_addr)^) or
You can’t perform that action at this time.
0 commit comments