-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
bgp_pbr.h
116 lines (86 loc) · 2.63 KB
/
bgp_pbr.h
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
* BGP pbr
* Copyright (C) 6WIND
*
* FRR 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 2, or (at your option) any
* later version.
*
* FRR 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; see the file COPYING; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __BGP_PBR_H__
#define __BGP_PBR_H__
#include "nexthop.h"
#include "zclient.h"
struct bgp_pbr_match {
char ipset_name[ZEBRA_IPSET_NAME_SIZE];
/* mapped on enum ipset_type
*/
uint32_t type;
#define MATCH_IP_SRC_SET 1 << 0
#define MATCH_IP_DST_SET 1 << 1
uint32_t flags;
vrf_id_t vrf_id;
/* unique identifier for ipset create transaction
*/
uint32_t unique;
/* unique identifier for iptable add transaction
*/
uint32_t unique2;
bool installed;
bool install_in_progress;
bool installed_in_iptable;
bool install_iptable_in_progress;
struct hash *entry_hash;
struct bgp_pbr_action *action;
};
struct bgp_pbr_match_entry {
struct bgp_pbr_match *backpointer;
uint32_t unique;
struct prefix src;
struct prefix dst;
bool installed;
bool install_in_progress;
};
struct bgp_pbr_action {
/*
* The Unique identifier of this specific pbrms
*/
uint32_t unique;
uint32_t fwmark;
uint32_t table_id;
float rate;
/*
* nexthop information, or drop information
* contains src vrf_id and nh contains dest vrf_id
*/
vrf_id_t vrf_id;
struct nexthop nh;
bool installed;
bool install_in_progress;
};
extern struct bgp_pbr_action *bgp_pbr_action_rule_lookup(uint32_t unique);
extern struct bgp_pbr_match *bgp_pbr_match_ipset_lookup(vrf_id_t vrf_id,
uint32_t unique);
extern struct bgp_pbr_match_entry *bgp_pbr_match_ipset_entry_lookup(
vrf_id_t vrf_id, char *name,
uint32_t unique);
extern void bgp_pbr_init(struct bgp *bgp);
extern uint32_t bgp_pbr_action_hash_key(void *arg);
extern int bgp_pbr_action_hash_equal(const void *arg1,
const void *arg2);
extern uint32_t bgp_pbr_match_entry_hash_key(void *arg);
extern int bgp_pbr_match_entry_hash_equal(const void *arg1,
const void *arg2);
extern uint32_t bgp_pbr_match_hash_key(void *arg);
extern int bgp_pbr_match_hash_equal(const void *arg1,
const void *arg2);
#endif /* __BGP_PBR_H__ */