]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* BGP open message handling |
896014f4 DL |
2 | * Copyright (C) 1999 Kunihiro Ishiguro |
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 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 | |
19 | */ | |
718e3744 | 20 | |
00d252cb | 21 | #ifndef _QUAGGA_BGP_OPEN_H |
22 | #define _QUAGGA_BGP_OPEN_H | |
23 | ||
6d58272b | 24 | /* Standard header for capability TLV */ |
d62a17ae | 25 | struct capability_header { |
d7c0a89a QY |
26 | uint8_t code; |
27 | uint8_t length; | |
6d58272b PJ |
28 | }; |
29 | ||
30 | /* Generic MP capability data */ | |
d62a17ae | 31 | struct capability_mp_data { |
a46a2e9b | 32 | uint16_t afi; /* iana_afi_t */ |
d7c0a89a | 33 | uint8_t reserved; |
a46a2e9b | 34 | uint8_t safi; /* iana_safi_t */ |
718e3744 | 35 | }; |
36 | ||
d62a17ae | 37 | struct graceful_restart_af { |
38 | afi_t afi; | |
39 | safi_t safi; | |
d7c0a89a | 40 | uint8_t flag; |
538621f2 | 41 | }; |
42 | ||
43 | /* Capability Code */ | |
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 */ | |
6d58272b | 48 | #define CAPABILITY_CODE_AS4 65 /* 4-octet AS number Capability */ |
89eeecb8 DS |
49 | #define CAPABILITY_CODE_DYNAMIC_OLD 66 /* Dynamic Capability, deprecated since 2003 */ |
50 | #define CAPABILITY_CODE_DYNAMIC 67 /* Dynamic Capability */ | |
a82478b9 | 51 | #define CAPABILITY_CODE_ADDPATH 69 /* Addpath Capability */ |
9af52ccf | 52 | #define CAPABILITY_CODE_ENHANCED_RR 70 /* Enhanced Route Refresh capability */ |
8606be87 | 53 | #define CAPABILITY_CODE_LLGR 71 /* Long-lived Graceful Restart */ |
da88f402 | 54 | #define CAPABILITY_CODE_FQDN 73 /* Advertise hostname capability */ |
8a92a8a0 | 55 | #define CAPABILITY_CODE_ENHE 5 /* Extended Next Hop Encoding */ |
538621f2 | 56 | #define CAPABILITY_CODE_REFRESH_OLD 128 /* Route Refresh Capability(cisco) */ |
57 | #define CAPABILITY_CODE_ORF_OLD 130 /* Cooperative Route Filtering Capability(cisco) */ | |
ef56aee4 | 58 | #define CAPABILITY_CODE_EXT_MESSAGE 6 /* Extended Message Support */ |
d864dd9e | 59 | #define CAPABILITY_CODE_ROLE 9 /* Role Capability */ |
718e3744 | 60 | |
538621f2 | 61 | /* Capability Length */ |
62 | #define CAPABILITY_CODE_MP_LEN 4 | |
718e3744 | 63 | #define CAPABILITY_CODE_REFRESH_LEN 0 |
538621f2 | 64 | #define CAPABILITY_CODE_DYNAMIC_LEN 0 |
65 | #define CAPABILITY_CODE_RESTART_LEN 2 /* Receiving only case */ | |
6d58272b | 66 | #define CAPABILITY_CODE_AS4_LEN 4 |
a82478b9 | 67 | #define CAPABILITY_CODE_ADDPATH_LEN 4 |
8a92a8a0 | 68 | #define CAPABILITY_CODE_ENHE_LEN 6 /* NRLI AFI = 2, SAFI = 2, Nexthop AFI = 2 */ |
e978e1de | 69 | #define CAPABILITY_CODE_MIN_FQDN_LEN 2 |
9af52ccf | 70 | #define CAPABILITY_CODE_ENHANCED_LEN 0 |
8606be87 | 71 | #define CAPABILITY_CODE_LLGR_LEN 0 |
e978e1de | 72 | #define CAPABILITY_CODE_ORF_LEN 5 |
ef56aee4 | 73 | #define CAPABILITY_CODE_EXT_MESSAGE_LEN 0 /* Extended Message Support */ |
d864dd9e | 74 | #define CAPABILITY_CODE_ROLE_LEN 1 |
718e3744 | 75 | |
76 | /* Cooperative Route Filtering Capability. */ | |
718e3744 | 77 | |
538621f2 | 78 | /* ORF Type */ |
5bb2aa89 | 79 | #define ORF_TYPE_RESERVED 0 |
9ea364a2 | 80 | #define ORF_TYPE_PREFIX 64 |
718e3744 | 81 | #define ORF_TYPE_PREFIX_OLD 128 |
82 | ||
538621f2 | 83 | /* ORF Mode */ |
9ea364a2 DA |
84 | #define ORF_MODE_RECEIVE 1 |
85 | #define ORF_MODE_SEND 2 | |
86 | #define ORF_MODE_BOTH 3 | |
718e3744 | 87 | |
718e3744 | 88 | /* Capability Message Action. */ |
89 | #define CAPABILITY_ACTION_SET 0 | |
90 | #define CAPABILITY_ACTION_UNSET 1 | |
91 | ||
538621f2 | 92 | /* Graceful Restart */ |
d83facbb | 93 | #define GRACEFUL_RESTART_R_BIT 0x8000 |
eea685b6 | 94 | #define GRACEFUL_RESTART_N_BIT 0x4000 |
d83facbb | 95 | #define GRACEFUL_RESTART_F_BIT 0x80 |
538621f2 | 96 | |
8606be87 DA |
97 | /* Long-lived Graceful Restart */ |
98 | #define LLGR_F_BIT 0x80 | |
99 | ||
d08c0c80 DA |
100 | /* Optional Parameters */ |
101 | #define BGP_OPEN_NON_EXT_OPT_LEN 255 /* Non-Ext OP Len. */ | |
102 | #define BGP_OPEN_NON_EXT_OPT_TYPE_EXTENDED_LENGTH 255 /* Non-Ext OP Type */ | |
103 | #define BGP_OPEN_EXT_OPT_PARAMS_CAPABLE(peer) \ | |
104 | (CHECK_FLAG(peer->flags, PEER_FLAG_EXTENDED_OPT_PARAMS) \ | |
105 | || CHECK_FLAG(peer->sflags, PEER_STATUS_EXT_OPT_PARAMS_LENGTH)) | |
106 | ||
107 | extern int bgp_open_option_parse(struct peer *peer, uint16_t length, | |
108 | int *mp_capability); | |
109 | extern uint16_t bgp_open_capability(struct stream *s, struct peer *peer, | |
110 | bool ext_opt_params); | |
94d4c685 DS |
111 | extern void bgp_capability_vty_out(struct vty *vty, struct peer *peer, |
112 | bool use_json, json_object *json_neigh); | |
d08c0c80 | 113 | extern as_t peek_for_as4_capability(struct peer *peer, uint16_t length); |
00d252cb | 114 | |
115 | #endif /* _QUAGGA_BGP_OPEN_H */ |