When we call `bind()` or `connect()`, the `addr` and `port` should be
in big endian value representation.
Portability notes:
- Do not hard code the address with integer like this `0x0100007fU`.
Instead, use `inet_addr("127.0.0.1")` to ensure portability for
the machine with different endianess. It's also cleaner and more
readable to use `inet_addr()` from `#include <arpa/inet.h>`.
- Use `htons(port_number)` to make sure the port_number is properly
choosen instead directly assign it with integer (still about
endianess problem).
This commit fixes endianess issue in these files:
test/232c93d07b74-test.c
test/accept-link.c
test/accept.c
test/poll-link.c
test/shutdown.c
test/socket-rw-eagain.c
test/socket-rw.c
Fixes: 08bd815170 ("Un-DOSify test/232c93d07b74-test.c")
Fixes: 4bce856d43 ("Improve reliability of poll/accept-link tests")
Fixes: 904989c0f1 ("Add nonblock empty socket read test")
Fixes: 7de6253569 ("test/accept: code reuse cleanup")
Fixes: 5068da320a ("Add IORING_OP_SHUTDOWN test case")
Fixes: 2b52a1be2d ("Moves function calls out of assert().")
Suggested-by: Louvian Lyndal <louvianlyndal@gmail.com>
Signed-off-by: Ammar Faizi <ammarfaizi2@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>