]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_mpath.h
bgpd: fix some NULL pointer dereference bugs
[mirror_frr.git] / bgpd / bgp_mpath.h
CommitLineData
8ef0791c 1/*
165b5fff
JB
2 * BGP Multipath
3 * Copyright (C) 2010 Google Inc.
4 *
5 * This file is part of Quagga
6 *
7 * Quagga is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
10 * later version.
11 *
12 * Quagga is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
896014f4
DL
17 * You should have received a copy of the GNU General Public License along
18 * with this program; see the file COPYING; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
165b5fff
JB
20 */
21
22#ifndef _QUAGGA_BGP_MPATH_H
23#define _QUAGGA_BGP_MPATH_H
24
de8d5dff
JB
25/* Supplemental information linked to bgp_info for keeping track of
26 * multipath selections, lazily allocated to save memory
27 */
d62a17ae 28struct bgp_info_mpath {
29 /* Points to the first multipath (on bestpath) or the next multipath */
30 struct bgp_info_mpath *mp_next;
de8d5dff 31
d62a17ae 32 /* Points to the previous multipath or NULL on bestpath */
33 struct bgp_info_mpath *mp_prev;
de8d5dff 34
d62a17ae 35 /* Points to bgp_info associated with this multipath info */
36 struct bgp_info *mp_info;
de8d5dff 37
d62a17ae 38 /* When attached to best path, the number of selected multipaths */
d7c0a89a 39 uint32_t mp_count;
0b597ef0 40
d62a17ae 41 /* Aggregated attribute for advertising multipath route */
42 struct attr *mp_attr;
de8d5dff
JB
43};
44
165b5fff 45/* Functions to support maximum-paths configuration */
d7c0a89a
QY
46extern int bgp_maximum_paths_set(struct bgp *, afi_t, safi_t, int, uint16_t,
47 uint16_t);
d62a17ae 48extern int bgp_maximum_paths_unset(struct bgp *, afi_t, safi_t, int);
165b5fff 49
96450faf
JB
50/* Functions used by bgp_best_selection to record current
51 * multipath selections
52 */
d62a17ae 53extern int bgp_info_nexthop_cmp(struct bgp_info *bi1, struct bgp_info *bi2);
54extern void bgp_mp_list_init(struct list *);
55extern void bgp_mp_list_clear(struct list *);
56extern void bgp_mp_list_add(struct list *, struct bgp_info *);
57extern void bgp_mp_dmed_deselect(struct bgp_info *);
58extern void bgp_info_mpath_update(struct bgp_node *, struct bgp_info *,
59 struct bgp_info *, struct list *,
60 struct bgp_maxpaths_cfg *);
61extern void bgp_info_mpath_aggregate_update(struct bgp_info *,
62 struct bgp_info *);
de8d5dff
JB
63
64/* Unlink and free multipath information associated with a bgp_info */
d62a17ae 65extern void bgp_info_mpath_dequeue(struct bgp_info *);
66extern void bgp_info_mpath_free(struct bgp_info_mpath **);
de8d5dff
JB
67
68/* Walk list of multipaths associated with a best path */
d62a17ae 69extern struct bgp_info *bgp_info_mpath_first(struct bgp_info *);
70extern struct bgp_info *bgp_info_mpath_next(struct bgp_info *);
de8d5dff
JB
71
72/* Accessors for multipath information */
d7c0a89a 73extern uint32_t bgp_info_mpath_count(struct bgp_info *);
d62a17ae 74extern struct attr *bgp_info_mpath_attr(struct bgp_info *);
96450faf 75
165b5fff 76#endif /* _QUAGGA_BGP_MPATH_H */