summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_vrf.h
blob: 8dffe27dcf228978a0e9b1127c102c19fb2cb116 (plain)
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
/*
 * Zebra Vrf Header
 * Copyright (C) 2016 Cumulus Networks
 *                    Donald Sahrp
 *
 * This file is part of Quagga.
 *
 * Quagga 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.
 *
 * Quagga 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 GNU Zebra; see the file COPYING.  If not, write to the Free
 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 */
#if !defined(__ZEBRA_RIB_H__)
#define __ZEBRA_RIB_H__

#include <zebra/zebra_ns.h>

/* Routing table instance.  */
struct zebra_vrf
{
  /* Identifier. */
  vrf_id_t vrf_id;

  /* Routing table name.  */
  char name[VRF_NAMSIZ];

  /* Description.  */
  char *desc;

  /* FIB identifier.  */
  u_char fib_id;

  /* Flags. */
  u_int16_t flags;
#define ZEBRA_VRF_RIB_SCHEDULED   (1 << 0)

  u_int32_t table_id;

  /* Routing table.  */
  struct route_table *table[AFI_MAX][SAFI_MAX];

  /* Static route configuration.  */
  struct route_table *stable[AFI_MAX][SAFI_MAX];

  /* Recursive Nexthop table */
  struct route_table *rnh_table[AFI_MAX];

  /* Import check table (used mostly by BGP */
  struct route_table *import_check_table[AFI_MAX];

  /* Routing tables off of main table for redistribute table */
  struct route_table *other_table[AFI_MAX][ZEBRA_KERNEL_TABLE_MAX];

  /* 2nd pointer type used primarily to quell a warning on
   * ALL_LIST_ELEMENTS_RO
   */
  struct list _rid_all_sorted_list;
  struct list _rid_lo_sorted_list;
  struct list *rid_all_sorted_list;
  struct list *rid_lo_sorted_list;
  struct prefix rid_user_assigned;

  /*
   * Back pointer to the owning namespace.
   */
  struct zebra_ns *zns;

  /* MPLS static LSP config table */
  struct hash *slsp_table;

  /* MPLS label forwarding table */
  struct hash *lsp_table;

  /* MPLS processing flags */
  u_int16_t mpls_flags;
#define MPLS_FLAG_SCHEDULE_LSPS    (1 << 0)
};

struct route_table *
zebra_vrf_table_with_table_id (afi_t afi, safi_t safi,
                               vrf_id_t vrf_id, u_int32_t table_id);

extern void zebra_vrf_static_route_interface_fixup (struct interface *ifp);
extern void zebra_vrf_update_all (struct zserv *client);
extern struct zebra_vrf *zebra_vrf_lookup (vrf_id_t vrf_id);
extern struct zebra_vrf *zebra_vrf_list_lookup_by_name (const char *);
extern struct zebra_vrf *zebra_vrf_alloc (vrf_id_t, const char *);
extern struct route_table *zebra_vrf_table (afi_t, safi_t, vrf_id_t);
extern struct route_table *zebra_vrf_static_table (afi_t, safi_t, struct zebra_vrf *zvrf);
extern struct route_table *zebra_vrf_other_route_table (afi_t afi, u_int32_t table_id,
							vrf_id_t vrf_id);
extern void zebra_vrf_init (void);
#endif