HewlettPackard / netperf

Netperf is a benchmark that can be used to measure the performance of many different types of networking. It provides tests for both unidirectional throughput, and end-to-end latency.
MIT License
859 stars 187 forks source link

netperf sends traffic with an address different from the one specified by the parameter "-L" on linux #56

Open O-ring opened 3 years ago

O-ring commented 3 years ago

Hello everyone,

I have compiled netperf-master on Slackware linux x86-64, with the following options:

sh configure --prefix=/usr --enable-demo --enable-histogram

If I run the following command:

netperf -L 1.1.1.1 -H 10.81.160.56 -d 10 -l 5 -v 2 -D 1 -f m

I can see on the remote host (10.81.160.56) that the tcp traffic source ip address is not the one specified with the '-L' parameters, but another ip address (host is multi homed). Here is the output from netperf:

netperf -L 1.1.1.1 -H 10.81.160.56 -d 10 -l 5 -v 2 -D 1 -f m resolve_host called with host '10.81.160.56' port '(null)' family AF_UNSPEC getaddrinfo returned the following for host '10.81.160.56' port '(null)' family AF_UNSPEC cannonical name: '10.81.160.56' flags: 22 family: AF_INET: socktype: SOCK_STREAM protocol IPPROTO_TCP addrlen 16 sa_family: AF_INET sadata: 0 0 10 81 160 56 0 0 0 0 0 0 0 0 0 0 scan_omni_args called with the following argument vector netperf -L 1.1.1.1 -H 10.81.160.56 -d -l 5 -v 2 -D 1 -f m 10 sizeof(omni_request_struct)=200/648 sizeof(omni_response_struct)=204/648 sizeof(omni_results_struct)=284/648 Program name: netperf Local send alignment: 8 Local recv alignment: 8 Remote send alignment: 8 Remote recv alignment: 8 Local socket priority: -1 Remote socket priority: -1 Local socket TOS: cs0 Remote socket TOS: cs0 Report local CPU 0 Report remote CPU 0 Verbosity: 2 Debug: 1 Port: 12865 Test name: TCP_STREAM Test bytes: 0 Test time: 5 Test trans: 0 Host name: 10.81.160.56

installing catcher for all signals Could not install signal catcher for sig 32, errno 22 Could not install signal catcher for sig 33, errno 22 Could not install signal catcher for sig 65, errno 22 remotehost is 10.81.160.56 and port 12865 resolve_host called with host '10.81.160.56' port '12865' family AF_INET getaddrinfo returned the following for host '10.81.160.56' port '12865' family AF_INET cannonical name: '10.81.160.56' flags: 22 family: AF_INET: socktype: SOCK_STREAM protocol IPPROTO_TCP addrlen 16 sa_family: AF_INET sadata: 50 65 10 81 160 56 0 0 0 0 0 0 0 0 0 0 resolve_host called with host '1.1.1.1' port '0' family AF_UNSPEC getaddrinfo returned the following for host '1.1.1.1' port '0' family AF_UNSPEC cannonical name: '1.1.1.1' flags: 22 family: AF_INET: socktype: SOCK_STREAM protocol IPPROTO_TCP addrlen 16 sa_family: AF_INET sadata: 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 establish_control called with host '10.81.160.56' port '12865' remfam AF_INET local '1.1.1.1' port '0' locfam AF_UNSPEC bound control socket to 1.1.1.1 and 0 successful connection to remote netserver at 10.81.160.56 and 12865 complete_addrinfo using hostname 10.81.160.56 port 0 family AF_INET type SOCK_STREAM prot IPPROTO_TCP flags 0x0 getaddrinfo returned the following for host '10.81.160.56' port '0' family AF_INET cannonical name: '10.81.160.56' flags: 22 family: AF_INET: socktype: SOCK_STREAM protocol IPPROTO_TCP addrlen 16 sa_family: AF_INET sadata: 0 0 10 81 160 56 0 0 0 0 0 0 0 0 0 0 local_data_address not set, using local_host_name of '1.1.1.1' complete_addrinfo using hostname 1.1.1.1 port 0 family AF_UNSPEC type SOCK_STREAM prot IPPROTO_TCP flags 0x1 getaddrinfo returned the following for host '1.1.1.1' port '0' family AF_UNSPEC cannonical name: '1.1.1.1' flags: 23 family: AF_INET: socktype: SOCK_STREAM protocol IPPROTO_TCP addrlen 16 sa_family: AF_INET sadata: 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 MIGRATED TCP STREAM TEST from 1.1.1.1 () port 0 AF_INET to 10.81.160.56 () port 0 AF_INET : histogram : demo create_data_socket: socket 4 obtained... netperf: get_sock_buffer: send socket size determined to be 131072 netperf: get_sock_buffer: receive socket size determined to be 131072 send_omni_inner: 2 entry send_ring obtained... recv_response: received a 656 byte response remote listen done. remote port is 40275 About to start a timer for 5 seconds. Interim result: 77.22 10^6bits/s over 1.032 seconds ending at 1611671064.064 Interim result: 74.05 10^6bits/s over 1.062 seconds ending at 1611671065.126 Interim result: 72.41 10^6bits/s over 1.014 seconds ending at 1611671066.139 Interim result: 71.36 10^6bits/s over 1.014 seconds ending at 1611671067.153 Interim result: 74.00 10^6bits/s over 0.879 seconds ending at 1611671068.032 netperf: get_sock_buffer: receive socket size determined to be 131072 netperf: get_sock_buffer: send socket size determined to be 1912320 disconnect_data_socket sock 4 init 1 do_close 1 protocol 6 Adjusting elapsed_time by 0 seconds recv_response: received a 656 byte response remote results obtained calculate_confidence: itr 1; time 5.197987; res 71.192497 lcpu -1.000000; rcpu -1.000000 lsdm -1.000000; rsdm -1.000000 Recv Send Send
Socket Socket Message Elapsed
Size Size Size Time Throughput
bytes bytes bytes secs. 10^6bits/sec

