dapr / dapr/components-contrib

IPv6 preferred over IPv4 in mDNS

Open
#1,606 4 comments 0 reactions 0 assignees View on GitHub
pinned question
Dominant language
Go
Stars
602
Forks
580
Avg merge
4d 9h
Merged PRs (30d)
6

Description

Based on the code in the following lines :

```go
if hasIPv4Address {
addr = fmt.Sprintf("%s:%d", entry.AddrIPv4[0].String(), port)
m.addAppAddressIPv4(appID, addr)
}
if hasIPv6Address {
addr = fmt.Sprintf("%s:%d", entry.AddrIPv6[0].String(), port)
m.addAppAddressIPv6(appID, addr)
}

if onEach != nil {
onEach(addr) // invoke callback.
}

```

https://github.com/dapr/components-contrib/blob/master/nameresolution/mdns/mdns.go#L708-L719

It is seen that onEach() is called with the address populated.
But when both IPv6 and IPv4 addresses are available for an application, IPv6 is given preference over IPv4 ...

Is this the expected behavior or should it be changed. As a follow up should there be some way to select only one interface to use when both are available?

cc @jjcollinge

Contributor guide

Open the contributing guide

Research direction

Start with components-contrib/nameresolution/mdns/mdns.go around lines 708-719 and trace how IPv4 and IPv6 addresses are passed to onEach(). Reproduce the case where both address types are available, then confirm the expected preference and whether selecting one interface is in scope. Done means the behavior and any selection mechanism are agreed and covered by relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.