| File: | builds/wireshark/wireshark/epan/dissectors/packet-bmp.c |
| Warning: | line 941, column 17 Value stored to 'offset' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | /* packet-bmp.c |
| 2 | * Routines for BMP packet dissection |
| 3 | * (c) Copyright Ebben Aries <[email protected]> |
| 4 | * |
| 5 | * Wireshark - Network traffic analyzer |
| 6 | * By Gerald Combs <[email protected]> |
| 7 | * Copyright 1998 Gerald Combs |
| 8 | * |
| 9 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 10 | */ |
| 11 | /* |
| 12 | * Supports: |
| 13 | * RFC7854 BGP Monitoring Protocol |
| 14 | * RFC8671 Support for Adj-RIB-Out in the BGP Monitoring Protocol (BMP) |
| 15 | * RFC9069 Support for Local RIB in BGP Monitoring Protocol (BMP) |
| 16 | * draft-xu-grow-bmp-route-policy-attr-trace-04 BGP Route Policy and Attribute Trace Using BMP |
| 17 | * draft-ietf-grow-bmp-tlv-13 BMP v4: TLV support for BMP Route Monitoring and Peer Down Messages |
| 18 | * draft-ietf-grow-bmp-path-marking-tlv-02: BMP Extension for Path Status TLV |
| 19 | */ |
| 20 | |
| 21 | #include "config.h" |
| 22 | |
| 23 | #include <epan/packet.h> |
| 24 | #include <epan/expert.h> |
| 25 | #include <epan/prefs.h> |
| 26 | #include <epan/tfs.h> |
| 27 | |
| 28 | #include "packet-tcp.h" |
| 29 | #include "packet-bgp.h" |
| 30 | |
| 31 | void proto_register_bmp(void); |
| 32 | void proto_reg_handoff_bmp(void); |
| 33 | |
| 34 | #define FRAME_HEADER_LEN5 5 |
| 35 | |
| 36 | /* BMP Common Header Message Types */ |
| 37 | #define BMP_MSG_TYPE_ROUTE_MONITORING0x00 0x00 /* Route Monitoring */ |
| 38 | #define BMP_MSG_TYPE_STAT_REPORT0x01 0x01 /* Statistics Report */ |
| 39 | #define BMP_MSG_TYPE_PEER_DOWN0x02 0x02 /* Peer Down Notification */ |
| 40 | #define BMP_MSG_TYPE_PEER_UP0x03 0x03 /* Peer Up Notification */ |
| 41 | #define BMP_MSG_TYPE_INIT0x04 0x04 /* Initiation Message */ |
| 42 | #define BMP_MSG_TYPE_TERM0x05 0x05 /* Termination Message */ |
| 43 | #define BMP_MSG_TYPE_ROUTE_MIRRORING0x06 0x06 /* Route Mirroring */ |
| 44 | #define BMP_MSG_TYPE_ROUTE_POLICY0x64 0x64 /* Route Policy and Attribute Trace Message */ |
| 45 | |
| 46 | /* BMP Initiation Message Types */ |
| 47 | #define BMP_INIT_INFO_STRING0x00 0x00 /* String */ |
| 48 | #define BMP_INIT_SYSTEM_DESCRIPTION0x01 0x01 /* sysDescr */ |
| 49 | #define BMP_INIT_SYSTEM_NAME0x02 0x02 /* sysName */ |
| 50 | #define BMP_INIT_VRF_TABLE_NAME0x03 0x03 /* VRF/Table Name */ |
| 51 | #define BMP_INIT_ADMIN_LABEL0x04 0x04 /* Admin Label */ |
| 52 | |
| 53 | /* BMP Per Peer Types */ |
| 54 | #define BMP_PEER_GLOBAL_INSTANCE0x00 0x00 /* Global Instance Peer */ |
| 55 | #define BMP_PEER_RD_INSTANCE0x01 0x01 /* RD Instance Peer */ |
| 56 | #define BMP_PEER_LOCAL_INSTANCE0x02 0x02 /* Local Instance Peer */ |
| 57 | #define BMP_PEER_LOC_RIB_INSTANCE0x03 0x03 /* Loc-RIB Instance Peer */ |
| 58 | |
| 59 | /* BMP Per Peer Header Flags */ |
| 60 | #define BMP_PEER_FLAG_IPV60x80 0x80 /* V Flag: IPv6 */ |
| 61 | #define BMP_PEER_FLAG_POST_POLICY0x40 0x40 /* L Flag: Post-policy */ |
| 62 | #define BMP_PEER_FLAG_AS_PATH0x20 0x20 /* A Flag: AS_PATH */ |
| 63 | #define BMP_PEER_FLAG_ADJ_RIB_OUT0x10 0x10 |
| 64 | #define BMP_PEER_FLAG_RES0x0F 0x0F /* Reserved */ |
| 65 | #define BMP_PEER_FLAG_MASK0xFF 0xFF |
| 66 | |
| 67 | /* BMP Per Peer Loc-RIB Header Flags : RFC9069 */ |
| 68 | #define BMP_PEER_FLAG_LOC_RIB0x80 0x80 /* F Flag : Loc-RIB */ |
| 69 | #define BMP_PEER_FLAG_LOC_RIB_RES0x7F 0x7F /* Reserved */ |
| 70 | |
| 71 | /* BMP Stat Types */ |
| 72 | #define BMP_STAT_PREFIX_REJ0x00 0x00 /* Number of prefixes rejected by inbound policy */ |
| 73 | #define BMP_STAT_PREFIX_DUP0x01 0x01 /* Number of (known) duplicate prefix advertisements */ |
| 74 | #define BMP_STAT_WITHDRAW_DUP0x02 0x02 /* Number of (known) duplicate withdraws */ |
| 75 | #define BMP_STAT_CLUSTER_LOOP0x03 0x03 /* Number of updates invalidated due to CLUSTER_LIST loop */ |
| 76 | #define BMP_STAT_AS_LOOP0x04 0x04 /* Number of updates invalidated due to AS_PATH loop */ |
| 77 | #define BMP_STAT_INV_ORIGINATOR0x05 0x05 /* Number of updates invalidated due to ORIGINATOR_ID loop */ |
| 78 | #define BMP_STAT_AS_CONFED_LOOP0x06 0x06 /* Number of updates invalidated due to AS_CONFED loop */ |
| 79 | #define BMP_STAT_ROUTES_ADJ_RIB_IN0x07 0x07 /* Number of routes in Adj-RIBs-In */ |
| 80 | #define BMP_STAT_ROUTES_LOC_RIB0x08 0x08 /* Number of routes in Loc-RIB */ |
| 81 | #define BMP_STAT_ROUTES_PER_ADJ_RIB_IN0x09 0x09 /* Number of routes in per-AFI/SAFI Adj-RIBs-In */ |
| 82 | #define BMP_STAT_ROUTES_PER_LOC_RIB0x0A 0x0A /* Number of routes in per-AFI/SAFI Loc-RIB */ |
| 83 | #define BMP_STAT_UPDATE_TREAT0x0B 0x0B /* Number of updates subjected to treat-as-withdraw treatment */ |
| 84 | #define BMP_STAT_PREFIXES_TREAT0x0C 0x0C /* Number of prefixes subjected to treat-as-withdraw treatment */ |
| 85 | #define BMP_STAT_DUPLICATE_UPDATE0x0D 0x0D /* Number of duplicate update messages received */ |
| 86 | #define BMP_STAT_ROUTES_PRE_ADJ_RIB_OUT0x0E 0x0E /* Number of routes in pre-policy Adj-RIB-Out */ |
| 87 | #define BMP_STAT_ROUTES_POST_ADJ_RIB_OUT0x0F 0x0F /* Number of routes in post-policy Adj-RIB-Out */ |
| 88 | #define BMP_STAT_ROUTES_PRE_PER_ADJ_RIB_OUT0x10 0x10 /* Number of routes in per-AFI/SAFI pre-policy Adj-RIB-Out */ |
| 89 | #define BMP_STAT_ROUTES_POST_PER_ADJ_RIB_OUT0x11 0x11 /* Number of routes in per-AFI/SAFI post-policy Adj RIB-Out */ |
| 90 | |
| 91 | /* BMP Peer Down Reason Codes */ |
| 92 | #define BMP_PEER_DOWN_LOCAL_NOTIFY0x1 0x1 /* Local system closed the session, NOTIFICATION PDU follows */ |
| 93 | #define BMP_PEER_DOWN_LOCAL_NO_NOTIFY0x2 0x2 /* Local system closed the session, FSM Event follows */ |
| 94 | #define BMP_PEER_DOWN_REMOTE_NOTIFY0x3 0x3 /* Remote system closed the session, NOTIFICATION PDU follows */ |
| 95 | #define BMP_PEER_DOWN_REMOTE_NO_NOTIFY0x4 0x4 /* Remote system closed the session without notification */ |
| 96 | #define BMP_PEER_DOWN_INFO_NO_LONGER0x5 0x5 /* Information for this peer will no longer be sent to the monitoring station for configuration reasons */ |
| 97 | #define BMP_PEER_DOWN_LOCAL_SYSTEM_CLOSED0x6 0x6 /* Local system closed, TLV data Follows */ //RFC9069 |
| 98 | |
| 99 | /* BMP Termination Message Types */ |
| 100 | #define BMP_TERM_TYPE_STRING0x00 0x00 /* String */ |
| 101 | #define BMP_TERM_TYPE_REASON0x01 0x01 /* Reason */ |
| 102 | |
| 103 | /* BMP Termination Reason Codes */ |
| 104 | #define BMP_TERM_REASON_ADMIN_CLOSE0x00 0x00 /* Session administratively closed */ |
| 105 | #define BMP_TERM_REASON_UNSPECIFIED0x01 0x01 /* Unspecified reason */ |
| 106 | #define BMP_TERM_REASON_RESOURCES0x02 0x02 /* Out of resources */ |
| 107 | #define BMP_TERM_REASON_REDUNDANT0x03 0x03 /* Redundant connection */ |
| 108 | #define BMP_TERM_REASON_PERM_CLOSE0x04 0x04 /* Session permanently administratively closed */ |
| 109 | |
| 110 | /* BMP Route Policy TLV */ |
| 111 | #define BMP_ROUTE_POLICY_TLV_VRF0x00 0x00 |
| 112 | #define BMP_ROUTE_POLICY_TLV_POLICY0x01 0x01 |
| 113 | #define BMP_ROUTE_POLICY_TLV_PRE_POLICY0x02 0x02 |
| 114 | #define BMP_ROUTE_POLICY_TLV_POST_POLICY0x03 0x03 |
| 115 | #define BMP_ROUTE_POLICY_TLV_STRING0x04 0x04 |
| 116 | |
| 117 | /* BMP Peer Up TLV */ |
| 118 | #define BMP_PEER_UP_TLV_STRING0x00 0x00 |
| 119 | #define BMP_PEER_UP_TLV_SYS_DESCR0x01 0x01 |
| 120 | #define BMP_PEER_UP_TLV_SYS_NAME0x02 0x02 |
| 121 | /* this one is called peer state because both peer up and down use it */ |
| 122 | #define BMP_PEER_STATE_TLV_VRF_TABLE_NAME0x03 0x03 |
| 123 | #define BMP_PEER_UP_TLV_ADMIN_LABEL0x04 0x04 |
| 124 | |
| 125 | /* BMP Route Mirroring TLV */ |
| 126 | #define BMP_ROUTE_MIRRORING_TLV_BGP_MESSAGE0x00 0x00 |
| 127 | #define BMP_ROUTE_MIRRORING_TLV_INFORMATION0x01 0x01 |
| 128 | |
| 129 | /* BMP draft-ietf-grow-bmp-tlv TLV */ |
| 130 | #define BMPv4_TLV_TYPE_STATELESS_PARSING0x01 0x01 |
| 131 | #define BMPv4_TLV_TYPE_GROUP0x02 0x02 |
| 132 | #define BMPv4_TLV_TYPE_VRF_TABLE_NAME0x03 0x03 |
| 133 | #define BMPv4_TLV_TYPE_BGP_MSG0x04 0x04 |
| 134 | #define BMPv4_TLV_TYPE_BGP_PATH_STATUS0x05 0x05 |
| 135 | |
| 136 | /* BMP draft-item-grow-bmp-tlv TLV Lengths */ |
| 137 | #define BMPv4_TLV_LENGTH_GROUP_ITEM0x02 0x02 |
| 138 | #define BMPv4_TLV_LENGTH_VRF_TABLE_NAME_MAX_LENGTH0xFF 0xFF |
| 139 | #define BMPv4_TLV_LENGTH_PATH_STATUS_STATUS_LENGTH0x04 0x04 |
| 140 | #define BMPv4_TLV_LENGTH_PATH_STATUS_REASON_LENGTH0x02 0x02 |
| 141 | |
| 142 | static const value_string bmp_typevals[] = { |
| 143 | { BMP_MSG_TYPE_ROUTE_MONITORING0x00, "Route Monitoring" }, |
| 144 | { BMP_MSG_TYPE_STAT_REPORT0x01, "Statistics Report" }, |
| 145 | { BMP_MSG_TYPE_PEER_DOWN0x02, "Peer Down Notification" }, |
| 146 | { BMP_MSG_TYPE_PEER_UP0x03, "Peer Up Notification" }, |
| 147 | { BMP_MSG_TYPE_INIT0x04, "Initiation Message" }, |
| 148 | { BMP_MSG_TYPE_TERM0x05, "Termination Message" }, |
| 149 | { BMP_MSG_TYPE_ROUTE_MIRRORING0x06, "Route Mirroring" }, |
| 150 | { BMP_MSG_TYPE_ROUTE_POLICY0x64, "Route Policy and Attribute Trace Message" }, |
| 151 | { 0, NULL((void*)0) } |
| 152 | }; |
| 153 | |
| 154 | static const value_string init_typevals[] = { |
| 155 | { BMP_INIT_INFO_STRING0x00, "String" }, |
| 156 | { BMP_INIT_SYSTEM_DESCRIPTION0x01, "sysDescr" }, |
| 157 | { BMP_INIT_SYSTEM_NAME0x02, "sysName" }, |
| 158 | { BMP_INIT_VRF_TABLE_NAME0x03, "VRF/Table" }, |
| 159 | { BMP_INIT_ADMIN_LABEL0x04, "Admin Label" }, |
| 160 | { 0, NULL((void*)0) } |
| 161 | }; |
| 162 | |
| 163 | static const value_string peer_typevals[] = { |
| 164 | { BMP_PEER_GLOBAL_INSTANCE0x00, "Global Instance Peer" }, |
| 165 | { BMP_PEER_RD_INSTANCE0x01, "RD Instance Peer" }, |
| 166 | { BMP_PEER_LOCAL_INSTANCE0x02, "Local Instance Peer" }, |
| 167 | { BMP_PEER_LOC_RIB_INSTANCE0x03, "Loc-RIB Instance Peer" }, |
| 168 | { 0, NULL((void*)0) } |
| 169 | }; |
| 170 | |
| 171 | static const value_string down_reason_typevals[] = { |
| 172 | { BMP_PEER_DOWN_LOCAL_NOTIFY0x1, "Local System, Notification" }, |
| 173 | { BMP_PEER_DOWN_LOCAL_NO_NOTIFY0x2, "Local System, No Notification" }, |
| 174 | { BMP_PEER_DOWN_REMOTE_NOTIFY0x3, "Remote System, Notification" }, |
| 175 | { BMP_PEER_DOWN_REMOTE_NO_NOTIFY0x4, "Remote System, No Notification" }, |
| 176 | { BMP_PEER_DOWN_INFO_NO_LONGER0x5, "Peer no longer be sent Information (Configuration reasons)" }, |
| 177 | { BMP_PEER_DOWN_LOCAL_SYSTEM_CLOSED0x6, "Local system closed, TLV data Follows" }, |
| 178 | { 0, NULL((void*)0) } |
| 179 | }; |
| 180 | |
| 181 | static const value_string term_typevals[] = { |
| 182 | { BMP_TERM_TYPE_STRING0x00, "String" }, |
| 183 | { BMP_TERM_TYPE_REASON0x01, "Reason" }, |
| 184 | { 0, NULL((void*)0) } |
| 185 | }; |
| 186 | |
| 187 | static const value_string term_reason_typevals[] = { |
| 188 | { BMP_TERM_REASON_ADMIN_CLOSE0x00, "Session administratively closed" }, |
| 189 | { BMP_TERM_REASON_UNSPECIFIED0x01, "Unspecified reason" }, |
| 190 | { BMP_TERM_REASON_RESOURCES0x02, "Out of resources" }, |
| 191 | { BMP_TERM_REASON_REDUNDANT0x03, "Redundant connection" }, |
| 192 | { BMP_TERM_REASON_PERM_CLOSE0x04, "Session permanently administratively closed" }, |
| 193 | { 0, NULL((void*)0) } |
| 194 | }; |
| 195 | |
| 196 | static const value_string stat_typevals[] = { |
| 197 | { BMP_STAT_PREFIX_REJ0x00, "Rejected Prefixes" }, |
| 198 | { BMP_STAT_PREFIX_DUP0x01, "Duplicate Prefixes" }, |
| 199 | { BMP_STAT_WITHDRAW_DUP0x02, "Duplicate Withdraws" }, |
| 200 | { BMP_STAT_CLUSTER_LOOP0x03, "Invalid CLUSTER_LIST Loop" }, |
| 201 | { BMP_STAT_AS_LOOP0x04, "Invalid AS_PATH Loop" }, |
| 202 | { BMP_STAT_INV_ORIGINATOR0x05, "Invalid ORIGINATOR_ID" }, |
| 203 | { BMP_STAT_AS_CONFED_LOOP0x06, "Invalid AS_CONFED Loop" }, |
| 204 | { BMP_STAT_ROUTES_ADJ_RIB_IN0x07, "Routes in Adj-RIB-In" }, |
| 205 | { BMP_STAT_ROUTES_LOC_RIB0x08, "Routes in Loc-RIB" }, |
| 206 | { BMP_STAT_ROUTES_PER_ADJ_RIB_IN0x09, "Routes in per-AFI/SAF Adj-RIB-In" }, |
| 207 | { BMP_STAT_ROUTES_PER_LOC_RIB0x0A, "Routes in per-AFI/SAFLoc-RIB" }, |
| 208 | { BMP_STAT_UPDATE_TREAT0x0B, "Updates subjected to treat-as-withdraw treatment" }, |
| 209 | { BMP_STAT_PREFIXES_TREAT0x0C, "Prefixes subjected to treat-as-withdraw treatment" }, |
| 210 | { BMP_STAT_DUPLICATE_UPDATE0x0D, "Duplicate update messages received" }, |
| 211 | { BMP_STAT_ROUTES_PRE_ADJ_RIB_OUT0x0E, "Routes in pre-policy Adj-RIB-Out" }, |
| 212 | { BMP_STAT_ROUTES_POST_ADJ_RIB_OUT0x0F, "Routes in post-policy Adj-RIB-Out" }, |
| 213 | { BMP_STAT_ROUTES_PRE_PER_ADJ_RIB_OUT0x10, "Routes in per-AFI/SAFI pre-policy Adj-RIB-Out" }, |
| 214 | { BMP_STAT_ROUTES_POST_PER_ADJ_RIB_OUT0x11, "Routes in per-AFI/SAFI post-policy Adj RIB-Out" }, |
| 215 | { 0, NULL((void*)0) } |
| 216 | }; |
| 217 | |
| 218 | static const value_string route_policy_tlv_typevals[] = { |
| 219 | { BMP_ROUTE_POLICY_TLV_VRF0x00, "VRF/Table" }, |
| 220 | { BMP_ROUTE_POLICY_TLV_POLICY0x01, "Policy TLV" }, |
| 221 | { BMP_ROUTE_POLICY_TLV_PRE_POLICY0x02, "Pre Policy Attribute" }, |
| 222 | { BMP_ROUTE_POLICY_TLV_POST_POLICY0x03, "Post Policy Attribute" }, |
| 223 | { BMP_ROUTE_POLICY_TLV_STRING0x04, "String" }, |
| 224 | { 0, NULL((void*)0) } |
| 225 | }; |
| 226 | |
| 227 | static const value_string route_policy_tlv_policy_class_typevals[] = { |
| 228 | { 0, "Inbound policy" }, |
| 229 | { 1, "Outbound policy" }, |
| 230 | { 2, "Multi-protocol Redistribute" }, |
| 231 | { 3, "Cross-VRF Redistribute" }, |
| 232 | { 4, "VRF import" }, |
| 233 | { 5, "VRF export" }, |
| 234 | { 6, "Network" }, |
| 235 | { 7, "Aggregation" }, |
| 236 | { 8, "Route Withdraw" }, |
| 237 | { 0, NULL((void*)0) } |
| 238 | }; |
| 239 | |
| 240 | static const value_string bmpv4_tlv_typevals[] = { |
| 241 | { BMPv4_TLV_TYPE_STATELESS_PARSING0x01, "Stateless Parsing" }, |
| 242 | { BMPv4_TLV_TYPE_GROUP0x02, "Group" }, |
| 243 | { BMPv4_TLV_TYPE_VRF_TABLE_NAME0x03, "VRF/Table Name" }, |
| 244 | { BMPv4_TLV_TYPE_BGP_MSG0x04, "BGP Message" }, |
| 245 | { BMPv4_TLV_TYPE_BGP_PATH_STATUS0x05, "BGP Path Status" }, |
| 246 | { 0, NULL((void*)0) } |
| 247 | }; |
| 248 | |
| 249 | |
| 250 | enum bmp_path_status { |
| 251 | BMP_PATH_STATUS_RESERVED = 0x00000000, |
| 252 | BMP_PATH_STATUS_INVALID = 0x00000001, |
| 253 | BMP_PATH_STATUS_BEST = 0x00000002, |
| 254 | BMP_PATH_STATUS_NON_SELECTED = 0x00000004, |
| 255 | BMP_PATH_STATUS_PRIMARY = 0x00000008, |
| 256 | BMP_PATH_STATUS_BACKUP = 0x00000010, |
| 257 | BMP_PATH_STATUS_NON_INSTALLED = 0x00000020, |
| 258 | BMP_PATH_STATUS_BEST_EXTERNAL = 0x00000040, |
| 259 | BMP_PATH_STATUS_ADDPATH = 0x00000080, |
| 260 | BMP_PATH_STATUS_FILTERED_IN = 0x00000100, |
| 261 | BMP_PATH_STATUS_FILTERED_OUT = 0x00000200, |
| 262 | BMP_PATH_STATUS_INVALID_ROV = 0x00000400, |
| 263 | }; |
| 264 | |
| 265 | #define BMP_PATH_STATUS_MASK0x000007ff 0x000007ff |
| 266 | |
| 267 | enum bmp_path_status_reason { |
| 268 | BMP_PATH_STATUS_REASON_RESERVED = 0x0000, |
| 269 | BMP_PATH_STATUS_REASON_INVALID_FOR_AS_LOOP = 0x0001, |
| 270 | BMP_PATH_STATUS_REASON_INVALID_FOR_UNRESOLVABLE_NEXTHOP = 0x0002, |
| 271 | BMP_PATH_STATUS_REASON_NOT_PREFERRED_FOR_LOCAL_PREFERENCE = 0x0003, |
| 272 | BMP_PATH_STATUS_REASON_NOT_PREFERRED_FOR_AS_PATH_LENGTH = 0x0004, |
| 273 | BMP_PATH_STATUS_REASON_NOT_PREFERRED_FOR_ORIGIN = 0x0005, |
| 274 | BMP_PATH_STATUS_REASON_NOT_PREFERRED_FOR_MED = 0x0006, |
| 275 | BMP_PATH_STATUS_REASON_NOT_PREFERRED_FOR_PEER_TYPE = 0x0007, |
| 276 | BMP_PATH_STATUS_REASON_NOT_PREFERRED_FOR_IGP_COST = 0x0008, |
| 277 | BMP_PATH_STATUS_REASON_NOT_PREFERRED_FOR_ROUTER_ID = 0x0009, |
| 278 | BMP_PATH_STATUS_REASON_NOT_PREFERRED_FOR_PEER_ADDRESS = 0x000A, |
| 279 | BMP_PATH_STATUS_REASON_NOT_PREFERRED_FOR_AIGP = 0x000B |
| 280 | }; |
| 281 | |
| 282 | static const value_string bmpv4_tlv_path_status_reason_typevals[] = { |
| 283 | |
| 284 | { BMP_PATH_STATUS_REASON_RESERVED, "Reserved" }, |
| 285 | { BMP_PATH_STATUS_REASON_INVALID_FOR_AS_LOOP, "Invalid for AS Loop" }, |
| 286 | { BMP_PATH_STATUS_REASON_INVALID_FOR_UNRESOLVABLE_NEXTHOP, "Invalid for unresolvable nexthop" }, |
| 287 | { BMP_PATH_STATUS_REASON_NOT_PREFERRED_FOR_LOCAL_PREFERENCE, "Not Preferred for Local Preference" }, |
| 288 | { BMP_PATH_STATUS_REASON_NOT_PREFERRED_FOR_AS_PATH_LENGTH, "Not Preferred for AS Path Length" }, |
| 289 | { BMP_PATH_STATUS_REASON_NOT_PREFERRED_FOR_ORIGIN, "Not Preferred for Origin" }, |
| 290 | { BMP_PATH_STATUS_REASON_NOT_PREFERRED_FOR_MED, "Not Preferred for MED" }, |
| 291 | { BMP_PATH_STATUS_REASON_NOT_PREFERRED_FOR_PEER_TYPE, "Not Preferred for Peer Type" }, |
| 292 | { BMP_PATH_STATUS_REASON_NOT_PREFERRED_FOR_IGP_COST, "Not Preferred for IGP Cost" }, |
| 293 | { BMP_PATH_STATUS_REASON_NOT_PREFERRED_FOR_ROUTER_ID, "Not Preferred for Router ID" }, |
| 294 | { BMP_PATH_STATUS_REASON_NOT_PREFERRED_FOR_PEER_ADDRESS, "Not Preferred for Peer Address" }, |
| 295 | { BMP_PATH_STATUS_REASON_NOT_PREFERRED_FOR_AIGP, "Not Preferred for AIGP" }, |
| 296 | { 0, NULL((void*)0) } |
| 297 | }; |
| 298 | |
| 299 | static const value_string peer_up_tlv_typevals[] = { |
| 300 | { BMP_PEER_UP_TLV_STRING0x00, "String" }, |
| 301 | { BMP_PEER_UP_TLV_SYS_DESCR0x01, "sysDescr" }, |
| 302 | { BMP_PEER_UP_TLV_SYS_NAME0x02, "sysName" }, |
| 303 | { BMP_PEER_STATE_TLV_VRF_TABLE_NAME0x03, "VRF/Table" }, |
| 304 | { BMP_PEER_UP_TLV_ADMIN_LABEL0x04, "Admin Label" }, |
| 305 | { 0, NULL((void*)0) } |
| 306 | }; |
| 307 | |
| 308 | static const value_string peer_down_tlv_typevals[] = { |
| 309 | { BMP_PEER_STATE_TLV_VRF_TABLE_NAME0x03, "VRF/Table" }, |
| 310 | { 0, NULL((void*)0) } |
| 311 | }; |
| 312 | |
| 313 | static const value_string route_mirroring_typevals[] = { |
| 314 | { BMP_ROUTE_MIRRORING_TLV_BGP_MESSAGE0x00, "BGP Message" }, |
| 315 | { BMP_ROUTE_MIRRORING_TLV_INFORMATION0x01, "Information" }, |
| 316 | { 0, NULL((void*)0) } |
| 317 | }; |
| 318 | |
| 319 | static const value_string route_mirroring_information_typevals[] = { |
| 320 | { 0, "Errored PDU" }, |
| 321 | { 1, "Messages Lost" }, |
| 322 | { 0, NULL((void*)0) } |
| 323 | }; |
| 324 | |
| 325 | |
| 326 | static int proto_bmp; |
| 327 | |
| 328 | /* BMP Common Header field */ |
| 329 | static int hf_bmp_version; |
| 330 | static int hf_bmp_length; |
| 331 | static int hf_bmp_type; |
| 332 | |
| 333 | /* BMP Unused Bytes field */ |
| 334 | static int hf_bmp_unused; |
| 335 | |
| 336 | /* BMP Initiation Header field */ |
| 337 | static int hf_init_types; |
| 338 | static int hf_init_type; |
| 339 | static int hf_init_length; |
| 340 | static int hf_init_info; |
| 341 | |
| 342 | /* BMP Per Peer Header field */ |
| 343 | static int hf_peer_header; |
| 344 | static int hf_peer_type; |
| 345 | static int hf_peer_flags; |
| 346 | static int hf_peer_flags_ipv6; |
| 347 | static int hf_peer_flags_post_policy; |
| 348 | static int hf_peer_flags_as_path; |
| 349 | static int hf_peer_flags_adj_rib_out; |
| 350 | static int hf_peer_flags_res; |
| 351 | static int hf_peer_flags_loc_rib; |
| 352 | static int hf_peer_flags_loc_rib_res; |
| 353 | static int hf_peer_distinguisher; |
| 354 | static int hf_peer_ipv4_address; |
| 355 | static int hf_peer_ipv6_address; |
| 356 | static int hf_peer_asn; |
| 357 | static int hf_peer_bgp_id; |
| 358 | static int hf_peer_timestamp_sec; |
| 359 | static int hf_peer_timestamp_msec; |
| 360 | |
| 361 | static int hf_peer_route_mirroring_type; |
| 362 | static int hf_peer_route_mirroring_length; |
| 363 | static int hf_peer_route_mirroring_code; |
| 364 | |
| 365 | /* BMP Peer Up Notification field */ |
| 366 | static int hf_peer_up_ipv4_address; |
| 367 | static int hf_peer_up_ipv6_address; |
| 368 | static int hf_peer_up_local_port; |
| 369 | static int hf_peer_up_remote_port; |
| 370 | |
| 371 | static int hf_peer_state_tlv; |
| 372 | static int hf_peer_state_tlv_type; |
| 373 | static int hf_peer_state_tlv_length; |
| 374 | static int hf_peer_state_tlv_value; |
| 375 | static int hf_peer_state_tlv_vrf_table_name; |
| 376 | static int hf_peer_up_tlv_string; |
| 377 | static int hf_peer_up_tlv_sys_name; |
| 378 | static int hf_peer_up_tlv_sys_descr; |
| 379 | static int hf_peer_up_tlv_admin_label; |
| 380 | |
| 381 | /* BMP Peer Down Notification field */ |
| 382 | static int hf_peer_down_reason; |
| 383 | static int hf_peer_down_data; |
| 384 | |
| 385 | /* BMP Stat Reports field */ |
| 386 | static int hf_stats_count; |
| 387 | static int hf_stat_type; |
| 388 | static int hf_stat_len; |
| 389 | static int hf_stat_data; |
| 390 | static int hf_stat_data_prefix_rej; |
| 391 | static int hf_stat_data_prefix_dup; |
| 392 | static int hf_stat_data_withdraw_dup; |
| 393 | static int hf_stat_data_cluster_loop; |
| 394 | static int hf_stat_data_as_loop; |
| 395 | static int hf_stat_data_inv_originator; |
| 396 | static int hf_stat_data_as_confed_loop; |
| 397 | static int hf_stat_data_routes_adj_rib_in; |
| 398 | static int hf_stat_data_routes_loc_rib; |
| 399 | static int hf_stat_data_routes_per_adj_rib_in_afi; |
| 400 | static int hf_stat_data_routes_per_adj_rib_in_safi; |
| 401 | static int hf_stat_data_routes_per_adj_rib_in; |
| 402 | static int hf_stat_data_routes_per_loc_rib_afi; |
| 403 | static int hf_stat_data_routes_per_loc_rib_safi; |
| 404 | static int hf_stat_data_routes_per_loc_rib; |
| 405 | static int hf_stat_data_update_treat; |
| 406 | static int hf_stat_data_prefixes_treat; |
| 407 | static int hf_stat_data_duplicate_update; |
| 408 | static int hf_stat_data_routes_pre_adj_rib_out; |
| 409 | static int hf_stat_data_routes_post_adj_rib_out; |
| 410 | static int hf_stat_data_routes_pre_per_adj_rib_out_afi; |
| 411 | static int hf_stat_data_routes_pre_per_adj_rib_out_safi; |
| 412 | static int hf_stat_data_routes_pre_per_adj_rib_out; |
| 413 | static int hf_stat_data_routes_post_per_adj_rib_out_afi; |
| 414 | static int hf_stat_data_routes_post_per_adj_rib_out_safi; |
| 415 | static int hf_stat_data_routes_post_per_adj_rib_out; |
| 416 | |
| 417 | /* BMP Termination field */ |
| 418 | static int hf_term_types; |
| 419 | static int hf_term_type; |
| 420 | static int hf_term_len; |
| 421 | static int hf_term_info; |
| 422 | static int hf_term_reason; |
| 423 | |
| 424 | /* BMP Route Policy */ |
| 425 | static int hf_route_policy_flags; |
| 426 | static int hf_route_policy_flags_ipv6; |
| 427 | static int hf_route_policy_flags_res; |
| 428 | static int hf_route_policy_rd; |
| 429 | static int hf_route_policy_prefix_length; |
| 430 | static int hf_route_policy_prefix_ipv4; |
| 431 | static int hf_route_policy_prefix_reserved; |
| 432 | static int hf_route_policy_prefix_ipv6; |
| 433 | static int hf_route_policy_route_origin; |
| 434 | static int hf_route_policy_event_count; |
| 435 | static int hf_route_policy_total_event_length; |
| 436 | static int hf_route_policy_single_event_length; |
| 437 | static int hf_route_policy_event_index; |
| 438 | static int hf_route_policy_timestamp_sec; |
| 439 | static int hf_route_policy_timestamp_msec; |
| 440 | static int hf_route_policy_path_identifier; |
| 441 | static int hf_route_policy_afi; |
| 442 | static int hf_route_policy_safi; |
| 443 | static int hf_route_policy_tlv; |
| 444 | static int hf_route_policy_tlv_type; |
| 445 | static int hf_route_policy_tlv_length; |
| 446 | static int hf_route_policy_tlv_value; |
| 447 | static int hf_route_policy_tlv_vrf_table_id; |
| 448 | static int hf_route_policy_tlv_vrf_table_name; |
| 449 | static int hf_route_policy_tlv_policy_flags; |
| 450 | static int hf_route_policy_tlv_policy_flags_m; |
| 451 | static int hf_route_policy_tlv_policy_flags_p; |
| 452 | static int hf_route_policy_tlv_policy_flags_d; |
| 453 | static int hf_route_policy_tlv_policy_flags_res; |
| 454 | static int hf_route_policy_tlv_policy_count; |
| 455 | static int hf_route_policy_tlv_policy_class; |
| 456 | static int hf_route_policy_tlv_policy_peer_ipv4; |
| 457 | static int hf_route_policy_tlv_policy_peer_ipv6; |
| 458 | static int hf_route_policy_tlv_policy_peer_reserved; |
| 459 | static int hf_route_policy_tlv_policy_peer_router_id; |
| 460 | static int hf_route_policy_tlv_policy_peer_as; |
| 461 | static int hf_route_policy_tlv_policy; |
| 462 | static int hf_route_policy_tlv_policy_name_length; |
| 463 | static int hf_route_policy_tlv_policy_item_id_length; |
| 464 | static int hf_route_policy_tlv_policy_name; |
| 465 | static int hf_route_policy_tlv_policy_item_id; |
| 466 | static int hf_route_policy_tlv_policy_flag; |
| 467 | static int hf_route_policy_tlv_policy_flag_c; |
| 468 | static int hf_route_policy_tlv_policy_flag_r; |
| 469 | static int hf_route_policy_tlv_policy_flag_res2; |
| 470 | |
| 471 | static int hf_route_policy_tlv_string; |
| 472 | |
| 473 | static int hf_bmpv4_tlv; |
| 474 | static int hf_bmpv4_tlv_type; |
| 475 | static int hf_bmpv4_tlv_length; |
| 476 | static int hf_bmpv4_tlv_index; |
| 477 | static int hf_bmpv4_tlv_value_bytes; |
| 478 | static int hf_bmpv4_tlv_value_string; |
| 479 | static int hf_bmpv4_tlv_value_bool; |
| 480 | static int hf_bmpv4_tlv_value_index; |
| 481 | static int hf_bmpv4_tlv_group_id; |
| 482 | static int hf_bmpv4_tlv_path_status_status; |
| 483 | static int hf_bmpv4_tlv_path_status_reason; |
| 484 | |
| 485 | static int hf_bmp_path_status_invalid; |
| 486 | static int hf_bmp_path_status_best; |
| 487 | static int hf_bmp_path_status_non_selected; |
| 488 | static int hf_bmp_path_status_primary; |
| 489 | static int hf_bmp_path_status_backup; |
| 490 | static int hf_bmp_path_status_non_installed; |
| 491 | static int hf_bmp_path_status_best_external; |
| 492 | static int hf_bmp_path_status_addpath; |
| 493 | static int hf_bmp_path_status_filtered_in; |
| 494 | static int hf_bmp_path_status_filtered_out; |
| 495 | static int hf_bmp_path_status_invalid_rov; |
| 496 | |
| 497 | static int * const hf_bmpv4_tlv_path_status[] = { |
| 498 | &hf_bmp_path_status_invalid, |
| 499 | &hf_bmp_path_status_best, |
| 500 | &hf_bmp_path_status_non_selected, |
| 501 | &hf_bmp_path_status_primary, |
| 502 | &hf_bmp_path_status_backup, |
| 503 | &hf_bmp_path_status_non_installed, |
| 504 | &hf_bmp_path_status_best_external, |
| 505 | &hf_bmp_path_status_addpath, |
| 506 | &hf_bmp_path_status_filtered_in, |
| 507 | &hf_bmp_path_status_filtered_out, |
| 508 | &hf_bmp_path_status_invalid_rov, |
| 509 | NULL((void*)0) |
| 510 | }; |
| 511 | |
| 512 | static int ett_bmp; |
| 513 | static int ett_bmp_route_monitoring; |
| 514 | static int ett_bmp_stat_report; |
| 515 | static int ett_bmp_stat_type; |
| 516 | static int ett_bmp_peer_down; |
| 517 | static int ett_bmp_peer_up; |
| 518 | static int ett_bmp_peer_state_tlv; |
| 519 | static int ett_bmp_peer_header; |
| 520 | static int ett_bmp_peer_flags; |
| 521 | static int ett_bmp_init; |
| 522 | static int ett_bmp_init_types; |
| 523 | static int ett_bmp_init_type; |
| 524 | static int ett_bmp_term; |
| 525 | static int ett_bmp_term_type; |
| 526 | static int ett_bmp_term_types; |
| 527 | static int ett_bmp_route_mirroring; |
| 528 | static int ett_bmp_route_policy_flags; |
| 529 | static int ett_bmp_route_policy_tlv; |
| 530 | static int ett_bmp_route_policy_tlv_policy_flags; |
| 531 | static int ett_bmp_route_policy_tlv_policy; |
| 532 | static int ett_bmpv4_tlv; |
| 533 | static int ett_bmpv4_tlv_value; |
| 534 | static int ett_bmpv4_tlv_path_status; |
| 535 | |
| 536 | |
| 537 | static expert_field ei_stat_data_unknown; |
| 538 | static expert_field ei_bmpv4_tlv_unknown_tlv; |
| 539 | static expert_field ei_bmpv4_tlv_string_bad_length; |
| 540 | static expert_field ei_bmpv4_tlv_not_fully_parsed; |
| 541 | |
| 542 | static dissector_handle_t bmp_handle; |
| 543 | static dissector_handle_t dissector_bgp; |
| 544 | |
| 545 | /* desegmentation */ |
| 546 | static bool_Bool bmp_desegment = true1; |
| 547 | |
| 548 | typedef struct bmpv4_tlv_info { |
| 549 | uint16_t type; |
| 550 | uint16_t length; |
| 551 | uint16_t idx; |
| 552 | bool_Bool has_index; |
| 553 | } bmpv4_tlv_info; |
| 554 | |
| 555 | /* Dissect BMPv4 TLV Header |
| 556 | * |
| 557 | * with Index (Route Monitoring Message) |
| 558 | * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 559 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 560 | * | Type (2 octets) | Length (2 octets) | |
| 561 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 562 | * | Index (2 octets) | |
| 563 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 564 | * ~ Value (variable) ~ |
| 565 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 566 | * |
| 567 | * without Index |
| 568 | * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 569 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 570 | * | Type (2 octets) | Length (2 octets) | |
| 571 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 572 | * ~ Value (variable) ~ |
| 573 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 574 | */ |
| 575 | static bmpv4_tlv_info bmpv4_dissect_tlv_hdr(tvbuff_t *tvb, packet_info* pinfo, proto_tree **tree_ref, int *offset_ref, uint8_t bmp_type) { |
| 576 | |
| 577 | int offset = *offset_ref; |
| 578 | proto_tree *tree = *tree_ref; |
| 579 | uint32_t value_holder; |
| 580 | bmpv4_tlv_info tlv = { 0 }; |
| 581 | |
| 582 | tlv.type = tvb_get_ntohs(tvb, offset); |
| 583 | tlv.length = tvb_get_ntohs(tvb, offset + 2); |
| 584 | tlv.has_index = bmp_type == BMP_MSG_TYPE_ROUTE_MONITORING0x00; |
| 585 | |
| 586 | int total_length = 2 /* type field */ |
| 587 | + 2 /* length field */ |
| 588 | + (tlv.has_index ? 2 : 0) /* index field, if present */ |
| 589 | + tlv.length; /* tlv value length */ |
| 590 | |
| 591 | proto_item *ti = proto_tree_add_item(tree, hf_bmpv4_tlv, tvb, offset, total_length, ENC_NA0x00000000); |
| 592 | proto_item_append_text(ti, ": %s", val_to_str(pinfo->pool, tlv.type, bmpv4_tlv_typevals, "Unknown (0x%02x)")); |
| 593 | |
| 594 | proto_tree *subtree = proto_item_add_subtree(ti, ett_bmpv4_tlv); |
| 595 | |
| 596 | proto_tree_add_item(subtree, hf_bmpv4_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
| 597 | offset += 2; |
| 598 | |
| 599 | proto_tree_add_item_ret_uint(subtree, hf_bmpv4_tlv_length, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &value_holder); |
| 600 | offset += 2; |
| 601 | |
| 602 | if (tlv.has_index) { |
| 603 | proto_tree_add_item_ret_uint(subtree, hf_bmpv4_tlv_index, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &value_holder); |
| 604 | tlv.idx = (uint16_t) value_holder; |
| 605 | offset += 2; |
| 606 | } |
| 607 | |
| 608 | *offset_ref = offset; |
| 609 | *tree_ref = subtree; |
| 610 | |
| 611 | return tlv; |
| 612 | } |
| 613 | |
| 614 | static void bmpv4_dissect_tlvs(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo, uint8_t bmp_msg_type) { |
| 615 | bmpv4_tlv_info tlv = { 0 }; |
| 616 | |
| 617 | while (tvb_captured_length_remaining(tvb, offset) >= 4) { |
| 618 | proto_tree *tlv_tree = tree; |
| 619 | tlv = bmpv4_dissect_tlv_hdr(tvb, pinfo, &tlv_tree, &offset, bmp_msg_type); |
| 620 | const int base_offset = offset; |
| 621 | |
| 622 | switch (tlv.type) { |
| 623 | case BMPv4_TLV_TYPE_STATELESS_PARSING0x01: { |
| 624 | dissect_bgp_capability_item(tvb, tlv_tree, pinfo, offset, false0); |
| 625 | offset += tlv.length; |
| 626 | break; |
| 627 | } |
| 628 | case BMPv4_TLV_TYPE_GROUP0x02: { |
| 629 | proto_tree_add_item(tlv_tree, hf_bmpv4_tlv_group_id, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
| 630 | offset += 2; |
| 631 | |
| 632 | const int list_length = tlv.length - 2 /* group id is not in list */; |
| 633 | proto_item *ti = proto_tree_add_item(tlv_tree, hf_bmpv4_tlv_value_bytes, tvb, offset, list_length, ENC_NA0x00000000); |
| 634 | |
| 635 | const int list_count = list_length / BMPv4_TLV_LENGTH_GROUP_ITEM0x02; |
| 636 | proto_item_set_text(ti, "Target Count: %d", list_count); |
| 637 | proto_item *subtree = proto_item_add_subtree(ti, ett_bmpv4_tlv_value); |
| 638 | |
| 639 | for (int i = 0; i < list_count; i++) { |
| 640 | proto_tree_add_item(subtree, hf_bmpv4_tlv_value_index, tvb, offset, BMPv4_TLV_LENGTH_GROUP_ITEM0x02, ENC_BIG_ENDIAN0x00000000); |
| 641 | offset += BMPv4_TLV_LENGTH_GROUP_ITEM0x02; |
| 642 | } |
| 643 | |
| 644 | break; |
| 645 | } |
| 646 | case BMPv4_TLV_TYPE_VRF_TABLE_NAME0x03: { |
| 647 | proto_item *ti = proto_tree_add_item(tlv_tree, hf_bmpv4_tlv_value_string, tvb, offset, tlv.length, |
| 648 | ENC_ASCII0x00000000); |
| 649 | offset += tlv.length; |
| 650 | |
| 651 | if (tlv.length == 0 || tlv.length > BMPv4_TLV_LENGTH_VRF_TABLE_NAME_MAX_LENGTH0xFF) { |
| 652 | expert_add_info(pinfo, ti, &ei_bmpv4_tlv_string_bad_length); |
| 653 | } |
| 654 | break; |
| 655 | } |
| 656 | case BMPv4_TLV_TYPE_BGP_PATH_STATUS0x05: { |
| 657 | const bool_Bool has_reason = tlv.length > BMPv4_TLV_LENGTH_PATH_STATUS_STATUS_LENGTH0x04; |
| 658 | |
| 659 | proto_tree_add_bitmask(tlv_tree, tvb, offset, hf_bmpv4_tlv_path_status_status, ett_bmpv4_tlv_path_status, hf_bmpv4_tlv_path_status, ENC_BIG_ENDIAN0x00000000); |
| 660 | offset += BMPv4_TLV_LENGTH_PATH_STATUS_STATUS_LENGTH0x04; |
| 661 | |
| 662 | if (!has_reason) |
| 663 | break; |
| 664 | |
| 665 | proto_tree_add_item(tlv_tree, hf_bmpv4_tlv_path_status_reason, tvb, offset, BMPv4_TLV_LENGTH_PATH_STATUS_REASON_LENGTH0x02, ENC_BIG_ENDIAN0x00000000); |
| 666 | offset += BMPv4_TLV_LENGTH_PATH_STATUS_REASON_LENGTH0x02; |
| 667 | break; |
| 668 | } |
| 669 | case BMPv4_TLV_TYPE_BGP_MSG0x04: { |
| 670 | |
| 671 | proto_item *ti = proto_tree_add_item(tlv_tree, hf_bmpv4_tlv_value_bytes, tvb, offset, tlv.length, ENC_NA0x00000000); |
| 672 | proto_tree *subtree = proto_item_add_subtree(ti, ett_bmpv4_tlv_value); |
| 673 | |
| 674 | const int consumed = call_dissector(dissector_bgp, tvb_new_subset_length(tvb, offset, tlv.length), pinfo, subtree); |
| 675 | offset += consumed; |
| 676 | |
| 677 | break; |
| 678 | } |
| 679 | default: |
| 680 | // Unknown TLV |
| 681 | proto_tree_add_item(tlv_tree, hf_bmpv4_tlv_value_bytes, tvb, offset, tlv.length, ENC_NA0x00000000); |
| 682 | expert_add_info(pinfo, tlv_tree, &ei_bmpv4_tlv_unknown_tlv); |
| 683 | offset += tlv.length; |
| 684 | break; |
| 685 | } |
| 686 | |
| 687 | if (offset != base_offset + tlv.length) { |
| 688 | expert_add_info(pinfo, tlv_tree, &ei_bmpv4_tlv_not_fully_parsed); |
| 689 | } |
| 690 | |
| 691 | offset = base_offset + tlv.length; |
| 692 | } |
| 693 | } |
| 694 | |
| 695 | /* |
| 696 | * Dissect BMP Peer Down Notification |
| 697 | * |
| 698 | * 0 1 2 3 4 5 6 7 8 |
| 699 | * +-+-+-+-+-+-+-+-+ |
| 700 | * | Reason | 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 |
| 701 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 702 | * | Data (present if Reason = 1, 2 or 3) | |
| 703 | * ~ ~ |
| 704 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 705 | * |
| 706 | */ |
| 707 | static void |
| 708 | dissect_bmp_peer_down_notification(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset, int8_t flags _U___attribute__((unused)), bool_Bool is_v4) |
| 709 | { |
| 710 | uint8_t down_reason; |
| 711 | |
| 712 | proto_tree_add_item_ret_uint8(tree, hf_peer_down_reason, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000, &down_reason); |
| 713 | offset += 1; |
| 714 | |
| 715 | /* bmp version 3 */ |
| 716 | switch (down_reason) { |
| 717 | case BMP_PEER_DOWN_LOCAL_NO_NOTIFY0x2: { |
| 718 | /* FSM event code */ |
| 719 | proto_tree_add_item(tree, hf_peer_down_data, tvb, offset, 2, ENC_NA0x00000000); |
| 720 | offset += 2; |
| 721 | break; |
| 722 | } |
| 723 | case BMP_PEER_DOWN_LOCAL_NOTIFY0x1: |
| 724 | case BMP_PEER_DOWN_REMOTE_NOTIFY0x3: { |
| 725 | col_clear(pinfo->cinfo, COL_INFO); |
| 726 | offset += call_dissector(dissector_bgp, tvb_new_subset_remaining(tvb, offset), pinfo, tree); |
| 727 | break; |
| 728 | } |
| 729 | case BMP_PEER_DOWN_LOCAL_SYSTEM_CLOSED0x6: { |
| 730 | uint32_t type, length; |
| 731 | proto_item *tlv_item; |
| 732 | proto_tree *tlv_tree; |
| 733 | tlv_item = proto_tree_add_item(tree, hf_peer_state_tlv, tvb, offset, 2 + 2, ENC_NA0x00000000); |
| 734 | tlv_tree = proto_item_add_subtree(tlv_item, ett_bmp_peer_state_tlv); |
| 735 | |
| 736 | type = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN0x00000000); |
| 737 | |
| 738 | /* unknown tlv type, and we support other types with version 4 so let v4 dissect it */ |
| 739 | if (try_val_to_str(type, peer_down_tlv_typevals) == NULL((void*)0) && is_v4) { |
| 740 | break; |
| 741 | } |
| 742 | |
| 743 | proto_tree_add_item(tlv_tree, hf_peer_state_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
| 744 | offset += 2; |
| 745 | |
| 746 | proto_tree_add_item_ret_uint(tlv_tree, hf_peer_state_tlv_length, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &length); |
| 747 | offset += 2; |
| 748 | |
| 749 | proto_item_append_text(tlv_item, ": (t=%d,l=%d) %s", type, length, val_to_str(pinfo->pool, type, peer_down_tlv_typevals, "Unknown TLV Type (%02d)") ); |
| 750 | proto_item_set_len(tlv_item, 2 + 2 + length); |
| 751 | |
| 752 | proto_tree_add_item(tlv_tree, hf_peer_state_tlv_value, tvb, offset, length, ENC_NA0x00000000); |
| 753 | proto_tree_add_item(tlv_tree, hf_peer_state_tlv_vrf_table_name, tvb, offset, length, ENC_ASCII0x00000000); |
| 754 | offset += length; |
| 755 | break; |
| 756 | } |
| 757 | default: |
| 758 | break; |
| 759 | } |
| 760 | |
| 761 | /* bmp version 4 */ |
| 762 | if (is_v4) { |
| 763 | bmpv4_dissect_tlvs(tree, tvb, offset, pinfo, BMP_MSG_TYPE_PEER_DOWN0x02); |
| 764 | return; |
| 765 | } |
| 766 | } |
| 767 | |
| 768 | /* |
| 769 | * Dissect BMP Peer Up Notification |
| 770 | * |
| 771 | * 0 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 |
| 772 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 773 | * | Local Address (16 bytes) | |
| 774 | * ~ ~ |
| 775 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 776 | * | Local Port | Remote Port | |
| 777 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 778 | * | Sent OPEN Message | |
| 779 | * ~ ~ |
| 780 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 781 | * | Received OPEN Message | |
| 782 | * ~ ~ |
| 783 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 784 | * | Information (variable) | |
| 785 | * ~ ~ |
| 786 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 787 | * |
| 788 | */ |
| 789 | static void |
| 790 | dissect_bmp_peer_up_notification(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset, int8_t flags) |
| 791 | { |
| 792 | if (flags & BMP_PEER_FLAG_IPV60x80) { |
| 793 | proto_tree_add_item(tree, hf_peer_up_ipv6_address, tvb, offset, 16, ENC_NA0x00000000); |
| 794 | offset += 16; |
| 795 | } else { |
| 796 | proto_tree_add_item(tree, hf_bmp_unused, tvb, offset, 12, ENC_NA0x00000000); |
| 797 | offset += 12; |
| 798 | proto_tree_add_item(tree, hf_peer_up_ipv4_address, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 799 | offset += 4; |
| 800 | } |
| 801 | |
| 802 | proto_tree_add_item(tree, hf_peer_up_local_port, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
| 803 | offset += 2; |
| 804 | |
| 805 | proto_tree_add_item(tree, hf_peer_up_remote_port, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
| 806 | offset += 2; |
| 807 | |
| 808 | col_clear(pinfo->cinfo, COL_INFO); |
| 809 | offset += call_dissector(dissector_bgp, tvb_new_subset_remaining(tvb, offset), pinfo, tree); |
| 810 | offset += call_dissector(dissector_bgp, tvb_new_subset_remaining(tvb, offset), pinfo, tree); |
| 811 | |
| 812 | while (tvb_reported_length_remaining(tvb, offset) > 0) { |
| 813 | uint32_t type, length; |
| 814 | proto_item *tlv_item; |
| 815 | proto_tree *tlv_tree; |
| 816 | tlv_item = proto_tree_add_item(tree, hf_peer_state_tlv, tvb, offset, 2 + 2, ENC_NA0x00000000); |
| 817 | tlv_tree = proto_item_add_subtree(tlv_item, ett_bmp_peer_state_tlv); |
| 818 | |
| 819 | proto_tree_add_item_ret_uint(tlv_tree, hf_peer_state_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &type); |
| 820 | offset += 2; |
| 821 | |
| 822 | proto_tree_add_item_ret_uint(tlv_tree, hf_peer_state_tlv_length, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &length); |
| 823 | offset += 2; |
| 824 | |
| 825 | proto_item_append_text(tlv_item, ": (t=%d,l=%d) %s", type, length, val_to_str(pinfo->pool, type, peer_up_tlv_typevals, "Unknown TLV Type (%02d)") ); |
| 826 | proto_item_set_len(tlv_item, 2 + 2 + length); |
| 827 | |
| 828 | proto_tree_add_item(tlv_tree, hf_peer_state_tlv_value, tvb, offset, length, ENC_NA0x00000000); |
| 829 | switch(type){ |
| 830 | case BMP_PEER_UP_TLV_STRING0x00: { |
| 831 | proto_tree_add_item(tlv_tree, hf_peer_up_tlv_string, tvb, offset, length, ENC_ASCII0x00000000); |
| 832 | offset += length; |
| 833 | } |
| 834 | break; |
| 835 | case BMP_PEER_UP_TLV_SYS_DESCR0x01: { |
| 836 | proto_tree_add_item(tlv_tree, hf_peer_up_tlv_sys_descr, tvb, offset, length, ENC_ASCII0x00000000); |
| 837 | offset += length; |
| 838 | } |
| 839 | break; |
| 840 | case BMP_PEER_UP_TLV_SYS_NAME0x02: { |
| 841 | proto_tree_add_item(tlv_tree, hf_peer_up_tlv_sys_name, tvb, offset, length, ENC_ASCII0x00000000); |
| 842 | offset += length; |
| 843 | } |
| 844 | break; |
| 845 | case BMP_PEER_STATE_TLV_VRF_TABLE_NAME0x03: { |
| 846 | proto_tree_add_item(tlv_tree, hf_peer_state_tlv_vrf_table_name, tvb, offset, length, ENC_ASCII0x00000000); |
| 847 | offset += length; |
| 848 | } |
| 849 | break; |
| 850 | case BMP_PEER_UP_TLV_ADMIN_LABEL0x04: { |
| 851 | proto_tree_add_item(tlv_tree, hf_peer_up_tlv_admin_label, tvb, offset, length, ENC_ASCII0x00000000); |
| 852 | offset += length; |
| 853 | } |
| 854 | break; |
| 855 | default:{ |
| 856 | //TODO: Add expert info about undecoded type ? |
| 857 | offset += length; |
| 858 | } |
| 859 | |
| 860 | } |
| 861 | |
| 862 | } |
| 863 | |
| 864 | |
| 865 | } |
| 866 | |
| 867 | /* |
| 868 | * Dissect BMP Stats Report |
| 869 | * |
| 870 | * 0 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 |
| 871 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 872 | * | Stats Count | |
| 873 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 874 | * |
| 875 | * |
| 876 | * 0 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 |
| 877 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 878 | * | Stat Type | Stat Len | |
| 879 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 880 | * | Stat Data | |
| 881 | * ~ ~ |
| 882 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 883 | * |
| 884 | */ |
| 885 | static void |
| 886 | dissect_bmp_stat_report(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset, int8_t flags _U___attribute__((unused))) |
| 887 | { |
| 888 | uint32_t stat_len, stat_type; |
| 889 | uint32_t i; |
| 890 | int data_start; |
| 891 | |
| 892 | uint32_t stats_count = tvb_get_ntohl(tvb, offset); |
| 893 | |
| 894 | proto_tree_add_item(tree, hf_stats_count, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 895 | offset += 4; |
| 896 | |
| 897 | for (i = 0; i < stats_count; i++) { |
| 898 | proto_item *ti; |
| 899 | proto_item *subtree; |
| 900 | |
| 901 | ti = proto_tree_add_item_ret_uint(tree, hf_stat_type, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &stat_type); |
| 902 | subtree = proto_item_add_subtree(ti, ett_bmp_stat_type); |
| 903 | offset += 2; |
| 904 | |
| 905 | proto_tree_add_item_ret_uint(subtree, hf_stat_len, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &stat_len); |
| 906 | offset += 2; |
| 907 | data_start = offset; |
| 908 | |
| 909 | proto_tree_add_item(subtree, hf_stat_data, tvb, offset, stat_len, ENC_NA0x00000000); |
| 910 | switch(stat_type){ |
| 911 | case BMP_STAT_PREFIX_REJ0x00: |
| 912 | proto_tree_add_item(subtree, hf_stat_data_prefix_rej, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 913 | offset += 4; |
| 914 | break; |
| 915 | case BMP_STAT_PREFIX_DUP0x01: |
| 916 | proto_tree_add_item(subtree, hf_stat_data_prefix_dup, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 917 | offset += 4; |
| 918 | break; |
| 919 | case BMP_STAT_WITHDRAW_DUP0x02: |
| 920 | proto_tree_add_item(subtree, hf_stat_data_withdraw_dup, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 921 | offset += 4; |
| 922 | break; |
| 923 | case BMP_STAT_CLUSTER_LOOP0x03: |
| 924 | proto_tree_add_item(subtree, hf_stat_data_cluster_loop, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 925 | offset += 4; |
| 926 | break; |
| 927 | case BMP_STAT_AS_LOOP0x04: |
| 928 | proto_tree_add_item(subtree, hf_stat_data_as_loop, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 929 | offset += 4; |
| 930 | break; |
| 931 | case BMP_STAT_INV_ORIGINATOR0x05: |
| 932 | proto_tree_add_item(subtree, hf_stat_data_inv_originator, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 933 | offset += 4; |
| 934 | break; |
| 935 | case BMP_STAT_AS_CONFED_LOOP0x06: |
| 936 | proto_tree_add_item(subtree, hf_stat_data_as_confed_loop, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 937 | offset += 4; |
| 938 | break; |
| 939 | case BMP_STAT_ROUTES_ADJ_RIB_IN0x07: |
| 940 | proto_tree_add_item(subtree, hf_stat_data_routes_adj_rib_in, tvb, offset, 8, ENC_BIG_ENDIAN0x00000000); |
| 941 | offset += 8; |
Value stored to 'offset' is never read | |
| 942 | break; |
| 943 | case BMP_STAT_ROUTES_LOC_RIB0x08: |
| 944 | proto_tree_add_item(subtree, hf_stat_data_routes_loc_rib, tvb, offset, 8, ENC_BIG_ENDIAN0x00000000); |
| 945 | offset += 8; |
| 946 | break; |
| 947 | case BMP_STAT_ROUTES_PER_ADJ_RIB_IN0x09: |
| 948 | proto_tree_add_item(subtree, hf_stat_data_routes_per_adj_rib_in_afi, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
| 949 | offset += 2; |
| 950 | proto_tree_add_item(subtree, hf_stat_data_routes_per_adj_rib_in_safi, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000); |
| 951 | offset += 1; |
| 952 | proto_tree_add_item(subtree, hf_stat_data_routes_per_adj_rib_in, tvb, offset, 8, ENC_BIG_ENDIAN0x00000000); |
| 953 | offset += 8; |
| 954 | break; |
| 955 | case BMP_STAT_ROUTES_PER_LOC_RIB0x0A: |
| 956 | proto_tree_add_item(subtree, hf_stat_data_routes_per_loc_rib_afi, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
| 957 | offset += 2; |
| 958 | proto_tree_add_item(subtree, hf_stat_data_routes_per_loc_rib_safi, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000); |
| 959 | offset += 1; |
| 960 | proto_tree_add_item(subtree, hf_stat_data_routes_per_loc_rib, tvb, offset, 8, ENC_BIG_ENDIAN0x00000000); |
| 961 | offset += 8; |
| 962 | break; |
| 963 | case BMP_STAT_UPDATE_TREAT0x0B: |
| 964 | proto_tree_add_item(subtree, hf_stat_data_update_treat, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 965 | offset += 4; |
| 966 | break; |
| 967 | case BMP_STAT_PREFIXES_TREAT0x0C: |
| 968 | proto_tree_add_item(subtree, hf_stat_data_prefixes_treat, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 969 | offset += 4; |
| 970 | break; |
| 971 | case BMP_STAT_DUPLICATE_UPDATE0x0D: |
| 972 | proto_tree_add_item(subtree, hf_stat_data_duplicate_update, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 973 | offset += 4; |
| 974 | break; |
| 975 | case BMP_STAT_ROUTES_PRE_ADJ_RIB_OUT0x0E: |
| 976 | proto_tree_add_item(subtree, hf_stat_data_routes_pre_adj_rib_out, tvb, offset, 8, ENC_BIG_ENDIAN0x00000000); |
| 977 | offset += 8; |
| 978 | break; |
| 979 | case BMP_STAT_ROUTES_POST_ADJ_RIB_OUT0x0F: |
| 980 | proto_tree_add_item(subtree, hf_stat_data_routes_post_adj_rib_out, tvb, offset, 8, ENC_BIG_ENDIAN0x00000000); |
| 981 | offset += 8; |
| 982 | break; |
| 983 | case BMP_STAT_ROUTES_PRE_PER_ADJ_RIB_OUT0x10: |
| 984 | proto_tree_add_item(subtree, hf_stat_data_routes_pre_per_adj_rib_out_afi, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
| 985 | offset += 2; |
| 986 | proto_tree_add_item(subtree, hf_stat_data_routes_pre_per_adj_rib_out_safi, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000); |
| 987 | offset += 1; |
| 988 | proto_tree_add_item(subtree, hf_stat_data_routes_pre_per_adj_rib_out, tvb, offset, 8, ENC_BIG_ENDIAN0x00000000); |
| 989 | offset += 8; |
| 990 | break; |
| 991 | case BMP_STAT_ROUTES_POST_PER_ADJ_RIB_OUT0x11: |
| 992 | proto_tree_add_item(subtree, hf_stat_data_routes_post_per_adj_rib_out_afi, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
| 993 | offset += 2; |
| 994 | proto_tree_add_item(subtree, hf_stat_data_routes_post_per_adj_rib_out_safi, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000); |
| 995 | offset += 1; |
| 996 | proto_tree_add_item(subtree, hf_stat_data_routes_post_per_adj_rib_out, tvb, offset, 8, ENC_BIG_ENDIAN0x00000000); |
| 997 | offset += 8; |
| 998 | break; |
| 999 | default: |
| 1000 | expert_add_info(pinfo, ti, &ei_stat_data_unknown); |
| 1001 | break; |
| 1002 | } |
| 1003 | /* The length of a known type can differ from what is decoded */ |
| 1004 | offset = data_start + stat_len; |
| 1005 | } |
| 1006 | } |
| 1007 | |
| 1008 | /* |
| 1009 | * Dissect BMP Termination Message |
| 1010 | * |
| 1011 | * 0 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 |
| 1012 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1013 | * | Information Type | Information Length | |
| 1014 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1015 | * | Information (variable) | |
| 1016 | * ~ ~ |
| 1017 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1018 | * |
| 1019 | */ |
| 1020 | static void |
| 1021 | dissect_bmp_termination(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U___attribute__((unused)), int offset, uint8_t bmp_type _U___attribute__((unused)), uint16_t len) |
| 1022 | { |
| 1023 | uint16_t term_type; |
| 1024 | uint16_t term_len; |
| 1025 | |
| 1026 | proto_item *ti; |
| 1027 | proto_item *subtree; |
| 1028 | |
| 1029 | ti = proto_tree_add_item(tree, hf_term_types, tvb, offset, len, ENC_NA0x00000000); |
| 1030 | subtree = proto_item_add_subtree(ti, ett_bmp_term_types); |
| 1031 | |
| 1032 | term_type = tvb_get_ntohs(tvb, offset); |
| 1033 | proto_item_append_text(subtree, ", Type %s", |
| 1034 | val_to_str(pinfo->pool, term_type, term_typevals, "Unknown (0x%02x)")); |
| 1035 | |
| 1036 | proto_tree_add_item(subtree, hf_term_type, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
| 1037 | offset += 2; |
| 1038 | |
| 1039 | proto_tree_add_item_ret_uint16(subtree, hf_term_len, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &term_len); |
| 1040 | offset += 2; |
| 1041 | |
| 1042 | if (term_type == BMP_TERM_TYPE_STRING0x00) { |
| 1043 | proto_tree_add_item(subtree, hf_term_info, tvb, offset, term_len, ENC_ASCII0x00000000); |
| 1044 | } else { |
| 1045 | proto_tree_add_item(subtree, hf_term_reason, tvb, offset, term_len, ENC_BIG_ENDIAN0x00000000); |
| 1046 | } |
| 1047 | /*offset += term_len;*/ |
| 1048 | } |
| 1049 | |
| 1050 | /* |
| 1051 | * Dissect BMP Per-Peer Header |
| 1052 | * |
| 1053 | * 0 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 |
| 1054 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1055 | * | Peer Type | Peer Flags | |
| 1056 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1057 | * | Peer Distinguisher (present based on peer type) | |
| 1058 | * | | |
| 1059 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1060 | * | Peer Address (16 bytes) | |
| 1061 | * ~ ~ |
| 1062 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1063 | * | Peer AS | |
| 1064 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1065 | * | Peer BGP ID | |
| 1066 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1067 | * | Timestamp (seconds) | |
| 1068 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1069 | * | Timestamp (microseconds) | |
| 1070 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1071 | * |
| 1072 | */ |
| 1073 | static void |
| 1074 | dissect_bmp_peer_header(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset, uint8_t bmp_msg_type, uint16_t len, uint8_t bmp_version) |
| 1075 | { |
| 1076 | uint8_t flags; |
| 1077 | uint32_t type; |
| 1078 | proto_item *item; |
| 1079 | proto_item *ti; |
| 1080 | proto_item *peer_hdr_subtree; |
| 1081 | |
| 1082 | static int * const peer_flags[] = { |
| 1083 | &hf_peer_flags_ipv6, |
| 1084 | &hf_peer_flags_post_policy, |
| 1085 | &hf_peer_flags_as_path, |
| 1086 | &hf_peer_flags_adj_rib_out, |
| 1087 | &hf_peer_flags_res, |
| 1088 | NULL((void*)0) |
| 1089 | }; |
| 1090 | static int * const peer_flags_loc_rib[] = { |
| 1091 | &hf_peer_flags_loc_rib, |
| 1092 | &hf_peer_flags_loc_rib_res, |
| 1093 | NULL((void*)0) |
| 1094 | }; |
| 1095 | |
| 1096 | ti = proto_tree_add_item(tree, hf_peer_header, tvb, offset, len, ENC_NA0x00000000); |
| 1097 | peer_hdr_subtree = proto_item_add_subtree(ti, ett_bmp_peer_header); |
| 1098 | |
| 1099 | proto_tree_add_item_ret_uint(peer_hdr_subtree, hf_peer_type, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000, &type); |
| 1100 | offset += 1; |
| 1101 | |
| 1102 | flags = tvb_get_uint8(tvb, offset); |
| 1103 | |
| 1104 | if (type == BMP_PEER_LOC_RIB_INSTANCE0x03) { |
| 1105 | proto_tree_add_bitmask(peer_hdr_subtree, tvb, offset, hf_peer_flags, ett_bmp_peer_flags, peer_flags_loc_rib, ENC_NA0x00000000); |
| 1106 | } else { |
| 1107 | proto_tree_add_bitmask(peer_hdr_subtree, tvb, offset, hf_peer_flags, ett_bmp_peer_flags, peer_flags, ENC_NA0x00000000); |
| 1108 | } |
| 1109 | offset += 1; |
| 1110 | |
| 1111 | item = proto_tree_add_item(peer_hdr_subtree, hf_peer_distinguisher, tvb, offset, 8, ENC_NA0x00000000); |
| 1112 | proto_item_set_text(item, "Peer Distinguisher: %s", decode_bgp_rd(pinfo->pool, tvb, offset)); |
| 1113 | offset += 8; |
| 1114 | |
| 1115 | if (flags & BMP_PEER_FLAG_IPV60x80) { |
| 1116 | proto_tree_add_item(peer_hdr_subtree, hf_peer_ipv6_address, tvb, offset, 16, ENC_NA0x00000000); |
| 1117 | offset += 16; |
| 1118 | } else { |
| 1119 | proto_tree_add_item(peer_hdr_subtree, hf_bmp_unused, tvb, offset, 12, ENC_NA0x00000000); |
| 1120 | offset += 12; |
| 1121 | proto_tree_add_item(peer_hdr_subtree, hf_peer_ipv4_address, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 1122 | offset += 4; |
| 1123 | } |
| 1124 | |
| 1125 | proto_tree_add_item(peer_hdr_subtree, hf_peer_asn, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 1126 | offset += 4; |
| 1127 | |
| 1128 | proto_tree_add_item(peer_hdr_subtree, hf_peer_bgp_id, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 1129 | offset += 4; |
| 1130 | |
| 1131 | proto_tree_add_item(peer_hdr_subtree, hf_peer_timestamp_sec, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 1132 | offset += 4; |
| 1133 | |
| 1134 | proto_tree_add_item(peer_hdr_subtree, hf_peer_timestamp_msec, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 1135 | offset += 4; |
| 1136 | |
| 1137 | bool_Bool is_v4 = bmp_version == 4; |
| 1138 | |
| 1139 | switch (bmp_msg_type) { |
| 1140 | case BMP_MSG_TYPE_ROUTE_MONITORING0x00: { |
| 1141 | if (is_v4) { |
| 1142 | bmpv4_dissect_tlvs(tree, tvb, offset, pinfo, bmp_msg_type); |
| 1143 | } else { |
| 1144 | col_clear(pinfo->cinfo, COL_INFO); |
| 1145 | call_dissector(dissector_bgp, tvb_new_subset_remaining(tvb, offset), pinfo, tree); |
| 1146 | } |
| 1147 | break; |
| 1148 | } |
| 1149 | case BMP_MSG_TYPE_ROUTE_MIRRORING0x06: { |
| 1150 | while (tvb_reported_length_remaining(tvb, offset) > 0) { |
| 1151 | uint32_t route_mirroring_type, length; |
| 1152 | proto_tree_add_item_ret_uint(tree, hf_peer_route_mirroring_type, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &route_mirroring_type); |
| 1153 | offset += 2; |
| 1154 | proto_tree_add_item_ret_uint(tree, hf_peer_route_mirroring_length, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &length); |
| 1155 | offset += 2; |
| 1156 | switch (route_mirroring_type) { |
| 1157 | case BMP_ROUTE_MIRRORING_TLV_BGP_MESSAGE0x00: /* BGP Message */ |
| 1158 | col_clear(pinfo->cinfo, COL_INFO); |
| 1159 | call_dissector(dissector_bgp, tvb_new_subset_length(tvb, offset, length), pinfo, tree); |
| 1160 | break; |
| 1161 | case BMP_ROUTE_MIRRORING_TLV_INFORMATION0x01: /* Information */ |
| 1162 | proto_tree_add_item(tree, hf_peer_route_mirroring_code, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
| 1163 | break; |
| 1164 | } |
| 1165 | offset += length; |
| 1166 | } |
| 1167 | break; |
| 1168 | |
| 1169 | } |
| 1170 | case BMP_MSG_TYPE_STAT_REPORT0x01: |
| 1171 | dissect_bmp_stat_report(tvb, tree, pinfo, offset, flags); |
| 1172 | break; |
| 1173 | case BMP_MSG_TYPE_PEER_DOWN0x02: { |
| 1174 | dissect_bmp_peer_down_notification(tvb, tree, pinfo, offset, flags, is_v4); |
| 1175 | break; |
| 1176 | } |
| 1177 | case BMP_MSG_TYPE_PEER_UP0x03: |
| 1178 | dissect_bmp_peer_up_notification(tvb, tree, pinfo, offset, flags); |
| 1179 | break; |
| 1180 | case BMP_MSG_TYPE_INIT0x04: |
| 1181 | case BMP_MSG_TYPE_TERM0x05: |
| 1182 | default: |
| 1183 | DISSECTOR_ASSERT_NOT_REACHED()(proto_report_dissector_bug("%s:%u: failed assertion \"DISSECTOR_ASSERT_NOT_REACHED\"" , "epan/dissectors/packet-bmp.c", 1183)); |
| 1184 | break; |
| 1185 | } |
| 1186 | } |
| 1187 | |
| 1188 | /* |
| 1189 | * Dissect BMP Initiation Message |
| 1190 | * |
| 1191 | * 0 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 |
| 1192 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1193 | * | Information Type | Information Length | |
| 1194 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1195 | * | Information (variable) | |
| 1196 | * ~ ~ |
| 1197 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1198 | * |
| 1199 | */ |
| 1200 | static void |
| 1201 | dissect_bmp_init(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U___attribute__((unused)), int offset, uint8_t bmp_type _U___attribute__((unused)), uint16_t len) |
| 1202 | { |
| 1203 | uint16_t init_type; |
| 1204 | uint16_t init_len; |
| 1205 | proto_tree *pti; |
| 1206 | proto_tree *parent_tree; |
| 1207 | |
| 1208 | pti = proto_tree_add_item(tree, hf_init_types, tvb, offset, len, ENC_NA0x00000000); |
| 1209 | parent_tree = proto_item_add_subtree(pti, ett_bmp_init_types); |
| 1210 | |
| 1211 | while (tvb_reported_length_remaining(tvb, offset) > 0) { |
| 1212 | proto_tree *ti; |
| 1213 | proto_tree *subtree; |
| 1214 | |
| 1215 | init_type = tvb_get_ntohs(tvb, offset); |
| 1216 | proto_item_append_text(pti, ", Type %s", |
| 1217 | val_to_str(pinfo->pool, init_type, init_typevals, "Unknown (0x%02x)")); |
| 1218 | |
| 1219 | ti = proto_tree_add_item(parent_tree, hf_init_type, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
| 1220 | subtree = proto_item_add_subtree(ti, ett_bmp_init_type); |
| 1221 | offset += 2; |
| 1222 | |
| 1223 | proto_tree_add_item_ret_uint16(subtree, hf_init_length, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &init_len); |
| 1224 | offset += 2; |
| 1225 | |
| 1226 | proto_tree_add_item(subtree, hf_init_info, tvb, offset, init_len, ENC_ASCII0x00000000); |
| 1227 | offset += init_len; |
| 1228 | } |
| 1229 | } |
| 1230 | |
| 1231 | /* |
| 1232 | +---------------------------------------------------------------+ |
| 1233 | | Single event length | |
| 1234 | +---------------------------------------------------------------+ |
| 1235 | | Event index | |
| 1236 | +---------------------------------------------------------------+ |
| 1237 | | Timestamp(seconds) | |
| 1238 | +---------------------------------------------------------------+ |
| 1239 | | Timestamp(microseconds) | |
| 1240 | +---------------------------------------------------------------+ |
| 1241 | | Path Identifier | |
| 1242 | +---------------------------------------------------------------+ |
| 1243 | | AFI | |
| 1244 | +---------------------------------------------------------------+ |
| 1245 | | SAFI | |
| 1246 | +---------------------------------------------------------------+ |
| 1247 | | VRF/Table TLV | |
| 1248 | +---------------------------------------------------------------+ |
| 1249 | | Policy TLV | |
| 1250 | +---------------------------------------------------------------+ |
| 1251 | | Pre Policy Attribute TLV | |
| 1252 | +---------------------------------------------------------------+ |
| 1253 | | Post Policy Attribute TLV | |
| 1254 | +---------------------------------------------------------------+ |
| 1255 | | String TLV | |
| 1256 | +---------------------------------------------------------------+ |
| 1257 | */ |
| 1258 | |
| 1259 | static int |
| 1260 | dissect_bmp_route_policy_event(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U___attribute__((unused)), int offset) |
| 1261 | { |
| 1262 | uint32_t single_event_length; |
| 1263 | |
| 1264 | proto_tree_add_item_ret_uint(tree, hf_route_policy_single_event_length, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &single_event_length); |
| 1265 | offset += 2; |
| 1266 | single_event_length -=2; |
| 1267 | |
| 1268 | proto_tree_add_item(tree, hf_route_policy_event_index, tvb, offset, 1, ENC_NA0x00000000); |
| 1269 | offset += 1; |
| 1270 | single_event_length -=1; |
| 1271 | |
| 1272 | proto_tree_add_item(tree, hf_route_policy_timestamp_sec, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 1273 | offset += 4; |
| 1274 | single_event_length -=4; |
| 1275 | |
| 1276 | proto_tree_add_item(tree, hf_route_policy_timestamp_msec, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 1277 | offset += 4; |
| 1278 | single_event_length -=4; |
| 1279 | |
| 1280 | proto_tree_add_item(tree, hf_route_policy_path_identifier, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 1281 | offset += 4; |
| 1282 | single_event_length -=4; |
| 1283 | |
| 1284 | proto_tree_add_item(tree, hf_route_policy_afi, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
| 1285 | offset += 2; |
| 1286 | single_event_length -=2; |
| 1287 | |
| 1288 | proto_tree_add_item(tree, hf_route_policy_safi, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000); |
| 1289 | offset += 1; |
| 1290 | single_event_length -=1; |
| 1291 | |
| 1292 | while (single_event_length > 0) { |
| 1293 | uint32_t type, length; |
| 1294 | proto_item *tlv_item; |
| 1295 | proto_tree *tlv_tree; |
| 1296 | tlv_item = proto_tree_add_item(tree, hf_route_policy_tlv, tvb, offset, 2+2, ENC_NA0x00000000); |
| 1297 | tlv_tree = proto_item_add_subtree(tlv_item, ett_bmp_route_policy_tlv); |
| 1298 | |
| 1299 | proto_tree_add_item_ret_uint(tlv_tree, hf_route_policy_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &type); |
| 1300 | offset += 2; |
| 1301 | single_event_length -= 2; |
| 1302 | |
| 1303 | proto_tree_add_item_ret_uint(tlv_tree, hf_route_policy_tlv_length, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &length); |
| 1304 | offset += 2; |
| 1305 | single_event_length -= 2; |
| 1306 | |
| 1307 | proto_item_append_text(tlv_item, ": (t=%d,l=%d) %s", type, length, val_to_str(pinfo->pool, type, route_policy_tlv_typevals, "Unknown TLV Type (%02d)") ); |
| 1308 | proto_item_set_len(tlv_item, 2 + 2 + length); |
| 1309 | |
| 1310 | proto_tree_add_item(tlv_tree, hf_route_policy_tlv_value, tvb, offset, length, ENC_NA0x00000000); |
| 1311 | switch(type){ |
| 1312 | case BMP_ROUTE_POLICY_TLV_VRF0x00: { |
| 1313 | proto_tree_add_item(tlv_tree, hf_route_policy_tlv_vrf_table_id, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 1314 | proto_tree_add_item(tlv_tree, hf_route_policy_tlv_vrf_table_name, tvb, offset+4, length-4, ENC_ASCII0x00000000); |
| 1315 | offset += length; |
| 1316 | single_event_length -=length; |
| 1317 | } |
| 1318 | break; |
| 1319 | case BMP_ROUTE_POLICY_TLV_POLICY0x01: { |
| 1320 | uint8_t flags; |
| 1321 | uint32_t policy_count; |
| 1322 | static int * const route_policy_tlv_policy_flags[] = { |
| 1323 | &hf_route_policy_tlv_policy_flags_m, |
| 1324 | &hf_route_policy_tlv_policy_flags_p, |
| 1325 | &hf_route_policy_tlv_policy_flags_d, |
| 1326 | &hf_route_policy_tlv_policy_flags_res, |
| 1327 | NULL((void*)0) |
| 1328 | }; |
| 1329 | static int * const route_policy_tlv_policy_flag[] = { |
| 1330 | &hf_route_policy_tlv_policy_flag_c, |
| 1331 | &hf_route_policy_tlv_policy_flag_r, |
| 1332 | &hf_route_policy_tlv_policy_flag_res2, |
| 1333 | NULL((void*)0) |
| 1334 | }; |
| 1335 | |
| 1336 | flags = tvb_get_uint8(tvb, offset); |
| 1337 | proto_tree_add_bitmask(tlv_tree, tvb, offset, hf_route_policy_tlv_policy_flags, ett_bmp_route_policy_tlv_policy_flags, route_policy_tlv_policy_flags, ENC_NA0x00000000); |
| 1338 | offset += 1; |
| 1339 | proto_tree_add_item_ret_uint(tlv_tree, hf_route_policy_tlv_policy_count, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000, &policy_count); |
| 1340 | offset += 1; |
| 1341 | |
| 1342 | proto_tree_add_item(tlv_tree, hf_route_policy_tlv_policy_class, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000); |
| 1343 | offset += 1; |
| 1344 | |
| 1345 | if(flags & BMP_PEER_FLAG_IPV60x80){ |
| 1346 | proto_tree_add_item(tlv_tree, hf_route_policy_tlv_policy_peer_ipv6, tvb, offset, 16, ENC_NA0x00000000); |
| 1347 | offset += 16; |
| 1348 | } else { |
| 1349 | proto_tree_add_item(tlv_tree, hf_route_policy_tlv_policy_peer_reserved, tvb, offset, 12, ENC_NA0x00000000); |
| 1350 | offset += 12; |
| 1351 | proto_tree_add_item(tlv_tree, hf_route_policy_tlv_policy_peer_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 1352 | offset += 4; |
| 1353 | } |
| 1354 | |
| 1355 | proto_tree_add_item(tlv_tree, hf_route_policy_tlv_policy_peer_router_id, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 1356 | offset += 4; |
| 1357 | |
| 1358 | proto_tree_add_item(tlv_tree, hf_route_policy_tlv_policy_peer_as, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 1359 | offset += 4; |
| 1360 | |
| 1361 | while(policy_count){ |
| 1362 | proto_item *policy_item; |
| 1363 | proto_tree *policy_tree; |
| 1364 | const uint8_t *policy_name, *policy_id; |
| 1365 | uint32_t policy_name_length, policy_item_id_length; |
| 1366 | |
| 1367 | policy_item = proto_tree_add_item(tlv_tree, hf_route_policy_tlv_policy, tvb, offset, 2+2, ENC_NA0x00000000); |
| 1368 | policy_tree = proto_item_add_subtree(policy_item, ett_bmp_route_policy_tlv_policy); |
| 1369 | |
| 1370 | |
| 1371 | proto_tree_add_item_ret_uint(policy_tree, hf_route_policy_tlv_policy_name_length, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &policy_name_length); |
| 1372 | offset += 2; |
| 1373 | |
| 1374 | proto_tree_add_item_ret_uint(policy_tree, hf_route_policy_tlv_policy_item_id_length, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &policy_item_id_length); |
| 1375 | offset += 2; |
| 1376 | |
| 1377 | proto_item_append_text(policy_tree, ": (t=%d,l=%d)", policy_name_length, policy_item_id_length); |
| 1378 | proto_item_set_len(policy_tree, 2 + 2 + policy_name_length + policy_item_id_length ); |
| 1379 | |
| 1380 | proto_tree_add_item_ret_string(policy_tree, hf_route_policy_tlv_policy_name, tvb, offset, policy_name_length, ENC_ASCII0x00000000|ENC_NA0x00000000, pinfo->pool, &policy_name); |
| 1381 | proto_item_append_text(policy_tree, " name: %s", policy_name); |
| 1382 | offset += policy_name_length; |
| 1383 | |
| 1384 | proto_tree_add_item_ret_string(policy_tree, hf_route_policy_tlv_policy_item_id, tvb, offset, policy_item_id_length, ENC_ASCII0x00000000|ENC_NA0x00000000, pinfo->pool, &policy_id); |
| 1385 | proto_item_append_text(policy_tree, " id: %s", policy_id); |
| 1386 | offset += policy_item_id_length; |
| 1387 | |
| 1388 | proto_tree_add_bitmask(policy_tree, tvb, offset, hf_route_policy_tlv_policy_flag, ett_bmp_route_policy_tlv_policy_flags, route_policy_tlv_policy_flag, ENC_NA0x00000000); |
| 1389 | offset += 1; |
| 1390 | |
| 1391 | policy_count--; |
| 1392 | } |
| 1393 | single_event_length -= length; |
| 1394 | } |
| 1395 | break; |
| 1396 | case BMP_ROUTE_POLICY_TLV_PRE_POLICY0x02: { |
| 1397 | dissect_bgp_path_attr(tlv_tree, tvb, length, offset, pinfo); |
| 1398 | offset += length; |
| 1399 | single_event_length -= length; |
| 1400 | } |
| 1401 | break; |
| 1402 | case BMP_ROUTE_POLICY_TLV_POST_POLICY0x03: { |
| 1403 | dissect_bgp_path_attr(tlv_tree, tvb, length, offset, pinfo); |
| 1404 | offset += length; |
| 1405 | single_event_length -= length; |
| 1406 | } |
| 1407 | break; |
| 1408 | case BMP_ROUTE_POLICY_TLV_STRING0x04: { |
| 1409 | proto_tree_add_item(tlv_tree, hf_route_policy_tlv_string, tvb, offset, length, ENC_ASCII0x00000000); |
| 1410 | offset += length; |
| 1411 | single_event_length -= length; |
| 1412 | } |
| 1413 | break; |
| 1414 | default:{ |
| 1415 | //TODO: Add expert info about undecoded type ? |
| 1416 | offset += length; |
| 1417 | single_event_length -=length; |
| 1418 | } |
| 1419 | |
| 1420 | } |
| 1421 | |
| 1422 | } |
| 1423 | |
| 1424 | return offset; |
| 1425 | } |
| 1426 | |
| 1427 | |
| 1428 | /* |
| 1429 | * Dissect BMP Route Policy and Attribute Message |
| 1430 | * |
| 1431 | * +---------------------------------------------------------------+ |
| 1432 | * |V| Reserved | |
| 1433 | * +---------------------------------------------------------------+ |
| 1434 | * | Route Distinguisher | |
| 1435 | * +---------------------------------------------------------------+ |
| 1436 | * | Prefix length | |
| 1437 | * +---------------------------------------------------------------+ |
| 1438 | * | Prefix | |
| 1439 | * +---------------------------------------------------------------+ |
| 1440 | * | Route Origin | |
| 1441 | * +---------------------------------------------------------------+ |
| 1442 | * | Event count | |
| 1443 | * +---------------------------------------------------------------+ |
| 1444 | * | Total event length | |
| 1445 | * +---------------------------------------------------------------+ |
| 1446 | * | 1st Event | |
| 1447 | * +---------------------------------------------------------------+ |
| 1448 | * | 2nd Event | |
| 1449 | * +---------------------------------------------------------------+ |
| 1450 | * ~ ~ |
| 1451 | * + ...... + |
| 1452 | * ~ ~ |
| 1453 | * +---------------------------------------------------------------+ |
| 1454 | * | Last Event | |
| 1455 | * +---------------------------------------------------------------+ |
| 1456 | * |
| 1457 | */ |
| 1458 | static void |
| 1459 | dissect_bmp_route_policy(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset, uint8_t bmp_type _U___attribute__((unused)), uint16_t len _U___attribute__((unused))) |
| 1460 | { |
| 1461 | uint8_t flags; |
| 1462 | uint32_t event_count; |
| 1463 | |
| 1464 | static int * const route_policy_flags[] = { |
| 1465 | &hf_route_policy_flags_ipv6, |
| 1466 | &hf_route_policy_flags_res, |
| 1467 | NULL((void*)0) |
| 1468 | }; |
| 1469 | |
| 1470 | flags = tvb_get_uint8(tvb, offset); |
| 1471 | |
| 1472 | proto_tree_add_bitmask(tree, tvb, offset, hf_route_policy_flags, ett_bmp_route_policy_flags, route_policy_flags, ENC_NA0x00000000); |
| 1473 | offset += 1; |
| 1474 | |
| 1475 | proto_tree_add_item(tree, hf_route_policy_rd, tvb, offset, 8, ENC_BIG_ENDIAN0x00000000); |
| 1476 | offset += 8; |
| 1477 | |
| 1478 | proto_tree_add_item(tree, hf_route_policy_prefix_length, tvb, offset, 1, ENC_NA0x00000000); |
| 1479 | offset += 1; |
| 1480 | |
| 1481 | if(flags & BMP_PEER_FLAG_IPV60x80){ |
| 1482 | proto_tree_add_item(tree, hf_route_policy_prefix_ipv6, tvb, offset, 16, ENC_NA0x00000000); |
| 1483 | offset += 16; |
| 1484 | } else { |
| 1485 | proto_tree_add_item(tree, hf_route_policy_prefix_reserved, tvb, offset, 12, ENC_NA0x00000000); |
| 1486 | offset += 12; |
| 1487 | proto_tree_add_item(tree, hf_route_policy_prefix_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 1488 | offset += 4; |
| 1489 | } |
| 1490 | |
| 1491 | proto_tree_add_item(tree, hf_route_policy_route_origin, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 1492 | offset += 4; |
| 1493 | |
| 1494 | proto_tree_add_item_ret_uint(tree, hf_route_policy_event_count, tvb, offset, 1, ENC_NA0x00000000, &event_count); |
| 1495 | offset += 1; |
| 1496 | |
| 1497 | proto_tree_add_item(tree, hf_route_policy_total_event_length, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
| 1498 | offset += 2; |
| 1499 | |
| 1500 | while(event_count){ |
| 1501 | offset = dissect_bmp_route_policy_event(tvb, tree, pinfo, offset); |
| 1502 | event_count--; |
| 1503 | } |
| 1504 | } |
| 1505 | |
| 1506 | /* |
| 1507 | * Dissect BMP PDU and Common Header |
| 1508 | * |
| 1509 | * 0 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 |
| 1510 | * +-+-+-+-+-+-+-+-+ |
| 1511 | * | Version | |
| 1512 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1513 | * | Message Length | |
| 1514 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1515 | * | Msg. Type | |
| 1516 | * +---------------+ |
| 1517 | * |
| 1518 | */ |
| 1519 | static unsigned |
| 1520 | get_bmp_pdu_len(packet_info *pinfo _U___attribute__((unused)), tvbuff_t *tvb, int offset, void *data _U___attribute__((unused))) |
| 1521 | { |
| 1522 | return tvb_get_ntohl(tvb, offset + 1); |
| 1523 | } |
| 1524 | |
| 1525 | static int |
| 1526 | dissect_bmp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U___attribute__((unused))) |
| 1527 | { |
| 1528 | int offset = 0; |
| 1529 | uint8_t bmp_type; |
| 1530 | uint16_t len; |
| 1531 | int arg; |
| 1532 | proto_item *ti; |
| 1533 | proto_item *bmp_tree; |
| 1534 | |
| 1535 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "BMP"); |
| 1536 | col_clear(pinfo->cinfo, COL_INFO); |
| 1537 | |
| 1538 | bmp_type = tvb_get_uint8(tvb, 5); |
| 1539 | |
| 1540 | col_add_fstr(pinfo->cinfo, COL_INFO, "Type: %s", |
| 1541 | val_to_str(pinfo->pool, bmp_type, bmp_typevals, "Unknown (0x%02x)")); |
| 1542 | |
| 1543 | ti = proto_tree_add_item(tree, proto_bmp, tvb, 0, -1, ENC_NA0x00000000); |
| 1544 | proto_item_append_text(ti, ", Type %s", |
| 1545 | val_to_str(pinfo->pool, bmp_type, bmp_typevals, "Unknown (0x%02x)")); |
| 1546 | |
| 1547 | switch (bmp_type) { |
| 1548 | case BMP_MSG_TYPE_ROUTE_MONITORING0x00: |
| 1549 | arg = ett_bmp_route_monitoring; |
| 1550 | break; |
| 1551 | case BMP_MSG_TYPE_STAT_REPORT0x01: |
| 1552 | arg = ett_bmp_stat_report; |
| 1553 | break; |
| 1554 | case BMP_MSG_TYPE_PEER_DOWN0x02: |
| 1555 | arg = ett_bmp_peer_down; |
| 1556 | break; |
| 1557 | case BMP_MSG_TYPE_PEER_UP0x03: |
| 1558 | arg = ett_bmp_peer_up; |
| 1559 | break; |
| 1560 | case BMP_MSG_TYPE_INIT0x04: |
| 1561 | arg = ett_bmp_init; |
| 1562 | break; |
| 1563 | case BMP_MSG_TYPE_TERM0x05: |
| 1564 | arg = ett_bmp_term; |
| 1565 | break; |
| 1566 | case BMP_MSG_TYPE_ROUTE_MIRRORING0x06: |
| 1567 | arg = ett_bmp_route_mirroring; |
| 1568 | break; |
| 1569 | default: |
| 1570 | arg = ett_bmp; |
| 1571 | break; |
| 1572 | } |
| 1573 | |
| 1574 | bmp_tree = proto_item_add_subtree(ti, arg); |
| 1575 | |
| 1576 | uint32_t bmp_version_tmp = 0; |
| 1577 | proto_tree_add_item_ret_uint(bmp_tree, hf_bmp_version, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000, &bmp_version_tmp); |
| 1578 | uint8_t bmp_version = (uint8_t) bmp_version_tmp; |
| 1579 | |
| 1580 | offset += 1; |
| 1581 | proto_tree_add_item(bmp_tree, hf_bmp_length, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
| 1582 | offset += 4; |
| 1583 | proto_tree_add_item(bmp_tree, hf_bmp_type, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000); |
| 1584 | offset += 1; |
| 1585 | |
| 1586 | len = tvb_get_ntohs(tvb, offset); |
| 1587 | |
| 1588 | switch (bmp_type) { |
| 1589 | case BMP_MSG_TYPE_INIT0x04: |
| 1590 | dissect_bmp_init(tvb, bmp_tree, pinfo, offset, bmp_type, len); |
| 1591 | break; |
| 1592 | case BMP_MSG_TYPE_ROUTE_MONITORING0x00: |
| 1593 | case BMP_MSG_TYPE_STAT_REPORT0x01: |
| 1594 | case BMP_MSG_TYPE_PEER_DOWN0x02: |
| 1595 | case BMP_MSG_TYPE_PEER_UP0x03: |
| 1596 | case BMP_MSG_TYPE_ROUTE_MIRRORING0x06: |
| 1597 | dissect_bmp_peer_header(tvb, bmp_tree, pinfo, offset, bmp_type, len, bmp_version); |
| 1598 | break; |
| 1599 | case BMP_MSG_TYPE_TERM0x05: |
| 1600 | dissect_bmp_termination(tvb, bmp_tree, pinfo, offset, bmp_type, len); |
| 1601 | break; |
| 1602 | case BMP_MSG_TYPE_ROUTE_POLICY0x64: |
| 1603 | dissect_bmp_route_policy(tvb, bmp_tree, pinfo, offset, bmp_type, len); |
| 1604 | break; |
| 1605 | default: |
| 1606 | break; |
| 1607 | } |
| 1608 | |
| 1609 | return tvb_captured_length(tvb); |
| 1610 | } |
| 1611 | |
| 1612 | /* Main dissecting routine */ |
| 1613 | static int |
| 1614 | dissect_bmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
| 1615 | { |
| 1616 | tcp_dissect_pdus(tvb, pinfo, tree, bmp_desegment, FRAME_HEADER_LEN5, get_bmp_pdu_len, dissect_bmp_pdu, data); |
| 1617 | return tvb_captured_length(tvb); |
| 1618 | } |
| 1619 | |
| 1620 | |
| 1621 | void |
| 1622 | proto_register_bmp(void) |
| 1623 | { |
| 1624 | expert_module_t *expert_bmp; |
| 1625 | |
| 1626 | static hf_register_info hf[] = { |
| 1627 | /* BMP Common Header */ |
| 1628 | { &hf_bmp_version, |
| 1629 | { "Version", "bmp.version", FT_UINT8, BASE_DEC, |
| 1630 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1631 | { &hf_bmp_length, |
| 1632 | { "Length", "bmp.length", FT_UINT32, BASE_DEC, |
| 1633 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1634 | { &hf_bmp_type, |
| 1635 | { "Type", "bmp.type", FT_UINT8, BASE_DEC, |
| 1636 | VALS(bmp_typevals)((0 ? (const struct _value_string*)0 : ((bmp_typevals)))), 0x0, "BMP message type", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1637 | |
| 1638 | /* Unused/Reserved Bytes */ |
| 1639 | { &hf_bmp_unused, |
| 1640 | { "Unused", "bmp.unused", FT_BYTES, BASE_NONE, |
| 1641 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1642 | |
| 1643 | /* Initiation Header */ |
| 1644 | { &hf_init_types, |
| 1645 | { "Information Types", "bmp.init.types", FT_NONE, BASE_NONE, |
| 1646 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1647 | { &hf_init_type, |
| 1648 | { "Type", "bmp.init.type", FT_UINT16, BASE_DEC, |
| 1649 | VALS(init_typevals)((0 ? (const struct _value_string*)0 : ((init_typevals)))), 0x0, "Initiation type", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1650 | { &hf_init_length, |
| 1651 | { "Length", "bmp.init.length", FT_UINT16, BASE_DEC, |
| 1652 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1653 | { &hf_init_info, |
| 1654 | { "Information", "bmp.init.info", FT_STRING, BASE_NONE, |
| 1655 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1656 | |
| 1657 | /* Per Peer Header */ |
| 1658 | { &hf_peer_header, |
| 1659 | { "Per Peer Header", "bmp.peer.header", FT_NONE, BASE_NONE, |
| 1660 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1661 | { &hf_peer_type, |
| 1662 | { "Type", "bmp.peer.type", FT_UINT8, BASE_DEC, |
| 1663 | VALS(peer_typevals)((0 ? (const struct _value_string*)0 : ((peer_typevals)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1664 | { &hf_peer_flags, |
| 1665 | { "Flags", "bmp.peer.flags", FT_UINT8, BASE_HEX, |
| 1666 | NULL((void*)0), BMP_PEER_FLAG_MASK0xFF, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1667 | { &hf_peer_flags_ipv6, |
| 1668 | { "IPv6", "bmp.peer.flags.ipv6", FT_BOOLEAN, 8, |
| 1669 | TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), BMP_PEER_FLAG_IPV60x80, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1670 | { &hf_peer_flags_post_policy, |
| 1671 | { "Post-policy", "bmp.peer.flags.post_policy", FT_BOOLEAN, 8, |
| 1672 | TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), BMP_PEER_FLAG_POST_POLICY0x40, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1673 | { &hf_peer_flags_as_path, |
| 1674 | { "AS PATH", "bmp.peer.flags.as_path", FT_BOOLEAN, 8, |
| 1675 | TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), BMP_PEER_FLAG_AS_PATH0x20, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1676 | { &hf_peer_flags_adj_rib_out, |
| 1677 | { "Adj-RIB-Out", "bmp.peer.flags.adj_rib_out", FT_BOOLEAN, 8, |
| 1678 | TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), BMP_PEER_FLAG_ADJ_RIB_OUT0x10, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1679 | { &hf_peer_flags_res, |
| 1680 | { "Reserved", "bmp.peer.flags.reserved", FT_BOOLEAN, 8, |
| 1681 | TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), BMP_PEER_FLAG_RES0x0F, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1682 | { &hf_peer_flags_loc_rib, |
| 1683 | { "Loc-RIB", "bmp.peer.flags.loc_rib", FT_BOOLEAN, 8, |
| 1684 | TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), BMP_PEER_FLAG_LOC_RIB0x80, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1685 | { &hf_peer_flags_loc_rib_res, |
| 1686 | { "Reserved", "bmp.peer.flags.loc_rib.res", FT_BOOLEAN, 8, |
| 1687 | TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), BMP_PEER_FLAG_LOC_RIB_RES0x7F, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1688 | { &hf_peer_distinguisher, |
| 1689 | { "Peer Distinguisher", "bmp.peer.distinguisher", FT_BYTES, BASE_NONE, |
| 1690 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1691 | { &hf_peer_ipv4_address, |
| 1692 | { "Address", "bmp.peer.ip.addr", FT_IPv4, BASE_NONE, |
| 1693 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1694 | { &hf_peer_ipv6_address, |
| 1695 | { "Address", "bmp.peer.ipv6.addr", FT_IPv6, BASE_NONE, |
| 1696 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1697 | { &hf_peer_asn, |
| 1698 | { "ASN", "bmp.peer.asn", FT_UINT32, BASE_DEC, |
| 1699 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1700 | { &hf_peer_bgp_id, |
| 1701 | { "BGP ID", "bmp.peer.id", FT_IPv4, BASE_NONE, |
| 1702 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1703 | { &hf_peer_timestamp_sec, |
| 1704 | { "Timestamp (sec)", "bmp.peer.timestamp.sec", FT_UINT32, BASE_DEC, |
| 1705 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1706 | { &hf_peer_timestamp_msec, |
| 1707 | { "Timestamp (msec)", "bmp.peer.timestamp.msec", FT_UINT32, BASE_DEC, |
| 1708 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1709 | /* Route Mirroring */ |
| 1710 | { &hf_peer_route_mirroring_type, |
| 1711 | { "Route Mirroring Type", "bmp.peer.route_mirroring.type", FT_UINT16, BASE_DEC, |
| 1712 | VALS(route_mirroring_typevals)((0 ? (const struct _value_string*)0 : ((route_mirroring_typevals )))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1713 | { &hf_peer_route_mirroring_length, |
| 1714 | { "Length", "bmp.peer.route_mirroring.length", FT_UINT16, BASE_DEC, |
| 1715 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1716 | { &hf_peer_route_mirroring_code, |
| 1717 | { "Code", "bmp.peer.route_mirroring.code", FT_UINT16, BASE_DEC, |
| 1718 | VALS(route_mirroring_information_typevals)((0 ? (const struct _value_string*)0 : ((route_mirroring_information_typevals )))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1719 | |
| 1720 | { &hf_peer_up_ipv4_address, |
| 1721 | { "Local Address", "bmp.peer.up.ip.addr", FT_IPv4, BASE_NONE, |
| 1722 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1723 | { &hf_peer_up_ipv6_address, |
| 1724 | { "Local Address", "bmp.peer.up.ipv6.addr", FT_IPv6, BASE_NONE, |
| 1725 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1726 | { &hf_peer_up_local_port, |
| 1727 | { "Local Port", "bmp.peer.up.port.local", FT_UINT16, BASE_DEC, |
| 1728 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1729 | { &hf_peer_up_remote_port, |
| 1730 | { "Remote Port", "bmp.peer.up.port.remote", FT_UINT16, BASE_DEC, |
| 1731 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1732 | |
| 1733 | /* Peer Up TLV */ |
| 1734 | { &hf_peer_state_tlv, |
| 1735 | { "Peer UP/Down TLV", "bmp.peer_state.tlv", FT_NONE, BASE_NONE, |
| 1736 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1737 | { &hf_peer_state_tlv_type, |
| 1738 | { "Type", "bmp.peer_state.tlv.type", FT_UINT16, BASE_DEC, |
| 1739 | VALS(peer_up_tlv_typevals)((0 ? (const struct _value_string*)0 : ((peer_up_tlv_typevals )))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1740 | { &hf_peer_state_tlv_length, |
| 1741 | { "Length", "bmp.peer_state.tlv.length", FT_UINT16, BASE_DEC, |
| 1742 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1743 | { &hf_peer_state_tlv_value, |
| 1744 | { "Value", "bmp.peer_state.tlv.value", FT_BYTES, BASE_NONE, |
| 1745 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1746 | { &hf_peer_up_tlv_string, |
| 1747 | { "String", "bmp.peer_up.tlv.sys_string", FT_STRING, BASE_NONE, |
| 1748 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1749 | { &hf_peer_up_tlv_sys_descr, |
| 1750 | { "SysDescr", "bmp.peer_up.tlv.sys_descr", FT_STRING, BASE_NONE, |
| 1751 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1752 | { &hf_peer_up_tlv_sys_name, |
| 1753 | { "SysName", "bmp.peer_up.tlv.sys_name", FT_STRING, BASE_NONE, |
| 1754 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1755 | { &hf_peer_state_tlv_vrf_table_name, |
| 1756 | { "VRF/Table name", "bmp.peer_state.tlv.vrf_table_name", FT_STRING, BASE_NONE, |
| 1757 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1758 | { &hf_peer_up_tlv_admin_label, |
| 1759 | { "Admin Label", "bmp.peer_up.tlv.admin_label", FT_STRING, BASE_NONE, |
| 1760 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1761 | |
| 1762 | /* Peer Down Notification */ |
| 1763 | { &hf_peer_down_reason, |
| 1764 | { "Reason", "bmp.peer.down.reason", FT_UINT8, BASE_DEC, |
| 1765 | VALS(down_reason_typevals)((0 ? (const struct _value_string*)0 : ((down_reason_typevals )))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1766 | { &hf_peer_down_data, |
| 1767 | { "Data", "bmp.peer.down.data", FT_NONE, BASE_NONE, |
| 1768 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1769 | |
| 1770 | /* Stats Report */ |
| 1771 | { &hf_stats_count, |
| 1772 | { "Stats Count", "bmp.stats.count", FT_UINT32, BASE_DEC, |
| 1773 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1774 | { &hf_stat_type, |
| 1775 | { "Type", "bmp.stats.type", FT_UINT16, BASE_DEC, |
| 1776 | VALS(stat_typevals)((0 ? (const struct _value_string*)0 : ((stat_typevals)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1777 | { &hf_stat_len, |
| 1778 | { "Length", "bmp.stats.length", FT_UINT16, BASE_DEC, |
| 1779 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1780 | { &hf_stat_data, |
| 1781 | { "Data", "bmp.stats.data", FT_BYTES, BASE_NONE, |
| 1782 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1783 | { &hf_stat_data_prefix_rej, |
| 1784 | { "Number of prefixes rejected by inbound policy", "bmp.stats.data.prefix_rej", FT_UINT32, BASE_DEC, |
| 1785 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1786 | { &hf_stat_data_prefix_dup, |
| 1787 | { "Number of (known) duplicate prefix advertisements", "bmp.stats.data.prefix_dup", FT_UINT32, BASE_DEC, |
| 1788 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1789 | { &hf_stat_data_withdraw_dup, |
| 1790 | { "Number of (known) duplicate withdraws", "bmp.stats.data.withdraw_dup", FT_UINT32, BASE_DEC, |
| 1791 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1792 | { &hf_stat_data_cluster_loop, |
| 1793 | { "Number of updates invalidated due to CLUSTER_LIST loop", "bmp.stats.data.cluster_loop", FT_UINT32, BASE_DEC, |
| 1794 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1795 | { &hf_stat_data_as_loop, |
| 1796 | { "Number of updates invalidated due to AS_PATH loop", "bmp.stats.data.as_loop", FT_UINT32, BASE_DEC, |
| 1797 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1798 | { &hf_stat_data_inv_originator, |
| 1799 | { "Number of updates invalidated due to ORIGINATOR_ID", "bmp.stats.data.inv_originator", FT_UINT32, BASE_DEC, |
| 1800 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1801 | { &hf_stat_data_as_confed_loop, |
| 1802 | { "Number of updates invalidated due to a loop found in AS_CONFED_SEQUENCE or AS_CONFED_SET", "bmp.stats.data.as_confed_loop", FT_UINT32, BASE_DEC, |
| 1803 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1804 | { &hf_stat_data_routes_adj_rib_in, |
| 1805 | { "Number of routes in Adj-RIBs-In", "bmp.stats.data.routes_adj_rib_in", FT_UINT64, BASE_DEC, |
| 1806 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1807 | { &hf_stat_data_routes_loc_rib, |
| 1808 | { "Number of routes in Loc-RIB", "bmp.stats.data.routes_loc_rib", FT_UINT64, BASE_DEC, |
| 1809 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1810 | { &hf_stat_data_routes_per_adj_rib_in_afi, |
| 1811 | { "AFI", "bmp.stats.data.routes_per_adj_rib_in.afi", FT_UINT16, BASE_DEC, |
| 1812 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1813 | { &hf_stat_data_routes_per_adj_rib_in_safi, |
| 1814 | { "SAFI", "bmp.stats.data.routes_per_adj_rib_in.safi", FT_UINT8, BASE_DEC, |
| 1815 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1816 | { &hf_stat_data_routes_per_adj_rib_in, |
| 1817 | { "Number of routes in per-AFI/SAFI Adj-RIB-In", "bmp.stats.data.routes_per_adj_rib_in", FT_UINT64, BASE_DEC, |
| 1818 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1819 | { &hf_stat_data_routes_per_loc_rib_afi, |
| 1820 | { "AFI", "bmp.stats.data.routes_per_loc_rib.afi", FT_UINT16, BASE_DEC, |
| 1821 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1822 | { &hf_stat_data_routes_per_loc_rib_safi, |
| 1823 | { "SAFI", "bmp.stats.data.routes_per_loc_rib.safi", FT_UINT8, BASE_DEC, |
| 1824 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1825 | { &hf_stat_data_routes_per_loc_rib, |
| 1826 | { "Number of routes in per-AFI/SAFI Adj-RIB-In", "bmp.stats.data.routes_per_loc_rib", FT_UINT64, BASE_DEC, |
| 1827 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1828 | { &hf_stat_data_update_treat, |
| 1829 | { "Number of updates subjected to treat-as-withdraw", "bmp.stats.data.update_treat", FT_UINT32, BASE_DEC, |
| 1830 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1831 | { &hf_stat_data_prefixes_treat, |
| 1832 | { "Number of prefixes subjected to treat-as-withdraw", "bmp.stats.data.prefixes_treat", FT_UINT32, BASE_DEC, |
| 1833 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1834 | { &hf_stat_data_duplicate_update, |
| 1835 | { "Number of duplicate update messages received", "bmp.stats.data.duplicate_update", FT_UINT32, BASE_DEC, |
| 1836 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1837 | { &hf_stat_data_routes_pre_adj_rib_out, |
| 1838 | { "Number of routes in pre-policy Adj-RIBs-Out", "bmp.stats.data.routes_pre_adj_rib_out", FT_UINT64, BASE_DEC, |
| 1839 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1840 | { &hf_stat_data_routes_post_adj_rib_out, |
| 1841 | { "Number of routes in post-policy Adj-RIBs-Out", "bmp.stats.data.routes_post_adj_rib_out", FT_UINT64, BASE_DEC, |
| 1842 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1843 | { &hf_stat_data_routes_pre_per_adj_rib_out_afi, |
| 1844 | { "AFI", "bmp.stats.data.routes_pre_per_adj_rib_out.afi", FT_UINT16, BASE_DEC, |
| 1845 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1846 | { &hf_stat_data_routes_pre_per_adj_rib_out_safi, |
| 1847 | { "SAFI", "bmp.stats.data.routes_pre_per_adj_rib_out.safi", FT_UINT8, BASE_DEC, |
| 1848 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1849 | { &hf_stat_data_routes_pre_per_adj_rib_out, |
| 1850 | { "Number of routes in per-AFI/SAFI pre-policy Adj-RIB-Out", "bmp.stats.data.routes_pre_per_adj_rib_out", FT_UINT64, BASE_DEC, |
| 1851 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1852 | { &hf_stat_data_routes_post_per_adj_rib_out_afi, |
| 1853 | { "AFI", "bmp.stats.data.routes_post_per_adj_rib_out.afi", FT_UINT16, BASE_DEC, |
| 1854 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1855 | { &hf_stat_data_routes_post_per_adj_rib_out_safi, |
| 1856 | { "SAFI", "bmp.stats.data.routes_post_per_adj_rib_out.safi", FT_UINT8, BASE_DEC, |
| 1857 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1858 | { &hf_stat_data_routes_post_per_adj_rib_out, |
| 1859 | { "Number of routes in per-AFI/SAFI post-policy Adj-RIB-Out", "bmp.stats.data.routes_post_per_adj_rib_out", FT_UINT64, BASE_DEC, |
| 1860 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1861 | /* Termination Message */ |
| 1862 | { &hf_term_types, |
| 1863 | { "Termination Types", "bmp.term.types", FT_NONE, BASE_NONE, |
| 1864 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1865 | { &hf_term_type, |
| 1866 | { "Type", "bmp.term.type", FT_UINT16, BASE_DEC, |
| 1867 | VALS(term_typevals)((0 ? (const struct _value_string*)0 : ((term_typevals)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1868 | { &hf_term_len, |
| 1869 | { "Length", "bmp.term.length", FT_UINT16, BASE_DEC, |
| 1870 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1871 | { &hf_term_info, |
| 1872 | { "Information", "bmp.term.info", FT_STRING, BASE_NONE, |
| 1873 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1874 | { &hf_term_reason, |
| 1875 | { "Reason", "bmp.term.reason", FT_UINT16, BASE_DEC, |
| 1876 | VALS(term_reason_typevals)((0 ? (const struct _value_string*)0 : ((term_reason_typevals )))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1877 | |
| 1878 | /* Route Policy */ |
| 1879 | { &hf_route_policy_flags, |
| 1880 | { "Flags", "bmp.route_policy.flags", FT_UINT8, BASE_HEX, |
| 1881 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1882 | { &hf_route_policy_flags_ipv6, |
| 1883 | { "IPv6", "bmp.route_policy.flags.ipv6", FT_BOOLEAN, 8, |
| 1884 | TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), BMP_PEER_FLAG_IPV60x80, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1885 | { &hf_route_policy_flags_res, |
| 1886 | { "Reserved", "bmp.route_policy.flags.res", FT_UINT8, BASE_HEX, |
| 1887 | NULL((void*)0), 0x7F, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1888 | { &hf_route_policy_rd, |
| 1889 | { "Route Distinguisher", "bmp.route_policy.type", FT_UINT64, BASE_HEX_DEC, |
| 1890 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1891 | { &hf_route_policy_prefix_length, |
| 1892 | { "Prefix Length", "bmp.route_policy.prefix_length", FT_UINT8, BASE_DEC, |
| 1893 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1894 | { &hf_route_policy_prefix_ipv4, |
| 1895 | { "Prefix (IPv4)", "bmp.route_policy.prefix_ipv4", FT_IPv4, BASE_NONE, |
| 1896 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1897 | { &hf_route_policy_prefix_reserved, |
| 1898 | { "Prefix (Reserved)", "bmp.route_policy.prefix_reserved", FT_BYTES, BASE_NONE, |
| 1899 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1900 | { &hf_route_policy_prefix_ipv6, |
| 1901 | { "Prefix (IPv6)", "bmp.route_policy.prefix_ipv6", FT_IPv6, BASE_NONE, |
| 1902 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1903 | { &hf_route_policy_route_origin, |
| 1904 | { "Route origin", "bmp.route_policy.route_origin", FT_UINT32, BASE_DEC, |
| 1905 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1906 | { &hf_route_policy_event_count, |
| 1907 | { "Event count", "bmp.route_policy.event_count", FT_UINT8, BASE_DEC, |
| 1908 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1909 | { &hf_route_policy_total_event_length, |
| 1910 | { "Total Event Length", "bmp.route_policy.total_event_length", FT_UINT16, BASE_DEC, |
| 1911 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1912 | { &hf_route_policy_single_event_length, |
| 1913 | { "Single event length", "bmp.route_policy.single_event_length", FT_UINT16, BASE_DEC, |
| 1914 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1915 | { &hf_route_policy_event_index, |
| 1916 | { "Event count", "bmp.route_policy.event_index", FT_UINT8, BASE_DEC, |
| 1917 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1918 | { &hf_route_policy_timestamp_sec, |
| 1919 | { "Timestamp (sec)", "bmp.route_policy.timestamp.sec", FT_UINT32, BASE_DEC, |
| 1920 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1921 | { &hf_route_policy_timestamp_msec, |
| 1922 | { "Timestamp (msec)", "bmp.route_policy.timestamp.msec", FT_UINT32, BASE_DEC, |
| 1923 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1924 | { &hf_route_policy_path_identifier, |
| 1925 | { "Path Identifier", "bmp.route_policy.path_identifier", FT_UINT32, BASE_DEC, |
| 1926 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1927 | { &hf_route_policy_afi, |
| 1928 | { "AFI", "bmp.route_policy.afi", FT_UINT16, BASE_DEC, |
| 1929 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1930 | { &hf_route_policy_safi, |
| 1931 | { "SAFI", "bmp.route_policy.safi", FT_UINT8, BASE_DEC, |
| 1932 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1933 | { &hf_route_policy_tlv, |
| 1934 | { "TLV", "bmp.route_policy.tlv", FT_NONE, BASE_NONE, |
| 1935 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1936 | { &hf_route_policy_tlv_type, |
| 1937 | { "Type", "bmp.route_policy.tlv.type", FT_UINT16, BASE_DEC, |
| 1938 | VALS(route_policy_tlv_typevals)((0 ? (const struct _value_string*)0 : ((route_policy_tlv_typevals )))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1939 | { &hf_route_policy_tlv_length, |
| 1940 | { "Length", "bmp.route_policy.tlv.length", FT_UINT16, BASE_DEC, |
| 1941 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1942 | { &hf_route_policy_tlv_value, |
| 1943 | { "Value", "bmp.route_policy.tlv.value", FT_BYTES, BASE_NONE, |
| 1944 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1945 | { &hf_route_policy_tlv_vrf_table_id, |
| 1946 | { "Table id", "bmp.route_policy.tlv.vrf.table_id", FT_UINT32, BASE_DEC, |
| 1947 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1948 | { &hf_route_policy_tlv_vrf_table_name, |
| 1949 | { "Table name", "bmp.route_policy.tlv.vrf.table_name", FT_STRING, BASE_NONE, |
| 1950 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1951 | { &hf_route_policy_tlv_policy_flags, |
| 1952 | { "Flags", "bmp.route_policy.tlv.policy.flags", FT_UINT8, BASE_HEX, |
| 1953 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1954 | { &hf_route_policy_tlv_policy_flags_m, |
| 1955 | { "M(atch)", "bmp.route_policy.tlv.policy.flags.m", FT_BOOLEAN, 8, |
| 1956 | NULL((void*)0), 0x80, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1957 | { &hf_route_policy_tlv_policy_flags_p, |
| 1958 | { "P(ermit)", "bmp.route_policy.tlv.policy.flags.p", FT_BOOLEAN, 8, |
| 1959 | NULL((void*)0), 0x40, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1960 | { &hf_route_policy_tlv_policy_flags_d, |
| 1961 | { "D(ifference)", "bmp.route_policy.tlv.policy.flags.d", FT_BOOLEAN, 8, |
| 1962 | NULL((void*)0), 0x20, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1963 | { &hf_route_policy_tlv_policy_flags_res, |
| 1964 | { "Reserved", "bmp.route_policy.tlv.policy.flags.res", FT_UINT8, BASE_HEX, |
| 1965 | NULL((void*)0), 0x1F, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1966 | { &hf_route_policy_tlv_policy_count, |
| 1967 | { "Policy Count", "bmp.route_policy.tlv.policy.count", FT_UINT8, BASE_DEC, |
| 1968 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1969 | { &hf_route_policy_tlv_policy_class, |
| 1970 | { "Policy Class", "bmp.route_policy.tlv.policy.class", FT_UINT8, BASE_HEX, |
| 1971 | VALS(route_policy_tlv_policy_class_typevals)((0 ? (const struct _value_string*)0 : ((route_policy_tlv_policy_class_typevals )))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1972 | { &hf_route_policy_tlv_policy_peer_ipv4, |
| 1973 | { "Peer (IPv4)", "bmp.route_policy.tlv.policy.peer_ipv4", FT_IPv4, BASE_NONE, |
| 1974 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1975 | { &hf_route_policy_tlv_policy_peer_reserved, |
| 1976 | { "Peer (Reserved)", "bmp.route_policy.tlv.policy.peer_reserved", FT_BYTES, BASE_NONE, |
| 1977 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1978 | { &hf_route_policy_tlv_policy_peer_ipv6, |
| 1979 | { "Peer (IPv6)", "bmp.route_policy.tlv.policy.peer_ipv6", FT_IPv6, BASE_NONE, |
| 1980 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1981 | { &hf_route_policy_tlv_policy_peer_router_id, |
| 1982 | { "Route Id", "bmp.route_policy.tlv.policy.peer.router_id", FT_IPv4, BASE_NONE, |
| 1983 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1984 | { &hf_route_policy_tlv_policy_peer_as, |
| 1985 | { "Peer AS", "bmp.route_policy.tlv.policy.peer.as", FT_UINT32, BASE_DEC, |
| 1986 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1987 | { &hf_route_policy_tlv_policy, |
| 1988 | { "Policy", "bmp.route_policy.tlv.policy", FT_NONE, BASE_NONE, |
| 1989 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1990 | { &hf_route_policy_tlv_policy_name_length, |
| 1991 | { "Policy Name Length", "bmp.route_policy.tlv.policy.name.length", FT_UINT16, BASE_DEC, |
| 1992 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1993 | { &hf_route_policy_tlv_policy_item_id_length, |
| 1994 | { "Policy ID Length", "bmp.route_policy.tlv.policy.item_id.length", FT_UINT16, BASE_DEC, |
| 1995 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1996 | { &hf_route_policy_tlv_policy_name, |
| 1997 | { "Policy Name", "bmp.route_policy.tlv.policy.name", FT_STRING, BASE_NONE, |
| 1998 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 1999 | { &hf_route_policy_tlv_policy_item_id, |
| 2000 | { "Policy ID", "bmp.route_policy.tlv.policy.item_id", FT_STRING, BASE_NONE, |
| 2001 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2002 | { &hf_route_policy_tlv_policy_flag, |
| 2003 | { "Flag", "bmp.route_policy.tlv.policy.flag", FT_UINT8, BASE_HEX, |
| 2004 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2005 | { &hf_route_policy_tlv_policy_flag_c, |
| 2006 | { "C(haining)", "bmp.route_policy.tlv.policy.flag.c", FT_BOOLEAN, 8, |
| 2007 | NULL((void*)0), 0x80, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2008 | { &hf_route_policy_tlv_policy_flag_r, |
| 2009 | { "R(ecursion)", "bmp.route_policy.tlv.policy.flag.r", FT_BOOLEAN, 8, |
| 2010 | NULL((void*)0), 0x40, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2011 | { &hf_route_policy_tlv_policy_flag_res2, |
| 2012 | { "Reserved", "bmp.route_policy.tlv.policy.flag.res2", FT_UINT8, BASE_HEX, |
| 2013 | NULL((void*)0), 0x3F, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2014 | { &hf_route_policy_tlv_string, |
| 2015 | { "String", "bmp.route_policy.tlv.string", FT_STRING, BASE_NONE, |
| 2016 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2017 | |
| 2018 | /* BMPv4 TLVs */ |
| 2019 | { &hf_bmpv4_tlv, |
| 2020 | { "BMPv4 TLV", "bmp.tlv", FT_NONE, BASE_NONE, |
| 2021 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2022 | { &hf_bmpv4_tlv_type, |
| 2023 | { "Type", "bmp.tlv.type", FT_UINT16, BASE_DEC, |
| 2024 | VALS(bmpv4_tlv_typevals)((0 ? (const struct _value_string*)0 : ((bmpv4_tlv_typevals)) )), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2025 | { &hf_bmpv4_tlv_length, |
| 2026 | { "Length", "bmp.tlv.length", FT_UINT16, BASE_DEC, |
| 2027 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2028 | { &hf_bmpv4_tlv_index, |
| 2029 | { "Index", "bmp.tlv.index", FT_UINT16, BASE_DEC, |
| 2030 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2031 | { &hf_bmpv4_tlv_value_bytes, |
| 2032 | { "Value", "bmp.tlv.value.bytes", FT_BYTES, SEP_SPACE, |
| 2033 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2034 | { &hf_bmpv4_tlv_value_string, |
| 2035 | { "Value", "bmp.tlv.value.string", FT_STRING, BASE_NONE, |
| 2036 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2037 | { &hf_bmpv4_tlv_value_bool, |
| 2038 | { "Value", "bmp.tlv.value.bool", FT_BOOLEAN, BASE_NONE, |
| 2039 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2040 | { &hf_bmpv4_tlv_value_index, |
| 2041 | { "Index", "bmp.tlv.value.index", FT_UINT16, BASE_DEC, |
| 2042 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2043 | { &hf_bmpv4_tlv_group_id, |
| 2044 | { "Group ID", "bmp.tlv.group_id", FT_UINT16, BASE_DEC, |
| 2045 | NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2046 | { &hf_bmpv4_tlv_path_status_status, |
| 2047 | { "Status", "bmp.tlv.value.path_status.status", FT_UINT32, BASE_HEX, |
| 2048 | NULL((void*)0), BMP_PATH_STATUS_MASK0x000007ff, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2049 | { &hf_bmpv4_tlv_path_status_reason, |
| 2050 | { "Reason", "bmp.tlv.value.path_status.reason", FT_UINT16, BASE_HEX, |
| 2051 | VALS(bmpv4_tlv_path_status_reason_typevals)((0 ? (const struct _value_string*)0 : ((bmpv4_tlv_path_status_reason_typevals )))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}, |
| 2052 | { &hf_bmp_path_status_invalid, |
| 2053 | { "invalid", "bmp.tlv.value.path_status.invalid", FT_BOOLEAN, 32, |
| 2054 | TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), BMP_PATH_STATUS_INVALID, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0)}}, |
| 2055 | { &hf_bmp_path_status_best, |
| 2056 | { "best", "bmp.tlv.value.path_status.best", FT_BOOLEAN, 32, |
| 2057 | TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), BMP_PATH_STATUS_BEST, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0)}}, |
| 2058 | { &hf_bmp_path_status_non_selected, |
| 2059 | { "non_selected", "bmp.tlv.value.path_status.non_selected", FT_BOOLEAN, 32, |
| 2060 | TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), BMP_PATH_STATUS_NON_SELECTED, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0)}}, |
| 2061 | { &hf_bmp_path_status_primary, |
| 2062 | { "primary", "bmp.tlv.value.path_status.primary", FT_BOOLEAN, 32, |
| 2063 | TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), BMP_PATH_STATUS_PRIMARY, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0)}}, |
| 2064 | { &hf_bmp_path_status_backup, |
| 2065 | { "backup", "bmp.tlv.value.path_status.backup", FT_BOOLEAN, 32, |
| 2066 | TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), BMP_PATH_STATUS_BACKUP, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0)}}, |
| 2067 | { &hf_bmp_path_status_non_installed, |
| 2068 | { "non_installed", "bmp.tlv.value.path_status.non_installed", FT_BOOLEAN, 32, |
| 2069 | TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), BMP_PATH_STATUS_NON_INSTALLED, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0)}}, |
| 2070 | { &hf_bmp_path_status_best_external, |
| 2071 | { "best_external", "bmp.tlv.value.path_status.best_external", FT_BOOLEAN, 32, |
| 2072 | TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), BMP_PATH_STATUS_BEST_EXTERNAL, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0)}}, |
| 2073 | { &hf_bmp_path_status_addpath, |
| 2074 | { "addpath", "bmp.tlv.value.path_status.addpath", FT_BOOLEAN, 32, |
| 2075 | TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), BMP_PATH_STATUS_ADDPATH, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0)}}, |
| 2076 | { &hf_bmp_path_status_filtered_in, |
| 2077 | { "filtered_in", "bmp.tlv.value.path_status.filtered_in", FT_BOOLEAN, 32, |
| 2078 | TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), BMP_PATH_STATUS_FILTERED_IN, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0)}}, |
| 2079 | { &hf_bmp_path_status_filtered_out, |
| 2080 | { "filtered_out", "bmp.tlv.value.path_status.filtered_out", FT_BOOLEAN, 32, |
| 2081 | TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), BMP_PATH_STATUS_FILTERED_OUT, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0)}}, |
| 2082 | { &hf_bmp_path_status_invalid_rov, |
| 2083 | { "invalid_rov", "bmp.tlv.value.path_status.invalid_rov", FT_BOOLEAN, 32, |
| 2084 | TFS(&tfs_set_notset)((0 ? (const struct true_false_string*)0 : ((&tfs_set_notset )))), BMP_PATH_STATUS_INVALID_ROV, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0)}}, |
| 2085 | }; |
| 2086 | |
| 2087 | /* Setup protocol subtree array */ |
| 2088 | static int *ett[] = { |
| 2089 | &ett_bmp, |
| 2090 | &ett_bmp_route_monitoring, |
| 2091 | &ett_bmp_stat_report, |
| 2092 | &ett_bmp_stat_type, |
| 2093 | &ett_bmp_peer_down, |
| 2094 | &ett_bmp_peer_up, |
| 2095 | &ett_bmp_peer_state_tlv, |
| 2096 | &ett_bmp_peer_header, |
| 2097 | &ett_bmp_peer_flags, |
| 2098 | &ett_bmp_init, |
| 2099 | &ett_bmp_init_type, |
| 2100 | &ett_bmp_init_types, |
| 2101 | &ett_bmp_term, |
| 2102 | &ett_bmp_term_type, |
| 2103 | &ett_bmp_term_types, |
| 2104 | &ett_bmp_route_mirroring, |
| 2105 | &ett_bmp_route_policy_flags, |
| 2106 | &ett_bmp_route_policy_tlv, |
| 2107 | &ett_bmp_route_policy_tlv_policy_flags, |
| 2108 | &ett_bmp_route_policy_tlv_policy, |
| 2109 | &ett_bmpv4_tlv, |
| 2110 | &ett_bmpv4_tlv_value, |
| 2111 | &ett_bmpv4_tlv_path_status, |
| 2112 | }; |
| 2113 | |
| 2114 | static ei_register_info ei[] = { |
| 2115 | { &ei_stat_data_unknown, |
| 2116 | { "bmp.stats.data.unknown", PI_UNDECODED0x05000000, PI_NOTE0x00400000, |
| 2117 | "Unknown stats type payload", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE , BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE , -1, ((void*)0)}} } |
| 2118 | }, |
| 2119 | { &ei_bmpv4_tlv_unknown_tlv, |
| 2120 | { "bmp.tlv.unknown", PI_UNDECODED0x05000000, PI_WARN0x00600000, |
| 2121 | "TLV Type is unknown", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE , BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE , -1, ((void*)0)}} } |
| 2122 | }, |
| 2123 | { &ei_bmpv4_tlv_string_bad_length, |
| 2124 | { "bmp.tlv.string.bad_length", PI_MALFORMED0x07000000, PI_NOTE0x00400000, |
| 2125 | "Bad string length (should be in range [1; 255])", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE , BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE , -1, ((void*)0)}} } |
| 2126 | }, |
| 2127 | { &ei_bmpv4_tlv_not_fully_parsed, |
| 2128 | { "bmp.tlv.not_fully_parsed", PI_MALFORMED0x07000000, PI_ERROR0x00800000, |
| 2129 | "TLV not fully parsed", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE , BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE , -1, ((void*)0)}} } |
| 2130 | }, |
| 2131 | }; |
| 2132 | |
| 2133 | module_t *bmp_module; |
| 2134 | |
| 2135 | proto_bmp = proto_register_protocol("BGP Monitoring Protocol", "BMP", "bmp"); |
| 2136 | |
| 2137 | bmp_handle = register_dissector("bmp", dissect_bmp, proto_bmp); |
| 2138 | |
| 2139 | proto_register_field_array(proto_bmp, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0])); |
| 2140 | proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0])); |
| 2141 | |
| 2142 | expert_bmp = expert_register_protocol(proto_bmp); |
| 2143 | expert_register_field_array(expert_bmp, ei, array_length(ei)(sizeof (ei) / sizeof (ei)[0])); |
| 2144 | |
| 2145 | bmp_module = prefs_register_protocol(proto_bmp, NULL((void*)0)); |
| 2146 | prefs_register_bool_preference(bmp_module, "desegment", |
| 2147 | "Reassemble BMP messages spanning multiple TCP segments", |
| 2148 | "Whether the BMP dissector should reassemble messages spanning multiple TCP segments." |
| 2149 | " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", |
| 2150 | &bmp_desegment); |
| 2151 | } |
| 2152 | |
| 2153 | |
| 2154 | void |
| 2155 | proto_reg_handoff_bmp(void) |
| 2156 | { |
| 2157 | dissector_add_for_decode_as_with_preference("tcp.port", bmp_handle); |
| 2158 | dissector_bgp = find_dissector_add_dependency("bgp.pdu", proto_bmp); |
| 2159 | } |
| 2160 | /* |
| 2161 | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
| 2162 | * |
| 2163 | * Local variables: |
| 2164 | * c-basic-offset: 4 |
| 2165 | * tab-width: 8 |
| 2166 | * indent-tabs-mode: nil |
| 2167 | * End: |
| 2168 | * |
| 2169 | * ex: set shiftwidth=4 tabstop=8 expandtab: |
| 2170 | * :indentSize=4:tabSize=8:noTabs=true: |
| 2171 | */ |