-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix getAddrInfo, add IPPROTO_ICMPV6 Closes #10198
- Loading branch information
Showing
5 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
discard """ | ||
exitcode: 0 | ||
output: "" | ||
""" | ||
|
||
# bug: https://github.com/nim-lang/Nim/issues/10198 | ||
|
||
import nativesockets | ||
|
||
block DGRAM_UDP: | ||
let aiList = getAddrInfo("127.0.0.1", 999.Port, AF_INET, SOCK_DGRAM, IPPROTO_UDP) | ||
doAssert aiList != nil | ||
doAssert aiList.ai_addr != nil | ||
doAssert aiList.ai_addrlen == 16 | ||
doAssert aiList.ai_next == nil | ||
freeAddrInfo aiList | ||
|
||
when defined(posix): | ||
|
||
block RAW_ICMP: | ||
# the port will be ignored | ||
let aiList = getAddrInfo("127.0.0.1", 999.Port, AF_INET, SOCK_RAW, IPPROTO_ICMP) | ||
doAssert aiList != nil | ||
doAssert aiList.ai_addr != nil | ||
doAssert aiList.ai_addrlen == 16 | ||
doAssert aiList.ai_next == nil | ||
freeAddrInfo aiList | ||
|
||
block RAW_ICMPV6: | ||
# the port will be ignored | ||
let aiList = getAddrInfo("::1", 999.Port, AF_INET6, SOCK_RAW, IPPROTO_ICMPV6) | ||
doAssert aiList != nil | ||
doAssert aiList.ai_addr != nil | ||
doAssert aiList.ai_addrlen == 28 | ||
doAssert aiList.ai_next == nil | ||
freeAddrInfo aiList |