diff options
author | Dmitry Yakunin <zeil@yandex-team.ru> | 2020-05-09 19:52:02 +0300 |
---|---|---|
committer | David Ahern <dsahern@gmail.com> | 2020-05-13 14:28:38 +0000 |
commit | 7bd9188581aa8abd644d45a990529a92efe50255 (patch) | |
tree | de79c1cc700bf68ee8436838ec8eb7ac4a13a0a6 /misc/ss.c | |
parent | 14f4bda590447179e2b338c6e494658d2f737e6e (diff) | |
download | iproute2-7bd9188581aa8abd644d45a990529a92efe50255.tar.gz |
ss: add checks for bc filter support
As noted by David Ahern, now if some bytecode filter is not supported
by running kernel printed error message is not clear. This patch is attempt to
detect such case and print correct message. This is done by providing checking
function for new filter types. As example check function for cgroup filter
is implemented. It sends correct lightweight request (idiag_states = 0)
with zero cgroup condition to the kernel and checks returned errno. If filter
is not supported EINVAL is returned. Result of checking is cached to
avoid extra checks if several same filters are specified.
Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru>
Signed-off-by: David Ahern <dsahern@gmail.com>
Diffstat (limited to 'misc/ss.c')
-rw-r--r-- | misc/ss.c | 17 |
1 files changed, 1 insertions, 16 deletions
@@ -29,6 +29,7 @@ #include <limits.h> #include <stdarg.h> +#include "ss_util.h" #include "utils.h" #include "rt_names.h" #include "ll_map.h" @@ -39,8 +40,6 @@ #include "cg_map.h" #include <linux/tcp.h> -#include <linux/sock_diag.h> -#include <linux/inet_diag.h> #include <linux/unix_diag.h> #include <linux/netdevice.h> /* for MAX_ADDR_LEN */ #include <linux/filter.h> @@ -64,24 +63,10 @@ #define AF_VSOCK PF_VSOCK #endif -#define MAGIC_SEQ 123456 #define BUF_CHUNK (1024 * 1024) /* Buffer chunk allocation size */ #define BUF_CHUNKS_MAX 5 /* Maximum number of allocated buffer chunks */ #define LEN_ALIGN(x) (((x) + 1) & ~1) -#define DIAG_REQUEST(_req, _r) \ - struct { \ - struct nlmsghdr nlh; \ - _r; \ - } _req = { \ - .nlh = { \ - .nlmsg_type = SOCK_DIAG_BY_FAMILY, \ - .nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST,\ - .nlmsg_seq = MAGIC_SEQ, \ - .nlmsg_len = sizeof(_req), \ - }, \ - } - #if HAVE_SELINUX #include <selinux/selinux.h> #else |