RE: [EXTERNAL] Re: Sockperf for FreeBSD not working while running as server

From: Wei Hu <weh_at_microsoft.com>
Date: Fri, 26 Sep 2025 05:44:26 UTC

> -----Original Message-----
> From: Enji Cooper (yaneurabeya) <yaneurabeya@gmail.com>
> Sent: Friday, September 26, 2025 11:33 AM
> 
> > On Sep 24, 2025, at 11:58 PM, Wei Hu <weh@microsoft.com> wrote:
> >
> > Hi,
> >
> > I want to use sockperf  (https://github.com/Mellanox/sockperf.git) to test
> latency for a network interface.
> >
> > I can build it after some changes in C++ source to suit it for the
> > latest C++ compiler on FreeBSD 15. Running Sockperf client on FreeBSD
> > (with command like ' sockperf ping-pong -i x.x.x.x -p 8201 -t 20 --tcp --
> pps=max --full-rtt) was successful. It can send and receive packets to sockperf
> server running on Linux and print out the latency stats.
> >
> > However, running it as sockperf server ( with command 'sockperf server
> > -i x.x.x.x --tcp -p 8201')  failed with tons of following errors which receiving
> packets from the Linux client:
> >
> > ...
> > [debug] raw: receive_pending_data IP: (unknown):(unk) [fd=4 ret=14]
> > Bad file descriptor <src/input_handlers.h: receive_pending_data #91>
> > size 74
> > sockperf: src/common.cpp:73:ERROR: getnameinfo returned 5: Address
> > family not recognized, addr family: 88
> > (errno=9 Bad file descriptor)
> 
> 	There is no address family == 88 on FreeBSD..
> 	Having an idea of what you’ve modified in your fork/branch would
> probably be a really helpful start.

Thanks! I also noticed this. Each time it gives different addr family. For example
I just ran again and this time the addr family is 54. I guess some data structures
are messed up.

Attached is the patch I applied to make it build on FreeBSD. Without the patch,
gmake spits errors like:

In file included from src/aopt.cpp:37:
In file included from src/defs.h:109:
src/ip_address.h:120:50: error: no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?
template <> struct hash<IPAddress> : public std::unary_function<IPAddress, int> {
                                            ~~~~~^~~~~~~~~~~~~~
                                                 __unary_function
/usr/include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here
using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;

Thanks,
Wei