summaryrefslogtreecommitdiffstats
path: root/ax25rtd
diff options
context:
space:
mode:
authorCraig Small <csmall@enc.com.au>2001-04-10 01:57:46 +0000
committerCraig Small <csmall@enc.com.au>2001-04-10 01:57:46 +0000
commit628edceba5f1485ef7c4ef30fba93b4c0c0dd955 (patch)
treed3df0a0118e426470fce2bff0492b9d2ee06f4c7 /ax25rtd
parent57cf4e9453c51359d0c9af334c3dc1156ea2527a (diff)
Initial revisionax25-apps-0.0.5p2
Diffstat (limited to 'ax25rtd')
-rw-r--r--ax25rtd/Makefile.am2
-rw-r--r--ax25rtd/Makefile.in5
-rw-r--r--ax25rtd/README.ax25rtd38
-rw-r--r--ax25rtd/ax25rtctl.c4
-rw-r--r--ax25rtd/ax25rtd.c7
-rw-r--r--ax25rtd/ax25rtd.h3
-rw-r--r--ax25rtd/cache_ctl.c19
-rw-r--r--ax25rtd/cache_dump.c2
-rw-r--r--ax25rtd/config.c68
-rw-r--r--ax25rtd/listener.c15
10 files changed, 112 insertions, 51 deletions
diff --git a/ax25rtd/Makefile.am b/ax25rtd/Makefile.am
index 8d24c09..6e87903 100644
--- a/ax25rtd/Makefile.am
+++ b/ax25rtd/Makefile.am
@@ -14,7 +14,7 @@ LDADD = $(AX25_LIB)
EXTRA_DIST = $(etcfiles) $(doc_DATA)
-docdir=/usr/doc/ax25-apps
+docdir=${datadir}/doc/ax25-apps
doc_DATA= TODO.ax25rtd README.ax25rtd
ax25rtd_SOURCES = \
diff --git a/ax25rtd/Makefile.in b/ax25rtd/Makefile.in
index c6f4aef..87e7c17 100644
--- a/ax25rtd/Makefile.in
+++ b/ax25rtd/Makefile.in
@@ -83,7 +83,7 @@ LDADD = $(AX25_LIB)
EXTRA_DIST = $(etcfiles) $(doc_DATA)
-docdir = /usr/doc/ax25-apps
+docdir = ${datadir}/doc/ax25-apps
doc_DATA = TODO.ax25rtd README.ax25rtd
ax25rtd_SOURCES = ax25rtd.c ax25rtd.h cache_ctl.c cache_dump.c config.c listener.c
@@ -269,14 +269,13 @@ distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
- cp -pr $$/$$file $(distdir)/$$file; \
+ cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
-
info-am:
info: info-am
dvi-am:
diff --git a/ax25rtd/README.ax25rtd b/ax25rtd/README.ax25rtd
index 229138e..fe7a241 100644
--- a/ax25rtd/README.ax25rtd
+++ b/ax25rtd/README.ax25rtd
@@ -1,3 +1,41 @@
+ax25rtd with DG2FEF/DG1KJD Linux-AX.25 Kernel NOTES:
+
+- Here is an example ax25rtd.conf file:
+
+ax25-maxroutes 256
+ip-maxroutes 256
+ip-encaps-dev ipax0
+
+[sp0]
+ax25-learn-routes yes
+ax25-learn-only-mine yes
+ip-adjust-mode no
+ip-learn-routes no
+arp-add yes
+
+[ipax0]
+arp-add yes
+ip-learn-routes yes
+
+- ax25-learn-only-mine has to be on for now, since ax25rtd is not able to
+ recognize digipeater paths yet when this node is part of it.
+
+- ax25rtd will be replaced as soon as possible by something reasonable, so
+ this is only a temporary solution
+
+- ipax0 must be up when ax25rtd is startet
+
+- all other listeners (ax25d et al) must be registrated at this point of
+ time, too
+
+- There must be an entry for ipax0 in /etc/axports, here is an example:
+
+ipax0 dg1kjd-10 76800 256 7 IP-encap device
+
+----
+ Jens
+
+
*****************************************************************
* Please send all comments and suggestions regarding ax25rtd to *
* Klaus Kudielka (klaus.kudielka@ieee.org). *
diff --git a/ax25rtd/ax25rtctl.c b/ax25rtd/ax25rtctl.c
index f9a3647..6b40451 100644
--- a/ax25rtd/ax25rtctl.c
+++ b/ax25rtd/ax25rtctl.c
@@ -1,4 +1,4 @@
-/* $Id: ax25rtctl.c,v 1.8 1998/08/20 01:43:28 kudielka Exp $
+/* $Id: ax25rtctl.c,v 1.1 2001/04/10 01:58:38 csmall Exp $
*
* Copyright (c) 1996 Jörg Reuter (jreuter@poboxes.com)
*
@@ -262,7 +262,7 @@ static void Version(void)
int sock;
char buf[256];
- printf("ax25rtctl $Revision: 1.8 $\n");
+ printf("ax25rtctl $Revision: 1.1 $\n");
sock = open_socket();
wsock(sock, "version\n");
read(sock, buf, sizeof(buf));
diff --git a/ax25rtd/ax25rtd.c b/ax25rtd/ax25rtd.c
index 22ffeb9..c7e8d2a 100644
--- a/ax25rtd/ax25rtd.c
+++ b/ax25rtd/ax25rtd.c
@@ -1,4 +1,4 @@
-/* $Id: ax25rtd.c,v 1.7 1996/10/23 18:27:43 jreuter Exp jreuter $
+/* $Id: ax25rtd.c,v 1.1 2001/04/10 01:58:38 csmall Exp $
*
* Copyright (c) 1996 Jörg Reuter (jreuter@poboxes.com)
*
@@ -28,10 +28,12 @@
*
*/
+#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
+#include <syslog.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
@@ -61,7 +63,7 @@
#include "../pathnames.h"
#include "ax25rtd.h"
-const char *Version = "ax25rtd $Revision: 1.7 $";
+const char *Version = "ax25rtd $Revision: 1.1 $";
config *Config = NULL;
int reload = 0;
@@ -74,6 +76,7 @@ ax25_rt_entry * ax25_routes = NULL;
int ax25_routes_cnt = 0;
int ax25_maxroutes = AX25_MAXROUTES;
+char ip_encaps_dev[32] = "";
config *dev_get_config(char *dev)
{
diff --git a/ax25rtd/ax25rtd.h b/ax25rtd/ax25rtd.h
index 01f7ef7..afebc71 100644
--- a/ax25rtd/ax25rtd.h
+++ b/ax25rtd/ax25rtd.h
@@ -1,4 +1,4 @@
-/* $Id: ax25rtd.h,v 1.6 1997/06/05 18:54:57 oe1kib Exp oe1kib $
+/* $Id: ax25rtd.h,v 1.1 2001/04/10 01:58:39 csmall Exp $
*
* Copyright (c) 1996 Jörg Reuter (jreuter@poboxes.com)
*
@@ -119,6 +119,7 @@ extern ax25_rt_entry * ax25_routes;
extern int ax25_routes_cnt;
extern int ax25_maxroutes;
+extern char ip_encaps_dev[];
/* config.c */
diff --git a/ax25rtd/cache_ctl.c b/ax25rtd/cache_ctl.c
index 6988c96..d204074 100644
--- a/ax25rtd/cache_ctl.c
+++ b/ax25rtd/cache_ctl.c
@@ -1,4 +1,4 @@
-/* $Id: cache_ctl.c,v 1.5 1996/10/23 18:27:43 jreuter Exp jreuter $
+/* $Id: cache_ctl.c,v 1.1 2001/04/10 01:58:39 csmall Exp $
*
* Copyright (c) 1996 Jörg Reuter (jreuter@poboxes.com)
*
@@ -41,7 +41,7 @@ int update_ip_route(config *config, unsigned long ip, int ipmode, ax25_address *
{
ip_rt_entry *bp = ip_routes;
ip_rt_entry *bp_prev = ip_routes;
- char *iface = config->dev;
+ char *iface;
int action = 0;
if (((ip ^ config->ip) & config->netmask) != 0)
@@ -68,7 +68,7 @@ int update_ip_route(config *config, unsigned long ip, int ipmode, ax25_address *
memcpy(&bp->call, call, AXLEN);
}
- if (ipmode && ipmode != bp->ipmode)
+ if (ipmode != bp->ipmode)
{
action |= NEW_IPMODE;
bp->ipmode = ipmode;
@@ -145,18 +145,25 @@ ax25_rt_entry *update_ax25_route(config *config, ax25_address *call, int ndigi,
while (bp)
{
- if (!memcmp(call, &bp->call, AXLEN) && !strcmp(bp->iface, iface))
+ if (!memcmp(call, &bp->call, AXLEN) )
{
if (bp->timestamp == 0 && timestamp != 0)
return NULL;
-
+
+ if (strcmp(bp->iface, iface))
+ {
+ del_kernel_ax25_route(bp->iface, &bp->call);
+ action |= NEW_ROUTE;
+ strcpy(bp->iface, iface);
+ }
+
if (ndigi != bp->ndigi || memcmp(bp->digipeater, digi, bp->ndigi*AXLEN))
{
action |= NEW_ROUTE;
memcpy(bp->digipeater, digi, ndigi*AXLEN);
bp->ndigi = ndigi;
}
-
+
bp->timestamp = timestamp;
if (bp != ax25_routes)
diff --git a/ax25rtd/cache_dump.c b/ax25rtd/cache_dump.c
index 9888583..3b51db5 100644
--- a/ax25rtd/cache_dump.c
+++ b/ax25rtd/cache_dump.c
@@ -1,4 +1,4 @@
-/* $Id: cache_dump.c,v 1.6 1998/08/20 01:43:38 kudielka Exp $
+/* $Id: cache_dump.c,v 1.1 2001/04/10 01:58:39 csmall Exp $
*
* Copyright (c) 1996 Jörg Reuter (jreuter@poboxes.com)
*
diff --git a/ax25rtd/config.c b/ax25rtd/config.c
index 76384e0..1f92b2c 100644
--- a/ax25rtd/config.c
+++ b/ax25rtd/config.c
@@ -1,4 +1,4 @@
-/* $Id: config.c,v 1.8 1998/08/20 01:43:39 kudielka Exp kudielka $
+/* $Id: config.c,v 1.1 2001/04/10 01:58:40 csmall Exp $
*
* Copyright (c) 1996 Jörg Reuter (jreuter@poboxes.com)
*
@@ -38,16 +38,8 @@
#include <net/if_arp.h>
#include <config.h>
-#ifdef HAVE_NETAX25_AX25_H
-#include <netax25/ax25.h>
-#else
#include <netax25/kernel_ax25.h>
-#endif
-#ifdef HAVE_NETROSE_ROSE_H
-#include <netrose/rose.h>
-#else
#include <netax25/kernel_rose.h>
-#endif
#include <netax25/axlib.h>
#include <netax25/axconfig.h>
@@ -233,6 +225,7 @@ void load_listeners(void)
{
config *config;
char buf[1024], device[14], call[10], dcall[10];
+ char dummy[1024];
int k;
FILE *fp;
ax25_address *axcall;
@@ -248,14 +241,12 @@ void load_listeners(void)
while (fgets(buf, sizeof(buf)-1, fp) != NULL)
{
- k = sscanf(buf, "%s %s %s", dcall, call, device);
- if (k == 3 && !strcmp(dcall, "*"))
+ k = sscanf(buf, "%s %s %s %s", dummy, device, call, dcall);
+ if (k == 4 && !strcmp(dcall, "*"))
{
axcall = asc2ax(call);
- if (!strcmp("???", device))
- {
- for (config = Config; config; config = config->next)
- {
+ if (!strcmp("*", device)) {
+ for (config = Config; config; config = config->next) {
if (call_is_mycall(config, axcall) || config->nmycalls > AX25_MAXCALLS)
continue;
memcpy(&config->mycalls[config->nmycalls++], axcall, AXLEN);
@@ -264,7 +255,7 @@ void load_listeners(void)
config = dev_get_config(device);
if (config == NULL || call_is_mycall(config, axcall) || config->nmycalls > AX25_MAXCALLS)
continue;
-
+
memcpy(&config->mycalls[config->nmycalls++], axcall, AXLEN);
}
}
@@ -392,8 +383,10 @@ void load_config()
while(arg && config->nmycalls < AX25_MAXCALLS)
{
axcall = asc2ax(arg);
- if (call_is_mycall(config, axcall))
+ if (call_is_mycall(config, axcall)) {
+ arg = get_next_arg(&p);
continue;
+ }
memcpy(&config->mycalls[config->nmycalls++], axcall, AXLEN);
arg = get_next_arg(&p);
}
@@ -451,19 +444,19 @@ void load_config()
} else
missing_arg(cmd);
} else
- if (config && !strcmp(cmd, "vc-mtu"))
- {
- /* vc-mtu <mtu>: MTU for virtual connect mode routes (unused) */
- if (arg)
+ if (config && !strcmp(cmd, "vc-mtu"))
{
- int k = atoi(arg);
-
- if (k == 0)
+ /* vc-mtu <mtu>: MTU for virtual connect mode routes (unused) */
+ if (arg)
{
- invalid_arg(cmd, arg);
- continue;
- } else {
- config->vc_mtu = k;
+ int k = atoi(arg);
+
+ if (k == 0)
+ {
+ invalid_arg(cmd, arg);
+ continue;
+ } else {
+ config->vc_mtu = k;
}
} else
missing_arg(cmd);
@@ -502,6 +495,12 @@ void load_config()
} else
missing_arg(cmd);
} else
+ if (!strcmp(cmd, "ip-encaps-dev")) {
+ if (arg)
+ strcpy(ip_encaps_dev, arg);
+ else
+ missing_arg(cmd);
+ } else
if (!strcmp(cmd, "ax25-maxroutes"))
{
if (arg)
@@ -638,6 +637,11 @@ void interpret_command(int fd, unsigned char *buf)
ipmode = (*arg == 'v');
+ if ((config = dev_get_config(ip_encaps_dev)) == NULL) {
+ printf("no config for %s\n", ip_encaps_dev);
+ return;
+ }
+
action = update_ip_route(config, ip, ipmode, asc2ax(arg2), stamp);
if (action & NEW_ROUTE)
@@ -723,16 +727,16 @@ void load_cache(void)
{
while(fgets(buf, sizeof(buf), fp) != NULL)
interpret_command(2, buf);
- fclose(fp);
- }
+ fclose(fp);
+ } else perror("open AX.25 route cache file");
fp = fopen(DATA_AX25ROUTED_IPRT_FILE, "r");
if (fp != NULL)
{
while(fgets(buf, sizeof(buf), fp) != NULL)
interpret_command(2, buf);
- fclose(fp);
- }
+ fclose(fp);
+ } else perror("open IP route cache file");
}
void save_cache(void)
diff --git a/ax25rtd/listener.c b/ax25rtd/listener.c
index a687f89..bd6b7ad 100644
--- a/ax25rtd/listener.c
+++ b/ax25rtd/listener.c
@@ -1,4 +1,4 @@
-/* $Id: listener.c,v 1.9 1997/06/05 18:56:08 oe1kib Exp kudielka $
+/* $Id: listener.c,v 1.1 2001/04/10 01:58:42 csmall Exp $
*
* Copyright (c) 1996 Jörg Reuter (jreuter@poboxes.com)
*
@@ -166,6 +166,9 @@ int set_route(config *config, long ip)
struct rtentry rt;
struct sockaddr_in *isa;
char origdev[16], buf[1024];
+/* modif f5lct */
+ long gwr;
+/* fin modif f5lct */
long ipr;
int fds;
FILE *fp;
@@ -180,8 +183,11 @@ int set_route(config *config, long ip)
fgets(buf, sizeof(buf)-1, fp); /* discard header */
while (fgets(buf, sizeof(buf)-1, fp) != NULL)
{
- sscanf(buf, "%s %lx", origdev, &ipr);
- if (ipr == ip)
+/* modif f5lct */
+ /* sscanf(buf, "%s %lx", origdev, &ipr); */
+ sscanf(buf, "%s %lx %lx", origdev, &ipr, &gwr);
+ if (ipr == ip && gwr == 00000000 )
+/* fin modif f5lct */
{
if (dev_get_config(origdev) == NULL)
{
@@ -565,6 +571,9 @@ void ax25_receive(int sock)
if (ip != 0)
{
+ if ((config = dev_get_config(ip_encaps_dev)) == NULL)
+ return;
+
action = update_ip_route(config, ip, ipmode, &srccall, stamp);
if (action & NEW_ROUTE)