Bug#907541: [openjdk-8] Bind to a multicast address fails

2021-06-16 Thread Andre Naujoks

Am 15.06.21 um 18:39 schrieb Thorsten Glaser:

Hi Andre,


This was supposed to be fixed upstream in Java 12:
https://bugs.openjdk.java.net/browse/JDK-8210493

However it was taken back again (see last comment in that issue) and is now
supposedly fixed in java 13:
https://bugs.openjdk.java.net/browse/JDK-8215294
https://bugs.openjdk.java.net/browse/JDK-8216417


thanks for this information bundle, it helps tremendously.


As far as I am aware, it works with current Java versions in Debian (>= 13).

I am not sure if Debian actually wants to carry this for the versions <13, as
the patch somehow introduced other issues (see the upstream bug-reports).


As far as I understand, the original patch indeed introduced issues,
so it’s probably not something we want to have in 8 and 11. The fix
in 13+ is not backportable because they basically rewrote the entire
socket classes’ implementations.

I guess this won’t be fixed in 8 and, more importantly, 11 currently.


Sad but understandable. I guess this can be closed again then.

Thanks for taking a look at this, though.

Regards
  Andre



bye,
//mirabilos





Bug#907541: [openjdk-8] Bind to a multicast address fails

2021-06-15 Thread Thorsten Glaser
Hi Andre,

> This was supposed to be fixed upstream in Java 12:
> https://bugs.openjdk.java.net/browse/JDK-8210493
> 
> However it was taken back again (see last comment in that issue) and is now
> supposedly fixed in java 13:
> https://bugs.openjdk.java.net/browse/JDK-8215294
> https://bugs.openjdk.java.net/browse/JDK-8216417

thanks for this information bundle, it helps tremendously.

> As far as I am aware, it works with current Java versions in Debian (>= 13).
> 
> I am not sure if Debian actually wants to carry this for the versions <13, as
> the patch somehow introduced other issues (see the upstream bug-reports).

As far as I understand, the original patch indeed introduced issues,
so it’s probably not something we want to have in 8 and 11. The fix
in 13+ is not backportable because they basically rewrote the entire
socket classes’ implementations.

I guess this won’t be fixed in 8 and, more importantly, 11 currently.

bye,
//mirabilos
-- 
Infrastrukturexperte • tarent solutions GmbH
Am Dickobskreuz 10, D-53121 Bonn • http://www.tarent.de/
Telephon +49 228 54881-393 • Fax: +49 228 54881-235
HRB AG Bonn 5168 • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg

*

Mit dem tarent-Newsletter nichts mehr verpassen: www.tarent.de/newsletter

*



Bug#907541: [openjdk-8] Bind to a multicast address fails

2021-06-15 Thread Andre Naujoks

Am 15.06.21 um 00:54 schrieb Thorsten Glaser:

tags 907541 + confirmed upstream
found 907541 openjdk-8/8u292-b10-1
found 907541 openjdk-11/11.0.12+4-1
thanks

On Wed, 29 Aug 2018, Andre Naujoks wrote:


This bugs affects all currently available Java versions in Debian (7, 8, 10 and 
11).
I don't know how to mark this here.


Normally, cloning the bug against all affected packages,
but I’m Cc’ing Doko on this hoping he’ll DTRT ☺


The contents of the patch should
be usable for all versions with very little change.

[…]

The attached patch fixes/adds this in the jvm.


This is another of these things where it’d be preferable to
fix this upstream first then apply the patch in Debian packages.
However it’s small and easily applied ahead of time. It’d be no
good if I’d fix this in openjdk-8 but 11 (and 17, possibly) are
unfixed; Doko?

Andre, can you report this upstream?


Hi Thorsten.

This was supposed to be fixed upstream in Java 12: 
https://bugs.openjdk.java.net/browse/JDK-8210493


However it was taken back again (see last comment in that issue) and is 
now supposedly fixed in java 13:

https://bugs.openjdk.java.net/browse/JDK-8215294
https://bugs.openjdk.java.net/browse/JDK-8216417

As far as I am aware, it works with current Java versions in Debian (>= 13).

I am not sure if Debian actually wants to carry this for the versions 
<13, as the patch somehow introduced other issues (see the upstream 
bug-reports).


It would be nice to have, but I'd understand if you'd decided against 
taking the patch after the back and forth that happened upstream.


Regards
  Andre



Thanks,
//mirabilos





Bug#907541: [openjdk-8] Bind to a multicast address fails

2021-06-14 Thread Thorsten Glaser
tags 907541 + confirmed upstream
found 907541 openjdk-8/8u292-b10-1
found 907541 openjdk-11/11.0.12+4-1
thanks

