aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rpki-rtr.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-rpki-rtr.c')
-rw-r--r--epan/dissectors/packet-rpki-rtr.c142
1 files changed, 110 insertions, 32 deletions
diff --git a/epan/dissectors/packet-rpki-rtr.c b/epan/dissectors/packet-rpki-rtr.c
index 2657f00227..35645e1b9e 100644
--- a/epan/dissectors/packet-rpki-rtr.c
+++ b/epan/dissectors/packet-rpki-rtr.c
@@ -25,42 +25,49 @@
void proto_register_rpkirtr(void);
void proto_reg_handoff_rpkirtr(void);
-static int proto_rpkirtr = -1;
-static int hf_rpkirtr_version = -1;
-static int hf_rpkirtr_pdu_type = -1;
-static int hf_rpkirtr_reserved = -1;
-static int hf_rpkirtr_session_id = -1;
-static int hf_rpkirtr_length = -1;
-static int hf_rpkirtr_serial_number = -1;
-static int hf_rpkirtr_flags = -1;
-static int hf_rpkirtr_flags_aw = -1;
-static int hf_rpkirtr_flags_rk = -1;
-static int hf_rpkirtr_prefix_length = -1;
-static int hf_rpkirtr_max_length = -1;
-static int hf_rpkirtr_ipv4_prefix = -1;
-static int hf_rpkirtr_ipv6_prefix = -1;
-static int hf_rpkirtr_as_number = -1;
-static int hf_rpkirtr_error_code = -1;
-static int hf_rpkirtr_length_pdu = -1;
-static int hf_rpkirtr_error_pdu = -1;
-static int hf_rpkirtr_length_text = -1;
-static int hf_rpkirtr_error_text = -1;
-static int hf_rpkirtr_refresh_interval = -1;
-static int hf_rpkirtr_retry_interval = -1;
-static int hf_rpkirtr_expire_interval = -1;
-static int hf_rpkirtr_subject_key_identifier = -1;
-static int hf_rpkirtr_subject_public_key_info = -1;
+static int proto_rpkirtr;
+static int hf_rpkirtr_version;
+static int hf_rpkirtr_pdu_type;
+static int hf_rpkirtr_reserved;
+static int hf_rpkirtr_session_id;
+static int hf_rpkirtr_length;
+static int hf_rpkirtr_serial_number;
+static int hf_rpkirtr_flags;
+static int hf_rpkirtr_flags_aw;
+static int hf_rpkirtr_flags_rk;
+static int hf_rpkirtr_flags_ar;
+static int hf_rpkirtr_flags_arafi;
+static int hf_rpkirtr_prefix_length;
+static int hf_rpkirtr_max_length;
+static int hf_rpkirtr_ipv4_prefix;
+static int hf_rpkirtr_ipv6_prefix;
+static int hf_rpkirtr_as_number;
+static int hf_rpkirtr_error_code;
+static int hf_rpkirtr_length_pdu;
+static int hf_rpkirtr_error_pdu;
+static int hf_rpkirtr_length_text;
+static int hf_rpkirtr_error_text;
+static int hf_rpkirtr_refresh_interval;
+static int hf_rpkirtr_retry_interval;
+static int hf_rpkirtr_expire_interval;
+static int hf_rpkirtr_subject_key_identifier;
+static int hf_rpkirtr_subject_public_key_info;
+static int hf_rpkirtr_aspa_provider_as_count;
+static int hf_rpkirtr_aspa_customer_asn;
+static int hf_rpkirtr_aspa_provider_asn;
#define RPKI_RTR_TCP_PORT 323
#define RPKI_RTR_TLS_PORT 324
static guint g_port_rpkirtr_tls = RPKI_RTR_TLS_PORT;
-static gint ett_rpkirtr = -1;
-static gint ett_flags = -1;
-static gint ett_flags_nd = -1;
+static gint ett_rpkirtr;
+static gint ett_flags;
+static gint ett_flags_nd;
+static gint ett_providers;
-static expert_field ei_rpkirtr_wrong_version_router_key = EI_INIT;
-static expert_field ei_rpkirtr_bad_length = EI_INIT;
+static expert_field ei_rpkirtr_wrong_version_aspa;
+static expert_field ei_rpkirtr_wrong_version_router_key;
+static expert_field ei_rpkirtr_bad_length;
static dissector_handle_t rpkirtr_handle;
@@ -76,6 +83,7 @@ static dissector_handle_t rpkirtr_handle;
#define RPKI_RTR_CACHE_RESET_PDU 8
#define RPKI_RTR_ROUTER_KEY 9
#define RPKI_RTR_ERROR_REPORT_PDU 10
+#define RPKI_RTR_ASPA_PDU 11
static const value_string rtr_pdu_type_vals[] = {
{ RPKI_RTR_SERIAL_NOTIFY_PDU, "Serial Notify" },
@@ -88,6 +96,7 @@ static const value_string rtr_pdu_type_vals[] = {
{ RPKI_RTR_CACHE_RESET_PDU, "Cache Reset" },
{ RPKI_RTR_ROUTER_KEY, "Router Key" },
{ RPKI_RTR_ERROR_REPORT_PDU, "Error Report" },
+ { RPKI_RTR_ASPA_PDU, "ASPA" },
{ 0, NULL }
};
@@ -115,6 +124,16 @@ static const true_false_string tfs_flag_type_rk = {
"Delete Router Key"
};
+static const true_false_string tfs_flag_type_ar = {
+ "New Autonomous System Provider Authorization Record",
+ "Delete Autonomous System Provider Authorization Record"
+};
+
+static const true_false_string tfs_flag_type_afi_ar = {
+ "IPv6",
+ "IPv4",
+};
+
static guint
get_rpkirtr_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
@@ -287,10 +306,42 @@ static int dissect_rpkirtr_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
proto_tree_add_item(rpkirtr_tree, hf_rpkirtr_length_text, tvb, offset, 4, ENC_BIG_ENDIAN);
len_text = tvb_get_ntohl(tvb, offset);
offset += 4;
- proto_tree_add_item(rpkirtr_tree, hf_rpkirtr_error_text, tvb, offset, len_text, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(rpkirtr_tree, hf_rpkirtr_error_text, tvb, offset, len_text, ENC_ASCII);
offset += len_text;
}
break;
+ case RPKI_RTR_ASPA_PDU: /* ASPA (11) */
+ if(version < 2){
+ /* Error about wrong version... */
+ expert_add_info(pinfo, ti_type, &ei_rpkirtr_wrong_version_aspa);
+ } else {
+ proto_tree_add_item(rpkirtr_tree, hf_rpkirtr_reserved, tvb, offset, 2, ENC_NA);
+ offset += 2;
+ proto_tree_add_item(rpkirtr_tree, hf_rpkirtr_length, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
+ ti_flags = proto_tree_add_item(rpkirtr_tree, hf_rpkirtr_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
+ flags_tree = proto_item_add_subtree(ti_flags, ett_flags_nd);
+ proto_tree_add_item(flags_tree, hf_rpkirtr_flags_ar, tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+ ti_flags = proto_tree_add_item(rpkirtr_tree, hf_rpkirtr_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
+ flags_tree = proto_item_add_subtree(ti_flags, ett_flags_nd);
+ proto_tree_add_item(flags_tree, hf_rpkirtr_flags_arafi, tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+
+ guint cnt_asns;
+ proto_tree_add_item_ret_uint(rpkirtr_tree, hf_rpkirtr_aspa_provider_as_count, tvb, offset, 2, ENC_BIG_ENDIAN, &cnt_asns);
+ offset += 2;
+
+ proto_tree_add_item(rpkirtr_tree, hf_rpkirtr_aspa_customer_asn, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
+
+ proto_tree *providers_tree = proto_item_add_subtree(rpkirtr_tree, ett_providers);
+ for (guint i = 0; i < cnt_asns; i++) {
+ proto_tree_add_item(providers_tree, hf_rpkirtr_aspa_provider_asn, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
+ }
+ }
+ break;
default:
/* No default ? At least sanity check the length*/
if (length > tvb_reported_length(tvb)) {
@@ -367,6 +418,16 @@ proto_register_rpkirtr(void)
FT_BOOLEAN, 8, TFS(&tfs_flag_type_rk), 0x01,
NULL, HFILL }
},
+ { &hf_rpkirtr_flags_ar,
+ { "Flag ASPA", "rpki-rtr.flags.ar",
+ FT_BOOLEAN, 8, TFS(&tfs_flag_type_ar), 0x01,
+ NULL, HFILL }
+ },
+ { &hf_rpkirtr_flags_arafi,
+ { "ASPA Address Family Flag", "rpki-rtr.flags.arafi",
+ FT_BOOLEAN, 8, TFS(&tfs_flag_type_afi_ar), 0x01,
+ NULL, HFILL }
+ },
{ &hf_rpkirtr_prefix_length,
{ "Prefix Length", "rpki-rtr.prefix_length",
FT_UINT8, BASE_DEC, NULL, 0x0,
@@ -441,16 +502,33 @@ proto_register_rpkirtr(void)
{ "Subject Public Key Info", "rpki-rtr.subject_public_key_info",
FT_NONE, BASE_NONE, NULL, 0x0,
NULL, HFILL }
+ },
+ { &hf_rpkirtr_aspa_provider_as_count,
+ { "ASPA Provider AS Count", "rpki-rtr.aspa_ascount",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ "The Provider AS Count is the number of 32-bit Provider Autonomous System Numbers in the PDU", HFILL }
+ },
+ { &hf_rpkirtr_aspa_customer_asn,
+ { "ASPA Customer ASN", "rpki-rtr.aspa_customer_asn",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ "The Customer Autonomous System Number is the 32-bit Autonomous System Number of the customer which authenticated the ASPA RPKI data", HFILL }
+ },
+ { &hf_rpkirtr_aspa_provider_asn,
+ { "ASPA Provider ASN", "rpki-rtr.aspa_provider_asn",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
}
};
static gint *ett[] = {
&ett_rpkirtr,
&ett_flags,
- &ett_flags_nd
+ &ett_flags_nd,
+ &ett_providers
};
static ei_register_info ei[] = {
+ { &ei_rpkirtr_wrong_version_aspa, { "rpkirtr.aspa.wrong_version", PI_MALFORMED, PI_WARN, "Wrong version for ASPA type", EXPFILL }},
{ &ei_rpkirtr_wrong_version_router_key, { "rpkirtr.router_key.wrong_version", PI_MALFORMED, PI_WARN, "Wrong version for Router Key type", EXPFILL }},
{ &ei_rpkirtr_bad_length, { "rpkirtr.bad_length", PI_MALFORMED, PI_ERROR, "Invalid length field", EXPFILL }},
};