]>
git.proxmox.com Git - mirror_frr.git/blob - lib/pbr.h
1 /* Policy Based Routing (PBR) main header
2 * Copyright (C) 2018 6WIND
4 * FRR is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2, or (at your option) any
9 * FRR is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with FRR; see the file COPYING. If not, write to the Free
16 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27 #define PBR_STR "Policy Based Routing\n"
32 * The filter or match criteria in a PBR rule.
33 * For simplicity, all supported filters are grouped into a structure rather
34 * than delineating further. A bitmask denotes which filters are actually
38 uint32_t filter_bm
; /* not encoded by zapi
40 #define PBR_FILTER_SRC_IP (1 << 0)
41 #define PBR_FILTER_DST_IP (1 << 1)
42 #define PBR_FILTER_SRC_PORT (1 << 2)
43 #define PBR_FILTER_DST_PORT (1 << 3)
44 #define PBR_FILTER_FWMARK (1 << 4)
45 #define PBR_FILTER_PROTO (1 << 5)
46 #define PBR_FILTER_SRC_PORT_RANGE (1 << 6)
47 #define PBR_FILTER_DST_PORT_RANGE (1 << 7)
49 /* Source and Destination IP address with masks. */
53 /* Source and Destination higher-layer (TCP/UDP) port numbers. */
57 /* Filter with fwmark */
64 * The action corresponding to a PBR rule.
65 * While the user specifies the action in a particular way, the forwarding
66 * plane implementation (Linux only) requires that to be encoded into a
67 * route table and the rule then point to that route table; in some cases,
68 * the user criteria may directly point to a table too.
77 * This is a combination of the filter criteria and corresponding action.
78 * Rules also have a user-defined sequence number which defines the relative
79 * order amongst rules.
87 struct pbr_filter filter
;
88 struct pbr_action action
;
92 extern int zapi_pbr_rule_encode(uint8_t cmd
, struct stream
*s
,
93 struct pbr_rule
*zrule
);