| 1 |
/* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 |
#ifndef __SS_UTIL_H__ |
| 3 |
#define __SS_UTIL_H__ |
| 4 |
|
| 5 |
#include <linux/sock_diag.h> |
| 6 |
#include <linux/inet_diag.h> |
| 7 |
|
| 8 |
#define MAGIC_SEQ 123456 |
| 9 |
|
| 10 |
#define DIAG_REQUEST(_req, _r) \ |
| 11 |
struct { \ |
| 12 |
struct nlmsghdr nlh; \ |
| 13 |
_r; \ |
| 14 |
} _req = { \ |
| 15 |
.nlh = { \ |
| 16 |
.nlmsg_type = SOCK_DIAG_BY_FAMILY, \ |
| 17 |
.nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST,\ |
| 18 |
.nlmsg_seq = MAGIC_SEQ, \ |
| 19 |
.nlmsg_len = sizeof(_req), \ |
| 20 |
}, \ |
| 21 |
} |
| 22 |
|
| 23 |
#endif /* __SS_UTIL_H__ */ |