diff options
author | Thomas Osterried <thomas@osterried.de> | 2012-01-31 23:18:37 +0000 |
---|---|---|
committer | Thomas Osterried <thomas@osterried.de> | 2012-01-31 23:18:37 +0000 |
commit | ed11cf70be0935d8e5dd389e829aa2527ccf674f (patch) | |
tree | 85f50458887bc24e0d601ff56a30308e1335eb73 /procutils.c | |
parent | 211d51d5e4d8c5665f70a7d85a82ba6e0ac2a426 (diff) |
Fixed Bug: libax25 cannot find interfaces with callsign's without SSID.
In http://www.linux-ax25.org/cvsweb/libax25/ChangeLog we read:
Revision 1.8: download - view: text, markup, annotated - select for diffs
Thu Sep 10 16:53:28 2009 UTC (2 years, 4 months ago) by ralf
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +5 -0 lines
ax25_ntoa: Don't emit SSID suffix if the SSID is zero.
From: Matti Aarnio OH2MQK <matti.aarnio@zmailer.org>
In http://www.linux-ax25.org/cvsweb/libax25/axutils.c.diff?r1=1.4;r2=1.5
funtion char *ax25_ntoa(const ax25_address *a):
- *s++ = '-';
+ /* Convention is: -0 suffixes are NOT printed */
+ if (a->ax25_call[6] & 0x1E) {
+ *s++ = '-';
- if ((n = ((a->ax25_call[6] >> 1) & 0x0F)) > 9) {
- *s++ = '1';
- n -= 10;
+ if ((n = ((a->ax25_call[6] >> 1) & 0x0F)) > 9) {
+ *s++ = '1';
+ n -= 10;
+ }
+ *s++ = n + '0';
}
-
- *s++ = n + '0';
+
*s++ = '\0';
This is diametral to the previous situation, where ax25_ntoa always returned
a call with SSID.
Unfortunately, that patch broke a fixe introduced in April 2009; that patch
fixed the same issue introduced by a patch in April 2008:
http://www.linux-ax25.org/cvsweb/libax25/axconfig.c
This is a fix for a bug introduced 2008-04-02, which caused interfaces
containing CALL without SSID not being found anymore (user had to
address CALL-0 instead of just CALL).
http://www.linux-ax25.org/cvsweb/libax25/axconfig.c.diff?r1=1.7;r2=1.8
[..]
+ /* 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. :(
+ */
[..]
It has been overseen that libax25 internaly uses ax25_ntoa, not just for
user-presentation.
The fix today resolves the problem, and cleans up helper routines like
strip_zero_ssid() that are no longer needed.
Affected files: axconfig.c, nrconfig.c and procutils.c.
Diffstat (limited to 'procutils.c')
-rw-r--r-- | procutils.c | 13 |
1 files changed, 0 insertions, 13 deletions
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)) { |