Skip to content

Commit 6c8fcbc

Browse files
lmolinarzr
authored andcommitted
ZGW-3403: Support single temporal associations
Multiple temporal associations may break the communication with end devices that have a single SPAN entry. This is the case for some S500 devices. Because of the use of multiple temporal associations, the Z/IP Gateway can communicate with the same end device using different SPANs. As a consequence, end devices have to store multiple SPANs to communicate with the Z/IP Gateway: one for persistent associations and one for temporal associations. In the case of end devices with the capacity to store only one SPAN, they will have to refresh the SPAN whenever the Z/IP Gateway switches to a different temporal association. If the SPAN changes in between two frame transmissions, then the end device will not be able to use the correct SPAN and will not decrypt the frames. When using a single temporal association, the Z/IP Gateway will communicate using the same SPAN. Therefore, end devices are not required to track distinct SPANs for the same controller. The default behavior remains the same, i.e., use four temporal associations. The use of a single temporal association is optional and has to be activated in the configuration file. Since the Z/IP Gateway is in "maintenance mode," and to minimize the impact on current users, it was decided to add this configuration parameter. Note that this change does not affect Z-Wave LR, where the Z/IP Gateway continues using four temporal associations. For the record the change has been tested on a US device. Thanks-to: Philippe Coval <[email protected]> Relate-to: #5 Relate-to: #21 Forwarded: lmolina#1
1 parent f138c88 commit 6c8fcbc

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

contiki/platform/linux/parse_config.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,20 @@ void ConfigInit()
421421
} else {
422422
cfg.is_max_lr_powerlevel_set = 0;
423423
}
424+
425+
cfg.single_classic_temp_association = atoi(
426+
config_get_val("ZipAssociationLimit", "0"));
427+
428+
if ((0 != cfg.single_classic_temp_association) &&
429+
(1 != cfg.single_classic_temp_association)) {
430+
WRN_PRINTF("Wrong configuration value for "
431+
"\"ZipAssociationLimit\" (%d). Ignoring",
432+
cfg.single_classic_temp_association);
433+
434+
cfg.single_classic_temp_association = 0;
435+
}
424436
}
425-
437+
426438
/*We wan't command line to override config file.*/
427439
parse_prog_args();
428440
}

src/Bridge_temp_assoc.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,12 @@ temp_assoc_add_to_association_table(temp_association_t *new_a)
390390

391391
static bool check_available_temp_assoc()
392392
{
393-
uint8_t temp_assoc_count = list_length(temp_association_table);
393+
uint8_t classic_temp_associations = MAX_CLASSIC_TEMP_ASSOCIATIONS;
394+
395+
if (0 != cfg.single_classic_temp_association)
396+
{
397+
classic_temp_associations = 1;
398+
}
394399

395400
if (is_lr_node(nodeOfIP(&(BACKUP_UIP_IP_BUF->destipaddr))) &&
396401
(lr_temp_assoc_next_nodeid_idx < MAX_LR_TEMP_ASSOCIATIONS))
@@ -401,7 +406,7 @@ static bool check_available_temp_assoc()
401406
return true;
402407
}
403408
else if (is_classic_node(nodeOfIP(&(BACKUP_UIP_IP_BUF->destipaddr))) &&
404-
(temp_assoc_next_nodeid_idx < MAX_CLASSIC_TEMP_ASSOCIATIONS))
409+
(temp_assoc_next_nodeid_idx < classic_temp_associations))
405410
{
406411
DBG_PRINTF("%d classic temp associations are currently allocated (leaving %d unallocated)\n",
407412
temp_assoc_next_nodeid_idx + 1,

src/zip_router_config.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,18 @@ struct router_config {
305305
* sets the LBT Threshold anytime ZIPGW resets the Z-Wave chip.
306306
* ZW_SetListenBeforeTalkThreshold()
307307
*/
308-
uint8_t zw_lbt;
308+
uint8_t zw_lbt;
309+
310+
/** Configuration parameter single_classic_temp_association in zipgateway.cfg
311+
*
312+
* Allows to limit to a single classical temporal association. By default, the
313+
* Z/IP Gateway uses four classical temporal associations. If the parameter
314+
* `single_classic_temp_association` is set, the Z/IP Gateway will use
315+
* only one classical temporal associations.
316+
* Allowed values are 1=enable or 0=disable (default).
317+
* This is an experimental feature.
318+
*/
319+
uint8_t single_classic_temp_association;
309320
};
310321

311322
/**

0 commit comments

Comments
 (0)