]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* BGP open message handling |
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 | |
17 | along with GNU Zebra; see the file COPYING. If not, write to the Free | |
18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
19 | 02111-1307, USA. */ | |
20 | ||
00d252cb | 21 | #ifndef _QUAGGA_BGP_OPEN_H |
22 | #define _QUAGGA_BGP_OPEN_H | |
23 | ||
6d58272b | 24 | /* Standard header for capability TLV */ |
ac4d0be5 | 25 | struct capability_header { |
26 | u_char code; | |
27 | u_char length; | |
6d58272b PJ |
28 | }; |
29 | ||
30 | /* Generic MP capability data */ | |
ac4d0be5 | 31 | struct capability_mp_data { |
32 | iana_afi_t afi; | |
33 | u_char reserved; | |
34 | safi_t safi; | |
718e3744 | 35 | }; |
36 | ||
6d58272b | 37 | #pragma pack(1) |
ac4d0be5 | 38 | struct capability_orf_entry { |
39 | struct capability_mp_data mpc; | |
40 | u_char num; | |
41 | struct { | |
42 | u_char type; | |
43 | u_char mode; | |
44 | } orfs[]; | |
45 | } __attribute__((packed)); | |
6d58272b | 46 | #pragma pack() |
718e3744 | 47 | |
ac4d0be5 | 48 | struct capability_as4 { |
49 | uint32_t as4; | |
0b2aa3a0 PJ |
50 | }; |
51 | ||
ac4d0be5 | 52 | struct graceful_restart_af { |
53 | afi_t afi; | |
54 | safi_t safi; | |
55 | u_char flag; | |
538621f2 | 56 | }; |
57 | ||
ac4d0be5 | 58 | struct capability_gr { |
59 | u_int16_t restart_flag_time; | |
60 | struct graceful_restart_af gr[]; | |
6d58272b PJ |
61 | }; |
62 | ||
538621f2 | 63 | /* Capability Code */ |
64 | #define CAPABILITY_CODE_MP 1 /* Multiprotocol Extensions */ | |
65 | #define CAPABILITY_CODE_REFRESH 2 /* Route Refresh Capability */ | |
66 | #define CAPABILITY_CODE_ORF 3 /* Cooperative Route Filtering Capability */ | |
67 | #define CAPABILITY_CODE_RESTART 64 /* Graceful Restart Capability */ | |
6d58272b | 68 | #define CAPABILITY_CODE_AS4 65 /* 4-octet AS number Capability */ |
89eeecb8 DS |
69 | #define CAPABILITY_CODE_DYNAMIC_OLD 66 /* Dynamic Capability, deprecated since 2003 */ |
70 | #define CAPABILITY_CODE_DYNAMIC 67 /* Dynamic Capability */ | |
a82478b9 | 71 | #define CAPABILITY_CODE_ADDPATH 69 /* Addpath Capability */ |
04b6bdc0 | 72 | #define CAPABILITY_CODE_FQDN 73 /* Advertise hostname capabilty */ |
8a92a8a0 | 73 | #define CAPABILITY_CODE_ENHE 5 /* Extended Next Hop Encoding */ |
538621f2 | 74 | #define CAPABILITY_CODE_REFRESH_OLD 128 /* Route Refresh Capability(cisco) */ |
75 | #define CAPABILITY_CODE_ORF_OLD 130 /* Cooperative Route Filtering Capability(cisco) */ | |
718e3744 | 76 | |
538621f2 | 77 | /* Capability Length */ |
78 | #define CAPABILITY_CODE_MP_LEN 4 | |
718e3744 | 79 | #define CAPABILITY_CODE_REFRESH_LEN 0 |
538621f2 | 80 | #define CAPABILITY_CODE_DYNAMIC_LEN 0 |
81 | #define CAPABILITY_CODE_RESTART_LEN 2 /* Receiving only case */ | |
6d58272b | 82 | #define CAPABILITY_CODE_AS4_LEN 4 |
a82478b9 | 83 | #define CAPABILITY_CODE_ADDPATH_LEN 4 |
8a92a8a0 | 84 | #define CAPABILITY_CODE_ENHE_LEN 6 /* NRLI AFI = 2, SAFI = 2, Nexthop AFI = 2 */ |
e978e1de DS |
85 | #define CAPABILITY_CODE_MIN_FQDN_LEN 2 |
86 | #define CAPABILITY_CODE_ORF_LEN 5 | |
718e3744 | 87 | |
88 | /* Cooperative Route Filtering Capability. */ | |
718e3744 | 89 | |
538621f2 | 90 | /* ORF Type */ |
718e3744 | 91 | #define ORF_TYPE_PREFIX 64 |
92 | #define ORF_TYPE_PREFIX_OLD 128 | |
93 | ||
538621f2 | 94 | /* ORF Mode */ |
718e3744 | 95 | #define ORF_MODE_RECEIVE 1 |
96 | #define ORF_MODE_SEND 2 | |
97 | #define ORF_MODE_BOTH 3 | |
98 | ||
718e3744 | 99 | /* Capability Message Action. */ |
100 | #define CAPABILITY_ACTION_SET 0 | |
101 | #define CAPABILITY_ACTION_UNSET 1 | |
102 | ||
538621f2 | 103 | /* Graceful Restart */ |
104 | #define RESTART_R_BIT 0x8000 | |
105 | #define RESTART_F_BIT 0x80 | |
106 | ||
ac4d0be5 | 107 | extern int bgp_open_option_parse(struct peer *, u_char, int *); |
108 | extern void bgp_open_capability(struct stream *, struct peer *); | |
109 | extern void bgp_capability_vty_out(struct vty *, struct peer *, u_char, | |
110 | json_object *); | |
111 | extern as_t peek_for_as4_capability(struct peer *, u_char); | |
00d252cb | 112 | |
113 | #endif /* _QUAGGA_BGP_OPEN_H */ |