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

DatagramChannel join without a network interface could use the channel option multicast interface instead of guessing from the local address #11541

Closed
vietj opened this issue Aug 3, 2021 · 2 comments · Fixed by #11585
Assignees
Milestone

Comments

@vietj
Copy link
Contributor

vietj commented Aug 3, 2021

Expected behavior

DatagramChannel#joinGroup(multicastAddress) calls DatagramChannel.joinGroup(multicastAddress, networkInterface, source) with the same network interface set on the channel options.

The code would look like

        try {
            return joinGroup(
                    multicastAddress,
                    config().getNetworkInterface(),
                    null, promise);
        } catch (SocketException e) {
            promise.setFailure(e);
        }
        return promise;

Actual behavior

DatagramChannel#joinGroup(multicastAddress) calls DatagramChannel.joinGroup(multicastAddress, networkInterface, source) with NetworkInterface.getByInetAddress(localAddress().getAddress()) that sometimes returns the null reference.

Steps to reproduce

Obvious

Minimal yet complete reproducer code (or URL to code)

Obvious

Netty version

Most

JVM version (e.g. java -version)

OS version (e.g. uname -a)

@NiteshKant
Copy link
Member

this sounds reasonable to me, @vietj you want to send a PR, I am happy to review.

@normanmaurer normanmaurer added this to the 4.1.68.Final milestone Aug 17, 2021
normanmaurer added a commit that referenced this issue Aug 17, 2021
…g multicast groups

Motivation:

We should use StandardSocketOptions#IP_MULTICAST_IF as default source when joing multicast groups and only try to use the localAddress if this returns null.

Modifications:

First check if StandardSocketOptions#IP_MULTICAST_IF was set and if so use the network interface when joining mulicast groups

Result:

Fixes #11541
@normanmaurer
Copy link
Member

@vietj PTAL #11585

@normanmaurer normanmaurer self-assigned this Aug 17, 2021
normanmaurer added a commit that referenced this issue Aug 18, 2021
…g multicast groups (#11585)

Motivation:

We should use StandardSocketOptions#IP_MULTICAST_IF as default source when joing multicast groups and only try to use the localAddress if this returns null.

Modifications:

First check if StandardSocketOptions#IP_MULTICAST_IF was set and if so use the network interface when joining mulicast groups

Result:

Fixes #11541
normanmaurer added a commit that referenced this issue Aug 18, 2021
…g multicast groups (#11585)

Motivation:

We should use StandardSocketOptions#IP_MULTICAST_IF as default source when joing multicast groups and only try to use the localAddress if this returns null.

Modifications:

First check if StandardSocketOptions#IP_MULTICAST_IF was set and if so use the network interface when joining mulicast groups

Result:

Fixes #11541
laosijikaichele pushed a commit to laosijikaichele/netty that referenced this issue Dec 16, 2021
…g multicast groups (netty#11585)

Motivation:

We should use StandardSocketOptions#IP_MULTICAST_IF as default source when joing multicast groups and only try to use the localAddress if this returns null.

Modifications:

First check if StandardSocketOptions#IP_MULTICAST_IF was set and if so use the network interface when joining mulicast groups

Result:

Fixes netty#11541
laosijikaichele pushed a commit to laosijikaichele/netty that referenced this issue Dec 16, 2021
…g multicast groups (netty#11585)

Motivation:

We should use StandardSocketOptions#IP_MULTICAST_IF as default source when joing multicast groups and only try to use the localAddress if this returns null.

Modifications:

First check if StandardSocketOptions#IP_MULTICAST_IF was set and if so use the network interface when joining mulicast groups

Result:

Fixes netty#11541
raidyue pushed a commit to raidyue/netty that referenced this issue Jul 8, 2022
…g multicast groups (netty#11585)

Motivation:

We should use StandardSocketOptions#IP_MULTICAST_IF as default source when joing multicast groups and only try to use the localAddress if this returns null.

Modifications:

First check if StandardSocketOptions#IP_MULTICAST_IF was set and if so use the network interface when joining mulicast groups

Result:

Fixes netty#11541
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants