2023-02-08 13:17:09 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2002-12-13 21:15:29 +01:00
|
|
|
/*
|
2004-05-18 20:57:06 +02:00
|
|
|
* Copyright (C) 2003 Yasuhiro Ohara
|
2002-12-13 21:15:29 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OSPF6_INTERFACE_H
|
|
|
|
#define OSPF6_INTERFACE_H
|
|
|
|
|
2016-12-07 13:25:38 +01:00
|
|
|
#include "qobj.h"
|
2016-06-12 17:32:23 +02:00
|
|
|
#include "hook.h"
|
2004-05-18 20:57:06 +02:00
|
|
|
#include "if.h"
|
2021-05-30 18:22:41 +02:00
|
|
|
#include "ospf6d.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2021-05-30 18:27:13 +02:00
|
|
|
DECLARE_MTYPE(OSPF6_AUTH_MANUAL_KEY);
|
|
|
|
|
2021-07-20 15:57:18 +02:00
|
|
|
#include "ospf6_neighbor.h"
|
|
|
|
|
2004-05-18 20:57:06 +02:00
|
|
|
/* Debug option */
|
|
|
|
extern unsigned char conf_debug_ospf6_interface;
|
|
|
|
#define OSPF6_DEBUG_INTERFACE_ON() (conf_debug_ospf6_interface = 1)
|
|
|
|
#define OSPF6_DEBUG_INTERFACE_OFF() (conf_debug_ospf6_interface = 0)
|
|
|
|
#define IS_OSPF6_DEBUG_INTERFACE (conf_debug_ospf6_interface)
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2021-05-30 18:22:41 +02:00
|
|
|
struct ospf6_auth_data {
|
2021-05-30 18:33:41 +02:00
|
|
|
/* config data */
|
|
|
|
uint8_t hash_algo; /* hash algorithm type */
|
|
|
|
uint16_t key_id; /* key-id used as SA in auth packet */
|
|
|
|
char *auth_key; /* Auth key */
|
|
|
|
char *keychain; /* keychain name */
|
|
|
|
|
|
|
|
/* operational data */
|
|
|
|
uint8_t flags; /* Flags related to auth config */
|
|
|
|
|
|
|
|
/* Counters and Statistics */
|
|
|
|
uint32_t tx_drop; /* Pkt drop due to auth fail while sending */
|
|
|
|
uint32_t rx_drop; /* Pkt drop due to auth fail while reading */
|
2021-05-30 18:22:41 +02:00
|
|
|
};
|
|
|
|
|
2004-05-18 20:57:06 +02:00
|
|
|
/* Interface structure */
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf6_interface {
|
|
|
|
/* IF info from zebra */
|
|
|
|
struct interface *interface;
|
|
|
|
|
|
|
|
/* back pointer */
|
|
|
|
struct ospf6_area *area;
|
|
|
|
|
2021-05-26 00:49:30 +02:00
|
|
|
uint32_t area_id;
|
|
|
|
int area_id_format;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* list of ospf6 neighbor */
|
2004-09-23 21:18:23 +02:00
|
|
|
struct list *neighbor_list;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* linklocal address of this I/F */
|
2004-05-18 20:57:06 +02:00
|
|
|
struct in6_addr *linklocal_addr;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2004-05-18 20:57:06 +02:00
|
|
|
/* Interface ID; use interface->ifindex */
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* ospf6 instance id */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t instance_id;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* I/F transmission delay */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t transdelay;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2021-03-10 18:59:07 +01:00
|
|
|
/* Packet send buffer. */
|
|
|
|
struct ospf6_fifo *obuf; /* Output queue */
|
|
|
|
|
2013-08-24 09:55:00 +02:00
|
|
|
/* Network Type */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t type;
|
2019-09-17 16:19:45 +02:00
|
|
|
bool type_cfg;
|
2013-08-24 09:55:00 +02:00
|
|
|
|
2021-07-20 15:57:18 +02:00
|
|
|
/* P2P/P2MP behavior: */
|
|
|
|
|
2021-07-27 16:12:04 +02:00
|
|
|
/* disable hellos on standard multicast? */
|
|
|
|
bool p2xp_no_multicast_hello;
|
2021-07-27 16:10:23 +02:00
|
|
|
/* only allow explicitly configured neighbors? */
|
|
|
|
bool p2xp_only_cfg_neigh;
|
|
|
|
|
2021-07-20 15:57:18 +02:00
|
|
|
struct ospf6_if_p2xp_neighcfgs_head p2xp_neighs;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Router Priority */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t priority;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2004-05-18 20:57:06 +02:00
|
|
|
/* Time Interval */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint16_t hello_interval;
|
|
|
|
uint16_t dead_interval;
|
|
|
|
uint32_t rxmt_interval;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2023-03-03 17:09:20 +01:00
|
|
|
/* Graceful-Restart data. */
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
uint16_t interval;
|
|
|
|
uint16_t elapsed_seconds;
|
|
|
|
struct event *t_grace_send;
|
|
|
|
} hello_delay;
|
|
|
|
} gr;
|
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t state_change;
|
2012-06-04 11:40:04 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Cost */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t cost;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* I/F MTU */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t ifmtu;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-06-22 18:17:24 +02:00
|
|
|
/* Configured MTU */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t c_ifmtu;
|
2017-06-22 18:17:24 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Interface State */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t state;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2015-05-20 03:03:40 +02:00
|
|
|
/* Interface socket setting trial counter, resets on success */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t sso_try_cnt;
|
2022-03-01 22:18:12 +01:00
|
|
|
struct event *thread_sso;
|
2015-05-20 03:03:40 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* OSPF6 Interface flag */
|
|
|
|
char flag;
|
|
|
|
|
2011-04-22 17:27:54 +02:00
|
|
|
/* MTU mismatch check */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t mtu_ignore;
|
2011-04-22 17:27:54 +02:00
|
|
|
|
2021-05-30 18:22:41 +02:00
|
|
|
/* Authentication trailer related config */
|
|
|
|
struct ospf6_auth_data at_data;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Decision of DR Election */
|
2020-03-27 13:39:01 +01:00
|
|
|
in_addr_t drouter;
|
|
|
|
in_addr_t bdrouter;
|
|
|
|
in_addr_t prev_drouter;
|
|
|
|
in_addr_t prev_bdrouter;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* Linklocal LSA Database: includes Link-LSA */
|
|
|
|
struct ospf6_lsdb *lsdb;
|
2004-08-15 07:52:07 +02:00
|
|
|
struct ospf6_lsdb *lsdb_self;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2004-05-18 20:57:06 +02:00
|
|
|
struct ospf6_lsdb *lsupdate_list;
|
|
|
|
struct ospf6_lsdb *lsack_list;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2004-05-18 20:57:06 +02:00
|
|
|
/* Ongoing Tasks */
|
2022-03-01 22:18:12 +01:00
|
|
|
struct event *thread_send_hello;
|
|
|
|
struct event *thread_send_lsupdate;
|
|
|
|
struct event *thread_send_lsack;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2022-03-01 22:18:12 +01:00
|
|
|
struct event *thread_network_lsa;
|
|
|
|
struct event *thread_link_lsa;
|
|
|
|
struct event *thread_intra_prefix_lsa;
|
|
|
|
struct event *thread_as_extern_lsa;
|
|
|
|
struct event *thread_wait_timer;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2004-05-18 20:57:06 +02:00
|
|
|
struct ospf6_route_table *route_connected;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2021-04-13 11:37:51 +02:00
|
|
|
/* last hello sent */
|
|
|
|
struct timeval last_hello;
|
|
|
|
|
2004-05-18 20:57:06 +02:00
|
|
|
/* prefix-list name to filter connected prefix */
|
2002-12-13 21:15:29 +01:00
|
|
|
char *plist_name;
|
2015-07-22 21:35:37 +02:00
|
|
|
|
|
|
|
/* BFD information */
|
2021-04-14 17:37:01 +02:00
|
|
|
struct {
|
|
|
|
bool enabled;
|
|
|
|
uint8_t detection_multiplier;
|
|
|
|
uint32_t min_rx;
|
|
|
|
uint32_t min_tx;
|
2021-04-16 21:17:31 +02:00
|
|
|
char *profile;
|
2021-04-14 17:37:01 +02:00
|
|
|
} bfd_config;
|
2016-12-07 13:25:38 +01:00
|
|
|
|
2021-03-10 18:59:07 +01:00
|
|
|
int on_write_q;
|
|
|
|
|
2018-01-09 01:53:53 +01:00
|
|
|
/* Statistics Fields */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t hello_in;
|
|
|
|
uint32_t hello_out;
|
|
|
|
uint32_t db_desc_in;
|
|
|
|
uint32_t db_desc_out;
|
|
|
|
uint32_t ls_req_in;
|
|
|
|
uint32_t ls_req_out;
|
|
|
|
uint32_t ls_upd_in;
|
|
|
|
uint32_t ls_upd_out;
|
|
|
|
uint32_t ls_ack_in;
|
|
|
|
uint32_t ls_ack_out;
|
|
|
|
uint32_t discarded;
|
2018-01-09 01:53:53 +01:00
|
|
|
|
2016-12-07 13:25:38 +01:00
|
|
|
QOBJ_FIELDS;
|
2002-12-13 21:15:29 +01:00
|
|
|
};
|
2016-12-07 13:25:38 +01:00
|
|
|
DECLARE_QOBJ_TYPE(ospf6_interface);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2004-05-18 20:57:06 +02:00
|
|
|
/* interface state */
|
2021-07-27 10:05:36 +02:00
|
|
|
#define OSPF6_INTERFACE_NONE 0
|
|
|
|
#define OSPF6_INTERFACE_DOWN 1
|
|
|
|
#define OSPF6_INTERFACE_LOOPBACK 2
|
|
|
|
#define OSPF6_INTERFACE_WAITING 3
|
|
|
|
#define OSPF6_INTERFACE_POINTTOPOINT 4
|
|
|
|
#define OSPF6_INTERFACE_POINTTOMULTIPOINT 5
|
|
|
|
#define OSPF6_INTERFACE_DROTHER 6
|
|
|
|
#define OSPF6_INTERFACE_BDR 7
|
|
|
|
#define OSPF6_INTERFACE_DR 8
|
|
|
|
#define OSPF6_INTERFACE_MAX 9
|
2004-05-18 20:57:06 +02:00
|
|
|
|
2019-11-20 17:26:59 +01:00
|
|
|
extern const char *const ospf6_interface_state_str[];
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2004-05-18 20:57:06 +02:00
|
|
|
/* flags */
|
|
|
|
#define OSPF6_INTERFACE_DISABLE 0x01
|
|
|
|
#define OSPF6_INTERFACE_PASSIVE 0x02
|
2012-10-24 16:45:53 +02:00
|
|
|
#define OSPF6_INTERFACE_NOAUTOCOST 0x04
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2012-02-10 07:42:45 +01:00
|
|
|
/* default values */
|
|
|
|
#define OSPF6_INTERFACE_HELLO_INTERVAL 10
|
|
|
|
#define OSPF6_INTERFACE_DEAD_INTERVAL 40
|
|
|
|
#define OSPF6_INTERFACE_RXMT_INTERVAL 5
|
|
|
|
#define OSPF6_INTERFACE_COST 1
|
|
|
|
#define OSPF6_INTERFACE_PRIORITY 1
|
|
|
|
#define OSPF6_INTERFACE_TRANSDELAY 1
|
|
|
|
#define OSPF6_INTERFACE_INSTANCE_ID 0
|
2016-06-13 15:06:45 +02:00
|
|
|
#define OSPF6_INTERFACE_BANDWIDTH 10000 /* Mbps */
|
|
|
|
#define OSPF6_REFERENCE_BANDWIDTH 100000 /* Mbps */
|
2015-05-20 03:03:40 +02:00
|
|
|
#define OSPF6_INTERFACE_SSO_RETRY_INT 1
|
|
|
|
#define OSPF6_INTERFACE_SSO_RETRY_MAX 5
|
2012-02-10 07:42:45 +01:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Function Prototypes */
|
|
|
|
|
2021-05-26 00:49:30 +02:00
|
|
|
extern void ospf6_interface_start(struct ospf6_interface *oi);
|
|
|
|
extern void ospf6_interface_stop(struct ospf6_interface *oi);
|
|
|
|
|
2020-09-01 10:31:49 +02:00
|
|
|
extern struct ospf6_interface *
|
|
|
|
ospf6_interface_lookup_by_ifindex(ifindex_t, vrf_id_t vrf_id);
|
2021-09-09 22:42:52 +02:00
|
|
|
extern struct ospf6_interface *ospf6_interface_create(struct interface *ifp);
|
|
|
|
extern void ospf6_interface_delete(struct ospf6_interface *oi);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2021-09-09 22:42:52 +02:00
|
|
|
extern void ospf6_interface_enable(struct ospf6_interface *oi);
|
|
|
|
extern void ospf6_interface_disable(struct ospf6_interface *oi);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2021-09-09 22:42:52 +02:00
|
|
|
extern void ospf6_interface_state_update(struct interface *ifp);
|
|
|
|
extern void ospf6_interface_connected_route_update(struct interface *ifp);
|
2021-03-25 12:29:51 +01:00
|
|
|
extern struct in6_addr *
|
|
|
|
ospf6_interface_get_global_address(struct interface *ifp);
|
2004-05-18 20:57:06 +02:00
|
|
|
|
|
|
|
/* interface event */
|
2022-03-01 22:18:12 +01:00
|
|
|
extern void interface_up(struct event *thread);
|
|
|
|
extern void interface_down(struct event *thread);
|
|
|
|
extern void wait_timer(struct event *thread);
|
|
|
|
extern void backup_seen(struct event *thread);
|
|
|
|
extern void neighbor_change(struct event *thread);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2008-08-15 14:45:30 +02:00
|
|
|
extern void ospf6_interface_init(void);
|
2021-05-03 13:46:41 +02:00
|
|
|
extern void ospf6_interface_clear(struct interface *ifp);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2015-05-20 03:03:40 +02:00
|
|
|
extern void install_element_ospf6_clear_interface(void);
|
|
|
|
|
2008-08-15 14:45:30 +02:00
|
|
|
extern int config_write_ospf6_debug_interface(struct vty *vty);
|
|
|
|
extern void install_element_ospf6_debug_interface(void);
|
2021-07-01 13:55:44 +02:00
|
|
|
extern int ospf6_interface_neighbor_count(struct ospf6_interface *oi);
|
|
|
|
extern uint8_t dr_election(struct ospf6_interface *oi);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2021-05-30 18:22:41 +02:00
|
|
|
extern void ospf6_interface_auth_trailer_cmd_init(void);
|
|
|
|
extern void ospf6_auth_write_config(struct vty *vty,
|
|
|
|
struct ospf6_auth_data *at_data);
|
2016-06-12 17:32:23 +02:00
|
|
|
DECLARE_HOOK(ospf6_interface_change,
|
|
|
|
(struct ospf6_interface * oi, int state, int old_state),
|
|
|
|
(oi, state, old_state));
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
#endif /* OSPF6_INTERFACE_H */
|