Skip to content

Commit e74e35d

Browse files
committed
Fix iid mask len.
Set xTR-ID not only por NAT traversal
1 parent 4225d24 commit e74e35d

7 files changed

Lines changed: 37 additions & 24 deletions

File tree

oor/config/oor_config_confuse.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -596,11 +596,6 @@ configure_xtr(cfg_t *cfg)
596596

597597
xtr->nat_aware = cfg_getbool(cfg, "nat_traversal_support") ? TRUE:FALSE;
598598
if(xtr->nat_aware){
599-
if (nat_set_xTR_ID(xtr) != GOOD){
600-
OOR_LOG(LERR,"Could not generate xTR-ID");
601-
return (BAD);
602-
}
603-
nat_set_site_ID(xtr, 0);
604599
default_rloc_afi = AF_INET;
605600
OOR_LOG(LDBG_1, "NAT support enabled. Set defaul RLOC to IPv4 family");
606601
}
@@ -622,7 +617,12 @@ configure_xtr(cfg_t *cfg)
622617
return (BAD);
623618
}
624619

625-
620+
/* Generate xTR identifier */
621+
if (tr_set_xTR_ID(xtr) != GOOD){
622+
OOR_LOG(LERR,"Could not generate xTR-ID");
623+
return (BAD);
624+
}
625+
tr_set_site_ID(xtr, 0);
626626

627627
/* destroy the hash table */
628628
shash_destroy(lcaf_ht);
@@ -648,11 +648,6 @@ configure_mn(cfg_t *cfg)
648648

649649
xtr->nat_aware = cfg_getbool(cfg, "nat_traversal_support") ? TRUE:FALSE;
650650
if(xtr->nat_aware){
651-
if (nat_set_xTR_ID(xtr) != GOOD){
652-
OOR_LOG(LERR,"Could not generate xTR-ID");
653-
return (BAD);
654-
}
655-
nat_set_site_ID(xtr, 0);
656651
default_rloc_afi = AF_INET;
657652
OOR_LOG(LDBG_1, "NAT support enabled. Set defaul RLOC to IPv4 family");
658653
}
@@ -674,6 +669,13 @@ configure_mn(cfg_t *cfg)
674669
return (BAD);
675670
}
676671

672+
/* Generate xTR identifier */
673+
if (tr_set_xTR_ID(xtr) != GOOD){
674+
OOR_LOG(LERR,"Could not generate xTR-ID");
675+
return (BAD);
676+
}
677+
tr_set_site_ID(xtr, 0);
678+
677679
/* destroy the hash table */
678680
shash_destroy(lcaf_ht);
679681

