]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_mpath.h
Merge pull request #531 from qlyoung/fix-stack-ref
[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 *
17 * You should have received a copy of the GNU General Public License
18 * along with Quagga; see the file COPYING. If not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 * 02111-1307, USA.
21 */
22
23#ifndef _QUAGGA_BGP_MPATH_H
24#define _QUAGGA_BGP_MPATH_H
25
de8d5dff
JB
26/* Supplemental information linked to bgp_info for keeping track of
27 * multipath selections, lazily allocated to save memory
28 */
29struct bgp_info_mpath
30{
31 /* Points to the first multipath (on bestpath) or the next multipath */
32 struct bgp_info_mpath *mp_next;
33
34 /* Points to the previous multipath or NULL on bestpath */
35 struct bgp_info_mpath *mp_prev;
36
37 /* Points to bgp_info associated with this multipath info */
38 struct bgp_info *mp_info;
39
40 /* When attached to best path, the number of selected multipaths */
41 u_int32_t mp_count;
0b597ef0
JB
42
43 /* Aggregated attribute for advertising multipath route */
44 struct attr *mp_attr;
de8d5dff
JB
45};
46
165b5fff 47/* Functions to support maximum-paths configuration */
5e242b0d
DS
48extern int bgp_maximum_paths_set (struct bgp *, afi_t, safi_t, int, u_int16_t,
49 u_int16_t);
165b5fff
JB
50extern int bgp_maximum_paths_unset (struct bgp *, afi_t, safi_t, int);
51
96450faf
JB
52/* Functions used by bgp_best_selection to record current
53 * multipath selections
54 */
7dc9d4e4 55extern int bgp_info_nexthop_cmp (struct bgp_info *bi1, struct bgp_info *bi2);
96450faf
JB
56extern void bgp_mp_list_init (struct list *);
57extern void bgp_mp_list_clear (struct list *);
58extern void bgp_mp_list_add (struct list *, struct bgp_info *);
6918e74b 59extern void bgp_mp_dmed_deselect (struct bgp_info *);
de8d5dff
JB
60extern void bgp_info_mpath_update (struct bgp_node *, struct bgp_info *,
61 struct bgp_info *, struct list *,
62 struct bgp_maxpaths_cfg *);
0b597ef0
JB
63extern void bgp_info_mpath_aggregate_update (struct bgp_info *,
64 struct bgp_info *);
de8d5dff
JB
65
66/* Unlink and free multipath information associated with a bgp_info */
67extern void bgp_info_mpath_dequeue (struct bgp_info *);
68extern void bgp_info_mpath_free (struct bgp_info_mpath **);
69
70/* Walk list of multipaths associated with a best path */
71extern struct bgp_info *bgp_info_mpath_first (struct bgp_info *);
72extern struct bgp_info *bgp_info_mpath_next (struct bgp_info *);
73
74/* Accessors for multipath information */
75extern u_int32_t bgp_info_mpath_count (struct bgp_info *);
0b597ef0 76extern struct attr *bgp_info_mpath_attr (struct bgp_info *);
96450faf 77
165b5fff 78#endif /* _QUAGGA_BGP_MPATH_H */