Skip to content

Commit f358c62

Browse files
committedJun 1, 2017
V20 configuration option for stations that don't understand AX.25 v2.2.
1 parent 77f4eb4 commit f358c62

File tree

7 files changed

+100
-19
lines changed

7 files changed

+100
-19
lines changed
 

‎CHANGES.md

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ This is a snapshot of ongoing development towards version of 1.5. Some features
1616

1717
- decode_aprs utility can now accept KISS frames and AX.25 frames as series of two digit hexadecimal numbers.
1818

19+
- New configuration option, V20, for listing stations known to not understand AX.25 v2.2.
20+
21+
1922
### Bugs Fixed: ###
2023

2124
- Little spelling errors in messages ????

‎ax25_link.c

+12-1
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,8 @@ void dl_connect_request (dlq_item_t *E)
885885
{
886886
ax25_dlsm_t *S;
887887
int ok_to_create = 1;
888+
int old_version;
889+
int n;
888890

889891
if (s_debug_client_app) {
890892
text_color_set(DW_COLOR_DEBUG);
@@ -902,7 +904,16 @@ void dl_connect_request (dlq_item_t *E)
902904

903905
INIT_T1V_SRT;
904906

905-
if (g_misc_config_p->maxv22 == 0) { // Don't attempt v2.2.
907+
// See if destination station is in list for v2.0 only.
908+
909+
old_version = 0;
910+
for (n = 0; n < g_misc_config_p->v20_count && ! old_version; n++) {
911+
if (strcmp(E->addrs[AX25_DESTINATION],g_misc_config_p->v20_addrs[n]) == 0) {
912+
old_version = 1;
913+
}
914+
}
915+
916+
if (old_version || g_misc_config_p->maxv22 == 0) { // Don't attempt v2.2.
906917

907918
set_version_2_0 (S);
908919

‎ax25_pad.c

+15-6
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ packet_t ax25_dup (packet_t copy_from)
707707
*
708708
* in_addr - Input such as "WB2OSZ-15*"
709709
*
710-
* strict - TRUE for strict checking (6 characters, no lower case,
710+
* strict - 1 (true) for strict checking (6 characters, no lower case,
711711
* SSID must be in range of 0 to 15).
712712
* Strict is appropriate for packets sent
713713
* over the radio. Communication with IGate
@@ -716,6 +716,8 @@ packet_t ax25_dup (packet_t copy_from)
716716
* We also get messages like this from a server.
717717
* KB1POR>APU25N,TCPIP*,qAC,T2NUENGLD:...
718718
*
719+
* 2 (extra true) will complain if * is found at end.
720+
*
719721
* Outputs: out_addr - Address without any SSID.
720722
* Must be at least AX25_MAX_ADDR_LEN bytes.
721723
*
@@ -745,6 +747,11 @@ int ax25_parse_addr (int position, char *in_addr, int strict, char *out_addr, in
745747
*out_ssid = 0;
746748
*out_heard = 0;
747749

750+
if (position < -1) position = -1;
751+
if (position > AX25_REPEATER_8) position = AX25_REPEATER_8;
752+
position++; /* Adjust for position_name above. */
753+
754+
748755
if (strict && strlen(in_addr) >= 2 && strncmp(in_addr, "qA", 2) == 0) {
749756

750757
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
754761

755762
//dw_printf ("ax25_parse_addr in: %s\n", in_addr);
756763

757-
if (position < -1) position = -1;
758-
if (position > AX25_REPEATER_8) position = AX25_REPEATER_8;
759-
position++; /* Adjust for position_name above. */
760764

761765
maxlen = strict ? 6 : (AX25_MAX_ADDR_LEN-1);
762766
p = in_addr;
@@ -811,11 +815,16 @@ int ax25_parse_addr (int position, char *in_addr, int strict, char *out_addr, in
811815
if (*p == '*') {
812816
*out_heard = 1;
813817
p++;
818+
if (strict == 2) {
819+
text_color_set(DW_COLOR_ERROR);
820+
dw_printf ("\"*\" is not allowed at end of address \"%s\" here.\n", in_addr);
821+
return 0;
822+
}
814823
}
815824

816825
if (*p != '\0') {
817-
text_color_set(DW_COLOR_ERROR);
818-
dw_printf ("Invalid character \"%c\" found in %saddress \"%s\".\n", *p, position_name[position], in_addr);
826+
text_color_set(DW_COLOR_ERROR);
827+
dw_printf ("Invalid character \"%c\" found in %saddress \"%s\".\n", *p, position_name[position], in_addr);
819828
return 0;
820829
}
821830

‎config.c

+65-11
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ static int check_via_path (char *via_path)
515515

516516
r = stemp;
517517
while (( a = strsep(&r,",")) != NULL) {
518-
int strict = 1;
518+
int strict = 2;
519519
int ok;
520520
char addr[AX25_MAX_ADDR_LEN];
521521
int ssid;
@@ -892,6 +892,8 @@ void config_init (char *fname, struct audio_s *p_audio_config,
892892
p_misc_config->maxframe_extended = AX25_K_MAXFRAME_EXTENDED_DEFAULT; /* Max frames to send before ACK. mod 128 "Window" size. */
893893

894894
p_misc_config->maxv22 = AX25_N2_RETRY_DEFAULT / 2; /* Max SABME before falling back to SABM. */
895+
p_misc_config->v20_addrs = NULL; /* Go directly to v2.0 for stations listed. */
896+
p_misc_config->v20_count = 0;
895897

896898
/*
897899
* Try to extract options from a file.
@@ -1193,6 +1195,24 @@ void config_init (char *fname, struct audio_s *p_audio_config,
11931195
}
11941196
else {
11951197

1198+
char *p;
1199+
int const strict = 2;
1200+
char call_no_ssid[AX25_MAX_ADDR_LEN];
1201+
int ssid, heard;
1202+
1203+
for (p = t; *p != '\0'; p++) {
1204+
if (islower(*p)) {
1205+
*p = toupper(*p); /* Silently force upper case. */
1206+
/* Might change to warning someday. */
1207+
}
1208+
}
1209+
1210+
if ( ! ax25_parse_addr (-1, t, strict, call_no_ssid, &ssid, &heard)) {
1211+
text_color_set(DW_COLOR_ERROR);
1212+
dw_printf ("Config file: Invalid value for MYCALL command on line %d.\n", line);
1213+
continue;
1214+
}
1215+
11961216
// Definitely set for current channel.
11971217
// Set for other channels which have not been set yet.
11981218

@@ -1205,17 +1225,7 @@ void config_init (char *fname, struct audio_s *p_audio_config,
12051225
strcasecmp(p_audio_config->achan[c].mycall, "NOCALL") == 0 ||
12061226
strcasecmp(p_audio_config->achan[c].mycall, "N0CALL") == 0) {
12071227

1208-
char *p;
1209-
12101228
strlcpy (p_audio_config->achan[c].mycall, t, sizeof(p_audio_config->achan[c].mycall));
1211-
1212-
for (p = p_audio_config->achan[c].mycall; *p != '\0'; p++) {
1213-
if (islower(*p)) {
1214-
*p = toupper(*p); /* silently force upper case. */
1215-
}
1216-
}
1217-
// TODO: additional checks if valid.
1218-
// Should have a function to check for valid callsign[-ssid]
12191229
}
12201230
}
12211231
}
@@ -3920,6 +3930,9 @@ void config_init (char *fname, struct audio_s *p_audio_config,
39203930

39213931
/*
39223932
* IGFILTER - IGate Server side filters.
3933+
* Is this name too confusing. Too similar to FILTER IG 0 ...
3934+
* Maybe SSFILTER suggesting Server Side.
3935+
* SUBSCRIBE might be better because it's not a filter that limits.
39233936
*
39243937
* IGFILTER filter-spec ...
39253938
*/
@@ -3928,6 +3941,12 @@ void config_init (char *fname, struct audio_s *p_audio_config,
39283941

39293942
t = split(NULL,1); /* Take rest of line as one string. */
39303943

3944+
if (p_igate_config->t2_filter != NULL) {
3945+
text_color_set(DW_COLOR_ERROR);
3946+
dw_printf ("Line %d: Warning - Earlier IGFILTER value will be replaced by this one.\n", line);
3947+
continue;
3948+
}
3949+
39313950
if (t != NULL && strlen(t) > 0) {
39323951
p_igate_config->t2_filter = strdup (t);
39333952
}
@@ -4562,6 +4581,41 @@ void config_init (char *fname, struct audio_s *p_audio_config,
45624581
}
45634582

45644583

4584+
/*
4585+
* V20 address [ address ... ] - Stations known to support only AX.25 v2.0.
4586+
* When connecting to these, skip SABME and go right to SABM.
4587+
* Possible to have multiple and they are cummulative.
4588+
*/
4589+
4590+
else if (strcasecmp(t, "V20") == 0) {
4591+
4592+
t = split(NULL,0);
4593+
if (t == NULL) {
4594+
text_color_set(DW_COLOR_ERROR);
4595+
dw_printf ("Line %d: Missing address(es) for V20.\n", line);
4596+
continue;
4597+
}
4598+
4599+
while (t != NULL) {
4600+
int const strict = 2;
4601+
char call_no_ssid[AX25_MAX_ADDR_LEN];
4602+
int ssid, heard;
4603+
4604+
if (ax25_parse_addr (AX25_DESTINATION, t, strict, call_no_ssid, &ssid, &heard)) {
4605+
p_misc_config->v20_addrs = (char**)realloc (p_misc_config->v20_addrs, sizeof(char*) * (p_misc_config->v20_count + 1));
4606+
p_misc_config->v20_addrs[p_misc_config->v20_count++] = strdup(t);
4607+
}
4608+
else {
4609+
text_color_set(DW_COLOR_ERROR);
4610+
dw_printf ("Line %d: Invalid station address for V20 command.\n", line);
4611+
4612+
// continue processing any others following.
4613+
}
4614+
t = split(NULL,0);
4615+
}
4616+
}
4617+
4618+
45654619
/*
45664620
* Invalid command.
45674621
*/

‎config.h

+4
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ struct misc_config_s {
104104
/* switching to SABM. This is to handle the case of an old */
105105
/* TNC which simply ignores SABME rather than replying with FRMR. */
106106

107+
char **v20_addrs; /* Stations known to understand only AX.25 v2.0 so we don't */
108+
/* waste time trying v2.2 first. */
109+
110+
int v20_count; /* Number of station addresses in array above. */
107111

108112

109113
// Beacons.

‎decode_aprs.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -3183,7 +3183,7 @@ double get_latitude_8 (char *p, int quiet)
31833183
else {
31843184
if ( ! quiet) {
31853185
text_color_set(DW_COLOR_ERROR);
3186-
dw_printf("Error: '%c' found for latitude hemisphere. Specification requires upper case N or s.\n", plat->ns);
3186+
dw_printf("Error: '%c' found for latitude hemisphere. Specification requires upper case N or S.\n", plat->ns);
31873187
}
31883188
return (G_UNKNOWN);
31893189
}

‎doc/User-Guide.pdf

10.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)
Please sign in to comment.