* struct nf_sockopt_ops
@ 2005-04-16 14:31 Carl-Daniel Hailfinger
2005-04-17 22:05 ` Patrick McHardy
0 siblings, 1 reply; 2+ messages in thread
From: Carl-Daniel Hailfinger @ 2005-04-16 14:31 UTC (permalink / raw)
To: Netfilter Development Mailinglist
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: struct nf_sockopt_ops
2005-04-16 14:31 struct nf_sockopt_ops Carl-Daniel Hailfinger
@ 2005-04-17 22:05 ` Patrick McHardy
0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2005-04-17 22:05 UTC (permalink / raw)
To: Carl-Daniel Hailfinger; +Cc: Netfilter Development Mailinglist
Carl-Daniel Hailfinger wrote:
> 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.
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-04-17 22:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-16 14:31 struct nf_sockopt_ops Carl-Daniel Hailfinger
2005-04-17 22:05 ` Patrick McHardy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.