oor/config/oor_config_functions.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ process_mapping_config(oor_ctrl_dev_t * dev, shash_t * lcaf_ht,
10051005
conf_mapping->iid = 0;
10061006
}
10071007
if (conf_mapping->iid > 0){
1008-
iidmlen = (lisp_addr_ip_afi(ip_eid_prefix) == AF_INET) ? 32: 128;
1008+
iidmlen = 32;
10091009
eid_prefix = lisp_addr_new_init_iid(conf_mapping->iid, ip_eid_prefix, iidmlen);
10101010
}else{
10111011
eid_prefix = lisp_addr_clone(ip_eid_prefix);
@@ -1302,12 +1302,12 @@ rtr_add_rtr_ms_node(lisp_rtr_t *rtr, char *addr_str, char *key, char *draft_vers
13021302
}
13031303

13041304
void
1305-
nat_set_site_ID(lisp_xtr_t *xtr, uint64_t site_id)
1305+
tr_set_site_ID(lisp_xtr_t *xtr, uint64_t site_id)
13061306
{
13071307
xtr->site_id = site_id;
13081308
}
13091309
int
1310-
nat_set_xTR_ID(lisp_xtr_t *xtr)
1310+
tr_set_xTR_ID(lisp_xtr_t *xtr)
13111311
{
13121312
FILE *xtr_id_file;
13131313
lisp_xtr_id *xtr_id = &(xtr->xtr_id);
@@ -1357,7 +1357,7 @@ nat_set_xTR_ID(lisp_xtr_t *xtr)
13571357
}
13581358
fclose(xtr_id_file);
13591359

1360-
OOR_LOG(LDBG_2,"nat_set_xTR_ID: xTR_ID initialiazed with value: %s",
1360+
OOR_LOG(LDBG_2,"tr_set_xTR_ID: xTR_ID initialiazed with value: %s",
13611361
get_char_from_xTR_ID(xtr_id));
13621362

13631363
return(GOOD);

oor/config/oor_config_functions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ rtr_add_rtr_ms_node(lisp_rtr_t *rtr, char *addr_str, char *key, char *draft_vers
201201
int
202202
ms_add_rtr_node(lisp_ms_t *ms, char *name, char *addr_str, char *key);
203203

204-
void nat_set_site_ID(lisp_xtr_t *xtr, uint64_t site_id);
205-
int nat_set_xTR_ID(lisp_xtr_t *xtr);
204+
void tr_set_site_ID(lisp_xtr_t *xtr, uint64_t site_id);
205+
int tr_set_xTR_ID(lisp_xtr_t *xtr);
206206

207207

208208

oor/config/oor_config_uci.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,6 @@ configure_xtr(struct uci_context *ctx, struct uci_package *pck)
283283

284284
if (nat_aware == TRUE){
285285
xtr->nat_aware = TRUE;
286-
nat_set_xTR_ID(xtr);
287-
nat_set_site_ID(xtr, 0);
288286
default_rloc_afi = AF_INET;
289287
OOR_LOG(LDBG_1, "NAT support enabled. Set defaul RLOC to IPv4 family");
290288
}else{
@@ -541,6 +539,13 @@ configure_xtr(struct uci_context *ctx, struct uci_package *pck)
541539
}
542540
}
543541

542+
/* Generate xTR identifier */
543+
if (tr_set_xTR_ID(xtr) != GOOD){
544+
OOR_LOG(LERR,"Could not generate xTR-ID");
545+
return (BAD);
546+
}
547+
tr_set_site_ID(xtr, 0);
548+
544549
/* Calculate forwarding info por proxy-etrs */
545550
if (xtr->tr.fwd_policy->init_map_cache_policy_inf(xtr->tr.fwd_policy_dev_parm,ipv4_petrs_mc) != GOOD){
546551
OOR_LOG(LDBG_1, "Couldn't initiate routing info for PeTRs for IPv4 EIDs!.");
@@ -644,8 +649,6 @@ configure_mn(struct uci_context *ctx, struct uci_package *pck)
644649

645650
if (nat_aware == TRUE){
646651
xtr->nat_aware = TRUE;
647-
nat_set_xTR_ID(xtr);
648-
nat_set_site_ID(xtr, 0);
649652
default_rloc_afi = AF_INET;
650653
OOR_LOG(LDBG_1, "NAT support enabled. Set defaul RLOC to IPv4 family");
651654
}else{
@@ -901,6 +904,13 @@ configure_mn(struct uci_context *ctx, struct uci_package *pck)
901904
}
902905
}
903906

907+
/* Generate xTR identifier */
908+
if (tr_set_xTR_ID(xtr) != GOOD){
909+
OOR_LOG(LERR,"Could not generate xTR-ID");
910+
return (BAD);
911+
}
912+
tr_set_site_ID(xtr, 0);
913+
904914
/* Calculate forwarding info por proxy-etrs */
905915
if (xtr->tr.fwd_policy->init_map_cache_policy_inf(xtr->tr.fwd_policy_dev_parm,ipv4_petrs_mc) != GOOD){
906916
OOR_LOG(LDBG_1, "Couldn't initiate routing info for PeTRs for IPv4 EIDs!.");

oor/control/lisp_rtr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ rtr_get_forwarding_entry(oor_ctrl_dev_t *dev, packet_tuple_t *tuple)
432432
map_loc_e = rtr->all_locs_map;
433433

434434
if (tuple->iid > 0){
435-
iidmlen = (lisp_addr_ip_afi(&tuple->src_addr) == AF_INET) ? 32: 128;
435+
iidmlen = 32;
436436
src_eid = lisp_addr_new_init_iid(tuple->iid, &tuple->src_addr, iidmlen);
437437
dst_eid = lisp_addr_new_init_iid(tuple->iid, &tuple->dst_addr, iidmlen);
438438
}else{

oor/control/lisp_xtr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ xtr_get_forwarding_entry(oor_ctrl_dev_t *dev, packet_tuple_t *tuple)
648648

649649

650650
if (tuple->iid > 0){
651-
iidmlen = (lisp_addr_ip_afi(&tuple->src_addr) == AF_INET) ? 32: 128;
651+
iidmlen = 32;
652652
src_eid = lisp_addr_new_init_iid(tuple->iid, &tuple->src_addr, iidmlen);
653653
dst_eid = lisp_addr_new_init_iid(tuple->iid, &tuple->dst_addr, iidmlen);
654654
}else{
@@ -1057,6 +1057,7 @@ xtr_build_and_send_map_reg(lisp_xtr_t * xtr, mapping_t * m, map_server_elt *ms,
10571057
}
10581058

10591059
hdr = lisp_msg_hdr(b);
1060+
10601061
MREG_PROXY_REPLY(hdr) = ms->proxy_reply;
10611062
MREG_NONCE(hdr) = nonce;
10621063

oor/lib/lisp_site.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ lisp_site_prefix_init(lisp_addr_t *eid, uint32_t iid, int key_type, char *key,
3131

3232
sp = xzalloc(sizeof(lisp_site_prefix_t));
3333
if (iid > 0){
34-
iidmlen = (lisp_addr_ip_afi(eid) == AF_INET) ? 32: 128;
34+
iidmlen = 32;
3535
sp->eid_prefix = lisp_addr_new_init_iid(iid, eid, iidmlen);
3636
}else{
3737
sp->eid_prefix = lisp_addr_clone(eid);

0 commit comments

Comments
 (0)