mirror of
https://github.com/rtbrick/bngblaster.git
synced 2024-05-06 15:54:57 +00:00
fix TLV 149 encoder for more than 1 binding TLV
This commit is contained in:
@@ -61,7 +61,7 @@ lspgen_write_cap_config(json_t *arr, lsdb_attr_t *attr)
|
||||
}
|
||||
|
||||
/*
|
||||
* Common function shared between ipv4_prefix,
|
||||
* Common function shared between ipv4_prefix,
|
||||
* ipv6_prefix and label_binding writers.
|
||||
*/
|
||||
void
|
||||
@@ -442,7 +442,7 @@ lspgen_read_ipv6_addr_config(lsdb_node_t *node, json_t *obj)
|
||||
}
|
||||
|
||||
/*
|
||||
* Common function shared between ipv4_prefix,
|
||||
* Common function shared between ipv4_prefix,
|
||||
* ipv6_prefix and label_binding readers.
|
||||
*/
|
||||
void
|
||||
@@ -539,6 +539,7 @@ lspgen_read_label_binding_config(lsdb_node_t *node, json_t *obj)
|
||||
}
|
||||
|
||||
attr_template.key.attr_type = ISIS_TLV_BINDING;
|
||||
attr_template.key.start_tlv = true;
|
||||
lsdb_add_node_attr(node, &attr_template);
|
||||
}
|
||||
|
||||
|
||||
@@ -249,6 +249,7 @@ typedef struct lsdb_attr_ {
|
||||
struct {
|
||||
uint8_t ordinal; /* Used for ordering TLV generation */
|
||||
uint8_t attr_type; /* Type */
|
||||
bool start_tlv; /* Always start a fresh TLV */
|
||||
union {
|
||||
struct lsdb_attr_prefix_ prefix;
|
||||
iso_prefix area;
|
||||
|
||||
@@ -171,7 +171,7 @@ lspgen_finalize_packet(lsdb_ctx_t *ctx, lsdb_node_t *node,
|
||||
|
||||
if (ctx->authentication_type == ISIS_AUTH_SIMPLE) {
|
||||
push_data(&packet->buf, (uint8_t *)ctx->authentication_key, auth_len);
|
||||
}
|
||||
}
|
||||
if (ctx->authentication_type == ISIS_AUTH_MD5) {
|
||||
push_be_uint(&packet->buf, 8, 0);
|
||||
push_be_uint(&packet->buf, 8, 0);
|
||||
@@ -289,8 +289,8 @@ lspgen_serialize_prefix_subtlv(lsdb_attr_t *attr, io_buffer_t *buf,
|
||||
* The IPv4 Prefix TLV has limited space for flags. Generate them as subTLV if required.
|
||||
*/
|
||||
if (attr->key.attr_type == ISIS_TLV_EXTD_IPV4_REACH &&
|
||||
(attr->key.prefix.ext_flag ||
|
||||
attr->key.prefix.r_flag ||
|
||||
(attr->key.prefix.ext_flag ||
|
||||
attr->key.prefix.r_flag ||
|
||||
attr->key.prefix.node_flag)) {
|
||||
|
||||
subtlv_start_idx = buf->idx;
|
||||
@@ -615,7 +615,8 @@ lspgen_gen_packet_node(lsdb_ctx_t *ctx, lsdb_node_t *node)
|
||||
* Start a fresh TLV ?
|
||||
*/
|
||||
if ((last_attr != attr->key.attr_type) ||
|
||||
(lspgen_calculate_tlv_space(&packet->buf, tlv_start_idx) < attr->size)) {
|
||||
(lspgen_calculate_tlv_space(&packet->buf, tlv_start_idx) < attr->size) ||
|
||||
attr->key.start_tlv) {
|
||||
tlv_start_idx = packet->buf.idx;
|
||||
push_be_uint(&packet->buf, 1, attr->key.attr_type); /* Type */
|
||||
push_be_uint(&packet->buf, 1, 0); /* Length */
|
||||
@@ -678,4 +679,5 @@ lspgen_gen_packet(lsdb_ctx_t *ctx)
|
||||
} while (dict_itor_next(itor));
|
||||
|
||||
dict_itor_free(itor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user