blob: 14113b06b424764ae8a48dc0a036da85ae439af1 [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/*
2 * Copyright (C) 2001 Yasuhiro Ohara
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 *
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Zebra; see the file COPYING. If not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 */
21
22#ifndef OSPF6_ASBR_H
23#define OSPF6_ASBR_H
24
Denis Ovsienko87362ce2011-08-27 22:19:34 +040025/* for struct ospf6_prefix */
26#include "ospf6_proto.h"
27/* for struct ospf6_lsa */
28#include "ospf6_lsa.h"
29/* for struct ospf6_route */
30#include "ospf6_route.h"
31
hasso508e53e2004-05-18 18:57:06 +000032/* Debug option */
33extern unsigned char conf_debug_ospf6_asbr;
34#define OSPF6_DEBUG_ASBR_ON() \
35 (conf_debug_ospf6_asbr = 1)
36#define OSPF6_DEBUG_ASBR_OFF() \
37 (conf_debug_ospf6_asbr = 0)
38#define IS_OSPF6_DEBUG_ASBR \
39 (conf_debug_ospf6_asbr)
paul718e3742002-12-13 20:15:29 +000040
41struct ospf6_external_info
42{
hasso508e53e2004-05-18 18:57:06 +000043 /* External route type */
paul718e3742002-12-13 20:15:29 +000044 int type;
45
hasso508e53e2004-05-18 18:57:06 +000046 /* Originating Link State ID */
paul718e3742002-12-13 20:15:29 +000047 u_int32_t id;
48
paul718e3742002-12-13 20:15:29 +000049 struct in6_addr forwarding;
Christian Franke7ae2b602016-10-01 06:41:40 +020050
51 route_tag_t tag;
Vyacheslav Trushkin42a7deb2011-11-16 14:22:03 +040052
Paul Jakma9099f9b2016-01-18 10:12:10 +000053 ifindex_t ifindex;
paul718e3742002-12-13 20:15:29 +000054};
55
paul718e3742002-12-13 20:15:29 +000056/* AS-External-LSA */
Denis Ovsienkoabc7ef42011-09-26 13:18:51 +040057#define OSPF6_AS_EXTERNAL_LSA_MIN_SIZE 4U /* w/o IPv6 prefix */
hasso508e53e2004-05-18 18:57:06 +000058struct ospf6_as_external_lsa
paul718e3742002-12-13 20:15:29 +000059{
60 u_int32_t bits_metric;
61
62 struct ospf6_prefix prefix;
63 /* followed by none or one forwarding address */
64 /* followed by none or one external route tag */
65 /* followed by none or one referenced LS-ID */
66};
67
68#define OSPF6_ASBR_BIT_T ntohl (0x01000000)
69#define OSPF6_ASBR_BIT_F ntohl (0x02000000)
70#define OSPF6_ASBR_BIT_E ntohl (0x04000000)
71
72#define OSPF6_ASBR_METRIC(E) (ntohl ((E)->bits_metric & htonl (0x00ffffff)))
73#define OSPF6_ASBR_METRIC_SET(E,C) \
74 { (E)->bits_metric &= htonl (0xff000000); \
75 (E)->bits_metric |= htonl (0x00ffffff) & htonl (C); }
76
Paul Jakma6ac29a52008-08-15 13:45:30 +010077extern void ospf6_asbr_lsa_add (struct ospf6_lsa *lsa);
78extern void ospf6_asbr_lsa_remove (struct ospf6_lsa *lsa);
79extern void ospf6_asbr_lsentry_add (struct ospf6_route *asbr_entry);
80extern void ospf6_asbr_lsentry_remove (struct ospf6_route *asbr_entry);
hasso508e53e2004-05-18 18:57:06 +000081
Paul Jakma6ac29a52008-08-15 13:45:30 +010082extern int ospf6_asbr_is_asbr (struct ospf6 *o);
Paul Jakma9099f9b2016-01-18 10:12:10 +000083extern void ospf6_asbr_redistribute_add (int type, ifindex_t ifindex,
Paul Jakma6ac29a52008-08-15 13:45:30 +010084 struct prefix *prefix,
85 u_int nexthop_num,
Christian Franke7ae2b602016-10-01 06:41:40 +020086 struct in6_addr *nexthop,
87 route_tag_t tag);
Paul Jakma9099f9b2016-01-18 10:12:10 +000088extern void ospf6_asbr_redistribute_remove (int type, ifindex_t ifindex,
Paul Jakma6ac29a52008-08-15 13:45:30 +010089 struct prefix *prefix);
paul718e3742002-12-13 20:15:29 +000090
Paul Jakma6ac29a52008-08-15 13:45:30 +010091extern int ospf6_redistribute_config_write (struct vty *vty);
paul718e3742002-12-13 20:15:29 +000092
Paul Jakma6ac29a52008-08-15 13:45:30 +010093extern void ospf6_asbr_init (void);
Christian Franked9628722013-03-08 21:47:35 +010094extern void ospf6_asbr_redistribute_reset (void);
Tom Goffae2254a2010-11-10 13:01:41 -080095extern void ospf6_asbr_terminate (void);
paul718e3742002-12-13 20:15:29 +000096
Paul Jakma6ac29a52008-08-15 13:45:30 +010097extern int config_write_ospf6_debug_asbr (struct vty *vty);
98extern void install_element_ospf6_debug_asbr (void);
hasso508e53e2004-05-18 18:57:06 +000099
paul718e3742002-12-13 20:15:29 +0000100#endif /* OSPF6_ASBR_H */