V20 configuration option for stations that don't understand AX.25 v2.2.

This commit is contained in:
WB2OSZ 2017-05-31 20:07:52 -04:00
parent 77f4eb4543
commit f358c621d0
7 changed files with 100 additions and 19 deletions

View File

@ -16,6 +16,9 @@ This is a snapshot of ongoing development towards version of 1.5. Some features
- decode_aprs utility can now accept KISS frames and AX.25 frames as series of two digit hexadecimal numbers. - decode_aprs utility can now accept KISS frames and AX.25 frames as series of two digit hexadecimal numbers.
- New configuration option, V20, for listing stations known to not understand AX.25 v2.2.
### Bugs Fixed: ### ### Bugs Fixed: ###
- Little spelling errors in messages ???? - Little spelling errors in messages ????

View File

@ -885,6 +885,8 @@ void dl_connect_request (dlq_item_t *E)
{ {
ax25_dlsm_t *S; ax25_dlsm_t *S;
int ok_to_create = 1; int ok_to_create = 1;
int old_version;
int n;
if (s_debug_client_app) { if (s_debug_client_app) {
text_color_set(DW_COLOR_DEBUG); text_color_set(DW_COLOR_DEBUG);
@ -902,7 +904,16 @@ void dl_connect_request (dlq_item_t *E)
INIT_T1V_SRT; INIT_T1V_SRT;
if (g_misc_config_p->maxv22 == 0) { // Don't attempt v2.2. // See if destination station is in list for v2.0 only.
old_version = 0;
for (n = 0; n < g_misc_config_p->v20_count && ! old_version; n++) {
if (strcmp(E->addrs[AX25_DESTINATION],g_misc_config_p->v20_addrs[n]) == 0) {
old_version = 1;
}
}
if (old_version || g_misc_config_p->maxv22 == 0) { // Don't attempt v2.2.
set_version_2_0 (S); set_version_2_0 (S);

View File

@ -707,7 +707,7 @@ packet_t ax25_dup (packet_t copy_from)
* *
* in_addr - Input such as "WB2OSZ-15*" * in_addr - Input such as "WB2OSZ-15*"
* *
* strict - TRUE for strict checking (6 characters, no lower case, * strict - 1 (true) for strict checking (6 characters, no lower case,
* SSID must be in range of 0 to 15). * SSID must be in range of 0 to 15).
* Strict is appropriate for packets sent * Strict is appropriate for packets sent
* over the radio. Communication with IGate * over the radio. Communication with IGate
@ -716,6 +716,8 @@ packet_t ax25_dup (packet_t copy_from)
* We also get messages like this from a server. * We also get messages like this from a server.
* KB1POR>APU25N,TCPIP*,qAC,T2NUENGLD:... * KB1POR>APU25N,TCPIP*,qAC,T2NUENGLD:...
* *
* 2 (extra true) will complain if * is found at end.
*
* Outputs: out_addr - Address without any SSID. * Outputs: out_addr - Address without any SSID.
* Must be at least AX25_MAX_ADDR_LEN bytes. * Must be at least AX25_MAX_ADDR_LEN bytes.
* *
@ -745,6 +747,11 @@ int ax25_parse_addr (int position, char *in_addr, int strict, char *out_addr, in
*out_ssid = 0; *out_ssid = 0;
*out_heard = 0; *out_heard = 0;
if (position < -1) position = -1;
if (position > AX25_REPEATER_8) position = AX25_REPEATER_8;
position++; /* Adjust for position_name above. */
if (strict && strlen(in_addr) >= 2 && strncmp(in_addr, "qA", 2) == 0) { if (strict && strlen(in_addr) >= 2 && strncmp(in_addr, "qA", 2) == 0) {
text_color_set(DW_COLOR_ERROR); text_color_set(DW_COLOR_ERROR);
@ -754,9 +761,6 @@ int ax25_parse_addr (int position, char *in_addr, int strict, char *out_addr, in
//dw_printf ("ax25_parse_addr in: %s\n", in_addr); //dw_printf ("ax25_parse_addr in: %s\n", in_addr);
if (position < -1) position = -1;
if (position > AX25_REPEATER_8) position = AX25_REPEATER_8;
position++; /* Adjust for position_name above. */
maxlen = strict ? 6 : (AX25_MAX_ADDR_LEN-1); maxlen = strict ? 6 : (AX25_MAX_ADDR_LEN-1);
p = in_addr; p = in_addr;
@ -811,6 +815,11 @@ int ax25_parse_addr (int position, char *in_addr, int strict, char *out_addr, in
if (*p == '*') { if (*p == '*') {
*out_heard = 1; *out_heard = 1;
p++; p++;
if (strict == 2) {
text_color_set(DW_COLOR_ERROR);
dw_printf ("\"*\" is not allowed at end of address \"%s\" here.\n", in_addr);
return 0;
}
} }
if (*p != '\0') { if (*p != '\0') {

View File

@ -515,7 +515,7 @@ static int check_via_path (char *via_path)
r = stemp; r = stemp;
while (( a = strsep(&r,",")) != NULL) { while (( a = strsep(&r,",")) != NULL) {
int strict = 1; int strict = 2;
int ok; int ok;
char addr[AX25_MAX_ADDR_LEN]; char addr[AX25_MAX_ADDR_LEN];
int ssid; int ssid;
@ -892,6 +892,8 @@ void config_init (char *fname, struct audio_s *p_audio_config,
p_misc_config->maxframe_extended = AX25_K_MAXFRAME_EXTENDED_DEFAULT; /* Max frames to send before ACK. mod 128 "Window" size. */ p_misc_config->maxframe_extended = AX25_K_MAXFRAME_EXTENDED_DEFAULT; /* Max frames to send before ACK. mod 128 "Window" size. */
p_misc_config->maxv22 = AX25_N2_RETRY_DEFAULT / 2; /* Max SABME before falling back to SABM. */ 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;
/* /*
* Try to extract options from a file. * Try to extract options from a file.
@ -1193,6 +1195,24 @@ void config_init (char *fname, struct audio_s *p_audio_config,
} }
else { else {
char *p;
int const strict = 2;
char call_no_ssid[AX25_MAX_ADDR_LEN];
int ssid, heard;
for (p = t; *p != '\0'; p++) {
if (islower(*p)) {
*p = toupper(*p); /* Silently force upper case. */
/* Might change to warning someday. */
}
}
if ( ! ax25_parse_addr (-1, t, strict, call_no_ssid, &ssid, &heard)) {
text_color_set(DW_COLOR_ERROR);
dw_printf ("Config file: Invalid value for MYCALL command on line %d.\n", line);
continue;
}
// Definitely set for current channel. // Definitely set for current channel.
// Set for other channels which have not been set yet. // Set for other channels which have not been set yet.
@ -1205,17 +1225,7 @@ void config_init (char *fname, struct audio_s *p_audio_config,
strcasecmp(p_audio_config->achan[c].mycall, "NOCALL") == 0 || strcasecmp(p_audio_config->achan[c].mycall, "NOCALL") == 0 ||
strcasecmp(p_audio_config->achan[c].mycall, "N0CALL") == 0) { strcasecmp(p_audio_config->achan[c].mycall, "N0CALL") == 0) {
char *p;
strlcpy (p_audio_config->achan[c].mycall, t, sizeof(p_audio_config->achan[c].mycall)); strlcpy (p_audio_config->achan[c].mycall, t, sizeof(p_audio_config->achan[c].mycall));
for (p = p_audio_config->achan[c].mycall; *p != '\0'; p++) {
if (islower(*p)) {
*p = toupper(*p); /* silently force upper case. */
}
}
// TODO: additional checks if valid.
// Should have a function to check for valid callsign[-ssid]
} }
} }
} }
@ -3920,6 +3930,9 @@ void config_init (char *fname, struct audio_s *p_audio_config,
/* /*
* IGFILTER - IGate Server side filters. * IGFILTER - IGate Server side filters.
* Is this name too confusing. Too similar to FILTER IG 0 ...
* Maybe SSFILTER suggesting Server Side.
* SUBSCRIBE might be better because it's not a filter that limits.
* *
* IGFILTER filter-spec ... * IGFILTER filter-spec ...
*/ */
@ -3928,6 +3941,12 @@ void config_init (char *fname, struct audio_s *p_audio_config,
t = split(NULL,1); /* Take rest of line as one string. */ t = split(NULL,1); /* Take rest of line as one string. */
if (p_igate_config->t2_filter != NULL) {
text_color_set(DW_COLOR_ERROR);
dw_printf ("Line %d: Warning - Earlier IGFILTER value will be replaced by this one.\n", line);
continue;
}
if (t != NULL && strlen(t) > 0) { if (t != NULL && strlen(t) > 0) {
p_igate_config->t2_filter = strdup (t); p_igate_config->t2_filter = strdup (t);
} }
@ -4562,6 +4581,41 @@ void config_init (char *fname, struct audio_s *p_audio_config,
} }
/*
* V20 address [ address ... ] - Stations known to support only AX.25 v2.0.
* When connecting to these, skip SABME and go right to SABM.
* Possible to have multiple and they are cummulative.
*/
else if (strcasecmp(t, "V20") == 0) {
t = split(NULL,0);
if (t == NULL) {
text_color_set(DW_COLOR_ERROR);
dw_printf ("Line %d: Missing address(es) for V20.\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->v20_addrs = (char**)realloc (p_misc_config->v20_addrs, sizeof(char*) * (p_misc_config->v20_count + 1));
p_misc_config->v20_addrs[p_misc_config->v20_count++] = strdup(t);
}
else {
text_color_set(DW_COLOR_ERROR);
dw_printf ("Line %d: Invalid station address for V20 command.\n", line);
// continue processing any others following.
}
t = split(NULL,0);
}
}
/* /*
* Invalid command. * Invalid command.
*/ */

View File

@ -104,6 +104,10 @@ struct misc_config_s {
/* switching to SABM. This is to handle the case of an old */ /* switching to SABM. This is to handle the case of an old */
/* TNC which simply ignores SABME rather than replying with FRMR. */ /* TNC which simply ignores SABME rather than replying with FRMR. */
char **v20_addrs; /* Stations known to understand only AX.25 v2.0 so we don't */
/* waste time trying v2.2 first. */
int v20_count; /* Number of station addresses in array above. */
// Beacons. // Beacons.

View File

@ -3183,7 +3183,7 @@ double get_latitude_8 (char *p, int quiet)
else { else {
if ( ! quiet) { if ( ! quiet) {
text_color_set(DW_COLOR_ERROR); text_color_set(DW_COLOR_ERROR);
dw_printf("Error: '%c' found for latitude hemisphere. Specification requires upper case N or s.\n", plat->ns); dw_printf("Error: '%c' found for latitude hemisphere. Specification requires upper case N or S.\n", plat->ns);
} }
return (G_UNKNOWN); return (G_UNKNOWN);
} }

Binary file not shown.