0
0
mirror of https://github.com/OpenVPN/openvpn.git synced 2024-09-20 12:02:28 +02:00
openvpn/tests
Arne Schwabe 0f904615bd Fix unit test of test_pkt on little endian Linux
This surprising breakage results from the fact that Linux basically uses
a different structure from the *BSD:

For exmaple, macOS has:

struct sockaddr_in {
    __uint8_t       sin_len;
    sa_family_t     sin_family;
    in_port_t       sin_port;
    struct  in_addr sin_addr;
    char            sin_zero[8];
};

with sa_family_t also uint8_t

and Linux has stupidly complex definition that boils down to:

struct sockaddr_in
  {
    uint16_t sin_family;
    in_port_t sin_port;
    struct in_addr sin_addr
    char sin_zero[8];
  };

So Linux basically has a 16 bit uint16 instead of two uint8_t. Because
s390x is big endian, this happens to be same in memory layout as on all
BSDs with first byte being 0 and second byte being the family.

Introduce a second array to check against, if we are on little endian
Linux.
This is a bit fragile but this is also just a unit test.

This also fixes compiling test_pkt with windows.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20221207140259.1083577-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25633.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2022-12-07 19:14:07 +01:00
..
unit_tests Fix unit test of test_pkt on little endian Linux 2022-12-07 19:14:07 +01:00
Makefile.am update copyright year to 2022 2022-01-26 13:38:41 +01:00
t_client.rc-sample Deprecate --ns-cert-type 2017-03-19 16:49:11 +01:00
t_client.sh.in introduce V= level to manage t_client.sh output verbosity 2022-09-27 17:53:52 +02:00
t_cltsrv-down.sh build: standard directory layout 2012-03-22 22:07:08 +01:00
t_cltsrv.sh build: standard directory layout 2012-03-22 22:07:08 +01:00
t_lpback.sh denoise tests/t_lpback.sh 2022-10-05 13:27:52 +02:00
t_net.sh networking: add net_iface_type API 2022-07-13 14:47:49 +02:00
update_t_client_ips.sh Prevent generation of duplicate EXPECT_IFCONFIG entries 2016-11-08 15:09:52 +01:00