On Wed, 2024-06-19 at 10:51 +0800, Geliang Tang wrote: > From: Geliang Tang <tanggeliang@xxxxxxxxxx> > > The opts.{type, noconnect} is at least a bit non intuitive or unnecessary. > The only use case now is in test_bpf_ip_check_defrag_ok which ends up > bypassing most (or at least some) of the connect_to_fd_opts() logic. It's > much better that test should have its own connect_to_fd_opts() instead. > > This patch adds a new "type" parameter for connect_to_fd_opts(), then > opts->type and getsockopt(SO_TYPE) can be replaced by "type" parameter in > it. > > In connect_to_fd(), use getsockopt(SO_TYPE) to get "type" value and pass > it to connect_to_fd_opts(). > > In bpf_tcp_ca.c and cgroup_v1v2.c, "SOCK_STREAM" types are passed to > connect_to_fd_opts(), and in ip_check_defrag.c, different types "SOCK_RAW" > and "SOCK_DGRAM" are passed to it. > > With these changes, the strcut member "type" of network_helper_opts can be > dropped now. > > Signed-off-by: Geliang Tang <tanggeliang@xxxxxxxxxx> > --- Acked-by: Eduard Zingerman <eddyz87@xxxxxxxxx>