]> git.proxmox.com Git - mirror_frr.git/blob - zebra/tc_netlink.h
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / zebra / tc_netlink.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Zebra Traffic Control (TC) interaction with the kernel using netlink.
4 *
5 * Copyright (C) 2022 Shichu Yang
6 */
7
8 #ifndef _ZEBRA_TC_NETLINK_H
9 #define _ZEBRA_TC_NETLINK_H
10
11 #ifdef HAVE_NETLINK
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 /* Represent a prefixed address in flower filter */
18
19 struct inet_prefix {
20 uint16_t flags;
21 uint16_t bytelen;
22 uint16_t bitlen;
23 uint16_t family;
24 uint32_t data[64];
25 };
26
27 enum {
28 PREFIXLEN_SPECIFIED = (1 << 0),
29 ADDRTYPE_INET = (1 << 1),
30 ADDRTYPE_UNSPEC = (1 << 2),
31 ADDRTYPE_MULTI = (1 << 3),
32
33 ADDRTYPE_INET_UNSPEC = ADDRTYPE_INET | ADDRTYPE_UNSPEC,
34 ADDRTYPE_INET_MULTI = ADDRTYPE_INET | ADDRTYPE_MULTI
35 };
36
37 extern enum netlink_msg_status
38 netlink_put_tc_qdisc_update_msg(struct nl_batch *bth,
39 struct zebra_dplane_ctx *ctx);
40 extern enum netlink_msg_status
41 netlink_put_tc_class_update_msg(struct nl_batch *bth,
42 struct zebra_dplane_ctx *ctx);
43 extern enum netlink_msg_status
44 netlink_put_tc_filter_update_msg(struct nl_batch *bth,
45 struct zebra_dplane_ctx *ctx);
46
47 /**
48 * "filter" & "class" in the following become "tfilter" & "tclass" for
49 * the sake of consistency with kernel message types (RTM_NEWTFILTER etc.)
50 */
51
52 extern int netlink_qdisc_read(struct zebra_ns *zns);
53 extern int netlink_tfilter_read_for_interface(struct zebra_ns *zns,
54 ifindex_t ifindex);
55
56 extern int netlink_tfilter_change(struct nlmsghdr *h, ns_id_t ns_id,
57 int startup);
58 extern int netlink_tclass_change(struct nlmsghdr *h, ns_id_t ns_id,
59 int startup);
60 extern int netlink_qdisc_change(struct nlmsghdr *h, ns_id_t ns_id, int startup);
61
62
63 #ifdef __cplusplus
64 }
65 #endif
66
67 #endif /* HAVE_NETLINK */
68
69 #endif /* _ZEBRA_TC_NETLINK_H */