mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-01-15 13:31:54 +00:00
stable but - channels and routes disabled, bgp_id needs bmp report field null for some reason, lots of remaining debugging logs
This commit is contained in:
parent
ebc54950aa
commit
01e00b4755
@ -654,6 +654,7 @@ mem_hash_mix_f_val(u64 *h, struct f_val *v)
|
|||||||
case T_PTR:
|
case T_PTR:
|
||||||
case T_ENUM_STATE:
|
case T_ENUM_STATE:
|
||||||
case T_BTIME:
|
case T_BTIME:
|
||||||
|
case T_BMP_CLOSING:
|
||||||
bug("Invalid type %s in f_val hashing", f_type_name(v->type));
|
bug("Invalid type %s in f_val hashing", f_type_name(v->type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
31
nest/proto.c
31
nest/proto.c
@ -51,7 +51,7 @@ static char *c_states[] = { "DOWN", "START", "UP", "STOP", "RESTART" };
|
|||||||
|
|
||||||
extern struct protocol proto_unix_iface;
|
extern struct protocol proto_unix_iface;
|
||||||
struct proto_attrs *proto_state_table;
|
struct proto_attrs *proto_state_table;
|
||||||
struct proto_attrs *channel_state_table;
|
//struct proto_attrs *channel_state_table;
|
||||||
|
|
||||||
static void proto_rethink_goal(struct proto *p);
|
static void proto_rethink_goal(struct proto *p);
|
||||||
static char *proto_state_name(struct proto *p);
|
static char *proto_state_name(struct proto *p);
|
||||||
@ -1314,7 +1314,7 @@ proto_new(struct proto_config *cf)
|
|||||||
log("protocol %s %x has id %i", p->name, p, p->id);
|
log("protocol %s %x has id %i", p->name, p, p->id);
|
||||||
if (p->id >= proto_state_table->length) //TODO check
|
if (p->id >= proto_state_table->length) //TODO check
|
||||||
protos_attr_field_grow();
|
protos_attr_field_grow();
|
||||||
init_list(&proto_state_table->channels_attrs[p->id]);
|
//init_list(&proto_state_table->channels_attrs[p->id]);
|
||||||
//log("init chann list %x (pid %i)", &proto_state_table->channels_attrs[p->id], p->id);
|
//log("init chann list %x (pid %i)", &proto_state_table->channels_attrs[p->id], p->id);
|
||||||
|
|
||||||
init_list(&p->channels);
|
init_list(&p->channels);
|
||||||
@ -2917,8 +2917,8 @@ protos_attr_field_init(void)
|
|||||||
log("start of protos_attr_field_init");
|
log("start of protos_attr_field_init");
|
||||||
int init_length = 16;
|
int init_length = 16;
|
||||||
proto_state_table = mb_allocz(&root_pool, sizeof(struct proto_attrs));
|
proto_state_table = mb_allocz(&root_pool, sizeof(struct proto_attrs));
|
||||||
proto_state_table->attrs = mb_allocz(&root_pool, sizeof(ea_list)*init_length);
|
proto_state_table->attrs = mb_allocz(&root_pool, sizeof(ea_list *_Atomic)*init_length);
|
||||||
proto_state_table->channels_attrs = mb_allocz(&root_pool, sizeof(list)*init_length);
|
proto_state_table->channels_attrs = mb_allocz(&root_pool, sizeof(struct channel_attrs_list) * init_length);
|
||||||
proto_state_table->length = init_length;
|
proto_state_table->length = init_length;
|
||||||
proto_state_table->proto_id_maker = mb_allocz(&root_pool, sizeof(struct hmap));
|
proto_state_table->proto_id_maker = mb_allocz(&root_pool, sizeof(struct hmap));
|
||||||
proto_state_table->channel_id_maker = mb_allocz(&root_pool, sizeof(struct hmap));
|
proto_state_table->channel_id_maker = mb_allocz(&root_pool, sizeof(struct hmap));
|
||||||
@ -2934,12 +2934,12 @@ protos_attr_field_grow(void)
|
|||||||
log("grow");
|
log("grow");
|
||||||
ea_list *_Atomic * new_field = mb_allocz(&root_pool, proto_state_table->length * sizeof(ea_list *_Atomic) * 2);
|
ea_list *_Atomic * new_field = mb_allocz(&root_pool, proto_state_table->length * sizeof(ea_list *_Atomic) * 2);
|
||||||
log("for realocated field allocated %x", new_field);
|
log("for realocated field allocated %x", new_field);
|
||||||
list * new_chann = mb_allocz(&root_pool, proto_state_table->length * sizeof(list) * 2);
|
struct channel_attrs_list * new_chann = mb_allocz(&root_pool, proto_state_table->length * sizeof(struct channel_attrs_list) * 2);
|
||||||
log("for realocated chann field allocated %x", new_chann);
|
log("for realocated chann field allocated %x", new_chann);
|
||||||
memcpy(new_field, proto_state_table->attrs, proto_state_table->length * (sizeof(ea_list* _Atomic)));
|
memcpy(new_field, proto_state_table->attrs, proto_state_table->length * (sizeof(ea_list* _Atomic)));
|
||||||
memcpy(new_chann, proto_state_table->channels_attrs, proto_state_table->length * (sizeof(list)));
|
memcpy(new_chann, proto_state_table->channels_attrs, proto_state_table->length * (sizeof(list)));
|
||||||
atomic_store(&proto_state_table->attrs, new_field);
|
atomic_store(&proto_state_table->attrs, new_field);
|
||||||
atomic_store(&proto_state_table->channels_attrs, new_chann); //TODO atomic
|
atomic_store(&proto_state_table->channels_attrs, new_chann);
|
||||||
atomic_store(&proto_state_table->length, (proto_state_table->length*2));
|
atomic_store(&proto_state_table->length, (proto_state_table->length*2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3091,9 +3091,10 @@ struct channel_attrs *
|
|||||||
get_channel_ea(struct channel *ch)
|
get_channel_ea(struct channel *ch)
|
||||||
{
|
{
|
||||||
struct channel_attrs *chan_att;
|
struct channel_attrs *chan_att;
|
||||||
WALK_LIST(chan_att, proto_state_table->channels_attrs[ch->proto->id])
|
WALK_TLIST(channel_attrs, chan_att, &proto_state_table->channels_attrs[ch->proto->id])
|
||||||
{
|
{
|
||||||
const int id = ea_get_int(chan_att->attrs, &ea_channel_id, 0);
|
const int id = ea_get_int(chan_att->attrs, &ea_channel_id, 0);
|
||||||
|
log("%x %i", chan_att, id);
|
||||||
if (ch->id == id)
|
if (ch->id == id)
|
||||||
return chan_att;
|
return chan_att;
|
||||||
}
|
}
|
||||||
@ -3106,6 +3107,8 @@ channel_journal_state_push(ea_list *attr, struct channel *ch)
|
|||||||
attr = ea_lookup(attr, 0, EALS_CUSTOM);
|
attr = ea_lookup(attr, 0, EALS_CUSTOM);
|
||||||
return; // do we need the journal?
|
return; // do we need the journal?
|
||||||
ea_list *old_attr = get_channel_ea(ch)->attrs;
|
ea_list *old_attr = get_channel_ea(ch)->attrs;
|
||||||
|
struct channel_attrs *ch_attr = get_channel_ea(ch); //TODO is this ok? What about add new tail and delete old chan attr?
|
||||||
|
ch_attr->attrs = attr;
|
||||||
LOCK_DOMAIN(rtable, proto_journal_domain);
|
LOCK_DOMAIN(rtable, proto_journal_domain);
|
||||||
struct channel_pending_update *pupdate = SKIP_BACK(struct channel_pending_update, li, lfjour_push_prepare(channel_journal));
|
struct channel_pending_update *pupdate = SKIP_BACK(struct channel_pending_update, li, lfjour_push_prepare(channel_journal));
|
||||||
if (!pupdate)
|
if (!pupdate)
|
||||||
@ -3113,8 +3116,6 @@ channel_journal_state_push(ea_list *attr, struct channel *ch)
|
|||||||
UNLOCK_DOMAIN(rtable, proto_journal_domain);
|
UNLOCK_DOMAIN(rtable, proto_journal_domain);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct channel_attrs *ch_attr = get_channel_ea(ch);
|
|
||||||
atomic_store(&ch_attr->attrs, attr);
|
|
||||||
*pupdate = (struct channel_pending_update) {
|
*pupdate = (struct channel_pending_update) {
|
||||||
.li = pupdate->li, /* Keep the item's internal state */
|
.li = pupdate->li, /* Keep the item's internal state */
|
||||||
.channel_attr = attr,
|
.channel_attr = attr,
|
||||||
@ -3137,15 +3138,17 @@ channel_journal_state_change(struct channel *ch, int old_state, int new_state)
|
|||||||
void
|
void
|
||||||
add_journal_channel(struct channel *ch)
|
add_journal_channel(struct channel *ch)
|
||||||
{
|
{
|
||||||
if (!NODE_VALID(HEAD(proto_state_table->channels_attrs[ch->proto->id])))
|
//if (!NODE_VALID(HEAD(proto_state_table->channels_attrs[ch->proto->id])))
|
||||||
init_list(&proto_state_table->channels_attrs[ch->proto->id]); // if we realocated channels lists, earlier inicialization would be problematic. But it does not seem to be problem for nonempty lists
|
// init_list(&proto_state_table->channels_attrs[ch->proto->id]); // if we realocated channels lists, earlier inicialization would be problematic. But it does not seem to be problem for nonempty lists
|
||||||
|
|
||||||
ea_list *eal = channel_state_to_eattr(ch, 0);
|
ea_list *eal = channel_state_to_eattr(ch, 0);
|
||||||
struct channel_attrs *attr = mb_allocz(&root_pool, 1230);//sizeof(struct channel_attrs));
|
struct channel_attrs *attr = mb_allocz(&root_pool, sizeof(struct channel_attrs)); //TODO free
|
||||||
log("for new channel allocated %x, eal %x", attr, eal);
|
log("for new channel allocated %x, eal %x", attr, eal);
|
||||||
attr->attrs = eal;
|
attr->attrs = eal;
|
||||||
add_tail(&proto_state_table->channels_attrs[ch->proto->id], &attr->n);
|
log("chann id %i %x",ea_get_int(eal, &ea_channel_id, 0), eal);
|
||||||
log("added tail to lis %x ch id %i, p id %i", &proto_state_table->channels_attrs[ch->proto->id], ch->id, ch->proto->id);
|
channel_attrs_add_tail(&proto_state_table->channels_attrs[ch->proto->id], attr);
|
||||||
|
log("added tail to lis %x ch id %i, p id %i ",
|
||||||
|
&proto_state_table->channels_attrs[ch->proto->id], ch->id, ch->proto->id);
|
||||||
if (get_channel_ea(ch) == 0)
|
if (get_channel_ea(ch) == 0)
|
||||||
bug("channel not stored ch id %i, p id %i", ch->id, ch->proto->id);
|
bug("channel not stored ch id %i, p id %i", ch->id, ch->proto->id);
|
||||||
}
|
}
|
||||||
|
@ -402,9 +402,26 @@ static inline int proto_is_inactive(struct proto *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#include "lib/tlists.h"
|
||||||
|
|
||||||
|
#define TLIST_PREFIX channel_attrs
|
||||||
|
#define TLIST_TYPE struct channel_attrs
|
||||||
|
#define TLIST_ITEM n
|
||||||
|
|
||||||
|
|
||||||
|
struct channel_attrs {
|
||||||
|
TLIST_DEFAULT_NODE;
|
||||||
|
ea_list *attrs;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define TLIST_WANT_ADD_TAIL
|
||||||
|
#define TLIST_WANT_WALK
|
||||||
|
|
||||||
|
#include "lib/tlists.h"
|
||||||
|
|
||||||
struct proto_attrs {
|
struct proto_attrs {
|
||||||
ea_list *_Atomic *attrs;
|
ea_list *_Atomic *attrs;
|
||||||
list *channels_attrs;
|
struct channel_attrs_list *channels_attrs;
|
||||||
_Atomic u32 length;
|
_Atomic u32 length;
|
||||||
struct hmap *proto_id_maker;
|
struct hmap *proto_id_maker;
|
||||||
struct hmap *channel_id_maker;
|
struct hmap *channel_id_maker;
|
||||||
@ -415,10 +432,6 @@ extern struct lfjour *channel_journal;
|
|||||||
extern struct proto_attrs *proto_state_table;
|
extern struct proto_attrs *proto_state_table;
|
||||||
extern DOMAIN(rtable) proto_journal_domain;
|
extern DOMAIN(rtable) proto_journal_domain;
|
||||||
|
|
||||||
struct channel_attrs {
|
|
||||||
node n;
|
|
||||||
ea_list *_Atomic attrs;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct proto_pending_update {
|
struct proto_pending_update {
|
||||||
LFJOUR_ITEM_INHERIT(li);
|
LFJOUR_ITEM_INHERIT(li);
|
||||||
|
Loading…
Reference in New Issue
Block a user