-
Notifications
You must be signed in to change notification settings - Fork 0
/
ospf.patch
93 lines (85 loc) · 3.96 KB
/
ospf.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
--- packet-ospf.c 2016-11-11 14:49:23.740202285 -0500
+++ temp.c 2016-11-11 14:49:16.224202370 -0500
@@ -247,6 +247,7 @@
/* Opaque-LSA - Router Informational Capabilities: TLV Types*/
#define OPT_RI_TLV 1
#define DYN_HOSTNAME_TLV 7
+#define SR_ALGORITHM_TLV 8
#if 0
/* The Opaque RI LSA TLV types definitions. */
@@ -257,6 +258,15 @@
};
#endif
+#define SR_ALGORITHM_TLV_SPF 0
+#define SR_ALGORITHM_TLV_SSPF 1
+
+static const value_string sr_algorithm_tlv_type_vals[] = {
+ {SR_ALGORITHM_TLV_SPF, "Shortest Path First (SPF)" },
+ {SR_ALGORITHM_TLV_SSPF, "Strict Shortest Path First (SPF)" },
+ {-1, NULL }
+};
+
static const value_string ls_type_vals[] = {
{OSPF_LSTYPE_ROUTER, "Router-LSA" },
{OSPF_LSTYPE_NETWORK, "Network-LSA" },
@@ -422,6 +432,7 @@
static gint ett_ospf_lsa_opaque_ri = -1;
static gint ett_ospf_lsa_ri_tlv = -1;
static gint ett_ospf_lsa_dyn_hostname_tlv = -1;
+static gint ett_ospf_lsa_sr_algorithm_tlv = -1;
static gint ett_ospf_lsa_unknown_tlv = -1;
@@ -602,6 +613,7 @@
static int hf_ospf_v3_prefix_option_mc = -1;
static int hf_ospf_v3_prefix_option_p = -1;
static int hf_ospf_dyn_hostname = -1;
+static int hf_ospf_sr_algorithm = -1;
static int hf_ospf_unknown_tlv_txt = -1;
static int hf_ospf_v2_grace_tlv = -1;
static int hf_ospf_v2_grace_period = -1;
@@ -2358,6 +2370,9 @@
int tlv_type;
int tlv_length;
+ guint16 sr_algorithm_number;
+ guint8 sr_algorithm_number_value;
+ const char *sr_algorithm_name;
ri_tree = proto_tree_add_subtree(tree, tvb, offset, length,
ett_ospf_lsa_opaque_ri, NULL, "Opaque Router Information LSA");
@@ -2392,6 +2407,22 @@
proto_tree_add_item(tlv_tree, hf_ospf_dyn_hostname, tvb, offset+4, tlv_length, ENC_ASCII|ENC_NA);
break;
+ case SR_ALGORITHM_TLV:
+ tlv_tree = proto_tree_add_subtree(ri_tree, tvb, offset, tlv_length+4, ett_ospf_lsa_sr_algorithm_tlv, NULL, "SR-Algorithm TLV");
+
+ proto_tree_add_uint_format_value(tlv_tree, hf_ospf_tlv_length, tvb, offset, 2, tlv_type, "SR-Algorithm TLV (%u)", tlv_type);
+
+ if (tlv_length > 0){
+ sr_algorithm_number = 1;
+ while(sr_algorithm_number <= tlv_length) {
+ sr_algorithm_number_value = tvb_get_guint8(tvb, offset + sr_algorithm_number + 3);
+ sr_algorithm_name = val_to_str_const(sr_algorithm_number_value, sr_algorithm_tlv_type_vals, "Unknown SR-Algorithm");
+ proto_tree_add_uint_format_value(tlv_tree, hf_ospf_sr_algorithm, tvb, offset + sr_algorithm_number + 3, 1, sr_algorithm_number_value, "Algorithm %d: (%d) %s", sr_algorithm_number, sr_algorithm_number_value, sr_algorithm_name);
+ sr_algorithm_number ++;
+ }
+ }
+ break;
+
default:
tlv_tree = proto_tree_add_subtree(ri_tree, tvb, offset, tlv_length+4,
ett_ospf_lsa_unknown_tlv, NULL, "Unknown Opaque RI LSA TLV");
@@ -3631,6 +3662,9 @@
{&hf_ospf_dyn_hostname,
{ "Dynamic Hostname", "ospf.dynhostname", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
+ {&hf_ospf_sr_algorithm,
+ {"SR-Algorithm","ospf.sralgorithm", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
+
/* text contained in the Unknown TLV of the Opaque RI LSA */
{&hf_ospf_unknown_tlv_txt,
{ "Text in the Unknown TLV", "ospf.unknown_text", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
@@ -3792,6 +3826,7 @@
&ett_ospf_lsa_opaque_ri,
&ett_ospf_lsa_ri_tlv,
&ett_ospf_lsa_dyn_hostname_tlv,
+ &ett_ospf_lsa_sr_algorithm_tlv,
&ett_ospf_lsa_unknown_tlv,
&ett_ospf_lsa_oif_tna,
&ett_ospf_lsa_oif_tna_stlv,