diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | axconfig.c | 19 | ||||
-rw-r--r-- | nrconfig.c | 10 | ||||
-rw-r--r-- | procutils.c | 13 |
4 files changed, 15 insertions, 33 deletions
@@ -1,3 +1,9 @@ + * Interfaces with a callsign without SSID were not been found anymore + after the last patch below. See cvs comment for detail. + Affected files: axconfig.c, nrconfig.c and procutils.c. + + -- Thomas Osterried DL9SAU <ax25@x-berg.in-berlin.de> Wed, 01 Feb 2012 00:10:45 +0100 + * ax25_ntoa() does no longer print a zero SSID. This avoids addresses like AB3DEF-0 which is general convention anyway. @@ -195,7 +195,6 @@ static int ax25_config_init_port(int fd, int lineno, char *line, const char **if char *name, *call, *baud, *paclen, *window, *desc; const char *dev = NULL; int found; - char call_beautified[10]; /* DL9SAU-10\0 */ name = strtok(line, " \t"); call = strtok(NULL, " \t"); @@ -237,26 +236,18 @@ static int ax25_config_init_port(int fd, int lineno, char *line, const char **if } strupr(call); - /* user may have configured "DL9SAU". But we compare to *ifcalls, - * which comes from ifr_hwaddr.sa_data and it always contains a SSID; - * in this case, "DL9SAU-0". This fixes a bug introduced 2008-04-02, - * which caused interfaces without SSID not being found anymore. :( - */ - strncpy(call_beautified, call, sizeof(call_beautified)-1); - call_beautified[sizeof(call_beautified)-1] = 0; - if (strchr(call_beautified, '-') == NULL && strlen(call_beautified) < 7) - strcat(call_beautified, "-0"); - found = 0; + char *cp; + if ((cp = strstr(call, "-0")) != NULL) + *cp = '\0'; for (;ifcalls && *ifcalls; ++ifcalls, ++ifdevs) { - if (strcmp(call_beautified, *ifcalls) == 0) { + if (strcmp(call, *ifcalls) == 0) { found = 1; dev = *ifdevs; break; } } - if (!found) { #if 0 /* None of your business to complain about some port being down... */ fprintf(stderr, "axconfig: port with call '%s' is not active\n", call); @@ -270,7 +261,7 @@ static int ax25_config_init_port(int fd, int lineno, char *line, const char **if } p->Name = strdup(name); - p->Call = strdup(call_beautified); + p->Call = strdup(call); p->Device = strdup(dev); p->Baud = atoi(baud); p->Window = atoi(window); @@ -179,7 +179,6 @@ static int nr_config_init_port(int fd, int lineno, char *line, const char **ifca char *name, *call, *alias, *paclen, *desc; const char *dev = NULL; int found = 0; - char call_beautified[10]; name = strtok(line, " \t"); call = strtok(NULL, " \t"); @@ -216,14 +215,13 @@ static int nr_config_init_port(int fd, int lineno, char *line, const char **ifca strupr(call); strupr(alias); - strncpy(call_beautified, call, sizeof(call_beautified)-1); - call_beautified[sizeof(call_beautified)-1] = 0; - if (strchr(call_beautified, '-') == NULL && strlen(call_beautified) < 7) - strcat(call_beautified, "-0"); + char *cp; + if ((cp = strstr(call, "-0")) != NULL) + *cp = 0; found = 0; for (;ifcalls && *ifcalls; ++ifcalls, ++ifdevs) { - if (strcmp(call_beautified, *ifcalls) == 0) { + if (strcmp(call, *ifcalls) == 0) { found = 1; dev = *ifdevs; break; diff --git a/procutils.c b/procutils.c index 816fa40..8eec81f 100644 --- a/procutils.c +++ b/procutils.c @@ -70,15 +70,6 @@ static char *token(char **ptr, const char *delim) return buf; } -static char *strip_zero_ssid(char *call) -{ - char *cp; - - if ((cp = strstr(call, "-0")) != NULL) - *cp = 0; - return call; -} - struct proc_ax25 *read_proc_ax25(void) { FILE *fp; @@ -345,8 +336,6 @@ struct proc_nr_nodes *read_proc_nr_nodes(void) cp = buffer; safe_strncpy(new->call, token(&cp, space), 9); - strip_zero_ssid(new->call); - safe_strncpy(new->alias, token(&cp, space), 6); new->w = safe_atoi(token(&cp, space)); @@ -386,7 +375,6 @@ struct proc_nr_nodes *read_proc_nr_nodes(void) break; if ((cp = nr_config_get_addr(name)) == NULL) break; - strip_zero_ssid(cp); safe_strncpy(new->call, cp, 9); if ((cp = nr_config_get_alias(name)) == NULL) break; @@ -670,7 +658,6 @@ struct proc_nr_nodes *find_node(char *addr, struct proc_nr_nodes *nodes) static struct proc_nr_nodes n; struct proc_nr_nodes *p, *list; - strip_zero_ssid(addr); list = nodes ? nodes : read_proc_nr_nodes(); for (p = list; p != NULL; p = p->next) { if (!strcasecmp(addr, p->call) || !strcasecmp(addr, p->alias)) { |