mirror of
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git
synced 2024-12-02 22:34:03 +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>
23 lines
515 B
C
23 lines
515 B
C
#ifndef __SS_UTIL_H__
|
|
#define __SS_UTIL_H__
|
|
|
|
#include <linux/sock_diag.h>
|
|
#include <linux/inet_diag.h>
|
|
|
|
#define MAGIC_SEQ 123456
|
|
|
|
#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), \
|
|
}, \
|
|
}
|
|
|
|
#endif /* __SS_UTIL_H__ */
|