strace/xlat/getsockipoptions.in
Mike Frysinger 54646b8e05 decode extend getsockopt/setsockopt options
Currently the code assumes the set of valid options between getsockopt
and setsockopt are exactly the same and thus maintains one list.  The
kernel unfortunately does not do this -- it allows for different opts
between the get and set functions.  See the {g,s}et_opt{min,max} fields
in the various netfilter subcores.

To support this, extend the printxval function to take multiple sets of
xlats as varargs.  Then we add the new get/set lists, and pass them down
in the net code when decoding things.

A simple example is iptables; before:
	getsockopt(4, SOL_IP, 0x40 /* IP_??? */, ...) = 0
	getsockopt(4, SOL_IP, 0x41 /* IP_??? */, ...) = 0
after:
	getsockopt(4, SOL_IP, IPT_SO_GET_INFO, ...) = 0
	getsockopt(4, SOL_IP, IPT_SO_GET_ENTRIES, ...) = 0

If these were setsockopt calls, then 0x40 & 0x41 would be
IPT_SO_SET_REPLACE & IPT_SO_SET_ADD_COUNTERS.

* configure.ac: Check for netfilter headers.
* defs.h (printxvals): New prototype.
(printxval): Change to a define.
* net.c: Include netfilter headers and new sockopts headers.
(print_sockopt_fd_level_name): Add a is_getsockopt argument.  Change SOL_IP
and SOL_IPV6 decoding to use printxvals, and use is_getsockopt to pass more
xlats down.
(getsockopt): Call print_sockopt_fd_level_name with is_getsockopt as true.
(setsockopt): Call print_sockopt_fd_level_name with is_getsockopt as false.
* util.c (printxval): Rename to ...
(printxvals): ... this.  Rewrite to be varargs based.
* xlat/getsockipoptions.in: New xlat list.
* xlat/getsockipv6options.in, xlat/setsockipoptions.in,
xlat/setsockipv6options.in: Likewise.
2015-08-26 12:09:25 +00:00

30 lines
557 B
Plaintext

/*
* Options specific to getsockopt(SOL_IP).
* Common {g,s}etsockopt(SOL_IP) options
* should be in sockipoptions.in instead.
*/
ARPT_SO_GET_INFO
ARPT_SO_GET_ENTRIES
ARPT_SO_GET_REVISION_MATCH
ARPT_SO_GET_REVISION_TARGET
EBT_SO_GET_INFO
EBT_SO_GET_ENTRIES
EBT_SO_GET_INIT_INFO
EBT_SO_GET_INIT_ENTRIES
IP_VS_SO_GET_VERSION
IP_VS_SO_GET_INFO
IP_VS_SO_GET_SERVICES
IP_VS_SO_GET_SERVICE
IP_VS_SO_GET_DESTS
IP_VS_SO_GET_DEST
IP_VS_SO_GET_TIMEOUT
IP_VS_SO_GET_DAEMON
IPT_SO_GET_INFO
IPT_SO_GET_ENTRIES
IPT_SO_GET_REVISION_MATCH
IPT_SO_GET_REVISION_TARGET