macOS 対向で UDP 送受信をやってみようとしたが unable to read from stream socket になる。
Solaris 側の BYTE_ORDER 判定が逆になっている。
Solaris 同士ではたまたま通るが、macOS や Linux 側の iperf3 とは UDP_CONNECT_REPLY が食い違って unable to read from stream socket になる。
原因は Solaris 側の endianness 判定でした。portable_endian.h の __sun 分岐で BYTE_ORDER / BIG_ENDIAN / LITTLE_ENDIAN が未定義のままになっていて、#if BYTE_ORDER == BIG_ENDIAN が未定義同士の 0 == 0 扱いになり、そのままだと Solaris x86 でも big-endian 用の UDP handshake 定数が使われる。
知らんかった...
--- src/portable_endian.h.orig
+++ src/portable_endian.h
@@ -59,6 +59,25 @@
# include <sys/types.h>
# include <netinet/in.h>
# include <inttypes.h>
+# include <sys/isa_defs.h>
+
+# if !defined(BIG_ENDIAN)
+# define BIG_ENDIAN 4321
+# endif
+
+# if !defined(LITTLE_ENDIAN)
+# define LITTLE_ENDIAN 1234
+# endif
+
+# if !defined(BYTE_ORDER)
+# if defined(_BIG_ENDIAN)
+# define BYTE_ORDER BIG_ENDIAN
+# elif defined(_LITTLE_ENDIAN)
+# define BYTE_ORDER LITTLE_ENDIAN
+# else
+# error unable to determine Solaris byte order
+# endif
+# endif
# if !defined (ntohll) || !defined(htonll)
# ifdef _BIG_ENDIAN
https://github.com/esnet/iperf
macOS 対向で UDP 送受信をやってみようとしたが unable to read from stream socket になる。
Solaris 側の BYTE_ORDER 判定が逆になっている。
Solaris 同士ではたまたま通るが、macOS や Linux 側の iperf3 とは UDP_CONNECT_REPLY が食い違って unable to read from stream socket になる。
原因は Solaris 側の endianness 判定でした。portable_endian.h の __sun 分岐で BYTE_ORDER / BIG_ENDIAN / LITTLE_ENDIAN が未定義のままになっていて、#if BYTE_ORDER == BIG_ENDIAN が未定義同士の 0 == 0 扱いになり、そのままだと Solaris x86 でも big-endian 用の UDP handshake 定数が使われる。
知らんかった...
https://github.com/esnet/iperf