From 38ab57afa45a872e53b5221907e34a8a4abed93f Mon Sep 17 00:00:00 2001 From: wb2osz Date: Mon, 2 Jul 2018 12:18:23 -0400 Subject: [PATCH] New NOXID option to avoid wasting time to listed station(s) which understand SABME but not XID. --- ax25_link.c | 11 +++++++++++ config.c | 38 ++++++++++++++++++++++++++++++++++++++ config.h | 7 +++++++ 3 files changed, 56 insertions(+) diff --git a/ax25_link.c b/ax25_link.c index 4d352b48..0e1bb3fa 100644 --- a/ax25_link.c +++ b/ax25_link.c @@ -6357,7 +6357,18 @@ static void mdl_negotiate_request (ax25_dlsm_t *S) int p = 1; int nopid = 0; packet_t pp; + int n; + +// At least one known [partial] v2.2 implementation understands SABME but not XID. +// Rather than wasting time, sending XID repeatedly until giving up, we have a workaround. +// The configuration file can contain a list of stations known not to respond to XID. +// Obviously this applies only to v2.2 because XID was not part of v2.0. + for (n = 0; n < g_misc_config_p->noxid_count; n++) { + if (strcmp(S->addrs[PEERCALL],g_misc_config_p->noxid_addrs[n]) == 0) { + return; + } + } switch (S->mdl_state) { diff --git a/config.c b/config.c index 86a36557..8c367e2c 100644 --- a/config.c +++ b/config.c @@ -904,6 +904,8 @@ void config_init (char *fname, struct audio_s *p_audio_config, p_misc_config->maxv22 = AX25_N2_RETRY_DEFAULT / 2; /* Max SABME before falling back to SABM. */ p_misc_config->v20_addrs = NULL; /* Go directly to v2.0 for stations listed. */ p_misc_config->v20_count = 0; + p_misc_config->noxid_addrs = NULL; /* Don't send XID to these stations. */ + p_misc_config->noxid_count = 0; /* * Try to extract options from a file. @@ -4796,6 +4798,42 @@ void config_init (char *fname, struct audio_s *p_audio_config, } +/* + * NOXID address [ address ... ] - Stations known not to understand XID. + * After connecting to these (with v2.2 obviously), don't try using XID commmand. + * AX.25 for Linux is the one known case so far. + * Possible to have multiple and they are cummulative. + */ + + else if (strcasecmp(t, "NOXID") == 0) { + + t = split(NULL,0); + if (t == NULL) { + text_color_set(DW_COLOR_ERROR); + dw_printf ("Line %d: Missing address(es) for NOXID.\n", line); + continue; + } + + while (t != NULL) { + int const strict = 2; + char call_no_ssid[AX25_MAX_ADDR_LEN]; + int ssid, heard; + + if (ax25_parse_addr (AX25_DESTINATION, t, strict, call_no_ssid, &ssid, &heard)) { + p_misc_config->noxid_addrs = (char**)realloc (p_misc_config->noxid_addrs, sizeof(char*) * (p_misc_config->noxid_count + 1)); + p_misc_config->noxid_addrs[p_misc_config->noxid_count++] = strdup(t); + } + else { + text_color_set(DW_COLOR_ERROR); + dw_printf ("Line %d: Invalid station address for NOXID command.\n", line); + + // continue processing any others following. + } + t = split(NULL,0); + } + } + + /* * Invalid command. */ diff --git a/config.h b/config.h index 675d2924..8a3c013e 100644 --- a/config.h +++ b/config.h @@ -111,6 +111,13 @@ struct misc_config_s { int v20_count; /* Number of station addresses in array above. */ + char **noxid_addrs; /* Stations known not to understand XID command so don't */ + /* waste time sending it and eventually giving up. */ + /* AX.25 for Linux is the one known case, so far, where */ + /* SABME is implemented but XID is not. */ + + int noxid_count; /* Number of station addresses in array above. */ + // Beacons.