]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
selftests/net: fix bugs in address and port initialization
authorSowmini Varadhan <sowmini.varadhan@oracle.com>
Mon, 25 Dec 2017 22:43:04 +0000 (14:43 -0800)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Thu, 12 Apr 2018 13:04:20 +0000 (10:04 -0300)
commit0c8e139a60c55ea4b10212f410fbb0acee37087f
tree5828c74bf4a2d2b3565d87387f4430f9a482a80f
parentd772b3a9d3c073cc8870962e62a9828020a32118
selftests/net: fix bugs in address and port initialization

BugLink: http://bugs.launchpad.net/bugs/1763366
[ Upstream commit d36f45e5b46723cf2d4147173e18c52d4143176d ]

Address/port initialization should work correctly regardless
of the order in which command line arguments are supplied,
E.g, cfg_port should be used to connect to the remote host
even if it is processed after -D, src/dst address initialization
should not require that [-4|-6] be specified before
the -S or -D args, receiver should be able to bind to *.<cfg_port>

Achieve this by making sure that the address/port structures
are initialized after all command line options are parsed.

Store cfg_port in host-byte order, and use htons()
to set up the sin_port/sin6_port before bind/connect,
so that the network system calls get the correct values
in network-byte order.

Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
tools/testing/selftests/net/msg_zerocopy.c