]>
git.proxmox.com Git - mirror_frr.git/blob - pbrd/pbr_nht.h
3 * Copyright (C) 2018 Cumulus Networks, Inc.
6 * FRR 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
8 * Free Software Foundation; either version 2, or (at your option) any
11 * FRR is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
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
23 #include <lib/zclient.h>
24 #include <lib/nexthop_group.h>
29 #define PBR_NHC_NAMELEN PBR_MAP_NAMELEN + 10
31 struct pbr_nexthop_group_cache
{
32 char name
[PBR_NHC_NAMELEN
];
39 * If all nexthops are considered valid
46 struct pbr_nexthop_cache
{
47 struct pbr_nexthop_group_cache
*parent
;
49 struct nexthop
*nexthop
;
54 extern void pbr_nht_write_table_range(struct vty
*vty
);
55 #define PBR_NHT_DEFAULT_LOW_TABLEID 10000
56 #define PBR_NHT_DEFAULT_HIGH_TABLEID 11000
57 extern void pbr_nht_set_tableid_range(uint32_t low
, uint32_t high
);
60 * Get the next tableid to use for installation.
63 * If set to true, retrieves the next ID without marking it used. The next
64 * call will return the same ID.
66 extern uint32_t pbr_nht_get_next_tableid(bool peek
);
68 * Get the next rule number to use for installation
70 extern void pbr_nht_write_rule_range(struct vty
*vty
);
72 #define PBR_NHT_DEFAULT_LOW_RULE 300
73 #define PBR_NHT_DEFAULT_HIGH_RULE 1300
74 extern void pbr_nht_set_rule_range(uint32_t low
, uint32_t high
);
76 extern uint32_t pbr_nht_get_next_rule(uint32_t seqno
);
78 extern void pbr_nhgroup_add_cb(const char *name
);
79 extern void pbr_nhgroup_add_nexthop_cb(const struct nexthop_group_cmd
*nhg
,
80 const struct nexthop
*nhop
);
81 extern void pbr_nhgroup_del_nexthop_cb(const struct nexthop_group_cmd
*nhg
,
82 const struct nexthop
*nhop
);
83 extern void pbr_nhgroup_delete_cb(const char *name
);
85 extern bool pbr_nht_nexthop_valid(struct nexthop_group
*nhg
);
86 extern bool pbr_nht_nexthop_group_valid(const char *name
);
88 extern struct pbr_nexthop_group_cache
*pbr_nht_add_group(const char *name
);
89 extern void pbr_nht_change_group(const char *name
);
90 extern void pbr_nht_delete_group(const char *name
);
92 extern void pbr_nht_add_individual_nexthop(struct pbr_map_sequence
*pbrms
,
93 const struct nexthop
*nhop
);
94 extern void pbr_nht_delete_individual_nexthop(struct pbr_map_sequence
*pbrms
);
96 * Given the tableid of the installed default
97 * route, find the nexthop-group associated with
98 * it, then find all pbr-maps that use it and
99 * install/delete them as well.
101 extern void pbr_nht_route_installed_for_table(uint32_t table_id
);
102 extern void pbr_nht_route_removed_for_table(uint32_t table_id
);
105 * Given the nexthop group name, lookup the associated
108 extern uint32_t pbr_nht_get_table(const char *name
);
110 extern bool pbr_nht_get_installed(const char *name
);
112 extern char *pbr_nht_nexthop_make_name(char *name
, size_t l
, uint32_t seqno
,
115 extern void pbr_nht_show_nexthop_group(struct vty
*vty
, const char *name
);
116 extern void pbr_nht_json_nexthop_group(json_object
*j
, const char *name
);
119 * When we get a callback from zebra about a nexthop changing
121 extern void pbr_nht_nexthop_update(struct zapi_route
*nhr
);
124 * When we get a callback from zebra about an interface status update.
126 extern void pbr_nht_nexthop_interface_update(struct interface
*ifp
);
128 extern void pbr_nht_init(void);