Author: axel Date: 2010-06-04 21:44:14 +0200 (Fri, 04 Jun 2010) New Revision: 1687
Modified: trunk/bmx/bmx.c trunk/bmx/bmx.h trunk/bmx/msg.c trunk/bmx/route.c Log: bmx.c.h route.c msg.c : hunting for bugs... temporary eliminate merge_neigh_nodes() and purge involved data-structrues instead
Modified: trunk/bmx/bmx.c =================================================================== --- trunk/bmx/bmx.c 2010-06-04 13:50:59 UTC (rev 1686) +++ trunk/bmx/bmx.c 2010-06-04 19:44:14 UTC (rev 1687) @@ -193,7 +193,8 @@ }
-uint32_t update_metric(struct metric_record *mr, struct metric_algo *ma, SQN_T sqn_in, SQN_T sqn_max, uint32_t probe) +uint32_t update_metric(struct link_node *ln, struct orig_node *on, + struct metric_record *mr, struct metric_algo *ma, SQN_T sqn_in, SQN_T sqn_max, uint32_t probe) {
dbgf_all( DBGT_INFO, @@ -243,6 +244,13 @@
// mr->clr out of any range: if ( mr->clr ) { + + dbgf(DBGL_SYS, DBGT_ERR, "ln %s on %s sqn_min %d updated %u ", + ln ? ln->llip4_str : "---", + on ? on->id.name : "---", + on ? on->ogm_sqn_min : 0, + on ? on->updated_timestamp : 0); + dbgf(DBGL_SYS, DBGT_ERR, "sqn_in %d sqn_max %d probe %u " "metric_algo: mask 0x%X steps %d window %d lounge %d metric_record: clr %d, set %d val %u", @@ -371,6 +379,8 @@ * purging ln->neigh->dhn and dhn->neigh */ //BMX3 (done) +/* + STATIC_FUNC struct neigh_node *merge_neigh_nodes(struct link_node *ln, struct dhash_node * dhn) { @@ -411,6 +421,7 @@
return neigh; } +*/
//BMX3 (done) @@ -462,12 +473,26 @@ //always if new dhash: assertion(-500450, 0); //this never happen! or ?
neigh = ln->neigh; + assertion(-500518, (neigh->dhn != my_orig_node.dhn));
} else {
- neigh = merge_neigh_nodes( ln, dhn); + //neigh = merge_neigh_nodes( ln, dhn); //they are the same! + dbgf(DBGL_SYS, DBGT_ERR, "Neigh restarted ?!! purging ln %s %jX and dhn %s %jX", + ln->neigh->dhn->on->desc0->id.name, + ln->neigh->dhn->on->desc0->id.rand.u64[0], + dhn->on->desc0->id.name, dhn->on->desc0->id.rand.u64[0]);
+ + invalidate_dhash_node( dhn ); + invalidate_dhash_node( ln->neigh->dhn ); + + return FAILURE; + + + assertion(-500519, (neigh->dhn != my_orig_node.dhn)); + }
} else { @@ -481,16 +506,20 @@ neigh = ln->neigh = dhn->neigh; avl_insert(&neigh->link_tree, ln, -300173);
+ assertion(-500516, (neigh->dhn != my_orig_node.dhn)); + + } else {
neigh = create_neigh_node( ln, dhn ); - + assertion(-500517, (neigh->dhn != my_orig_node.dhn)); } - }
assign_best_rtq_link(neigh);
+ assertion(-500510, (neigh->dhn != my_orig_node.dhn)); + return update_neighIID4x_repository(neigh, neighIID4neigh, neigh->dhn); }
@@ -576,7 +605,7 @@
// update_lounged_metric(0, lounge_size, sqn, sqn_max, &lndev->sqr[sqr], local_lws);
- update_metric(&lndev->mr[sqr], &link_metric_algo[sqr], sqn, sqn_max, 0); + update_metric(ln, NULL, &lndev->mr[sqr], &link_metric_algo[sqr], sqn, sqn_max, 0);
}
@@ -585,9 +614,9 @@ if (this_lndev) {
// update_lounged_metric(probe, lounge_size, sqn, sqn_max, &this_lndev->sqr[sqr], local_lws); - - update_metric(&this_lndev->mr[sqr], &link_metric_algo[sqr], sqn, sqn_max, probe);
+ update_metric(ln, NULL, &this_lndev->mr[sqr], &link_metric_algo[sqr], sqn, sqn_max, probe); + if (probe && sqr == SQR_RTQ) {
this_lndev->rtq_time_max = bmx_time; @@ -852,8 +881,8 @@ memcpy(&key, &rn->key, sizeof (struct link_key));
if (purge_all || !avl_find(&link_dev_tree, &rn->key)) { + avl_remove(&on->router_tree, &rn->key, -300226); debugFree(rn, -300225); - avl_remove(&on->router_tree, &rn->key, -300226); } } } @@ -898,7 +927,7 @@
} else {
- metric_temp = update_metric(&rn->mr, &on->path_metric_algo, 0, ogm_sqn_max_rcvd, 0); + metric_temp = update_metric(pb->ln, on, &rn->mr, &on->path_metric_algo, 0, ogm_sqn_max_rcvd, 0);
if (metric_best < metric_temp) {
@@ -928,10 +957,13 @@ rn_in = debugMalloc(sizeof (struct router_node), -300222); memset( rn_in, 0, sizeof(struct router_node)); memcpy( &rn_in->key, &pb->lndev->key, sizeof(struct link_key)); + + rn_in->mr.clr = on->ogm_sqn_max_rcvd & mask; + avl_insert(&on->router_tree, rn_in, -300223); }
- metric_in = update_metric(&rn_in->mr, &on->path_metric_algo, orig_sqn, ogm_sqn_max_rcvd, pb->lndev->mr[SQR_RTQ].val); + metric_in = update_metric(pb->ln, on, &rn_in->mr, &on->path_metric_algo, orig_sqn, ogm_sqn_max_rcvd, pb->lndev->mr[SQR_RTQ].val);
if (metric_in > metric_best && GREAT_SQN(rn_in->mr.set & mask, on->ogm_sqn_to_be_send & mask)) { @@ -952,12 +984,11 @@ ipStr(rn_in ? rn_in->key.llip4 : 0), rn_in ? rn_in->key.dev->name : "---", metric_in, ipStr(on->router_key.llip4), lndev_old ? on->router_key.dev->name : "---");
- assertion(-500504, (!on->router_key.llip4 || lndev_old)); + //assertion(-500504, (!on->router_key.llip4 || lndev_old)); lndev_old not needed anymore beyond this point
if (on->router_key.llip4) { configure_route(on->primary_ip4, 32, 0, on->router_key.llip4, 0, - on->router_key.dev->index, on->router_key.dev->name, - RT_TABLE_HOSTS, RTN_UNICAST, DEL, TRACK_OTHER_HOST); + 0, NULL, RT_TABLE_HOSTS, RTN_UNICAST, DEL, TRACK_OTHER_HOST); }
configure_route(on->primary_ip4, 32, 0, rn_in->key.llip4, my_orig_node.primary_ip4, @@ -987,8 +1018,7 @@
if (on->router_key.llip4) { configure_route(on->primary_ip4, 32, 0, on->router_key.llip4, 0, - on->router_key.dev->index, on->router_key.dev->name, - RT_TABLE_HOSTS, RTN_UNICAST, DEL, TRACK_OTHER_HOST); + 0, NULL, RT_TABLE_HOSTS, RTN_UNICAST, DEL, TRACK_OTHER_HOST); }
Modified: trunk/bmx/bmx.h =================================================================== --- trunk/bmx/bmx.h 2010-06-04 13:50:59 UTC (rev 1686) +++ trunk/bmx/bmx.h 2010-06-04 19:44:14 UTC (rev 1687) @@ -836,7 +836,7 @@ /* * PARANOIA ERROR CODES: * Negative numbers are used as SIGSEV error codes ! - * Currently used numbers are: -500000 ... -500501 + * Currently used numbers are: -500000 ... -500520 */
#ifdef NO_PARANOIA @@ -878,7 +878,8 @@
IDM_T validate_metric_algo(struct metric_algo *ma, struct ctrl_node *cn);
-uint32_t update_metric(struct metric_record *mr, struct metric_algo *ma, SQN_T sqn_in, SQN_T sqn_max, uint32_t probe); +uint32_t update_metric(struct link_node *ln, struct orig_node *on, + struct metric_record *mr, struct metric_algo *ma, SQN_T sqn_in, SQN_T sqn_max, uint32_t probe);
void update_link_node(struct link_node *ln, struct dev_node *iif, SQN_T sqn, SQN_T sqn_max, uint8_t sqr, uint32_t probe);
Modified: trunk/bmx/msg.c =================================================================== --- trunk/bmx/msg.c 2010-06-04 13:50:59 UTC (rev 1686) +++ trunk/bmx/msg.c 2010-06-04 19:44:14 UTC (rev 1687) @@ -1104,7 +1104,7 @@
// update_lounged_metric(0, local_rtq_lounge, ttn->dev->ogm_sqn, ttn->dev->ogm_sqn, &lndev->sqr[SQR_RTQ], local_lws);
- update_metric(&lndev->mr[SQR_RTQ], &link_metric_algo[SQR_RTQ], ttn->dev->ogm_sqn, ttn->dev->ogm_sqn, 0); + update_metric(NULL, NULL, &lndev->mr[SQR_RTQ], &link_metric_algo[SQR_RTQ], ttn->dev->ogm_sqn, ttn->dev->ogm_sqn, 0); }
dbgf_all( DBGT_INFO, "%s %s SQN %d", ttn->dev->name, ttn->dev->ip4_str, ttn->dev->ogm_sqn); @@ -1395,6 +1395,8 @@ IDM_T invalid = NO; struct description *cache = NULL;
+ assertion(-500511, (!ln || !ln->neigh || (ln->neigh->dhn != my_orig_node.dhn))); + if (avl_find(&dhash_invalid_tree, dhash)) {
invalid = YES; @@ -1434,17 +1436,27 @@ } }
- if (is_sender) - update_neigh_node(ln, orig_dhn, neighIID4x); + if (is_sender) {
- else if (update_neighIID4x_repository(ln->neigh, neighIID4x, orig_dhn) == FAILURE) + if (update_neigh_node(ln, orig_dhn, neighIID4x) == FAILURE ) + return FAILURE_POINTER; + + assertion(-500512, (!ln->neigh || (ln->neigh->dhn != my_orig_node.dhn))); + + } else if (update_neighIID4x_repository(ln->neigh, neighIID4x, orig_dhn) == FAILURE) { + return FAILURE_POINTER; + }
} else {
if (is_sender) { - update_neigh_node(ln, orig_dhn, neighIID4x); + if (update_neigh_node(ln, orig_dhn, neighIID4x) == FAILURE) + return FAILURE_POINTER; + + assertion(-500513, (!ln->neigh || (ln->neigh->dhn != my_orig_node.dhn))); + } else { //update_neigh_node(ln, dhn, IID_RSVD_UNUSED); //update_neigh_iid_repos(ln->neigh, neighIID4x, dhn); @@ -1461,7 +1473,11 @@
if ((orig_dhn = process_description(pb, cache, dhash))) {
- update_neigh_node(ln, orig_dhn, neighIID4x); + if (update_neigh_node(ln, orig_dhn, neighIID4x) == FAILURE) + return FAILURE_POINTER; + + assertion(-500514, (!ln->neigh || (ln->neigh->dhn != my_orig_node.dhn))); + }
} else if (ln->neigh && (cache = rem_cached_description(dhash))) { @@ -1562,7 +1578,8 @@ dhn = process_dhash_description_neighIID4x(pb, &dhash0, desc0, neighIID4x, is_sender);
dbgf_all( DBGT_INFO, "rcvd %s desc0: %jX via %s NB %s", - dhn ? "accepted" : "denied", desc0->id.rand.u64[0], pb->iif->name, pb->neigh_str); + (dhn && dhn != FAILURE_POINTER) ? "accepted" : "denied", + desc0->id.rand.u64[0], pb->iif->name, pb->neigh_str);
if (dhn == FAILURE_POINTER) {
Modified: trunk/bmx/route.c =================================================================== --- trunk/bmx/route.c 2010-06-04 13:50:59 UTC (rev 1686) +++ trunk/bmx/route.c 2010-06-04 19:44:14 UTC (rev 1687) @@ -1298,7 +1298,7 @@ }
-static int8_t track_route_and_proceed( uint32_t dest, int16_t mask, uint32_t metric, uint32_t gw, uint32_t src, int32_t ifi, char *dev, +static int8_t track_route_and_proceed( uint32_t dest, int16_t mask, uint32_t metric, uint32_t gw, uint32_t src, char *dev, int16_t rt_table, int16_t rta_type, int8_t del, int8_t track_t ) {
@@ -1418,7 +1418,7 @@
- if ( track_route_and_proceed(dest, mask, metric, gw, src, ifi, dev, rt_table, rta_type, del, track_t) == NO ) + if ( track_route_and_proceed(dest, mask, metric, gw, src, dev, rt_table, rta_type, del, track_t) == NO ) return;
if ( track_t != TRACK_OTHER_HOST )