]>
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
26 * The filter or match criteria in a PBR rule.
27 * For simplicity, all supported filters are grouped into a structure rather
28 * than delineating further. A bitmask denotes which filters are actually
32 uint32_t filter_bm
; /* not encoded by zapi
34 #define PBR_FILTER_SRC_IP (1 << 0)
35 #define PBR_FILTER_DST_IP (1 << 1)
36 #define PBR_FILTER_SRC_PORT (1 << 2)
37 #define PBR_FILTER_DST_PORT (1 << 3)
38 #define PBR_FILTER_FWMARK (1 << 4)
39 #define PBR_FILTER_PROTO (1 << 5)
40 #define PBR_FILTER_SRC_PORT_RANGE (1 << 6)
41 #define PBR_FILTER_DST_PORT_RANGE (1 << 7)
43 /* Source and Destination IP address with masks. */
47 /* Source and Destination higher-layer (TCP/UDP) port numbers. */
51 /* Filter with fwmark */
58 * The action corresponding to a PBR rule.
59 * While the user specifies the action in a particular way, the forwarding
60 * plane implementation (Linux only) requires that to be encoded into a
61 * route table and the rule then point to that route table; in some cases,
62 * the user criteria may directly point to a table too.
71 * This is a combination of the filter criteria and corresponding action.
72 * Rules also have a user-defined sequence number which defines the relative
73 * order amongst rules.
81 struct pbr_filter filter
;
82 struct pbr_action action
;
86 extern int zapi_pbr_rule_encode(uint8_t cmd
, struct stream
*s
,
87 struct pbr_rule
*zrule
);