]>
git.proxmox.com Git - mirror_frr.git/blob - bgpd/bgp_open.h
1 /* BGP open message handling
2 * Copyright (C) 1999 Kunihiro Ishiguro
4 * This file is part of GNU Zebra.
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
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.
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
21 #ifndef _QUAGGA_BGP_OPEN_H
22 #define _QUAGGA_BGP_OPEN_H
24 /* Standard header for capability TLV */
25 struct capability_header
{
30 /* Generic MP capability data */
31 struct capability_mp_data
{
32 uint16_t afi
; /* iana_afi_t */
34 uint8_t safi
; /* iana_safi_t */
37 struct graceful_restart_af
{
44 #define CAPABILITY_CODE_MP 1 /* Multiprotocol Extensions */
45 #define CAPABILITY_CODE_REFRESH 2 /* Route Refresh Capability */
46 #define CAPABILITY_CODE_ORF 3 /* Cooperative Route Filtering Capability */
47 #define CAPABILITY_CODE_RESTART 64 /* Graceful Restart Capability */
48 #define CAPABILITY_CODE_AS4 65 /* 4-octet AS number Capability */
49 #define CAPABILITY_CODE_DYNAMIC_OLD 66 /* Dynamic Capability, deprecated since 2003 */
50 #define CAPABILITY_CODE_DYNAMIC 67 /* Dynamic Capability */
51 #define CAPABILITY_CODE_ADDPATH 69 /* Addpath Capability */
52 #define CAPABILITY_CODE_ENHANCED_RR 70 /* Enhanced Route Refresh capability */
53 #define CAPABILITY_CODE_LLGR 71 /* Long-lived Graceful Restart */
54 #define CAPABILITY_CODE_FQDN 73 /* Advertise hostname capability */
55 #define CAPABILITY_CODE_ENHE 5 /* Extended Next Hop Encoding */
56 #define CAPABILITY_CODE_REFRESH_OLD 128 /* Route Refresh Capability(cisco) */
57 #define CAPABILITY_CODE_ORF_OLD 130 /* Cooperative Route Filtering Capability(cisco) */
58 #define CAPABILITY_CODE_EXT_MESSAGE 6 /* Extended Message Support */
60 /* Capability Length */
61 #define CAPABILITY_CODE_MP_LEN 4
62 #define CAPABILITY_CODE_REFRESH_LEN 0
63 #define CAPABILITY_CODE_DYNAMIC_LEN 0
64 #define CAPABILITY_CODE_RESTART_LEN 2 /* Receiving only case */
65 #define CAPABILITY_CODE_AS4_LEN 4
66 #define CAPABILITY_CODE_ADDPATH_LEN 4
67 #define CAPABILITY_CODE_ENHE_LEN 6 /* NRLI AFI = 2, SAFI = 2, Nexthop AFI = 2 */
68 #define CAPABILITY_CODE_MIN_FQDN_LEN 2
69 #define CAPABILITY_CODE_ENHANCED_LEN 0
70 #define CAPABILITY_CODE_LLGR_LEN 0
71 #define CAPABILITY_CODE_ORF_LEN 5
72 #define CAPABILITY_CODE_EXT_MESSAGE_LEN 0 /* Extended Message Support */
74 /* Cooperative Route Filtering Capability. */
77 #define ORF_TYPE_PREFIX 64
78 #define ORF_TYPE_PREFIX_OLD 128
81 #define ORF_MODE_RECEIVE 1
82 #define ORF_MODE_SEND 2
83 #define ORF_MODE_BOTH 3
85 /* Capability Message Action. */
86 #define CAPABILITY_ACTION_SET 0
87 #define CAPABILITY_ACTION_UNSET 1
89 /* Graceful Restart */
90 #define RESTART_R_BIT 0x8000
91 #define RESTART_F_BIT 0x80
93 /* Long-lived Graceful Restart */
94 #define LLGR_F_BIT 0x80
96 /* Optional Parameters */
97 #define BGP_OPEN_NON_EXT_OPT_LEN 255 /* Non-Ext OP Len. */
98 #define BGP_OPEN_NON_EXT_OPT_TYPE_EXTENDED_LENGTH 255 /* Non-Ext OP Type */
99 #define BGP_OPEN_EXT_OPT_PARAMS_CAPABLE(peer) \
100 (CHECK_FLAG(peer->flags, PEER_FLAG_EXTENDED_OPT_PARAMS) \
101 || CHECK_FLAG(peer->sflags, PEER_STATUS_EXT_OPT_PARAMS_LENGTH))
103 extern int bgp_open_option_parse(struct peer
*peer
, uint16_t length
,
105 extern uint16_t bgp_open_capability(struct stream
*s
, struct peer
*peer
,
106 bool ext_opt_params
);
107 extern void bgp_capability_vty_out(struct vty
*vty
, struct peer
*peer
,
108 bool use_json
, json_object
*json_neigh
);
109 extern as_t
peek_for_as4_capability(struct peer
*peer
, uint16_t length
);
111 #endif /* _QUAGGA_BGP_OPEN_H */