Skip to content
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

Two commits for IPv6 mDNS support in pion/ice #179

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ type Config struct {
// IncludeLoopback will include loopback interfaces to be eligble for queries and answers.
IncludeLoopback bool

// DisableLinkLocal disables answering with the Link-Local Address
DisableLinkLocal bool

// Interfaces will override the interfaces used for queries and answers.
Interfaces []net.Interface
}
25 changes: 13 additions & 12 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -865,19 +865,20 @@
var selectedIP net.IP
for _, ip := range ifc.ips {
ipCopy := ip
ipIsV6 := ipCopy.To4() == nil

// match up respective IP types based on question
if queryWantsV4 {
if ipv4 := ipCopy.To4(); ipv4 == nil {
continue
}
} else { // queryWantsV6
if ipv6 := ipCopy.To16(); ipv6 == nil {
continue
} else if !isSupportedIPv6(ipv6, c.multicastPktConnV4 == nil) {
c.log.Debugf("interface %d address not a supported IPv6 address %s", ifIndex, ipCopy)
continue
}
// Query must match family (A for IPv4 and AAAA IPv6)
if queryWantsV4 == ipIsV6 {
continue
}

if ipIsV6 && !isSupportedIPv6(ipCopy, c.multicastPktConnV4 == nil) {
c.log.Debugf("interface %d address not a supported IPv6 address %s", ifIndex, ipCopy)
continue

Check warning on line 877 in conn.go

View check run for this annotation

Codecov / codecov/patch

conn.go#L876-L877

Added lines #L876 - L877 were not covered by tests
}

if config.DisableLinkLocal && ipCopy.IsLinkLocalUnicast() {
continue

Check warning on line 881 in conn.go

View check run for this annotation

Codecov / codecov/patch

conn.go#L881

Added line #L881 was not covered by tests
}

selectedIP = ipCopy
Expand Down
Loading