mirror of
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git
synced 2024-11-15 14:05:22 +08:00
7bd9188581
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>
34 lines
560 B
C
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);
|