iproute2/misc/ssfilter.h
Dmitry Yakunin 7bd9188581 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>
2020-05-13 14:28:38 +00:00

34 lines
560 B
C

#include <stdbool.h>
enum {
SSF_DCOND,
SSF_SCOND,
SSF_OR,
SSF_AND,
SSF_NOT,
SSF_D_GE,
SSF_D_LE,
SSF_S_GE,
SSF_S_LE,
SSF_S_AUTO,
SSF_DEVCOND,
SSF_MARKMASK,
SSF_CGROUPCOND,
SSF__MAX
};
bool ssfilter_is_supported(int type);
struct ssfilter
{
int type;
struct ssfilter *post;
struct ssfilter *pred;
};
int ssfilter_parse(struct ssfilter **f, int argc, char **argv, FILE *fp);
void *parse_hostcond(char *addr, bool is_port);
void *parse_devcond(char *name);
void *parse_markmask(const char *markmask);
void *parse_cgroupcond(const char *path);