blob: dde589b8faaceaa219590717d94c5efe97e5783a [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/*
hasso508e53e2004-05-18 18:57:06 +00002 * Copyright (C) 2003 Yasuhiro Ohara
paul718e3742002-12-13 20:15:29 +00003 *
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_INTERFACE_H
23#define OSPF6_INTERFACE_H
24
hasso508e53e2004-05-18 18:57:06 +000025#include "if.h"
paul718e3742002-12-13 20:15:29 +000026
hasso508e53e2004-05-18 18:57:06 +000027/* Debug option */
28extern unsigned char conf_debug_ospf6_interface;
29#define OSPF6_DEBUG_INTERFACE_ON() \
30 (conf_debug_ospf6_interface = 1)
31#define OSPF6_DEBUG_INTERFACE_OFF() \
32 (conf_debug_ospf6_interface = 0)
33#define IS_OSPF6_DEBUG_INTERFACE \
34 (conf_debug_ospf6_interface)
paul718e3742002-12-13 20:15:29 +000035
hasso508e53e2004-05-18 18:57:06 +000036/* Interface structure */
paul718e3742002-12-13 20:15:29 +000037struct ospf6_interface
38{
39 /* IF info from zebra */
40 struct interface *interface;
41
42 /* back pointer */
43 struct ospf6_area *area;
44
45 /* list of ospf6 neighbor */
hasso52dc7ee2004-09-23 19:18:23 +000046 struct list *neighbor_list;
paul718e3742002-12-13 20:15:29 +000047
48 /* linklocal address of this I/F */
hasso508e53e2004-05-18 18:57:06 +000049 struct in6_addr *linklocal_addr;
paul718e3742002-12-13 20:15:29 +000050
hasso508e53e2004-05-18 18:57:06 +000051 /* Interface ID; use interface->ifindex */
paul718e3742002-12-13 20:15:29 +000052
53 /* ospf6 instance id */
54 u_char instance_id;
55
56 /* I/F transmission delay */
57 u_int32_t transdelay;
58
Dinesh Duttc5926a92013-08-24 07:55:00 +000059 /* Network Type */
60 u_char type;
61
paul718e3742002-12-13 20:15:29 +000062 /* Router Priority */
63 u_char priority;
64
hasso508e53e2004-05-18 18:57:06 +000065 /* Time Interval */
paul718e3742002-12-13 20:15:29 +000066 u_int16_t hello_interval;
67 u_int16_t dead_interval;
68 u_int32_t rxmt_interval;
69
Vincent Bernat3bc4f842012-06-04 11:40:04 +020070 u_int32_t state_change;
71
paul718e3742002-12-13 20:15:29 +000072 /* Cost */
73 u_int32_t cost;
74
75 /* I/F MTU */
76 u_int32_t ifmtu;
77
78 /* Interface State */
79 u_char state;
80
Vipin Kumarcb37de42015-05-19 18:03:40 -070081 /* Interface socket setting trial counter, resets on success */
82 u_char sso_try_cnt;
83
paul718e3742002-12-13 20:15:29 +000084 /* OSPF6 Interface flag */
85 char flag;
86
Dmitrij Tejblumd42306d2011-04-22 19:27:54 +040087 /* MTU mismatch check */
88 u_char mtu_ignore;
89
paul718e3742002-12-13 20:15:29 +000090 /* Decision of DR Election */
hasso508e53e2004-05-18 18:57:06 +000091 u_int32_t drouter;
92 u_int32_t bdrouter;
93 u_int32_t prev_drouter;
94 u_int32_t prev_bdrouter;
paul718e3742002-12-13 20:15:29 +000095
96 /* Linklocal LSA Database: includes Link-LSA */
97 struct ospf6_lsdb *lsdb;
hasso6452df02004-08-15 05:52:07 +000098 struct ospf6_lsdb *lsdb_self;
paul718e3742002-12-13 20:15:29 +000099
hasso508e53e2004-05-18 18:57:06 +0000100 struct ospf6_lsdb *lsupdate_list;
101 struct ospf6_lsdb *lsack_list;
paul718e3742002-12-13 20:15:29 +0000102
hasso508e53e2004-05-18 18:57:06 +0000103 /* Ongoing Tasks */
104 struct thread *thread_send_hello;
105 struct thread *thread_send_lsupdate;
106 struct thread *thread_send_lsack;
paul718e3742002-12-13 20:15:29 +0000107
hasso508e53e2004-05-18 18:57:06 +0000108 struct thread *thread_network_lsa;
109 struct thread *thread_link_lsa;
110 struct thread *thread_intra_prefix_lsa;
paul718e3742002-12-13 20:15:29 +0000111
hasso508e53e2004-05-18 18:57:06 +0000112 struct ospf6_route_table *route_connected;
paul718e3742002-12-13 20:15:29 +0000113
hasso508e53e2004-05-18 18:57:06 +0000114 /* prefix-list name to filter connected prefix */
paul718e3742002-12-13 20:15:29 +0000115 char *plist_name;
116};
117
hasso508e53e2004-05-18 18:57:06 +0000118/* interface state */
119#define OSPF6_INTERFACE_NONE 0
120#define OSPF6_INTERFACE_DOWN 1
121#define OSPF6_INTERFACE_LOOPBACK 2
122#define OSPF6_INTERFACE_WAITING 3
123#define OSPF6_INTERFACE_POINTTOPOINT 4
124#define OSPF6_INTERFACE_DROTHER 5
125#define OSPF6_INTERFACE_BDR 6
126#define OSPF6_INTERFACE_DR 7
127#define OSPF6_INTERFACE_MAX 8
paul718e3742002-12-13 20:15:29 +0000128
paul0c083ee2004-10-10 12:54:58 +0000129extern const char *ospf6_interface_state_str[];
hasso508e53e2004-05-18 18:57:06 +0000130
131/* flags */
132#define OSPF6_INTERFACE_DISABLE 0x01
133#define OSPF6_INTERFACE_PASSIVE 0x02
Vincent Bernatc19543b2012-10-24 14:45:53 +0000134#define OSPF6_INTERFACE_NOAUTOCOST 0x04
paul718e3742002-12-13 20:15:29 +0000135
Vyacheslav Trushkinb51a3a32012-02-10 10:42:45 +0400136/* default values */
137#define OSPF6_INTERFACE_HELLO_INTERVAL 10
138#define OSPF6_INTERFACE_DEAD_INTERVAL 40
139#define OSPF6_INTERFACE_RXMT_INTERVAL 5
140#define OSPF6_INTERFACE_COST 1
141#define OSPF6_INTERFACE_PRIORITY 1
142#define OSPF6_INTERFACE_TRANSDELAY 1
143#define OSPF6_INTERFACE_INSTANCE_ID 0
Vincent Bernatc19543b2012-10-24 14:45:53 +0000144#define OSPF6_INTERFACE_BANDWIDTH 10000 /* Kbps */
145#define OSPF6_REFERENCE_BANDWIDTH 100000 /* Kbps */
Vipin Kumarcb37de42015-05-19 18:03:40 -0700146#define OSPF6_INTERFACE_SSO_RETRY_INT 1
147#define OSPF6_INTERFACE_SSO_RETRY_MAX 5
Vyacheslav Trushkinb51a3a32012-02-10 10:42:45 +0400148
David Lamparter6b0655a2014-06-04 06:53:35 +0200149
paul718e3742002-12-13 20:15:29 +0000150/* Function Prototypes */
151
Paul Jakma6ac29a52008-08-15 13:45:30 +0100152extern struct ospf6_interface *ospf6_interface_lookup_by_ifindex (int);
153extern struct ospf6_interface *ospf6_interface_create (struct interface *);
154extern void ospf6_interface_delete (struct ospf6_interface *);
paul718e3742002-12-13 20:15:29 +0000155
Paul Jakma6ac29a52008-08-15 13:45:30 +0100156extern void ospf6_interface_enable (struct ospf6_interface *);
157extern void ospf6_interface_disable (struct ospf6_interface *);
paul718e3742002-12-13 20:15:29 +0000158
Paul Jakma6ac29a52008-08-15 13:45:30 +0100159extern void ospf6_interface_if_add (struct interface *);
160extern void ospf6_interface_if_del (struct interface *);
161extern void ospf6_interface_state_update (struct interface *);
162extern void ospf6_interface_connected_route_update (struct interface *);
hasso508e53e2004-05-18 18:57:06 +0000163
164/* interface event */
Paul Jakma6ac29a52008-08-15 13:45:30 +0100165extern int interface_up (struct thread *);
166extern int interface_down (struct thread *);
167extern int wait_timer (struct thread *);
168extern int backup_seen (struct thread *);
169extern int neighbor_change (struct thread *);
paul718e3742002-12-13 20:15:29 +0000170
Paul Jakma6ac29a52008-08-15 13:45:30 +0100171extern void ospf6_interface_init (void);
paul718e3742002-12-13 20:15:29 +0000172
Vipin Kumare87f8082015-05-19 18:03:40 -0700173extern void install_element_ospf6_clear_interface (void);
174
Paul Jakma6ac29a52008-08-15 13:45:30 +0100175extern int config_write_ospf6_debug_interface (struct vty *vty);
176extern void install_element_ospf6_debug_interface (void);
paul718e3742002-12-13 20:15:29 +0000177
178#endif /* OSPF6_INTERFACE_H */