On Wed, 29 Aug 2018, Andre Naujoks wrote:

> This bugs affects all currently available Java versions in Debian (7, 8, 10 
> and 11).
> I don't know how to mark this here.

Normally, cloning the bug against all affected packages,
but I’m Cc’ing Doko on this hoping he’ll DTRT ☺

> The contents of the patch should
> be usable for all versions with very little change.
[…]
> The attached patch fixes/adds this in the jvm.

This is another of these things where it’d be preferable to
fix this upstream first then apply the patch in Debian packages.
However it’s small and easily applied ahead of time. It’d be no
good if I’d fix this in openjdk-8 but 11 (and 17, possibly) are
unfixed; Doko?

Andre, can you report this upstream?

Thanks,
//mirabilos
-- 
15:41⎜ Somebody write a testsuite for helloworld :-)



Bug#907541: [openjdk-8] Bind to a multicast address fails

2018-08-29 Thread Andre Naujoks
Package: openjdk-8
Version: 8u181-b13-1
Severity: normal
Tags: patch

--- Please enter the report below this line. ---

This bugs affects all currently available Java versions in Debian (7, 8, 10 and 
11).
I don't know how to mark this here. The contents of the patch should
be usable for all versions with very little change.

If a java program tries to bind a datagram/UDP socket to a link- or node-local 
multicast
address and also sets the needed interface index, the bind operation on the 
socket
fails with "java.net.SocketException: Invalid argument".

This is because the JVM only transfers the interface index to the scope_id 
field in the struct sockaddr_in6,
if the address to bind to is a link local address (IN6_IS_ADDR_LINKLOCAL()).

A bind to a multicast address of link- or node-local scope needs the scope_id 
field as well.
(There might be an additional problem here, when binding to a higher scoped 
multicast address and trying to use
the non-default-route interface)

The attached patch fixes/adds this in the jvm.

I applied the patch by copying it to an "apt-get source"d openjdk-8 packages 
debian/patches dir and including it
in the debian/rules file in the COMMON_PATCHES variable. The resulting debian 
packages work as expected.

Additionally attached is a very small test program that wrongly throws the 
mentioned exception.
When run with the patched VM it works.
You might have to edit the interface name in line 33 when trying this out.

Regards
  Andre

--- System information. ---
Architecture: 
Kernel:   Linux 4.17.0-3-amd64

Debian Release: buster/sid
  500 unstable-debug  debug.mirrors.debian.org 
  500 unstabledeb.debian.org 

--- Package information. ---
Package's Depends field is empty.

Package's Recommends field is empty.

Package's Suggests field is empty.

diff -Naur jdk/src/solaris/native/java/net/net_util_md.c jdk.new/src/solaris/native/java/net/net_util_md.c
--- a/jdk/src/solaris/native/java/net/net_util_md.c	2018-05-17 22:24:20.0 +0200
+++ b/jdk/src/solaris/native/java/net/net_util_md.c	2018-08-28 10:54:00.022607297 +0200
@@ -838,7 +838,9 @@
  * cases the used value is cached for further use.
  */
 #ifdef __linux__
-if (IN6_IS_ADDR_LINKLOCAL(&(him6->sin6_addr))) {
+if (IN6_IS_ADDR_LINKLOCAL(&(him6->sin6_addr))
+|| IN6_IS_ADDR_MC_NODELOCAL(&(him6->sin6_addr))
+|| IN6_IS_ADDR_MC_LINKLOCAL(&(him6->sin6_addr))) {
 int cached_scope_id = 0, scope_id = 0;
 
 if (ia6_cachedscopeidID) {

import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Inet6Address;
import java.net.NetworkInterface;

import java.lang.Error;

class mcast_test {

private static final byte[] ADDR = new byte[]{
(byte) 0xff,
(byte) 0x12,
(byte) 0x00,
(byte) 0x00,
(byte) 0x00,
(byte) 0x00,
(byte) 0x00,
(byte) 0x00,
(byte) 0x00,
(byte) 0x00,
(byte) 0x00,
(byte) 0x00,
(byte) 0x47,
(byte) 0x49,
(byte) 0x47,
(byte) 0x50
};

	public static void main(String[] args) throws Exception
	{
		Inet6Address addr = Inet6Address.getByAddress(
"", ADDR, NetworkInterface.getByName("enp6s0")
);

		System.out.println(addr);

		DatagramSocket s = new DatagramSocket(
new InetSocketAddress(
	addr,
	29550
	)
);
	}
};