CloudNativeDataPlane / cndp

Cloud Native Data Plane (CNDP) is a collection of user space libraries to accelerate packet processing for cloud applications using AF_XDP sockets as the primary I/O..
BSD 3-Clause "New" or "Revised" License
90 stars 32 forks source link

`chnl_connect` should accept operations from Channel 0 #370

Closed jalalmostafa closed 5 months ago

jalalmostafa commented 5 months ago

The current implementation of chnl_connect rejects operations from channel 0 and returns EFAULT. I did not understand the reason for this. Assume the CNDP application is a usual TCP client, then the first channel created to initialize a connection could be channel 0 which is rejected.

https://github.com/CloudNativeDataPlane/cndp/blob/9413087ac193cabdbd3db2f6df64986232acb4df/lib/cnet/chnl/cnet_chnl.c#L486

Is this a typo (the developer wanted to check the channel data structure ch for NULL values instead of channel descriptor cd)? If so, this PR fixes the typo and does necessary refactoring.