You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to add a function (in syscall_unix.go) to set the socket repair options.
There are a few "typed" functions that exist already (unix.SetsockoptInt,SetsockoptInet4Addr,SetsockoptLinger) and I see this new function sitting alongside them.
The reason I would like to add it is because I cannot currently see a way to pass in the repair options in the way they need to be passed in.
There is no way (that I can see, please help if I am incorrect) to do this syscall in that manner, given the protection the go api has with the typed/named functions.
The work would be :
Add the tcp_repair_opt struct as TcpRepairOpt struct alongside the other structs in x/sys/unix/linux/types.go that are auto generated to x/sys/unix/ztypes_linux_amd64.go at build time. This tcp_repair_opt linux struct is currently found in the netinet/tcp.h linux header file
Add a function SetsockoptRepairOpt(fd, level, opt int, o []TcpRepairOpt) (err error) {
Would this be worth adding ?
The text was updated successfully, but these errors were encountered:
seankhliao
changed the title
/x/sys/unix Allow for setting tcp repair options
proposal: x/sys/unix: allow setting tcp repair options
Jun 30, 2021
go version go1.16.5 linux/amd64
GOARCH="amd64"
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
I would like to add a function (in syscall_unix.go) to set the socket repair options.
There are a few "typed" functions that exist already (unix.SetsockoptInt,SetsockoptInet4Addr,SetsockoptLinger) and I see this new function sitting alongside them.
The reason I would like to add it is because I cannot currently see a way to pass in the repair options in the way they need to be passed in.
An example of doing this call in C is
setsockopt(sk, SOL_TCP, TCP_REPAIR_OPTIONS,
opts, 4 * sizeof(struct tcp_repair_opt)
where opts is
struct tcp_repair_opt opts[4]
and tcp_repair_opts from tcp.h is
/* For socket repair options. */
struct tcp_repair_opt
{
u_int32_t opt_code;
u_int32_t opt_val;
};
There is no way (that I can see, please help if I am incorrect) to do this syscall in that manner, given the protection the go api has with the typed/named functions.
The work would be :
Add the tcp_repair_opt struct as TcpRepairOpt struct alongside the other structs in x/sys/unix/linux/types.go that are auto generated to x/sys/unix/ztypes_linux_amd64.go at build time. This tcp_repair_opt linux struct is currently found in the netinet/tcp.h linux header file
Add a function SetsockoptRepairOpt(fd, level, opt int, o []TcpRepairOpt) (err error) {
Would this be worth adding ?
The text was updated successfully, but these errors were encountered: