Skip to content

Commit 402b48d

Browse files
authored
Merge pull request esnet#1468 from BrainSlayer/master
fix endian type of udp connect / reply messages
2 parents a67fd67 + 9caff37 commit 402b48d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/iperf.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
#include "queue.h"
6868
#include "cjson.h"
6969
#include "iperf_time.h"
70+
#include "portable_endian.h"
7071

7172
#if defined(HAVE_SSL)
7273
#include <openssl/bio.h>
@@ -453,9 +454,16 @@ struct iperf_test
453454
extern int gerror; /* error value from getaddrinfo(3), for use in internal error handling */
454455

455456
/* UDP "connect" message and reply (textual value for Wireshark, etc. readability - legacy was numeric) */
457+
458+
#if BYTE_ORDER == BIG_ENDIAN
459+
#define UDP_CONNECT_MSG 0x39383736
460+
#define UDP_CONNECT_REPLY 0x36373839
461+
#define LEGACY_UDP_CONNECT_REPLY 0xb168de3a
462+
#else
456463
#define UDP_CONNECT_MSG 0x36373839 // "6789" - legacy value was 123456789
457464
#define UDP_CONNECT_REPLY 0x39383736 // "9876" - legacy value was 987654321
458465
#define LEGACY_UDP_CONNECT_REPLY 987654321 // Old servers may still reply with the legacy value
466+
#endif
459467

460468
/* In Reverse mode, maximum number of packets to wait for "accept" response - to handle out of order packets */
461469
#define MAX_REVERSE_OUT_OF_ORDER_PACKETS 2

src/iperf_udp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
#include "timer.h"
4848
#include "net.h"
4949
#include "cjson.h"
50-
#include "portable_endian.h"
5150

5251
#if defined(HAVE_INTTYPES_H)
5352
# include <inttypes.h>

0 commit comments

Comments
 (0)