-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add support for IPv6 scoped addresses (RFC4007) #15263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
straight-shoota
merged 29 commits into
crystal-lang:master
from
foxxx0:ipv6ll_scope_rfc4007
May 22, 2025
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
5b253ee
implement IPv6 scoped addresses (RFC4007)
foxxx0 78a1101
remove totally unnecessary artifact
foxxx0 06d9a06
adjust RFC4007 implementation based on review feedback
foxxx0 280e074
remove trailing dot from exception messages
foxxx0 cd27591
add specs for invalid v4 addrs with zone identifier
foxxx0 e39b72e
clarify RFC4007 comment and fix #inspect example
foxxx0 8f84cd3
wrap references to methods in backticks
foxxx0 867b13e
optimize rfc4007 parsing approach, unify exceptions
foxxx0 fe90d21
rework rfc4007 parsing to subslice
foxxx0 67a91a7
revert public parse_v6_fields? return type
foxxx0 85a5d12
streamline rfc4007 zone subslice building
foxxx0 ff85550
use hexadecimal representation for expected values
foxxx0 070257e
remove unneeded type declaration for IF_NAMESIZE constant
foxxx0 83244d8
remove erroneous WASI c/net/if dependency
foxxx0 6ab3d90
polish `Socket::Address.#link_local_interface` comment
foxxx0 addd235
handle `LibC.if_indextoname` errno
foxxx0 a396d5a
raise NotImplementedError on wasi for `#link_local_interface`
foxxx0 12a944d
fix errno handling for `Socket::Address.#link_local_interface`
foxxx0 28af243
use `LibC.has_method?` to guard against missing implementations
foxxx0 a16ed4b
use normal Int32 for `zone_id`
foxxx0 72c8b56
restrict zone_id parameter to Int32
foxxx0 2227909
handle windows errno appropriately
foxxx0 1f45a62
rework `if_indextoname` error handling
foxxx0 6d8f516
only look at errno for supported platforms
foxxx0 5e379df
adjust specs to match previous commit
foxxx0 9109226
only skip errno inspection on `flag?(:win32)`
foxxx0 21b5b49
fix formatting
foxxx0 22675f9
raise exception from errno on non-windows platforms
foxxx0 a6f880f
expect proper darwin/bsd errno message for ENXIO
foxxx0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,9 @@ | ||
require "../netinet/in" | ||
require "../stdint" | ||
|
||
lib LibC | ||
IF_NAMESIZE = 16u8 | ||
foxxx0 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
fun if_nametoindex(ifname : Char*) : UInt | ||
fun if_indextoname(ifindex : UInt, ifname : LibC::Char*) : LibC::Char* | ||
end |
This file contains hidden or 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,9 @@ | ||
require "../netinet/in" | ||
require "../stdint" | ||
|
||
lib LibC | ||
IF_NAMESIZE = 16u8 | ||
|
||
fun if_nametoindex(ifname : Char*) : UInt | ||
fun if_indextoname(ifindex : UInt, ifname : LibC::Char*) : LibC::Char* | ||
end |
This file contains hidden or 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,9 @@ | ||
require "../netinet/in" | ||
require "../stdint" | ||
|
||
lib LibC | ||
IF_NAMESIZE = 16u8 | ||
|
||
fun if_nametoindex(ifname : Char*) : UInt | ||
fun if_indextoname(ifindex : UInt, ifname : LibC::Char*) : LibC::Char* | ||
end |
This file contains hidden or 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,9 @@ | ||
require "../netinet/in" | ||
require "../stdint" | ||
|
||
lib LibC | ||
IF_NAMESIZE = 16u8 | ||
|
||
fun if_nametoindex(ifname : Char*) : UInt | ||
fun if_indextoname(ifindex : UInt, ifname : LibC::Char*) : LibC::Char* | ||
end |
This file contains hidden or 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,9 @@ | ||
require "../netinet/in" | ||
require "../stdint" | ||
|
||
lib LibC | ||
IF_NAMESIZE = 16u8 | ||
|
||
fun if_nametoindex(ifname : Char*) : UInt | ||
fun if_indextoname(ifindex : UInt, ifname : LibC::Char*) : LibC::Char* | ||
end |
This file contains hidden or 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,9 @@ | ||
require "../netinet/in" | ||
require "../stdint" | ||
|
||
lib LibC | ||
IF_NAMESIZE = 16u8 | ||
|
||
fun if_nametoindex(ifname : Char*) : UInt | ||
fun if_indextoname(ifindex : UInt, ifname : LibC::Char*) : LibC::Char* | ||
end |
This file contains hidden or 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,9 @@ | ||
require "../netinet/in" | ||
require "../stdint" | ||
|
||
lib LibC | ||
IF_NAMESIZE = 16u8 | ||
|
||
fun if_nametoindex(ifname : Char*) : UInt | ||
fun if_indextoname(ifindex : UInt, ifname : LibC::Char*) : LibC::Char* | ||
end |
This file contains hidden or 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,9 @@ | ||
require "../netinet/in" | ||
require "../stdint" | ||
|
||
lib LibC | ||
IF_NAMESIZE = 16u8 | ||
|
||
fun if_nametoindex(ifname : Char*) : UInt | ||
fun if_indextoname(ifindex : UInt, ifname : LibC::Char*) : LibC::Char* | ||
end |
This file contains hidden or 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,9 @@ | ||
require "../netinet/in" | ||
require "../stdint" | ||
|
||
lib LibC | ||
IF_NAMESIZE = 16u8 | ||
|
||
fun if_nametoindex(ifname : Char*) : UInt | ||
fun if_indextoname(ifindex : UInt, ifname : LibC::Char*) : LibC::Char* | ||
end |
This file contains hidden or 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,9 @@ | ||
require "../netinet/in" | ||
require "../stdint" | ||
|
||
lib LibC | ||
IF_NAMESIZE = 16u8 | ||
|
||
fun if_nametoindex(ifname : Char*) : UInt | ||
fun if_indextoname(ifindex : UInt, ifname : LibC::Char*) : LibC::Char* | ||
end |
This file contains hidden or 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,9 @@ | ||
require "../netinet/in" | ||
require "../stdint" | ||
|
||
lib LibC | ||
IF_NAMESIZE = 16u8 | ||
|
||
fun if_nametoindex(ifname : Char*) : UInt | ||
fun if_indextoname(ifindex : UInt, ifname : LibC::Char*) : LibC::Char* | ||
end |
This file contains hidden or 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,9 @@ | ||
require "../netinet/in" | ||
require "../stdint" | ||
|
||
lib LibC | ||
IF_NAMESIZE = 16u8 | ||
|
||
fun if_nametoindex(ifname : Char*) : UInt | ||
fun if_indextoname(ifindex : UInt, ifname : LibC::Char*) : LibC::Char* | ||
end |
This file contains hidden or 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,9 @@ | ||
require "../netinet/in" | ||
require "../stdint" | ||
|
||
lib LibC | ||
IF_NAMESIZE = 16u8 | ||
|
||
fun if_nametoindex(ifname : Char*) : UInt | ||
fun if_indextoname(ifindex : UInt, ifname : LibC::Char*) : LibC::Char* | ||
end |
This file contains hidden or 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,9 @@ | ||
require "../netinet/in" | ||
require "../stdint" | ||
|
||
lib LibC | ||
IF_NAMESIZE = 16u8 | ||
|
||
fun if_nametoindex(ifname : Char*) : UInt | ||
fun if_indextoname(ifindex : UInt, ifname : LibC::Char*) : LibC::Char* | ||
end |
This file contains hidden or 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,9 @@ | ||
require "../netinet/in" | ||
require "../stdint" | ||
|
||
lib LibC | ||
IF_NAMESIZE = 16u8 | ||
|
||
fun if_nametoindex(ifname : Char*) : UInt | ||
fun if_indextoname(ifindex : UInt, ifname : LibC::Char*) : LibC::Char* | ||
end |
foxxx0 marked this conversation as resolved.
Show resolved
Hide resolved
foxxx0 marked this conversation as resolved.
Show resolved
Hide resolved
|
Empty file.
This file contains hidden or 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,12 @@ | ||
require "./in6addr" | ||
require "./inaddr" | ||
require "./stdint" | ||
|
||
@[Link("iphlpapi")] | ||
lib LibC | ||
NDIS_IF_MAX_STRING_SIZE = 256u16 | ||
foxxx0 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
IF_NAMESIZE = LibC::NDIS_IF_MAX_STRING_SIZE + 1 # need one more byte for terminating '\0' | ||
|
||
fun if_nametoindex(ifname : Char*) : UInt | ||
fun if_indextoname(ifindex : UInt, ifname : LibC::Char*) : LibC::Char* | ||
end |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.