Skip to content

Commit 38ab57a

Browse files
committed
New NOXID option to avoid wasting time to listed station(s)
which understand SABME but not XID.
1 parent 22f6457 commit 38ab57a

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

ax25_link.c

+11
Original file line numberDiff line numberDiff line change
@@ -6357,7 +6357,18 @@ static void mdl_negotiate_request (ax25_dlsm_t *S)
63576357
int p = 1;
63586358
int nopid = 0;
63596359
packet_t pp;
6360+
int n;
6361+
6362+
// At least one known [partial] v2.2 implementation understands SABME but not XID.
6363+
// Rather than wasting time, sending XID repeatedly until giving up, we have a workaround.
6364+
// The configuration file can contain a list of stations known not to respond to XID.
6365+
// Obviously this applies only to v2.2 because XID was not part of v2.0.
63606366

6367+
for (n = 0; n < g_misc_config_p->noxid_count; n++) {
6368+
if (strcmp(S->addrs[PEERCALL],g_misc_config_p->noxid_addrs[n]) == 0) {
6369+
return;
6370+
}
6371+
}
63616372

63626373
switch (S->mdl_state) {
63636374

config.c

+38
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,8 @@ void config_init (char *fname, struct audio_s *p_audio_config,
904904
p_misc_config->maxv22 = AX25_N2_RETRY_DEFAULT / 2; /* Max SABME before falling back to SABM. */
905905
p_misc_config->v20_addrs = NULL; /* Go directly to v2.0 for stations listed. */
906906
p_misc_config->v20_count = 0;
907+
p_misc_config->noxid_addrs = NULL; /* Don't send XID to these stations. */
908+
p_misc_config->noxid_count = 0;
907909

908910
/*
909911
* Try to extract options from a file.
@@ -4796,6 +4798,42 @@ void config_init (char *fname, struct audio_s *p_audio_config,
47964798
}
47974799

47984800

4801+
/*
4802+
* NOXID address [ address ... ] - Stations known not to understand XID.
4803+
* After connecting to these (with v2.2 obviously), don't try using XID commmand.
4804+
* AX.25 for Linux is the one known case so far.
4805+
* Possible to have multiple and they are cummulative.
4806+
*/
4807+
4808+
else if (strcasecmp(t, "NOXID") == 0) {
4809+
4810+
t = split(NULL,0);
4811+
if (t == NULL) {
4812+
text_color_set(DW_COLOR_ERROR);
4813+
dw_printf ("Line %d: Missing address(es) for NOXID.\n", line);
4814+
continue;
4815+
}
4816+
4817+
while (t != NULL) {
4818+
int const strict = 2;
4819+
char call_no_ssid[AX25_MAX_ADDR_LEN];
4820+
int ssid, heard;
4821+
4822+
if (ax25_parse_addr (AX25_DESTINATION, t, strict, call_no_ssid, &ssid, &heard)) {
4823+
p_misc_config->noxid_addrs = (char**)realloc (p_misc_config->noxid_addrs, sizeof(char*) * (p_misc_config->noxid_count + 1));
4824+
p_misc_config->noxid_addrs[p_misc_config->noxid_count++] = strdup(t);
4825+
}
4826+
else {
4827+
text_color_set(DW_COLOR_ERROR);
4828+
dw_printf ("Line %d: Invalid station address for NOXID command.\n", line);
4829+
4830+
// continue processing any others following.
4831+
}
4832+
t = split(NULL,0);
4833+
}
4834+
}
4835+
4836+
47994837
/*
48004838
* Invalid command.
48014839
*/

config.h

+7
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ struct misc_config_s {
111111

112112
int v20_count; /* Number of station addresses in array above. */
113113

114+
char **noxid_addrs; /* Stations known not to understand XID command so don't */
115+
/* waste time sending it and eventually giving up. */
116+
/* AX.25 for Linux is the one known case, so far, where */
117+
/* SABME is implemented but XID is not. */
118+
119+
int noxid_count; /* Number of station addresses in array above. */
120+
114121

115122
// Beacons.
116123

0 commit comments

Comments
 (0)