Author: axel
Date: 2010-06-04 15:34:00 +0200 (Fri, 04 Jun 2010)
New Revision: 1685
Modified:
trunk/bmx/bmx.c
trunk/bmx/bmx.h
trunk/bmx/hna.c
trunk/bmx/iid.c
trunk/bmx/iid.h
trunk/bmx/msg.c
Log:
iid.c hna.c msg.c bmx.ch CPU performance optimization
Modified: trunk/bmx/bmx.c
===================================================================
--- trunk/bmx/bmx.c 2010-06-03 23:50:21 UTC (rev 1684)
+++ trunk/bmx/bmx.c 2010-06-04 13:34:00 UTC (rev 1685)
@@ -157,7 +157,7 @@
IDM_T blacklisted_neighbor(struct packet_buff *pb, struct description_hash *dhash)
{
- dbgf(DBGL_ALL, DBGT_INFO, "%s via %s", pb->neigh_str, pb->iif->name);
+ dbgf_all(DBGT_INFO, "%s via %s", pb->neigh_str, pb->iif->name);
return NO;
}
@@ -196,7 +196,7 @@
uint32_t update_metric(struct metric_record *mr, struct metric_algo *ma, SQN_T sqn_in, SQN_T sqn_max, uint32_t probe)
{
- dbgf(DBGL_ALL, DBGT_INFO,
+ dbgf_all( DBGT_INFO,
"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",
sqn_in, sqn_max, probe,
@@ -326,7 +326,7 @@
assertion( -500451, (nn));
- dbgf(DBGL_CHANGES, DBGT_INFO, "%s", nn->dhn->on->id.name);
+ dbgf_all( DBGT_INFO, "%s", nn->dhn->on->id.name);
while ((ln = avl_iterate_item(&nn->link_tree, &an))) {
@@ -443,7 +443,7 @@
{
struct neigh_node *neigh = NULL;
- dbgf( DBGL_CHANGES, DBGT_INFO, "neigh %s neighIID4neigh %d dhn->orig %s",
+ dbgf_all( DBGT_INFO, "neigh %s neighIID4neigh %d dhn->orig %s",
ln->llip4_str, neighIID4neigh, dhn->on->desc0->id.name);
assertion(-500389, (ln && neighIID4neigh > IID_RSVD_MAX));
@@ -516,7 +516,7 @@
lndev->key.dev = dev;
lndev->key.llip4 = ln->llip4;
- dbgf( DBGL_CHANGES, DBGT_INFO, "creating new lndev %16s %10s %s",
+ dbgf_all( DBGT_INFO, "creating new lndev %16s %10s %s",
ipStr(ln->llip4), dev->name, dev->ip4_str );
list_add_tail(&ln->lndev_list, &lndev->list);
@@ -607,7 +607,7 @@
ln->rq_sqn_max = sqn;
}
- dbgf(DBGL_CHANGES, DBGT_INFO, "%s dev %s",
+ dbgf_all(DBGT_INFO, "%s dev %s",
ipStr(ln->llip4), this_lndev ? this_lndev->key.dev->name : "???");
}
@@ -621,7 +621,7 @@
struct link_node *ln;
uint32_t itip4 = 0;
- dbgf(DBGL_CHANGES, DBGT_INFO, "%s %s %s only_expired",
+ dbgf_all( DBGT_INFO, "%s %s %s only_expired",
ipStr(only_llip4), only_dev ? only_dev->name : "---", only_expired ? " " : "not");
while ((an = (only_llip4 ? (avl_find(&link_tree, &only_llip4)) : (avl_next(&link_tree, &itip4)))) && (ln = an->item)) {
@@ -639,7 +639,7 @@
if ((!only_dev || only_dev == lndev->key.dev) &&
(!only_expired || (((uint32_t) (bmx_time - lndev->pkt_time_max)) > (uint32_t) purge_to))) {
- dbgf(DBGL_SYS, DBGT_INFO, "purging lndev %16s %10s %s",
+ dbgf(DBGL_CHANGES, DBGT_INFO, "purging lndev %16s %10s %s",
ipStr(ln->llip4), lndev->key.dev->name, lndev->key.dev->ip4_str);
list_del_next(&ln->lndev_list, prev);
@@ -662,14 +662,9 @@
avl_remove(&nn->link_tree, &ln->llip4, -300198);
- dbgf(DBGL_SYS, DBGT_INFO, "ln->neigh %s (%d more link_tree.items)",
- ln->llip4_str, nn->link_tree.items);
-
if (!nn->link_tree.items) {
if (nn->dhn) {
- dbgf(DBGL_SYS, DBGT_INFO, "setting ln->neigh->dhn (%s) = NULL",
- nn->dhn->on->id.name);
nn->dhn->neigh = NULL;
}
@@ -705,7 +700,7 @@
dhn->on = on;
on->dhn = dhn;
- dbgf(DBGL_CHANGES, DBGT_INFO, "dhash %8X.. myIID4orig %d", dhn->dhash.h.u32[0], dhn->myIID4orig);
+ dbgf_all(DBGT_INFO, "dhash %8X.. myIID4orig %d", dhn->dhash.h.u32[0], dhn->myIID4orig);
return dhn;
}
@@ -734,13 +729,13 @@
struct dhash_node *dhn;
- dbgf(DBGL_CHANGES, DBGT_INFO, "%s", purge_all ? "purge_all" : "only_expired");
+ dbgf_all( DBGT_INFO, "%s", purge_all ? "purge_all" : "only_expired");
while ((dhn = plist_get_first(&dhash_invalid_plist)) ) {
if (purge_all || ((uint32_t) (bmx_time - dhn->referred_timestamp) > MIN_DHASH_TO)) {
- dbgf(DBGL_CHANGES, DBGT_INFO, "dhash %8X myIID4orig %d", dhn->dhash.h.u32[0], dhn->myIID4orig);
+ dbgf_all( DBGT_INFO, "dhash %8X myIID4orig %d", dhn->dhash.h.u32[0], dhn->myIID4orig);
plist_rem_head(&dhash_invalid_plist);
avl_remove(&dhash_invalid_tree, &dhn->dhash, -300194);
@@ -756,7 +751,7 @@
STATIC_FUNC
void unlink_dhash_node(struct dhash_node *dhn)
{
- dbgf(DBGL_CHANGES, DBGT_INFO, "dhash %8X myIID4orig %d", dhn->dhash.h.u32[0], dhn->myIID4orig);
+ dbgf_all(DBGT_INFO, "dhash %8X myIID4orig %d", dhn->dhash.h.u32[0], dhn->myIID4orig);
if (dhn->neigh) {
@@ -765,7 +760,7 @@
while ((an = dhn->neigh->link_tree.root) && (ln = an->item)) {
- dbgf(DBGL_SYS, DBGT_INFO, "dhn->neigh->link_tree item %s", ln->llip4_str);
+ dbgf_all(DBGT_INFO, "dhn->neigh->link_tree item %s", ln->llip4_str);
assertion(-500284, (ln->neigh == dhn->neigh));
@@ -808,7 +803,7 @@
void invalidate_dhash_node( struct dhash_node *dhn )
{
- dbgf(DBGL_CHANGES, DBGT_INFO,
+ dbgf_all( DBGT_INFO,
"dhash %8X myIID4orig %d, my_iid_repository: used %d, inactive %d min_free %d max_free %d ",
dhn->dhash.h.u32[0], dhn->myIID4orig,
my_iid_repos.tot_used, dhash_invalid_tree.items+1, my_iid_repos.min_free, my_iid_repos.max_free);
@@ -865,45 +860,51 @@
IDM_T update_orig_metrics(struct packet_buff *pb, struct orig_node *on, IID_T orig_sqn)
{
- dbgf(DBGL_ALL, DBGT_INFO, "%s orig_sqn %d via neigh %s", on->id.name, orig_sqn,pb->neigh_str);
+ dbgf_all( DBGT_INFO, "%s orig_sqn %d via neigh %s", on->id.name, orig_sqn,pb->neigh_str);
struct router_node *rn_in = NULL;
uint32_t metric_in, metric_best = 0;
SQN_T mask = on->path_metric_algo.sqn_mask;
-// SQN_T range = on->ogm_sqn_range;
+ struct link_key *key_in = &pb->lndev->key;
-// return SUCCESS;
-
if (on->blocked || (((SQN_T) (orig_sqn - on->ogm_sqn_min)) >= on->ogm_sqn_range))
return FAILURE;
-/*
+ SQN_T ogm_sqn_max_rcvd = MAX_SQ(on->ogm_sqn_max_rcvd, orig_sqn);
- if (((SQN_T) (((orig_sqn & mask) - (on->ogm_sqn_max_rcvd & mask)) - 1)) < on->ogm_sqn_range) {
+ if (((SQN_T) ((ogm_sqn_max_rcvd & mask) - (orig_sqn & mask))) > on->path_metric_algo.sqn_lounge ) {
+ dbgf(DBGL_CHANGES, DBGT_WARN, "%s orig_sqn %d to old max_sqn %d via neigh %s",
+ on->id.name, orig_sqn, on->ogm_sqn_max_rcvd, pb->neigh_str);
+
+ return FAILURE;
+ }
+
+ if (LESS_SQN((on->ogm_sqn_max_rcvd & mask), (orig_sqn & mask))) {
+
for (;;) {
struct router_node *rn;
struct avl_node *an;
-// SQN_T min_sqn_level = ((orig_sqn & mask) - on->ogm_sqn_steps);
struct router_node *rn_best = NULL;
uint32_t metric_temp;
metric_best = 0;
for (an = NULL; (rn = avl_iterate_item(&on->router_tree, &an));) {
- if (memcmp(&rn->key, &pb->lndev->key, sizeof (struct link_key))) {
+ if (rn->key.dev == key_in->dev && rn->key.llip4 == key_in->llip4) {
- metric_temp = update_metric(&rn->mr, &on->path_metric_algo, 0, orig_sqn, 0);
+ rn_in = rn;
+ } else {
+
+ metric_temp = update_metric(&rn->mr, &on->path_metric_algo, 0, ogm_sqn_max_rcvd, 0);
+
if (metric_best < metric_temp) {
metric_best = metric_temp;
rn_best = rn;
}
-
- } else {
- rn_in = rn;
}
}
@@ -916,69 +917,27 @@
}
} else {
- rn_in = avl_find_item(&on->router_tree, &pb->lndev->key);
- }
+ // already cleaned up, simple use last best_metric:
- on->ogm_sqn_max_rcvd = MAX_SQ(on->ogm_sqn_max_rcvd, orig_sqn);
+ metric_best = on->router_best_metric;
- */
- on->ogm_sqn_max_rcvd = MAX_SQ(on->ogm_sqn_max_rcvd, orig_sqn);
-
- if (((SQN_T) ((on->ogm_sqn_max_rcvd & mask) - (orig_sqn & mask))) > on->path_metric_algo.sqn_lounge ) {
-
- dbgf(DBGL_CHANGES, DBGT_WARN, "%s orig_sqn %d to old max_sqn %d via neigh %s",
- on->id.name, orig_sqn, on->ogm_sqn_max_rcvd, pb->neigh_str);
-
- return FAILURE;
+ rn_in = avl_find_item( &on->router_tree, key_in );
}
- for (;;) {
- struct router_node *rn;
- struct avl_node *an;
- struct router_node *rn_best = NULL;
- uint32_t metric_temp;
- metric_best = 0;
-
- for (an = NULL; (rn = avl_iterate_item(&on->router_tree, &an));) {
-
- if (memcmp(&rn->key, &pb->lndev->key, sizeof (struct link_key))) {
-
- metric_temp = update_metric(&rn->mr, &on->path_metric_algo, 0, on->ogm_sqn_max_rcvd, 0);
-
- if (metric_best < metric_temp) {
-
- metric_best = metric_temp;
- rn_best = rn;
- }
-
- } else {
- rn_in = rn;
- }
- }
-
- if (rn_best && !avl_find(&link_dev_tree, &rn_best->key)) {
- purge_router_tree(on, NO);
- continue;
- } else {
- break;
- }
- }
-
-
if (!rn_in) {
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->ogm_sqn_to_be_send = ((on->ogm_sqn_max_rcvd & mask) - on->ogm_sqn_steps);
avl_insert(&on->router_tree, rn_in, -300223);
}
- metric_in = update_metric(&rn_in->mr, &on->path_metric_algo, orig_sqn, on->ogm_sqn_max_rcvd, pb->lndev->mr[SQR_RTQ].val);
+ metric_in = update_metric(&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)) {
on->router_path_metric = metric_in;
+ on->router_best_metric = metric_in;
on->ogm_sqn_to_be_send = rn_in->mr.set;
ogm_aggreg_pending++;
@@ -1007,7 +966,13 @@
memcpy(&on->router_key, &rn_in->key, sizeof (struct link_key));
}
+
+ } else {
+ on->router_best_metric = metric_best;
}
+
+ on->ogm_sqn_max_rcvd = ogm_sqn_max_rcvd;
+
return SUCCESS;
}
@@ -1050,7 +1015,7 @@
void purge_orig(struct dev_node *only_dev, IDM_T only_expired)
{
- dbgf(DBGL_CHANGES, DBGT_INFO, "%s %s only expired",
+ dbgf_all( DBGT_INFO, "%s %s only expired",
only_dev ? only_dev->name : "---", only_expired ? " " : "NOT");
purge_link_node( 0, only_dev, only_expired );
@@ -1165,7 +1130,7 @@
pb->lndev->pkt_time_max = bmx_time;
- dbgf(DBGL_ALL, DBGT_INFO, "rcvd packet from %s size %d via dev %s",
+ dbgf_all( DBGT_INFO, "rcvd packet from %s size %d via dev %s",
pb->neigh_str, hdr->pkt_length, iif->name);
if (blacklisted_neighbor(pb, NULL))
@@ -2197,13 +2162,13 @@
memcpy( &id, &on->id, sizeof(struct description_id));
- dbgf(DBGL_CHANGES, DBGT_INFO, "trying to unblock %s...", on->desc0->id.name);
+ dbgf_all( DBGT_INFO, "trying to unblock %s...", on->desc0->id.name);
IDM_T tlvs_res = process_description_tlvs(on, on->desc0, TLV_DEL_TEST_ADD, NULL);
assertion(-500364, (tlvs_res == TLVS_BLOCKED || tlvs_res == TLVS_SUCCESS));
- dbgf(DBGL_CHANGES, DBGT_INFO, "...unblocking %s %s !",
+ dbgf(DBGL_CHANGES, DBGT_INFO, "unblocking %s %s !",
on->desc0->id.name, tlvs_res == TLVS_SUCCESS ? "success" : "failed");
}
Modified: trunk/bmx/bmx.h
===================================================================
--- trunk/bmx/bmx.h 2010-06-03 23:50:21 UTC (rev 1684)
+++ trunk/bmx/bmx.h 2010-06-04 13:34:00 UTC (rev 1685)
@@ -714,6 +714,7 @@
struct link_key router_key; // the neighbor which is the currently best_next_hop
struct avl_tree router_tree;
uint32_t router_path_metric;
+ uint32_t router_best_metric;
/*
Modified: trunk/bmx/hna.c
===================================================================
--- trunk/bmx/hna.c 2010-06-03 23:50:21 UTC (rev 1684)
+++ trunk/bmx/hna.c 2010-06-04 13:34:00 UTC (rev 1685)
@@ -146,7 +146,7 @@
set_uhna4_key(&key, uhna4[m].prefix_len, uhna4[m].ip4, ntohl(uhna4[m].metric));
}
- dbgf(DBGL_CHANGES, DBGT_INFO, "%s %s %s/%d metric %d",
+ dbgf_all( DBGT_INFO, "%s %s %s/%d metric %d",
tlv_op_str[op], glip4 ? "glip4:" : "uhna4:",
ipStr(key.glip4), key.prefix_len, ntohl(key.metric_be));
Modified: trunk/bmx/iid.c
===================================================================
--- trunk/bmx/iid.c 2010-06-03 23:50:21 UTC (rev 1684)
+++ trunk/bmx/iid.c 2010-06-04 13:34:00 UTC (rev 1685)
@@ -26,7 +26,7 @@
int8_t iid_extend_repos(struct iid_repos *rep)
{
- dbgf( DBGL_CHANGES, DBGT_INFO, "sizeof iid: %lu, tot_used %d arr_size %d ",
+ dbgf_all(DBGT_INFO, "sizeof iid: %lu, tot_used %d arr_size %d ",
(rep == &my_iid_repos) ? sizeof (IID_NODE_T*) : sizeof (IID_T), rep->tot_used, rep->arr_size);
paranoia(-500217, (rep == &my_iid_repos && rep->tot_used != rep->arr_size));
@@ -103,7 +103,7 @@
rep->tot_used--;
- dbgf(DBGL_CHANGES, DBGT_INFO, "mine %d, iid %d tot_used %d, min_free %d max_free %d",
+ dbgf_all( DBGT_INFO, "mine %d, iid %d tot_used %d, min_free %d max_free %d",
m, iid, rep->tot_used, rep->min_free, rep->max_free);
if (rep->tot_used > 0 && rep->tot_used <= IID_MIN_USED) {
@@ -130,7 +130,7 @@
if (dhn) {
if (!dhn->on) {
- dbgf(DBGL_CHANGES, DBGT_INFO, "myIID4x %d INVALIDATED %d sec ago",
+ dbgf_all( DBGT_INFO, "myIID4x %d INVALIDATED %d sec ago",
myIID4x, (bmx_time - dhn->referred_timestamp) / 1000);
}
@@ -246,7 +246,7 @@
if (p < rep->max_free && rep->arr.ref[p].myIID4x == myIID4x) {
- dbgf(DBGL_CHANGES, DBGT_INFO, "removed stale rep->arr.sid[%d] = %d", p, myIID4x);
+ dbgf_all(DBGT_INFO, "removed stale rep->arr.sid[%d] = %d", p, myIID4x);
iid_free(rep, p);
}
@@ -272,7 +272,7 @@
my_iid_repos.min_free = pos;
my_iid_repos.max_free = MAX(pos, my_iid_repos.max_free);
- dbgf(DBGL_CHANGES, DBGT_INFO, "mine %d, iid %d tot_used %d, min_free %d max_free %d",
+ dbgf_all(DBGT_INFO, "mine %d, iid %d tot_used %d, min_free %d max_free %d",
1, mid, my_iid_repos.tot_used, my_iid_repos.min_free, my_iid_repos.max_free);
dhn->referred_timestamp = bmx_time;
Modified: trunk/bmx/iid.h
===================================================================
--- trunk/bmx/iid.h 2010-06-03 23:50:21 UTC (rev 1684)
+++ trunk/bmx/iid.h 2010-06-04 13:34:00 UTC (rev 1685)
@@ -27,7 +27,7 @@
#define IID_NODE_T struct dhash_node
extern IID_NODE_T *unused2; // ensure knowledge of this type
-#define IID_REPOS_SIZE_BLOCK 2
+#define IID_REPOS_SIZE_BLOCK 128
#define IID_REPOS_SIZE_MAX ((IID_T)(-1))
#define IID_REPOS_SIZE_WARN 1024
Modified: trunk/bmx/msg.c
===================================================================
--- trunk/bmx/msg.c 2010-06-03 23:50:21 UTC (rev 1684)
+++ trunk/bmx/msg.c 2010-06-04 13:34:00 UTC (rev 1685)
@@ -198,7 +198,7 @@
struct description_hash tmp_dhash;
memset( &tmp_dhash, 0, sizeof(struct description_hash));
- dbgf(DBGL_CHANGES, DBGT_INFO, "%s", purge_all ? "purge_all" : "only_expired");
+ dbgf_all( DBGT_INFO, "%s", purge_all ? "purge_all" : "only_expired");
paranoia( -500349, (!is_zero((char*)&tmp_dhash, BMX_HASH0_LEN)));
@@ -234,7 +234,7 @@
return;
}
- dbgf(DBGL_CHANGES, DBGT_INFO, "%8X..", dhash->h.u32[0]);
+ dbgf_all( DBGT_INFO, "%8X..", dhash->h.u32[0]);
paranoia(-500261, (description_cache_tree.items > DEF_DESC0_CACHE_SIZE));
@@ -273,7 +273,7 @@
memset(&key, 0, sizeof (struct tx_timestamp_key));
- dbgf(DBGL_CHANGES, DBGT_INFO, "%s %s", dev->name, purge_all ? "purge_all" : "only_expired");
+ dbgf_all( DBGT_INFO, "%s %s", dev->name, purge_all ? "purge_all" : "only_expired");
while ((an = avl_next(&dev->tx_timestamp_tree, (ttn ? &ttn->key : &key)))) {
@@ -410,7 +410,7 @@
continue;
- dbgf(DBGL_CHANGES, DBGT_INFO, "%s %s dsc_sqn %d size %d ",
+ dbgf_all( DBGT_INFO, "%s %s dsc_sqn %d size %d ",
tlv_op_str[op], desc->id.name, ntohs(desc->dsc_sqn), ntohs(desc->dsc_tlvs_len));
@@ -524,7 +524,7 @@
int id_name_len;
- dbgf( DBGL_CHANGES, DBGT_INFO, "via dev: %s NB %s:dhash %8X.. id.rand %jX",
+ dbgf_all( DBGT_INFO, "via dev: %s NB %s:dhash %8X.. id.rand %jX",
pb->iif->name, pb->neigh_str, dhash->h.u32[0], desc->id.rand.u64[0]);
if (
@@ -592,7 +592,7 @@
avl_insert(&orig_tree, on, -300148);
}
- dbgf(DBGL_CHANGES, DBGT_INFO, "rcvd new desc SQN %d (old %d) from %s via %s NB %s",
+ dbgf_all( DBGT_INFO, "rcvd new desc SQN %d (old %d) from %s via %s NB %s",
ntohs(desc->dsc_sqn), on->desc0_sqn, desc->id.name, pb->iif->name, pb->neigh_str);
if (process_description_tlvs(on, desc, TLV_DEL_TEST_ADD, NULL) == TLVS_FAILURE)
@@ -690,7 +690,7 @@
if (tx_creator_result != ((int) ((ttn)->frame_data_length_target))) {
- dbgf(DBGL_CHANGES, DBGT_WARN, "msg %s to %s via %s mid4o %d send_data %d != target_data %d ",
+ dbgf_all( DBGT_WARN, "msg %s to %s via %s mid4o %d send_data %d != target_data %d ",
frame_handler[(ttn)->frame_type].name,
ipStr((ttn)->dst_ip4),
(ttn)->dev->name,
@@ -727,7 +727,7 @@
// struct link_node *ln_out = lndev_out ? lndev_out->link : NULL;
- dbgf(DBGL_CHANGES, DBGT_INFO, "%s %s %s sqn %d myIID4x %d neighIID4x %d",
+ dbgf_all( DBGT_INFO, "%s %s %s sqn %d myIID4x %d neighIID4x %d",
frame_handler[frame_type].name, ipStr(dest_ip4), dev_out->name, sqn, myIID4x, neighIID4x);
if (frame_handler[ frame_type ].min_rtq > (lndev_out ? lndev_out->mr[SQR_RTQ].val : 0)) {
@@ -824,7 +824,7 @@
void create_ogm_aggregation(void)
{
- dbgf(DBGL_CHANGES, DBGT_INFO, " ");
+ dbgf_all( DBGT_INFO, " ");
uint32_t n = 0;
@@ -840,7 +840,7 @@
IID_T start_iid = curr_iid;
- dbgf(DBGL_CHANGES, DBGT_INFO, "pending %d target %d start %d",
+ dbgf_all( DBGT_INFO, "pending %d target %d start %d",
ogm_aggreg_pending, target_aggregations, start_iid);
do {
@@ -855,10 +855,15 @@
on->ogm_sqn_aggregated + on->path_metric_algo.sqn_steps))
warn++;
- dbgf(warn ? DBGL_CHANGES : DBGL_ALL, warn ? DBGT_WARN : DBGT_INFO, "%s %s %d < %d",
- on->id.name, warn ? "delayed!" : "in-time",
- on->ogm_sqn_aggregated, on->ogm_sqn_to_be_send);
+ if ( warn ) {
+ dbgf(DBGL_CHANGES, DBGT_WARN, "%s delayed %d < %d",
+ on->id.name, on->ogm_sqn_aggregated, on->ogm_sqn_to_be_send);
+ } else {
+ dbgf_all(DBGT_INFO, "%s in-time %d < %d",
+ on->id.name, on->ogm_sqn_aggregated, on->ogm_sqn_to_be_send);
+ }
+
on->ogm_sqn_aggregated = on->ogm_sqn_to_be_send & on->path_metric_algo.sqn_mask;
ogm[n].orig_sqn = htons(on->ogm_sqn_to_be_send);
@@ -896,7 +901,7 @@
oan->tx_timestamp = (bmx_time - DEF_OGM_RESEND_INTERVAL);
oan->sqn = ++ogm_aggreg_sqn_max;
- dbgf(DBGL_CHANGES, DBGT_INFO, "aggregation_sqn %d aggregated_ogms %d", oan->sqn, n);
+ dbgf_all( DBGT_INFO, "aggregation_sqn %d aggregated_ogms %d", oan->sqn, n);
list_add_tail(&ogm_aggreg_list, &oan->list);
@@ -935,9 +940,9 @@
if ( oan_criteria || dhn_criteria ) {
if (oan_criteria) {
- dbgf(DBGL_CHANGES, DBGT_INFO, "aggreg_sqn %d ", oan_criteria->sqn);
+ dbgf_all(DBGT_INFO, "aggreg_sqn %d ", oan_criteria->sqn);
} else if (dhn_criteria) {
- dbgf(DBGL_CHANGES, DBGT_INFO, "NOT %s ", dhn_criteria->on->id.name);
+ dbgf_all(DBGT_INFO, "NOT %s ", dhn_criteria->on->id.name);
}
for (an = NULL; (dev = avl_iterate_item(&dev_ip4_tree, &an));)
@@ -958,7 +963,7 @@
assertion(-500446, (nn->best_rtq->key.dev));
assertion(-500447, (nn->best_rtq->key.dev->active));
- dbgf(DBGL_CHANGES, DBGT_INFO, " via %s to %s (redundant %d)",
+ dbgf_all( DBGT_INFO, " via %s to %s (redundant %d)",
nn->best_rtq->key.dev->name, nn->best_rtq->link->llip4_str,
nn->best_rtq->key.dev->misc_flag);
@@ -986,7 +991,7 @@
if (dev) {
- dbgf(DBGL_CHANGES, DBGT_INFO, "%s max %d active aggregations %d pending ogms %d expiery in %d ms",
+ dbgf_all( DBGT_INFO, "%s max %d active aggregations %d pending ogms %d expiery in %d ms",
dev->name, ogm_aggreg_sqn_max, ogm_aggreg_list.items, ogm_aggreg_pending,
(DEF_OGM_AGGREG_INTERVAL - ((uint32_t) (bmx_time - timestamp))));
@@ -1072,7 +1077,7 @@
hey0_rep->receiver_ip4 = ttn->dst_ip4;
hey0_rep->hello_dev_sqn = htons(ttn->sqn);
- dbgf(DBGL_CHANGES, DBGT_INFO, "dev %s %s to %s SQN %d",// dest_sid: %d",
+ dbgf_all( DBGT_INFO, "dev %s %s to %s SQN %d",// dest_sid: %d",
ttn->dev->name, ttn->dev->ip4_str, ipStr(ttn->dst_ip4), ttn->sqn/*, dtn->my_id_for_neigh*/);
return sizeof (struct msg_hello_reply);
@@ -1102,7 +1107,7 @@
update_metric(&lndev->mr[SQR_RTQ], &link_metric_algo[SQR_RTQ], ttn->dev->ogm_sqn, ttn->dev->ogm_sqn, 0);
}
- dbgf(DBGL_CHANGES, DBGT_INFO, "%s %s SQN %d", ttn->dev->name, ttn->dev->ip4_str, ttn->dev->ogm_sqn);
+ dbgf_all( DBGT_INFO, "%s %s SQN %d", ttn->dev->name, ttn->dev->ip4_str, ttn->dev->ogm_sqn);
return sizeof (struct msg_hello_adv);
}
@@ -1117,7 +1122,7 @@
req->receiver_ip4 = ttn->dst_ip4;
req->receiverIID4x = htons(ttn->neighIID4x);
- dbgf(DBGL_CHANGES, DBGT_INFO, "%s oif %s to %s requesting orig_did %d",
+ dbgf_all( DBGT_INFO, "%s oif %s to %s requesting orig_did %d",
frame_handler[ttn->frame_type].name, ttn->dev->name, ipStr(ttn->dst_ip4), ttn->neighIID4x);
return sizeof ( struct msg_description_request);
@@ -1204,7 +1209,7 @@
assertion(-500428, (ttn->frame_data_length_target <= buff_size));
- dbgf(DBGL_CHANGES, DBGT_INFO, " aggregation_sqn %d", ttn->sqn );
+ dbgf_all( DBGT_INFO, " aggregation_sqn %d", ttn->sqn );
list_for_each( list_pos, &ogm_aggreg_list )
{
@@ -1237,7 +1242,7 @@
ack->receiver_ip4 = ttn->dst_ip4;
ack->aggregation_sqn = htons(ttn->sqn);
- dbgf(DBGL_CHANGES, DBGT_INFO, " aggreg_sqn %d to %s", ttn->sqn, ipStr(ttn->dst_ip4));
+ dbgf_all( DBGT_INFO, " aggreg_sqn %d to %s", ttn->sqn, ipStr(ttn->dst_ip4));
return sizeof (struct msg_ogm_ack);
}
@@ -1255,10 +1260,10 @@
uint16_t msgs = (frame->length - (sizeof (struct frame_header) + sizeof (struct hdr_ogm_adv))) /
sizeof (struct msg_ogm_adv);
- dbgf(DBGL_CHANGES, DBGT_INFO, " ");
+ dbgf_all( DBGT_INFO, " ");
if (!nn) {
- dbgf(DBGL_CHANGES, DBGT_INFO, "via unknown neigh %s", pb->neigh_str );
+ dbgf_all( DBGT_INFO, "via unknown neigh %s", pb->neigh_str );
schedule_tx_task(pb->iif, pb->lndev, FRAME_TYPE_DHS0_REQS, 0, 0, 0, IID_RSVD_4YOU);
return frame->length;
}
@@ -1269,7 +1274,7 @@
if (bit_get(nn->ogm_aggregations_rcvd, OGM_AGGREG_SQN_CACHE_RANGE, aggregation_sqn)) {
- dbgf(DBGL_CHANGES, DBGT_INFO, "already known ogm_aggregation_sqn %d from neigh %s",
+ dbgf_all( DBGT_INFO, "already known ogm_aggregation_sqn %d from neigh %s",
aggregation_sqn, nn->dhn->on->id.name);
return frame->length;
@@ -1277,7 +1282,7 @@
if (((uint16_t) (nn->ogm_aggregation_rcvd_max - aggregation_sqn)) > OGM_AGGREG_SQN_CACHE_WARN) {
- dbgf( DBGL_SYS, DBGT_WARN, "neigh %s with unknown %s aggregation_sqn %d max %d ogms %d",
+ dbgf(DBGL_CHANGES, DBGT_WARN, "neigh %s with unknown %s aggregation_sqn %d max %d ogms %d",
pb->neigh_str, "OLD", aggregation_sqn, nn->ogm_aggregation_rcvd_max, msgs);
}
@@ -1298,7 +1303,7 @@
}
- dbgf(DBGL_CHANGES, DBGT_INFO, "neigh %s with unknown %s aggregation_sqn %d max %d ogms %d",
+ dbgf_all(DBGT_INFO, "neigh %s with unknown %s aggregation_sqn %d max %d ogms %d",
pb->neigh_str, "NEW", aggregation_sqn, nn->ogm_aggregation_rcvd_max, msgs);
uint16_t m;
@@ -1316,7 +1321,7 @@
if (dhn && (on = dhn->on) && ((SQN_T) (orig_sqn - on->ogm_sqn_min)) < on->ogm_sqn_range) {
- dbgf(DBGL_CHANGES, DBGT_INFO, " new orig_sqn %d / %d from %s neighIID4x %d via %s ",
+ dbgf_all(DBGT_INFO, " new orig_sqn %d / %d from %s neighIID4x %d via %s ",
orig_sqn, on->ogm_sqn_to_be_send, on->id.name, neighIID4x, pb->neigh_str);
update_orig_metrics(pb, on, orig_sqn);
@@ -1365,7 +1370,7 @@
bit_set(pb->ln->neigh->ogm_aggregations_acked, OGM_AGGREG_SQN_CACHE_RANGE, aggregation_sqn, 1);
- dbgf(DBGL_CHANGES, DBGT_INFO, "neigh %s sqn %d <= sqn_max %d",
+ dbgf_all(DBGT_INFO, "neigh %s sqn %d <= sqn_max %d",
pb->neigh_str, aggregation_sqn, ogm_aggreg_sqn_max);
@@ -1402,7 +1407,7 @@
if (orig_dhn == my_orig_node.dhn) {
- dbgf(DBGL_CHANGES, DBGT_INFO,
+ dbgf_all( DBGT_INFO,
"msg refers myself via %s neighIID4neigh %d neighIID4me %d",
pb->neigh_str, ln->neigh->neighIID4neigh, neighIID4x);
@@ -1470,7 +1475,7 @@
}
- dbgf(DBGL_CHANGES, DBGT_INFO, "via dev: %s NB %s:dhash %8X.. %s neighIID4x %d is_sender %d %s",
+ dbgf_all( DBGT_INFO, "via dev: %s NB %s:dhash %8X.. %s neighIID4x %d is_sender %d %s",
pb->iif->name, pb->neigh_str, dhash->h.u32[0],
(dsc ? "DESCRIPTION" : (cache ? "CACHED_DESCRIPTION" : (orig_dhn?"KNOWN":"UNDESCRIBED"))),
neighIID4x, is_sender,
@@ -1556,7 +1561,7 @@
dhn = process_dhash_description_neighIID4x(pb, &dhash0, desc0, neighIID4x, is_sender);
- dbgf(DBGL_CHANGES, DBGT_INFO, "rcvd %s desc0: %jX via %s NB %s",
+ 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);
@@ -1606,7 +1611,7 @@
IID_T myIID4x = ntohs(req->receiverIID4x);
uint16_t desc0_len = 0;
- dbg(DBGL_CHANGES, DBGT_INFO, "%s dest_llip4 %s myIID4x %d",
+ dbgf_all( DBGT_INFO, "%s dest_llip4 %s myIID4x %d",
frame_handler[frame_type].name, ipStr(req->receiver_ip4), myIID4x);
if ( req->receiver_ip4 != pb->iif->ip4_addr ) // if I am not asked
@@ -1666,7 +1671,7 @@
SQN_T sqn = ntohs(msg->hello_dev_sqn);
- dbgf(DBGL_CHANGES, DBGT_INFO, "via NB %s dev %s %s to %s SQN %d",
+ dbgf_all( DBGT_INFO, "via NB %s dev %s %s to %s SQN %d",
pb->neigh_str, pb->iif->name, pb->iif->ip4_str, ipStr(msg->receiver_ip4), sqn);
if ( msg->receiver_ip4 != pb->iif->ip4_addr )
@@ -1675,7 +1680,7 @@
if ((SQN_T) (pb->iif->ogm_sqn - sqn) > (SQN_T) local_rtq_lounge) {
- dbgf(DBGL_SYS, DBGT_INFO, "DAD-Alert invalid Link-Local SQN %d!=%d from %s via %s",
+ dbgf(DBGL_SYS, DBGT_ERR, "DAD-Alert invalid Link-Local SQN %d!=%d from %s via %s",
sqn, pb->iif->ogm_sqn, pb->neigh_str, pb->iif->name);
return FAILURE;
@@ -1722,7 +1727,7 @@
SQN_T sqn = ntohs(msg->hello_dev_sqn);
- dbgf(DBGL_CHANGES, DBGT_INFO, "NB %s via %s SQN %d ", pb->neigh_str, pb->iif->name, sqn);
+ dbgf_all( DBGT_INFO, "NB %s via %s SQN %d ", pb->neigh_str, pb->iif->name, sqn);
// skip updateing link_node if this SQN is known but not new
if ((ln->rq_sqn_max || ln->rq_time_max) &&
@@ -1768,7 +1773,7 @@
struct pkt_frame_handler *fhdl = &frame_handler[t];
- dbgf(DBGL_CHANGES, DBGT_INFO, "type %s size %d flags 0x%X",
+ dbgf_all( DBGT_INFO, "type %s size %d flags 0x%X",
fhdl->name, flength, fhdr->flags);
@@ -1913,7 +1918,7 @@
assertion(-500424, (fhdl->tx_msg_creator));
assertion(-500441, (ttn->myIID4x == IID_RSVD_4YOU));
- dbgf(DBGL_CHANGES, DBGT_INFO, "%s type %d=%s %s",
+ dbgf_all( DBGT_INFO, "%s type %d=%s %s",
dev->name, type, fhdl->name, "from dev->my_tx_tasks");
if (tx_task_obsolete(dev, type, ttn)) {
@@ -1962,7 +1967,7 @@
assertion(-500440, (ttn->frame_type == type));
- dbgf(DBGL_CHANGES, DBGT_INFO, "%s type %d=%s %s",
+ dbgf_all( DBGT_INFO, "%s type %d=%s %s",
dev->name, type, fhdl->name, "from dev->tx_tasks_list");
if (ttn->tx_timestamp == bmx_time) {
@@ -2037,7 +2042,7 @@
frame_hdr->length = htons(length);
frame_hdr->flags |= flags;
- dbgf(DBGL_ALL, DBGT_INFO, "send frame type %s size %d", fhdl->name, length);
+ dbgf_all( DBGT_INFO, "send frame type %s size %d", fhdl->name, length);
}
@@ -2053,7 +2058,7 @@
send_udp_packet(tx_buff, packet_size, &dev->ip4_netwbrc_addr, dev->unicast_sock);
- dbgf(DBGL_ALL, DBGT_INFO, "send packet size %d via dev %s", packet_size, dev->name);
+ dbgf_all( DBGT_INFO, "send packet size %d via dev %s", packet_size, dev->name);
packet_size = sizeof ( struct packet_header);
packet_full = NO;
@@ -2081,7 +2086,7 @@
register_task( my_hello_interval, schedule_my_hello_message, dev );
- dbgf(DBGL_CHANGES, DBGT_INFO, "%s", dev->name);
+ dbgf_all( DBGT_INFO, "%s", dev->name);
if (!LIST_EMPTY(&(dev->tx_tasks_list[FRAME_TYPE_HI40_ADVS]))) {
dbgf( DBGL_SYS, DBGT_ERR, " ");
@@ -2101,7 +2106,7 @@
if (((uint32_t) (my_orig_node.ogm_sqn_to_be_send + 1 - my_orig_node.ogm_sqn_min)) < my_orig_node.ogm_sqn_range) {
ogm_aggreg_pending++;
- dbgf(DBGL_CHANGES, DBGT_INFO, "ogm_sqn %d", my_orig_node.ogm_sqn_to_be_send);
+ dbgf_all(DBGT_INFO, "ogm_sqn %d", my_orig_node.ogm_sqn_to_be_send);
} else {
@@ -2194,7 +2199,7 @@
my_desc0_tlv_len += sizeof (struct frame_header) + msgs_size;
- dbgf(DBGL_CHANGES, DBGT_INFO, "added %s size %d",
+ dbgf_all(DBGT_INFO, "added %s size %d",
description0_tlv_handler[tlvt].name, msgs_size);
}
@@ -2206,7 +2211,7 @@
dsc->dsc_tlvs_len = htons(my_desc0_tlv_len);
- dbgf(DBGL_CHANGES, DBGT_INFO, "added tlv total of %d ", my_desc0_tlv_len);
+ dbgf_all(DBGT_INFO, "added tlv total of %d ", my_desc0_tlv_len);
// calculate hash: like shown in CTaoCrypt Usage Reference:
ShaUpdate(&bmx_sha, (byte*)dsc, (sizeof (struct description) + my_desc0_tlv_len));