strace/xlat/setsockipoptions.in

32 lines
582 B
Plaintext
Raw Normal View History

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-19 20:29:27 +03:00
/*
* Options specific to setsockopt(SOL_IP).
* Common {g,s}etsockopt(SOL_IP) options
* should be in sockipoptions.in instead.
*/
ARPT_SO_SET_REPLACE
ARPT_SO_SET_ADD_COUNTERS
EBT_SO_SET_ENTRIES
EBT_SO_SET_COUNTERS
IP_VS_SO_SET_NONE
IP_VS_SO_SET_INSERT
IP_VS_SO_SET_ADD
IP_VS_SO_SET_EDIT
IP_VS_SO_SET_DEL
IP_VS_SO_SET_FLUSH
IP_VS_SO_SET_LIST
IP_VS_SO_SET_ADDDEST
IP_VS_SO_SET_DELDEST
IP_VS_SO_SET_EDITDEST
IP_VS_SO_SET_TIMEOUT
IP_VS_SO_SET_STARTDAEMON
IP_VS_SO_SET_STOPDAEMON
IP_VS_SO_SET_RESTORE
IP_VS_SO_SET_SAVE
IP_VS_SO_SET_ZERO
IPT_SO_SET_REPLACE
IPT_SO_SET_ADD_COUNTERS