]> git.proxmox.com Git - mirror_frr.git/blame - ospf6d/ospf6_area.h
ospf6d: fix lookup of translated Type-5 LSA
[mirror_frr.git] / ospf6d / ospf6_area.h
CommitLineData
718e3744 1/*
508e53e2 2 * Copyright (C) 2003 Yasuhiro Ohara
718e3744 3 *
4 * This file is part of GNU Zebra.
5 *
6 * GNU Zebra 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
9 * later version.
10 *
11 * GNU Zebra 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.
15 *
896014f4
DL
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
718e3744 19 */
20
21#ifndef OSPF_AREA_H
22#define OSPF_AREA_H
23
718e3744 24#include "ospf6_top.h"
35a45dea 25#include "lib/json.h"
718e3744 26
d62a17ae 27struct ospf6_area {
28 /* Reference to Top data structure */
29 struct ospf6 *ospf6;
718e3744 30
d62a17ae 31 /* Area-ID */
858f9c08 32 in_addr_t area_id;
718e3744 33
42cabc55 34#define OSPF6_AREA_FMT_UNSET 0
79c3f4f4
QY
35#define OSPF6_AREA_FMT_DOTTEDQUAD 1
36#define OSPF6_AREA_FMT_DECIMAL 2
d62a17ae 37 /* Area-ID string */
38 char name[16];
718e3744 39
d62a17ae 40 /* flag */
d7c0a89a 41 uint8_t flag;
718e3744 42
d62a17ae 43 /* OSPF Option */
d7c0a89a 44 uint8_t options[3];
718e3744 45
d62a17ae 46 /* Summary routes to be originated (includes Configured Address Ranges)
47 */
48 struct ospf6_route_table *range_table;
49 struct ospf6_route_table *summary_prefix;
50 struct ospf6_route_table *summary_router;
049207c3 51
d62a17ae 52 /* Area type */
53 int no_summary;
ca1f4309 54
6735622c
RW
55 /* NSSA default-information-originate */
56 struct {
57 bool enabled;
58 int metric_type;
59 int metric_value;
60 } nssa_default_originate;
61
a2d0055a 62 /* Brouter traversal protection */
cbcf3335 63 bool intra_brouter_calc;
a2d0055a 64
d62a17ae 65 /* OSPF interface list */
66 struct list *if_list;
718e3744 67
d62a17ae 68 struct ospf6_lsdb *lsdb;
69 struct ospf6_lsdb *lsdb_self;
da086a3b 70 struct ospf6_lsdb *temp_router_lsa_lsdb;
6452df09 71
d62a17ae 72 struct ospf6_route_table *spf_table;
73 struct ospf6_route_table *route_table;
718e3744 74
d7c0a89a 75 uint32_t spf_calculation; /* SPF calculation count */
718e3744 76
d62a17ae 77 struct thread *thread_router_lsa;
78 struct thread *thread_intra_prefix_lsa;
d7c0a89a 79 uint32_t router_lsa_size_limit;
34956b31 80
d62a17ae 81 /* Area announce list */
82 struct {
83 char *name;
84 struct access_list *list;
85 } _export;
dea04441
PJ
86#define EXPORT_NAME(A) (A)->_export.name
87#define EXPORT_LIST(A) (A)->_export.list
34956b31 88
d62a17ae 89 /* Area acceptance list */
90 struct {
91 char *name;
92 struct access_list *list;
93 } import;
34956b31 94#define IMPORT_NAME(A) (A)->import.name
95#define IMPORT_LIST(A) (A)->import.list
96
d62a17ae 97 /* Type 3 LSA Area prefix-list */
98 struct {
99 char *name;
100 struct prefix_list *list;
101 } plist_in;
34956b31 102#define PREFIX_NAME_IN(A) (A)->plist_in.name
103#define PREFIX_LIST_IN(A) (A)->plist_in.list
104
d62a17ae 105 struct {
106 char *name;
107 struct prefix_list *list;
108 } plist_out;
34956b31 109#define PREFIX_NAME_OUT(A) (A)->plist_out.name
110#define PREFIX_LIST_OUT(A) (A)->plist_out.list
111
d62a17ae 112 /* Time stamps. */
113 struct timeval ts_spf; /* SPF calculation time stamp. */
d6927cf3
CS
114
115 uint32_t full_nbrs; /* Fully adjacent neighbors. */
690df177 116 uint8_t intra_prefix_originate; /* Force intra_prefix lsa originate */
ad500b22
K
117 uint8_t NSSATranslatorRole; /* NSSA configured role */
118#define OSPF6_NSSA_ROLE_NEVER 0
119#define OSPF6_NSSA_ROLE_CANDIDATE 1
120#define OSPF6_NSSA_ROLE_ALWAYS 2
121 uint8_t NSSATranslatorState; /* NSSA operational role */
122#define OSPF6_NSSA_TRANSLATE_DISABLED 0
123#define OSPF6_NSSA_TRANSLATE_ENABLED 1
718e3744 124};
125
ad500b22 126#define OSPF6_AREA_DEFAULT 0x00
6452df09 127#define OSPF6_AREA_ENABLE 0x01
128#define OSPF6_AREA_ACTIVE 0x02
129#define OSPF6_AREA_TRANSIT 0x04 /* TransitCapability */
130#define OSPF6_AREA_STUB 0x08
ad500b22 131#define OSPF6_AREA_NSSA 0x10
6452df09 132
6452df09 133#define IS_AREA_ENABLED(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_ENABLE))
134#define IS_AREA_ACTIVE(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_ACTIVE))
135#define IS_AREA_TRANSIT(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_TRANSIT))
136#define IS_AREA_STUB(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_STUB))
ad500b22 137#define IS_AREA_NSSA(oa) (CHECK_FLAG((oa)->flag, OSPF6_AREA_NSSA))
718e3744 138
beadc736 139#define OSPF6_CMD_AREA_GET(str, oa, ospf6) \
de842255 140 { \
42cabc55
IR
141 uint32_t area_id; \
142 int format, ret; \
143 ret = str2area_id(str, &area_id, &format); \
144 if (ret) { \
de842255 145 vty_out(vty, "Malformed Area-ID: %s\n", str); \
42cabc55 146 return CMD_WARNING; \
de842255 147 } \
de842255
PR
148 oa = ospf6_area_lookup(area_id, ospf6); \
149 if (oa == NULL) \
150 oa = ospf6_area_create(area_id, ospf6, format); \
151 }
152
718e3744 153/* prototypes */
42cabc55
IR
154extern int str2area_id(const char *str, uint32_t *area_id, int *area_id_fmt);
155extern void area_id2str(char *buf, int len, uint32_t area_id, int area_id_fmt);
156
d62a17ae 157extern int ospf6_area_cmp(void *va, void *vb);
6452df09 158
7932dd93
DS
159extern struct ospf6_area *ospf6_area_create(uint32_t area_id,
160 struct ospf6 *ospf6, int df);
161extern void ospf6_area_delete(struct ospf6_area *oa);
162extern struct ospf6_area *ospf6_area_lookup(uint32_t area_id,
163 struct ospf6 *ospf6);
beadc736 164extern struct ospf6_area *ospf6_area_lookup_by_area_id(uint32_t area_id);
508e53e2 165
0c293b92 166extern void ospf6_area_stub_unset(struct ospf6 *ospf6, struct ospf6_area *area);
7932dd93
DS
167extern void ospf6_area_enable(struct ospf6_area *oa);
168extern void ospf6_area_disable(struct ospf6_area *oa);
718e3744 169
7932dd93 170extern void ospf6_area_show(struct vty *vty, struct ospf6_area *oa,
35a45dea 171 json_object *json_areas, bool use_json);
6452df09 172
f4f0098c 173extern void ospf6_plist_update(struct prefix_list *plist);
f6c5f2e0 174extern void ospf6_filter_update(struct access_list *access);
beadc736 175extern void ospf6_area_config_write(struct vty *vty, struct ospf6 *ospf6);
d62a17ae 176extern void ospf6_area_init(void);
22b982df
PG
177struct ospf6_interface;
178extern void ospf6_area_interface_delete(struct ospf6_interface *oi);
718e3744 179
180#endif /* OSPF_AREA_H */