]> git.proxmox.com Git - mirror_frr.git/blob - zebra/tc_netlink.h
Merge pull request #12191 from manojvn/463777
[mirror_frr.git] / zebra / tc_netlink.h
1 /*
2 * Zebra Traffic Control (TC) interaction with the kernel using netlink.
3 *
4 * Copyright (C) 2022 Shichu Yang
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #ifndef _ZEBRA_TC_NETLINK_H
22 #define _ZEBRA_TC_NETLINK_H
23
24 #ifdef HAVE_NETLINK
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 /* Represent a prefixed address in flower filter */
31
32 struct inet_prefix {
33 uint16_t flags;
34 uint16_t bytelen;
35 uint16_t bitlen;
36 uint16_t family;
37 uint32_t data[64];
38 };
39
40 enum {
41 PREFIXLEN_SPECIFIED = (1 << 0),
42 ADDRTYPE_INET = (1 << 1),
43 ADDRTYPE_UNSPEC = (1 << 2),
44 ADDRTYPE_MULTI = (1 << 3),
45
46 ADDRTYPE_INET_UNSPEC = ADDRTYPE_INET | ADDRTYPE_UNSPEC,
47 ADDRTYPE_INET_MULTI = ADDRTYPE_INET | ADDRTYPE_MULTI
48 };
49
50 extern enum netlink_msg_status
51 netlink_put_tc_qdisc_update_msg(struct nl_batch *bth,
52 struct zebra_dplane_ctx *ctx);
53 extern enum netlink_msg_status
54 netlink_put_tc_class_update_msg(struct nl_batch *bth,
55 struct zebra_dplane_ctx *ctx);
56 extern enum netlink_msg_status
57 netlink_put_tc_filter_update_msg(struct nl_batch *bth,
58 struct zebra_dplane_ctx *ctx);
59
60 /**
61 * "filter" & "class" in the following become "tfilter" & "tclass" for
62 * the sake of consistency with kernel message types (RTM_NEWTFILTER etc.)
63 */
64
65 extern int netlink_qdisc_read(struct zebra_ns *zns);
66 extern int netlink_tfilter_read_for_interface(struct zebra_ns *zns,
67 ifindex_t ifindex);
68
69 extern int netlink_tfilter_change(struct nlmsghdr *h, ns_id_t ns_id,
70 int startup);
71 extern int netlink_tclass_change(struct nlmsghdr *h, ns_id_t ns_id,
72 int startup);
73 extern int netlink_qdisc_change(struct nlmsghdr *h, ns_id_t ns_id, int startup);
74
75
76 #ifdef __cplusplus
77 }
78 #endif
79
80 #endif /* HAVE_NETLINK */
81
82 #endif /* _ZEBRA_TC_NETLINK_H */