131072 131072 131072 5.20 71.19

Alignment Offset Bytes Bytes Sends Bytes Recvs Local Remote Local Remote Xfered Per Per Send Recv Send Recv Send (avg) Recv (avg) 8 8 0 0 46137344 131072.00 352 1404.02 32861

Maximum Segment Size (bytes) 1349

Histogram of time spent in send() call. UNIT_USEC : 0: 0: 0: 0: 0: 0: 0: 0: 0: 0 TEN_USEC : 0: 0: 216: 44: 3: 3: 2: 1: 0: 0 HUNDRED_USEC : 0: 0: 0: 0: 0: 0: 0: 0: 0: 0 UNIT_MSEC : 0: 0: 1: 0: 0: 0: 1: 0: 1: 0 TEN_MSEC : 0: 1: 7: 8: 3: 5: 2: 53: 0: 0 HUNDRED_MSEC : 0: 1: 0: 0: 0: 0: 0: 0: 0: 0 UNIT_SEC : 0: 0: 0: 0: 0: 0: 0: 0: 0: 0 TEN_SEC : 0: 0: 0: 0: 0: 0: 0: 0: 0: 0

100_SECS: 0 HIST_TOTAL: 352 sum 4990327, sumsquare 0.000000, limit 2 count 1 shutdown_control: shutdown of control connection requested.

and this is the "ip a li" output from the netperf box:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether fc:4d:d4:2e:dd:59 brd ff:ff:ff:ff:ff:ff inet 10.68.64.254/22 brd 10.68.67.255 scope global eth0 valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000 link/ether 00:1f:29:54:ac:0c brd ff:ff:ff:ff:ff:ff 4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:1f:29:54:ac:0d brd ff:ff:ff:ff:ff:ff 5: eth3: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000 link/ether 00:15:17:f9:54:0f brd ff:ff:ff:ff:ff:ff inet 1.1.1.1/28 scope global eth3 valid_lft forever preferred_lft forever 6: eth4: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether a0:ce:c8:13:1e:f2 brd ff:ff:ff:ff:ff:ff

ip source address is always the 10.68.64.254 even though the '-L' parameter has been specified

bkiziuk commented 3 years ago

Hmm, the help says that -L causes to bind (only) a control connection to a specific interface which seems to work. However, I would also like to see an ability to bind the data connection to a specific interface. It is useful in setups where there's a need to create multiple independent test streams via different physical interfaces.

O-ring commented 3 years ago

Hello,

yes indeed. I also try to dig inside the sources, but no luck.