uds: Prevent unintentional announce message timeouts.

During the configuration rework, the announce span was wrongly converted
into a hard coded macro.  In addition, the announceReceiptTimeout option
inadvertently became non-zero for the UDS port.  As a result, the UDS port
sets a useless announce message timer, causing the code to close and reopen
the UDS port every few seconds.

This bug has an interesting history.  It was first reported and fixed in
commit f36af8e0 ("uds: disable the accidentally enabled announce timer.").

That very fix was wrongly removed in commit 54f45063 ("port: change
'announce_span' into a macro.").  Because of various code changes, this
bad commit cannot be simply reverted now.

This patch re-introduces the 'announce_span' variable and clears both it
and 'announceReceiptTimeout' for the UDS port, effectively disabling the
announce message timer.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2016-07-05 14:48:59 +02:00
parent 0d61027fd3
commit 3938cbc101
2 changed files with 7 additions and 1 deletions

View File

@ -966,6 +966,10 @@ struct clock *clock_create(enum clock_type type, struct config *config,
/* Configure the UDS. */ /* Configure the UDS. */
snprintf(udsif->name, sizeof(udsif->name), "%s", snprintf(udsif->name, sizeof(udsif->name), "%s",
config_get_string(config, NULL, "uds_address")); config_get_string(config, NULL, "uds_address"));
if (config_set_section_int(config, udsif->name,
"announceReceiptTimeout", 0)) {
return NULL;
}
if (config_set_section_int(config, udsif->name, if (config_set_section_int(config, udsif->name,
"delay_mechanism", DM_AUTO)) { "delay_mechanism", DM_AUTO)) {
return NULL; return NULL;

4
port.c
View File

@ -103,6 +103,7 @@ struct port {
TimeInterval peerMeanPathDelay; TimeInterval peerMeanPathDelay;
Integer8 logAnnounceInterval; Integer8 logAnnounceInterval;
UInteger8 announceReceiptTimeout; UInteger8 announceReceiptTimeout;
int announce_span;
UInteger8 syncReceiptTimeout; UInteger8 syncReceiptTimeout;
UInteger8 transportSpecific; UInteger8 transportSpecific;
Integer8 logSyncInterval; Integer8 logSyncInterval;
@ -958,7 +959,7 @@ static int port_set_announce_tmo(struct port *p)
{ {
return set_tmo_random(p->fda.fd[FD_ANNOUNCE_TIMER], return set_tmo_random(p->fda.fd[FD_ANNOUNCE_TIMER],
p->announceReceiptTimeout, p->announceReceiptTimeout,
ANNOUNCE_SPAN, p->logAnnounceInterval); p->announce_span, p->logAnnounceInterval);
} }
static int port_set_delay_tmo(struct port *p) static int port_set_delay_tmo(struct port *p)
@ -2565,6 +2566,7 @@ struct port *port_open(int phc_index,
p->name = interface->name; p->name = interface->name;
p->asymmetry = config_get_int(cfg, p->name, "delayAsymmetry"); p->asymmetry = config_get_int(cfg, p->name, "delayAsymmetry");
p->asymmetry <<= 16; p->asymmetry <<= 16;
p->announce_span = transport == TRANS_UDS ? 0 : ANNOUNCE_SPAN;
p->follow_up_info = config_get_int(cfg, p->name, "follow_up_info"); p->follow_up_info = config_get_int(cfg, p->name, "follow_up_info");
p->freq_est_interval = config_get_int(cfg, p->name, "freq_est_interval"); p->freq_est_interval = config_get_int(cfg, p->name, "freq_est_interval");
p->hybrid_e2e = config_get_int(cfg, p->name, "hybrid_e2e"); p->hybrid_e2e = config_get_int(cfg, p->name, "hybrid_e2e");