blob: 3b92cbb62895910ef0cdbdac2c61e84d2a379222 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/* Copyright (C) 2022 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*!
* \file
*
* \brief XDP filter configuration constants.
*
* \addtogroup xdp
* @{
*/
#pragma once
#include <linux/types.h>
#define KNOT_XDP_PKT_ALIGNMENT 2 /*!< Fix for misaligned access to packet structures. */
/*! \brief XDP filter configuration flags. */
typedef enum {
KNOT_XDP_FILTER_ON = 1 << 0, /*!< Filter enabled. */
KNOT_XDP_FILTER_UDP = 1 << 1, /*!< Apply filter to UDP. */
KNOT_XDP_FILTER_TCP = 1 << 2, /*!< Apply filter to TCP. */
KNOT_XDP_FILTER_QUIC = 1 << 3, /*!< Apply filter to QUIC/UDP. */
KNOT_XDP_FILTER_PASS = 1 << 4, /*!< Pass incoming messages to ports >= port value. */
KNOT_XDP_FILTER_DROP = 1 << 5, /*!< Drop incoming messages to ports >= port value. */
KNOT_XDP_FILTER_ROUTE = 1 << 6, /*!< Consider routing information from kernel. */
} knot_xdp_filter_flag_t;
/*! \brief XDP map item for the filter configuration. */
typedef struct knot_xdp_opts knot_xdp_opts_t;
struct knot_xdp_opts {
__u16 flags; /*!< XDP filter flags \a knot_xdp_filter_flag_t. */
__u16 udp_port; /*!< UDP/TCP port to listen on. */
__u16 quic_port; /*!< QUIC/UDP port to listen on. */
} __attribute__((packed));
/*! \brief Additional information from the filter. */
typedef struct knot_xdp_info knot_xdp_info_t;
struct knot_xdp_info {
__u16 out_if_index; /*!< Index of the output interface (if routing enabled). */
};
/*! @} */
|