struct nf_sockopt_ops
Forgive me if that has already been discussed.
I'm wondering why the get and set members of the struct take some form of int as last parameter. Wouldn't be a long be the more logical choice? I can see changing the type here wouldn't help because nf_sockopt also accepting only an int for len.
struct nf_sockopt_ops
{
/* snip */
int (*set)(struct sock *sk, int optval, void __user *user, unsigned int len);
/* snip */
int (*get)(struct sock *sk, int optval, void __user *user, int *len);/* snip */
};
Or at least the last parameter of the set member being a signed int to match the parameter to nf_sockopt.
Any insight into why the parameters were chosen that way would be truly appreciated.
Regards,
Carl-Daniel
Quoted 13 lines · Carl-Daniel Hailfinger
Forgive me if that has already been discussed.
I'm wondering why the get and set members of the struct take some form of int as last parameter. Wouldn't be a long be the more logical choice? I can see changing the type here wouldn't help because
nf_sockoptalso accepting only an int for len.struct
nf_sockopt_ops
{
/* snip */int (*set)(struct sock *sk, int optval, void __user *user, unsigned int len); /* snip */ int (*get)(struct sock *sk, int optval, void __user *user, int *len);
Quoted 8 lines
/* snip */
};Or at least the last parameter of the set member being a signed int to match the parameter to
nf_sockopt.Any insight into why the parameters were chosen that way would be truly appreciated.
For compatibility. setsockopt(2):
The fifth argument of getsockopt and setsockopt is in reality an int [*] (and this is what BSD 4.* and libc4 and libc5 have). Some POSIX
confusion resulted in the present socklen_t, also used by glibc. See
also accept(2).
Regards
Patrick