Bug Fixes of Multi Face
diff --git a/macbook.conf b/macbook.conf
index b78921a..2bfe740 100644
--- a/macbook.conf
+++ b/macbook.conf
@@ -1,8 +1,8 @@
#----configuration file for macbook----------
#
router-name /ndn/memphis.edu/netlab/macbook/
-ccnneighbor /ndn/memphis.edu/dunhall/castor face11
-ccnneighbor /ndn/memphis.edu/netlab/pollux face13
+ccnneighbor /ndn/memphis.edu/dunhall/castor face9
+ccnneighbor /ndn/memphis.edu/netlab/pollux face11
ccnname /ndn/memphis.edu/patterson
ccnname /ndn/memphis.edu/houston/
#------lsdb-synch-interval-----
@@ -11,6 +11,6 @@
interest-resend-time 5
lsa-refresh-time 600
router-dead-interval 900
-multi-path-face-num 2
+multi-path-face-num 2
logdir /Users/akmhoque/NLSR2.0
diff --git a/nlsr_npt.c b/nlsr_npt.c
index 5116b4d..25c3c38 100644
--- a/nlsr_npt.c
+++ b/nlsr_npt.c
@@ -91,14 +91,17 @@
for ( i=0; i < num_face ; i++)
{
int face=faces[i];
- res_fle = hashtb_seek(ef, &face, sizeof(face), 0);
-
- if ( res_fle == HT_NEW_ENTRY )
+ if ( face != NO_FACE && face != ZERO_FACE)
{
- struct face_list_entry *fle=(struct face_list_entry *)malloc(sizeof(struct face_list_entry));
- fle=ef->data;
- fle->next_hop_face=face;
- fle->route_cost=route_costs[i];
+ res_fle = hashtb_seek(ef, &face, sizeof(face), 0);
+
+ if ( res_fle == HT_NEW_ENTRY )
+ {
+ struct face_list_entry *fle=(struct face_list_entry *)malloc(sizeof(struct face_list_entry));
+ fle=ef->data;
+ fle->next_hop_face=face;
+ fle->route_cost=route_costs[i];
+ }
}
}
@@ -144,16 +147,18 @@
for ( i=0; i< num_face ; i ++)
{
int face=faces[i];
- res_fle = hashtb_seek(ef, &face, sizeof(face), 0);
-
- if ( res_fle == HT_NEW_ENTRY )
+ if ( face != NO_FACE && face != ZERO_FACE)
{
- struct face_list_entry *fle=(struct face_list_entry *)malloc(sizeof(struct face_list_entry));
- fle=ef->data;
- fle->next_hop_face=face;
- fle->route_cost=route_costs[i];
+ res_fle = hashtb_seek(ef, &face, sizeof(face), 0);
+
+ if ( res_fle == HT_NEW_ENTRY )
+ {
+ struct face_list_entry *fle=(struct face_list_entry *)malloc(sizeof(struct face_list_entry));
+ fle=ef->data;
+ fle->next_hop_face=face;
+ fle->route_cost=route_costs[i];
+ }
}
-
}
hashtb_end(ef);
}
@@ -229,24 +234,28 @@
for( j=first_face; j>= last_face; j--)
{
- if ( j == last_face )
+ //printf("Adding face: Name:%s Face: %d\n",nle->name,faces[j]);
+ //printf("Orig Router: %s \n",orig_router);
+ //printf("Name Prefix: %s \n",nle->name);
+ //printf("Is neighbor Orig Router: %d \n",is_neighbor(orig_router));
+ //printf("Is neighbor Name Prefix: %d \n",is_neighbor(nle->name));
+
+ if ( is_neighbor(orig_router) == 0 )
{
- if( is_neighbor(nle->name) == 0 )
- {
- printf("Adding face: Name:%s Face: %d\n",nle->name,faces[j]);
- add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_REG, faces[j]);
- }
+ printf("Adding face: Name:%s Face: %d\n",nle->name,faces[j]);
+ add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_REG, faces[j]);
}
else
{
- if ( num_face-nlsr->multi_path_face_num > 0 && is_neighbor(orig_router) == 0 )
+ if ( j == last_face && is_neighbor(nle->name)==0)
{
printf("Adding face: Name:%s Face: %d\n",nle->name,faces[j]);
add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_REG, faces[j]);
}
}
}
-
+
+
hashtb_next(enle);
}
hashtb_end(enle);
@@ -335,22 +344,21 @@
for( j=first_face; j>= last_face; j--)
{
- if ( j == last_face )
+
+ if ( is_neighbor(orig_router) == 0 )
{
- if( is_neighbor(nle->name) == 0 )
- {
- printf("Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);
- add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, faces[j]);
- }
+ printf("Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);
+ add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, faces[j]);
}
else
{
- if ( num_face-nlsr->multi_path_face_num > 0 && is_neighbor(orig_router) == 0 )
+ if ( j == last_face && is_neighbor(nle->name)==0)
{
printf("Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);
add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, faces[j]);
}
}
+
}
@@ -729,6 +737,9 @@
nle=enle->data;
//delete all the fib entries here
+ printf("Deleting face: Name:%s Face: %d\n",nle->name,fle->next_hop_face);
+
+
if( is_neighbor(nle->name) == 0 )
{
printf("Deleting face: Name:%s Face: %d\n",nle->name,fle->next_hop_face);
@@ -926,17 +937,14 @@
for( j=first_face; j>= last_face; j--)
{
- if ( j == last_face )
+ if ( is_neighbor(orig_router) == 0 )
{
- if( is_neighbor(nle->name) == 0 )
- {
- printf("Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);
- add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, faces[j]);
- }
+ printf("Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);
+ add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, faces[j]);
}
else
{
- if ( num_face-nlsr->multi_path_face_num > 0 && is_neighbor(orig_router) == 0 )
+ if ( j == last_face && is_neighbor(nle->name)==0)
{
printf("Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);
add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, faces[j]);
diff --git a/nlsr_npt.h b/nlsr_npt.h
index c191579..587c8be 100644
--- a/nlsr_npt.h
+++ b/nlsr_npt.h
@@ -2,6 +2,7 @@
#define _NLSR_NPT_H_
#define NO_FACE -12345
+#define ZERO_FACE 0
struct npt_entry
{
diff --git a/nlsr_route.c b/nlsr_route.c
index fa6eef2..a5956d8 100644
--- a/nlsr_route.c
+++ b/nlsr_route.c
@@ -56,6 +56,7 @@
do_old_routing_table_updates();
clear_old_routing_table();
print_routing_table();
+ print_npt();
int i;
int **adj_matrix;