diff options
author | Luigi Rizzo <luigi@FreeBSD.org> | 2010-11-12 13:02:26 +0000 |
---|---|---|
committer | Luigi Rizzo <luigi@FreeBSD.org> | 2010-11-12 13:02:26 +0000 |
commit | 5c9d0a9ad384b852bdbc408697e27015334ea249 (patch) | |
tree | e91599dcbd47fe55ea222b065a06b499aa245cca /sys/sys/socketvar.h | |
parent | 2f8d87d326d2a274b1a932d537f182bdae4dbf88 (diff) | |
download | src-5c9d0a9ad384b852bdbc408697e27015334ea249.tar.gz src-5c9d0a9ad384b852bdbc408697e27015334ea249.zip |
This commit implements the SO_USER_COOKIE socket option, which lets
you tag a socket with an uint32_t value. The cookie can then be
used by the kernel for various purposes, e.g. setting the skipto
rule or pipe number in ipfw (this is the reason SO_USER_COOKIE has
been implemented; however there is nothing ipfw-specific in its
implementation).
The ipfw-related code that uses the optopn will be committed separately.
This change adds a field to 'struct socket', but the struct is not
part of any driver or userland-visible ABI so the change should be
harmless.
See the discussion at
http://lists.freebsd.org/pipermail/freebsd-ipfw/2009-October/004001.html
Idea and code from Paul Joe, small modifications and manpage
changes by myself.
Submitted by: Paul Joe
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=215178
Diffstat (limited to 'sys/sys/socketvar.h')
-rw-r--r-- | sys/sys/socketvar.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index 6d6578b68abe..94c3b24e5c3e 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -117,7 +117,14 @@ struct socket { void *so_accept_filter_arg; /* saved filter args */ char *so_accept_filter_str; /* saved user args */ } *so_accf; + /* + * so_fibnum, so_user_cookie and friends can be used to attach + * some user-specified metadata to a socket, which then can be + * used by the kernel for various actions. + * so_user_cookie is used by ipfw/dummynet. + */ int so_fibnum; /* routing domain for this socket */ + uint32_t so_user_cookie; }; /* |