Skip to content

Commit

Permalink
New NOXID option to avoid wasting time to listed station(s)
Browse files Browse the repository at this point in the history
which understand SABME but not XID.
  • Loading branch information
wb2osz committed Jul 2, 2018
1 parent 22f6457 commit 38ab57a
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ax25_link.c
Expand Up @@ -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) {

Expand Down
38 changes: 38 additions & 0 deletions config.c
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
*/
Expand Down
7 changes: 7 additions & 0 deletions config.h
Expand Up @@ -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.

Expand Down

0 comments on commit 38ab57a

Please sign in to comment.