summaryrefslogtreecommitdiffstats
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
parent57cf4e9453c51359d0c9af334c3dc1156ea2527a (diff)
Initial revisionax25-apps-0.0.5p2
-rw-r--r--ChangeLog17
-rw-r--r--INSTALL2
-rw-r--r--Makefile.am2
-rw-r--r--Makefile.in4
-rw-r--r--README3
-rw-r--r--ax25ipd/Makefile.am2
-rw-r--r--ax25ipd/Makefile.in5
-rw-r--r--ax25ipd/ax25ipd.c77
-rw-r--r--ax25ipd/process.c3
-rw-r--r--ax25mond/.cvsignore3
-rw-r--r--ax25mond/Makefile.am27
-rw-r--r--ax25mond/ax25mond.819
-rw-r--r--ax25mond/ax25mond.c377
-rw-r--r--ax25mond/ax25mond.conf3
-rw-r--r--ax25mond/ax25mond.conf.530
-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
-rw-r--r--call/Makefile.in3
-rw-r--r--call/call.c5
-rw-r--r--call/menu.c1
-rwxr-xr-xconfigure10
-rw-r--r--configure.in4
-rw-r--r--listen/Makefile.in3
-rw-r--r--listen/arpdump.c2
-rw-r--r--listen/ax25dump.c2
-rw-r--r--listen/icmpdump.c2
-rw-r--r--listen/ipdump.c2
-rw-r--r--listen/kissdump.c2
-rw-r--r--listen/listen.c14
-rw-r--r--listen/nrdump.c3
-rw-r--r--listen/rosedump.c295
-rw-r--r--listen/tcpdump.c2
-rw-r--r--listen/udpdump.c2
-rwxr-xr-xmkinstalldirs2
-rw-r--r--pathnames.h1
43 files changed, 986 insertions, 106 deletions
diff --git a/ChangeLog b/ChangeLog
index dd060d4..5e83dc1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+ax25-apps 0.0.5
+ * New rosedump.c from Jean-Paul.
+ * Changes to ax25rtd from Hubert F5LCT for problems with
+ kernel 2.2.13.
+ * Fix for ax25rtd in VC mode
+ * Patch from Hans to work better with newer GCCs
+ * doc dirs are now relocatable
+ * Added Jens patches
+ - Adapted ax25rtd to new kernel-ax25. ax25-learn-only-mine has
+ to be set to "true" for all interfaces to work right now.
+ Note that this is only a temporary solution.
+ - Made new-ax25-stack ready (listen, ax25rtd). Will still work
+ with old kernel-AX25 but need recompile.
+ * New program, ax25mond
+
+ -- Craig Small <csmall@small.dropbear.id.au>
+
ax25-apps 0.0.4
* Added Tomi's patch so it correctly detects broken headers
diff --git a/INSTALL b/INSTALL
index eb57a6a..33a98c2 100644
--- a/INSTALL
+++ b/INSTALL
@@ -3,7 +3,7 @@ Installation Instructions for AX.25 Tools
To make this package you will need the following:
glibc2.1 (Debian 2.1.1-5 or RedHat glibc-2.1.2-3)
- A Modern kernel, 2.2.x
+ A Modern kernel, 2.2.x with optional new-AX25-patch (DG2FEF / DG1KJD)
libtool
libax25 0.0.5 or better
diff --git a/Makefile.am b/Makefile.am
index 670f2e3..d3a8a78 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
-SUBDIRS = ax25ipd ax25rtd call listen
+SUBDIRS = ax25ipd ax25rtd call listen ax25mond
EXTRA_DIST = pathnames.h
diff --git a/Makefile.in b/Makefile.in
index ab8b282..7eca57a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -75,7 +75,7 @@ PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
VERSION = @VERSION@
-SUBDIRS = ax25ipd ax25rtd call listen
+SUBDIRS = ax25ipd ax25rtd call listen ax25mond
EXTRA_DIST = pathnames.h
@@ -273,7 +273,7 @@ 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 \
diff --git a/README b/README
index 989f3f8..15cd98b 100644
--- a/README
+++ b/README
@@ -5,7 +5,8 @@ Listen now by default is NOT setuid root which means that normal users will
not be able to run it out of the box. If you want everyone to run
listen then after installing the binaries as root type
chmod u+s /usr/bin/listen
-
+This version includes support for Mat DG2FEF's new AX.25 subsystem. Binaries
+are not interchangeable but require recompile.
- Craig Small <csmall@small.dropbear.id.au>
diff --git a/ax25ipd/Makefile.am b/ax25ipd/Makefile.am
index 93f90af..2c1acd6 100644
--- a/ax25ipd/Makefile.am
+++ b/ax25ipd/Makefile.am
@@ -5,7 +5,7 @@ man_MANS = ax25ipd.8 ax25ipd.conf.5
EXTRA_DIST = $(man_MANS) $(etcfiles) $(doc_DATA)
-docdir = /usr/doc/ax25-apps
+docdir = ${datadir}/doc/ax25-apps
doc_DATA = README.ax25ipd HISTORY.ax25ipd COPYING.ax25ipd
CFLAGS = -DUSE_TERMIO
diff --git a/ax25ipd/Makefile.in b/ax25ipd/Makefile.in
index 31ea95c..513d44d 100644
--- a/ax25ipd/Makefile.in
+++ b/ax25ipd/Makefile.in
@@ -81,7 +81,7 @@ man_MANS = ax25ipd.8 ax25ipd.conf.5
EXTRA_DIST = $(man_MANS) $(etcfiles) $(doc_DATA)
-docdir = /usr/doc/ax25-apps
+docdir = ${datadir}/doc/ax25-apps
doc_DATA = README.ax25ipd HISTORY.ax25ipd COPYING.ax25ipd
CFLAGS = -DUSE_TERMIO
@@ -339,14 +339,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/ax25ipd/ax25ipd.c b/ax25ipd/ax25ipd.c
index 107ad5f..e73f36b 100644
--- a/ax25ipd/ax25ipd.c
+++ b/ax25ipd/ax25ipd.c
@@ -17,6 +17,7 @@
#include <netax25/daemon.h>
#include <config.h>
+#include <getopt.h>
#include "../pathnames.h"
#include "ax25ipd.h"
@@ -26,6 +27,18 @@ jmp_buf restart_env;
/* Prototypes */
void hupper(int);
+int opt_version = 0;
+int opt_loglevel = 0;
+int opt_help = 0;
+char opt_configfile[1024];
+
+struct option options[] = {
+ "version", 0, &opt_version, 1,
+ "loglevel", 1, &opt_loglevel, 1,
+ "help", 0, &opt_help, 1,
+ "configfile", 1, NULL, 0,
+ 0,0,0,0 };
+
int
main(int argc, char **argv)
{
@@ -38,14 +51,58 @@ main(int argc, char **argv)
signal(SIGINT, int_handler);
signal(SIGTERM, term_handler);
- /* Say hello to the world */
- greet_world();
-
- /* Test arguments */
- if(argc>2){
- fprintf(stderr,"Usage: %s [<configuration-file>]\n",argv[0]);
- exit(1);
- }
+ while(1) {
+ int option_index = 0;
+ int c;
+
+ c = getopt_long(argc, argv, "c:hl:v", options, &option_index);
+ if (c == -1)
+ break;
+
+ switch (c) {
+ case 0:
+ break;
+ switch(option_index) {
+ case 0: case 2:
+ break;
+ case 1:
+ opt_loglevel = atoi(optarg);
+ break;
+ case 3:
+ strncpy(opt_configfile, optarg, 1023);
+ break;
+
+ }
+ break;
+ case 'c' :
+ strncpy(opt_configfile, optarg, 1023);
+ break;
+ case 'v':
+ opt_version = 1;
+ break;
+ case 'l':
+ opt_loglevel = atoi(optarg);
+ break;
+ }
+ }
+
+ if (optind < argc) { printf ("config %s\n", argv[optind++]); }
+
+ if (opt_version == 1) {
+ greet_world();
+ exit(0);
+ }
+ if (opt_help == 1) {
+ greet_world();
+ printf ("Usage:\n");
+ printf ("%s [flags]\n",argv[0]);
+ printf ("\nFlags:\n");
+ printf (" --version, -v Print version of program\n");
+ printf (" --help, -h This help screen\n");
+ printf (" --loglevel NUM, -l NUM Set logging level to NUM\n");
+ printf (" --configfile FILE, -c FILE Set confgiuration file to FILE\n");
+ exit(0);
+ }
/* Initialize all routines */
config_init();
@@ -55,7 +112,7 @@ main(int argc, char **argv)
io_init();
/* read config file */
- config_read(argv[1]);
+ config_read(opt_configfile);
/* print the current config and route info */
dump_config();
@@ -67,7 +124,7 @@ main(int argc, char **argv)
/* if we get this far without error, let's fork off ! :-) */
if (!daemon_start(TRUE)) {
- fprintf(stderr, "ax25ipd: cannot become a daemon\n");
+ syslog(stderr, "ax25ipd: cannot become a daemon\n");
return 1;
}
diff --git a/ax25ipd/process.c b/ax25ipd/process.c
index 20bae7f..fdf08ad 100644
--- a/ax25ipd/process.c
+++ b/ax25ipd/process.c
@@ -122,6 +122,9 @@ int l;
/* Warning - assuming buffer has room for 2 bytes */
add_crc(buf, l); l+=2;
send_ip(buf, l, ipaddr);
+ if (is_call_bcast(a)) {
+ send_broadcast(buf, l);
+ }
}
}
diff --git a/ax25mond/.cvsignore b/ax25mond/.cvsignore
new file mode 100644
index 0000000..2da6d7d
--- /dev/null
+++ b/ax25mond/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+Makefile.in
+ax25mond
diff --git a/ax25mond/Makefile.am b/ax25mond/Makefile.am
new file mode 100644
index 0000000..4ccbdc4
--- /dev/null
+++ b/ax25mond/Makefile.am
@@ -0,0 +1,27 @@
+
+sbin_PROGRAMS = ax25mond
+
+man_MANS = ax25mond.8 ax25mond.conf.5
+
+EXTRA_DIST = $(man_MANS) $(etcfiles)
+
+ax25mond_LDADD = $(AX25_LIB)
+
+ax25mond_SOURCES = \
+ ax25mond.c
+
+# Needed so that install is optional
+etcfiles = ax25mond.conf
+installconf:
+ $(mkinstalldirs) $(DESTDIR)$(AX25_SYSCONFDIR)
+ @list='$(etcfiles)'; for p in $$list; do \
+ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(AX25_SYSCONFDIR)/$$p"; \
+ $(INSTALL_DATA) $$p $(DESTDIR)$(AX25_SYSCONFDIR)/$$p; \
+ done
+
+AX25_SYSCONFDIR=$(sysconfdir)/ax25/
+AX25_LOCALSTATEDIR=$(localstatedir)/ax25/
+
+INCLUDES = -DAX25_SYSCONFDIR=\""$(AX25_SYSCONFDIR)"\" \
+ -DAX25_LOCALSTATEDIR=\""$(AX25_LOCALSTATEDIR)"\"
+
diff --git a/ax25mond/ax25mond.8 b/ax25mond/ax25mond.8
new file mode 100644
index 0000000..2ee9629
--- /dev/null
+++ b/ax25mond/ax25mond.8
@@ -0,0 +1,19 @@
+.TH AX25MOND 8 "30 January 1999" Linux "Linux System Managers Manual"
+.SH NAME
+ax25mond \- dump the AX.25 network traffic and and provide sockets
+where the received data will be retransmitted
+.SH SYNOPSIS
+.B ax25mond [-v|--version]
+.SH DESCRIPTION
+.LP
+.B Ax25mond
+will first read it's configuration file /etc/ax25/ax25mond.conf. It will
+then wait for connects on the sockets specified in this file. When
+connected, it will transmit all data which it has received on the AX.25
+monitor socket.
+.SH OPTIONS
+.TP 15
+.BI "\-v, \-\-version"
+Displays the version number and some copyright information.
+.SH AUTHOR
+Johann Hanne, DH3MB <jonny@baycom.org>
diff --git a/ax25mond/ax25mond.c b/ax25mond/ax25mond.c
new file mode 100644
index 0000000..58a932a
--- /dev/null
+++ b/ax25mond/ax25mond.c
@@ -0,0 +1,377 @@
+/*
+ * ax25mond.c - Wrapper for offering AX.25 traffic to non-root processes
+ *
+ * Copyright (C) 1998-1999 Johann Hanne, DH3MB. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*--------------------------------------------------------------------------*/
+
+#define VERSION "1.0"
+#define CONFFILE "/etc/ax25/ax25mond.conf"
+#define MAX_SOCKETS 5
+#define MAX_CONNECTS 50
+
+/*--------------------------------------------------------------------------*/
+
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+#include <netdb.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <syslog.h>
+#include <sys/time.h>
+#include <sys/un.h>
+#include <sys/socket.h>
+#include <sys/fcntl.h>
+#include <sys/signal.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <netinet/if_ether.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+// For older kernels
+#ifndef PF_PACKET
+ #define PF_PACKET PF_INET
+#endif
+
+/*--------------------------------------------------------------------------*/
+
+static union {
+ struct sockaddr sa;
+ struct sockaddr_in si;
+ struct sockaddr_un su;
+} addr;
+
+/*--------------------------------------------------------------------------*/
+
+int sock_list[MAX_SOCKETS];
+char sock_monmode[MAX_SOCKETS];
+char sock_filename[MAX_SOCKETS][100];
+int sock_num=0;
+int conn_list[MAX_CONNECTS];
+struct sockaddr conn_addr[MAX_CONNECTS];
+int conn_addrlen[MAX_CONNECTS];
+char conn_monmode[MAX_CONNECTS];
+int conn_num=0;
+int highest_sock_fd;
+int end=0;
+
+/*--------------------------------------------------------------------------*/
+
+/* from buildsaddr.c */
+struct sockaddr *build_sockaddr(const char *name, int *addrlen)
+{ char *host_name;
+ char *serv_name;
+ char buf[1024];
+
+ memset((char *) &addr, 0, sizeof(addr));
+ *addrlen=0;
+
+ host_name=strcpy(buf, name);
+ serv_name=strchr(buf, ':');
+ if(!serv_name)
+ return 0;
+ *serv_name++=0;
+ if(!*host_name || !*serv_name)
+ return 0;
+
+ if(!strcmp(host_name, "local") || !strcmp(host_name, "unix")) {
+ addr.su.sun_family=AF_UNIX;
+ *addr.su.sun_path=0;
+ strcat(addr.su.sun_path, serv_name);
+ *addrlen=sizeof(struct sockaddr_un);
+ return &addr.sa;
+ }
+
+ addr.si.sin_family=AF_INET;
+
+ if(!strcmp(host_name, "*")) {
+ addr.si.sin_addr.s_addr=INADDR_ANY;
+ } else if(!strcmp(host_name, "loopback")) {
+ addr.si.sin_addr.s_addr=inet_addr("127.0.0.1");
+ } else if((addr.si.sin_addr.s_addr=inet_addr(host_name))==-1L) {
+ struct hostent *hp=gethostbyname(host_name);
+ endhostent();
+ if(!hp)
+ return 0;
+ addr.si.sin_addr.s_addr=((struct in_addr *) (hp->h_addr))->s_addr;
+ }
+
+ if(isdigit(*serv_name & 0xff)) {
+ addr.si.sin_port=htons(atoi(serv_name));
+ } else {
+ struct servent *sp=getservbyname(serv_name, (char *) 0);
+ endservent();
+ if(!sp)
+ return 0;
+ addr.si.sin_port=sp->s_port;
+ }
+
+ *addrlen=sizeof(struct sockaddr_in);
+ return &addr.sa;
+}
+
+/*--------------------------------------------------------------------------*/
+
+void add_socket(char *sockname, char monmode) {
+ struct sockaddr *saddr;
+ int saddrlen;
+
+ if(sock_num==MAX_SOCKETS-1) {
+ fprintf(stderr, "WARNING: Too many sockets defined - only %d are "
+ "allowed\n", MAX_SOCKETS);
+ return;
+ }
+
+ if(!(saddr=build_sockaddr(sockname,&saddrlen))) {
+ fprintf(stderr, "WARNING: Invalid socket name: \"%s\"\n", sockname);
+ return;
+ }
+
+ if(saddr->sa_family==AF_UNIX)
+ strcpy(sock_filename[sock_num], strchr(sockname, ':')+1);
+ else
+ sock_filename[sock_num][0]=0;
+
+ if((sock_list[sock_num]=socket(saddr->sa_family,SOCK_STREAM,0))<0) {
+ fprintf(stderr, "WARNING: Error opening socket \"%s\": %s\n",
+ sockname, strerror(errno));
+ return;
+ }
+
+ if(bind(sock_list[sock_num],saddr,saddrlen)<0) {
+ fprintf(stderr, "WARNING: Error binding socket \"%s\": %s\n",
+ sockname, strerror(errno));
+ return;
+ }
+
+ if(listen(sock_list[sock_num], 5)<0) {
+ fprintf(stderr, "WARNING: Error listening on socket \"%s\": %s\n",
+ sockname, strerror(errno));
+ return;
+ }
+
+ fcntl(sock_list[sock_num],F_SETFL,O_NONBLOCK);
+
+ if(sock_list[sock_num] > highest_sock_fd)
+ highest_sock_fd=sock_list[sock_num];
+
+ sock_monmode[sock_num]=monmode;
+ sock_num++;
+}
+
+/*--------------------------------------------------------------------------*/
+
+void close_sockets() {
+ int i;
+
+ for(i=0;i<sock_num;i++) {
+ close(sock_list[i]);
+
+ if(sock_filename[i][0])
+ unlink(sock_filename[i]);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void quit_handler(int dummy) {
+ end=1;
+}
+
+/*--------------------------------------------------------------------------*/
+
+int main(int argc, char *argv[]) {
+ fd_set monavail;
+ int monrx_fd, monrxtx_fd;
+ struct sockaddr monfrom;
+ int monfromlen;
+ fd_set conn_request;
+ struct timeval tv;
+ char buf[500];
+ int size;
+ int i;
+ struct ifreq ifr;
+ FILE *conffile;
+ char confline[100];
+ char *mode;
+ char *sockname;
+
+ if(argc>1) {
+ if(argc==2 &&
+ (strcmp(argv[1],"-v")==0 || strcmp(argv[1],"--version")==0)) {
+ printf("%s: Version " VERSION "\n\n", argv[0]);
+ printf("Copyright (C) 1998-1999 Johann Hanne, DH3MB. All rights reserved.\n"
+ "This program is free software; you can redistribute it and/or modify\n"
+ "it under the terms of the GNU General Public License as published by\n"
+ "the Free Software Foundation; either version 2 of the License, or\n"
+ "(at your option) any later version.\n\n"
+ "This program is distributed in the hope that it will be useful,\n"
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n");
+ exit(1);
+ } else {
+ printf("Usage: %s [-v|--version]\n", argv[0]);
+ exit(0);
+ }
+ }
+
+ // At first, read the configuration file
+ if(!(conffile=fopen(CONFFILE, "r"))) {
+ fprintf(stderr, "Unable to open " CONFFILE ".\n");
+ exit(1);
+ }
+ while(fgets(confline, 100, conffile)) {
+ if(confline[0]=='#') // Comment
+ continue;
+
+ confline[strlen(confline)-1]=0; // Cut the LF
+
+ if(!(sockname=strchr(confline, ' '))) {
+ fprintf(stderr, "WARNING: The following configuration line includes "
+ "one or more errors:\n%s\n", confline);
+ continue;
+ }
+
+ *(sockname++)=0;
+ mode=confline;
+ if(strcasecmp(mode, "RX")==0)
+ add_socket(sockname, 0);
+ else if(strcasecmp(mode, "RXTX")==0)
+ add_socket(sockname, 1);
+ else
+ fprintf(stderr, "WARNING: Mode \"%s\" not supported\n", mode);
+
+ }
+ fclose(conffile);
+
+ if(sock_num==0) {
+ fprintf(stderr, "FATAL: No usable socket found\n");
+ exit(1);
+ }
+
+ // Fork into background
+ if(fork())
+ exit(0);
+
+ // Close stdout, stderr and stdin
+ fclose(stdout);
+ fclose(stderr);
+ fclose(stdin);
+
+ // Set some signal handlers
+ signal(SIGPIPE, SIG_IGN);
+ signal(SIGTERM, quit_handler);
+
+ openlog("ax25mond", LOG_PID, LOG_DAEMON);
+
+ // Open AX.25 socket for monitoring RX traffic only
+ if((monrx_fd=socket(PF_PACKET,SOCK_PACKET,htons(ETH_P_AX25)))<0) {
+ syslog(LOG_ERR, "Error opening monitor socket: %s\n",strerror(errno));
+ exit(1);
+ }
+ fcntl(monrx_fd,F_SETFL,O_NONBLOCK);
+
+ // Open AX.25 socket for monitoring RX and TX traffic
+ if((monrxtx_fd=socket(PF_PACKET,SOCK_PACKET,htons(ETH_P_ALL)))<0) {
+ syslog(LOG_ERR, "Error opening monitor socket: %s\n",strerror(errno));
+ exit(1);
+ }
+ fcntl(monrxtx_fd,F_SETFL,O_NONBLOCK);
+
+ while(!end) {
+
+ // Look for incoming connects on all open sockets
+ FD_ZERO(&conn_request);
+ for(i=0;i<sock_num;i++)
+ FD_SET(sock_list[i], &conn_request);
+ tv.tv_sec=0;
+ tv.tv_usec=0;
+ select(highest_sock_fd+1, &conn_request, 0, 0, &tv);
+ for(i=0;i<sock_num;i++)
+ if(FD_ISSET(sock_list[i], &conn_request)) {
+ conn_list[conn_num]=accept(sock_list[i],
+ &conn_addr[conn_num],
+ &conn_addrlen[conn_num]);
+ conn_monmode[conn_num]=sock_monmode[i];
+ conn_num++;
+ }
+
+ // Check if there is new data on the RX-only monitor socket
+ FD_ZERO(&monavail);
+ FD_SET(monrx_fd,&monavail);
+ tv.tv_sec=0;
+ tv.tv_usec=10;
+ select(monrx_fd+1, &monavail, 0, 0, &tv);
+ if(FD_ISSET(monrx_fd,&monavail)) {
+ monfromlen=sizeof(monfrom);
+ size=recvfrom(monrx_fd,buf,sizeof(buf),0,&monfrom,&monfromlen);
+ // Send the packet to all connected sockets
+ for(i=0;i<conn_num;i++) {
+ if(conn_monmode[i]==0)
+ if(send(conn_list[i],buf,size,0)<0)
+ if(errno!=EAGAIN) {
+ syslog(LOG_ERR, "Error sending monitor data: %s\n",
+ strerror(errno));
+ close(conn_list[i]);
+ conn_list[i]=conn_list[conn_num-1];
+ conn_num--;
+ }
+ }
+ }
+
+ // Check if there is new data on the RX+TX monitor socket
+ FD_ZERO(&monavail);
+ FD_SET(monrxtx_fd,&monavail);
+ tv.tv_sec=0;
+ tv.tv_usec=10;
+ select(monrxtx_fd+1, &monavail, 0, 0, &tv);
+ if(FD_ISSET(monrxtx_fd,&monavail)) {
+ monfromlen=sizeof(monfrom);
+ size=recvfrom(monrxtx_fd,buf,sizeof(buf),0,&monfrom,&monfromlen);
+ // Check, if we have received a AX.25-packet
+ strcpy(ifr.ifr_name,monfrom.sa_data);
+ ioctl(monrxtx_fd,SIOCGIFHWADDR,&ifr);
+ if (ifr.ifr_hwaddr.sa_family==AF_AX25)
+ // Send the packet to all connected sockets
+ for(i=0;i<conn_num;i++) {
+ if(conn_monmode[i]==1)
+ if(send(conn_list[i],buf,size,0)<0)
+ if(errno!=EAGAIN) {
+ syslog(LOG_ERR, "Error sending monitor data: %s\n",
+ strerror(errno));
+ close(conn_list[i]);
+ conn_list[i]=conn_list[conn_num-1];
+ conn_num--;
+ }
+ }
+ }
+
+ }
+
+ for(i=0;i<conn_num;i++)
+ close(conn_list[i]);
+ close_sockets();
+ close(monrx_fd);
+ close(monrxtx_fd);
+ closelog();
+ return 0;
+}
diff --git a/ax25mond/ax25mond.conf b/ax25mond/ax25mond.conf
new file mode 100644
index 0000000..53b4d7a
--- /dev/null
+++ b/ax25mond/ax25mond.conf
@@ -0,0 +1,3 @@
+# Create an internet socket on port 1234 and transmit the whole
+# AX.25 traffic
+rxtx *:1234
diff --git a/ax25mond/ax25mond.conf.5 b/ax25mond/ax25mond.conf.5
new file mode 100644
index 0000000..66d343e
--- /dev/null
+++ b/ax25mond/ax25mond.conf.5
@@ -0,0 +1,30 @@
+.TH AX25MOND.CONF 5 "30 January 1999" Linux "Linux Programmer's Manual"
+.SH NAME
+ax25mond.conf \- Specify the sockets which ax25mond will provide.
+.SH DESCRIPTION
+.LP
+The
+.B ax25mond.conf
+file specifies the internet- and unix-sockets which ax25mond(8)
+will provide. Example:
+.LP
+# Create an internet socket on port 1234 where all the
+.br
+# AX.25 traffic will be transmitted
+.br
+rxtx *:1234
+.br
+# Create an unix socket where only the received AX.25
+.br
+# traffic will be transmitted
+.br
+rx unix:/var/spool/ax25/monitor
+.br
+.LP
+You may specify up to 5 sockets (definable in ax25mond.c) and ax25mond
+will accept up to 50 connects (also definable in ax25mond.c).
+.SH FILES
+.LP
+/etc/ax25/ax25mond.conf
+.SH "SEE ALSO"
+.BR ax25mond (8).
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)
diff --git a/call/Makefile.in b/call/Makefile.in
index cdb2815..979b9f8 100644
--- a/call/Makefile.in
+++ b/call/Makefile.in
@@ -273,14 +273,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/call/call.c b/call/call.c
index c3cfd16..6139990 100644
--- a/call/call.c
+++ b/call/call.c
@@ -229,6 +229,11 @@ static int connect_to(char *address[])
return (-1);
}
ax25_aton(ax25_config_get_addr(port), &sockaddr.ax25);
+ if (sockaddr.ax25.fsa_ax25.sax25_ndigis == 0) {
+ ax25_aton_entry(ax25_config_get_addr(port),
+ sockaddr.ax25.fsa_digipeater[0].ax25_call);
+ sockaddr.ax25.fsa_ax25.sax25_ndigis = 1;
+ }
sockaddr.ax25.fsa_ax25.sax25_family = AF_AX25;
addrlen = sizeof(struct full_sockaddr_ax25);
diff --git a/call/menu.c b/call/menu.c
index e825789..61e17ff 100644
--- a/call/menu.c
+++ b/call/menu.c
@@ -8,6 +8,7 @@
#include <curses.h>
#include <stdlib.h>
+#include <string.h>
#include "menu.h"
typedef struct
diff --git a/configure b/configure
index 3bc46fc..96211ad 100755
--- a/configure
+++ b/configure
@@ -532,7 +532,7 @@ fi
-VERSION=0.0.4
+VERSION=0.0.5p2
PACKAGE=ax25-apps
ac_aux_dir=
for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
@@ -2178,7 +2178,7 @@ else
int main() {
/* Ultrix mips cc rejects this. */
-typedef int charset[2]; const charset x;
+typedef int charset[2]; const charset x = {0,0};
/* SunOS 4.1.1 cc rejects this. */
char const *const *ccp;
char **p;
@@ -2253,7 +2253,7 @@ for ac_kw in inline __inline__ __inline; do
#include "confdefs.h"
int main() {
-} $ac_kw foo() {
+} int $ac_kw foo() {
; return 0; }
EOF
if { (eval echo configure:2260: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
@@ -2775,7 +2775,7 @@ done
ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"
-trap 'rm -fr `echo "call/Makefile ax25ipd/Makefile listen/Makefile Makefile ax25rtd/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo "call/Makefile ax25ipd/Makefile listen/Makefile Makefile ax25rtd/Makefile ax25mond/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
@@ -2880,7 +2880,7 @@ EOF
cat >> $CONFIG_STATUS <<EOF
-CONFIG_FILES=\${CONFIG_FILES-"call/Makefile ax25ipd/Makefile listen/Makefile Makefile ax25rtd/Makefile"}
+CONFIG_FILES=\${CONFIG_FILES-"call/Makefile ax25ipd/Makefile listen/Makefile Makefile ax25rtd/Makefile ax25mond/Makefile"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
diff --git a/configure.in b/configure.in
index 192a498..fdb9103 100644
--- a/configure.in
+++ b/configure.in
@@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(ax25ipd/config.c)
dnl For automake
-VERSION=0.0.4
+VERSION=0.0.5p2
PACKAGE=ax25-apps
AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
@@ -76,4 +76,4 @@ if test "x$GCC" = "xyes"; then
fi
fi
-AC_OUTPUT(call/Makefile ax25ipd/Makefile listen/Makefile Makefile ax25rtd/Makefile)
+AC_OUTPUT(call/Makefile ax25ipd/Makefile listen/Makefile Makefile ax25rtd/Makefile ax25mond/Makefile)
diff --git a/listen/Makefile.in b/listen/Makefile.in
index acf7fba..9f1fe31 100644
--- a/listen/Makefile.in
+++ b/listen/Makefile.in
@@ -274,14 +274,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/listen/arpdump.c b/listen/arpdump.c
index a80716a..c399098 100644
--- a/listen/arpdump.c
+++ b/listen/arpdump.c
@@ -1,4 +1,4 @@
-/* @(#) $Header: arpdump.c,v 1.5 91/03/28 19:38:59 deyke Exp $ */
+/* @(#) $Header: /home/ax25-cvs/ax25-apps/listen/arpdump.c,v 1.1 2001/04/10 01:58:51 csmall Exp $ */
/* ARP packet tracing routines
* Copyright 1991 Phil Karn, KA9Q
diff --git a/listen/ax25dump.c b/listen/ax25dump.c
index 86b78e0..5265453 100644
--- a/listen/ax25dump.c
+++ b/listen/ax25dump.c
@@ -1,4 +1,4 @@
-/* @(#) $Header: ax25dump.c,v 1.5 91/02/24 20:16:33 deyke Exp $ */
+/* @(#) $Header: /home/ax25-cvs/ax25-apps/listen/ax25dump.c,v 1.1 2001/04/10 01:58:51 csmall Exp $ */
/* AX25 header tracing
* Copyright 1991 Phil Karn, KA9Q
diff --git a/listen/icmpdump.c b/listen/icmpdump.c
index 655d2fc..2b51e7f 100644
--- a/listen/icmpdump.c
+++ b/listen/icmpdump.c
@@ -1,4 +1,4 @@
-/* @(#) $Header: icmpdump.c,v 1.4 91/02/24 20:16:55 deyke Exp $ */
+/* @(#) $Header: /home/ax25-cvs/ax25-apps/listen/icmpdump.c,v 1.1 2001/04/10 01:58:52 csmall Exp $ */
/* ICMP header tracing
* Copyright 1991 Phil Karn, KA9Q
diff --git a/listen/ipdump.c b/listen/ipdump.c
index aa1abae..fc14461 100644
--- a/listen/ipdump.c
+++ b/listen/ipdump.c
@@ -1,4 +1,4 @@
-/* @(#) $Header: ipdump.c,v 1.6 91/07/16 17:55:22 deyke Exp $ */
+/* @(#) $Header: /home/ax25-cvs/ax25-apps/listen/ipdump.c,v 1.1 2001/04/10 01:58:52 csmall Exp $ */
/* IP header tracing routines
* Copyright 1991 Phil Karn, KA9Q
diff --git a/listen/kissdump.c b/listen/kissdump.c
index 38bf6e6..0066f63 100644
--- a/listen/kissdump.c
+++ b/listen/kissdump.c
@@ -1,4 +1,4 @@
-/* @(#) $Header: kissdump.c,v 1.7 92/11/29 17:37:52 deyke Exp $ */
+/* @(#) $Header: /home/ax25-cvs/ax25-apps/listen/kissdump.c,v 1.1 2001/04/10 01:58:53 csmall Exp $ */
/* Tracing routines for KISS TNC
* Copyright 1991 Phil Karn, KA9Q
diff --git a/listen/listen.c b/listen/listen.c
index e4daad6..f603f12 100644
--- a/listen/listen.c
+++ b/listen/listen.c
@@ -27,10 +27,6 @@
#include <config.h>
#include "listen.h"
-#ifdef AX25_NEW_DEVIF
-#define ki_dump ax25_dump
-#endif
-
int timestamp;
static void display_port(char *dev)
@@ -153,12 +149,20 @@ int main(int argc, char **argv)
if (ifr.ifr_hwaddr.sa_family == AF_AX25) {
display_port(sa.sa_data);
+#ifdef NEW_AX25_STACK
+ ax25_dump(buffer, size, dumpstyle);
+#else
ki_dump(buffer, size, dumpstyle);
+#endif
// lprintf(T_DATA, "\n");
}
} else {
display_port(sa.sa_data);
- ki_dump(buffer, size, dumpstyle);
+#ifdef NEW_AX25_STACK
+ ax25_dump(buffer, size, dumpstyle);
+#else
+ ki_dump(buffer, size, dumpstyle);
+#endif
// lprintf(T_DATA, "\n");
}
if (color)
diff --git a/listen/nrdump.c b/listen/nrdump.c
index 974fa71..a5a2bfc 100644
--- a/listen/nrdump.c
+++ b/listen/nrdump.c
@@ -1,9 +1,10 @@
-/* @(#) $Header: nrdump.c,v 1.2 91/02/24 20:17:28 deyke Exp $ */
+/* @(#) $Header: /home/ax25-cvs/ax25-apps/listen/nrdump.c,v 1.1 2001/04/10 01:58:54 csmall Exp $ */
/* NET/ROM header tracing routines
* Copyright 1991 Phil Karn, KA9Q
*/
#include <stdio.h>
+#include <string.h>
#include "listen.h"
#define AXLEN 7
diff --git a/listen/rosedump.c b/listen/rosedump.c
index aff16aa..c4d26b0 100644
--- a/listen/rosedump.c
+++ b/listen/rosedump.c
@@ -1,10 +1,24 @@
/*
* Copyright 1996 Jonathan Naylor G4KLX
+ *
+ * Added ROSE new facilities : Jean-Paul ROUBELAT 04-1998
+ * Added ROSE multi-digi : Jean-Paul ROUBELAT 05-1998
+ * Added ROSE PID transport : Jean-Paul ROUBELAT 07-1998
*/
+
#include <stdio.h>
#include <string.h>
#include "listen.h"
+#define PID_SEGMENT 0x08
+#define PID_ARP 0xCD
+#define PID_NETROM 0xCF
+#define PID_IP 0xCC
+#define PID_X25 0x01
+#define PID_TEXNET 0xC3
+#define PID_FLEXNET 0xCE
+#define PID_NO_L3 0xF0
+
#define ROSE_ADDR_LEN 5
#define CALL_REQUEST 0x0B
@@ -29,25 +43,49 @@
#define DBIT 0x40
#define MBIT 0x10
+#define AX25_HBIT 0x80
+
static char *dump_x25_addr(unsigned char *);
static char *clear_code(unsigned char);
static char *reset_code(unsigned char);
static char *restart_code(unsigned char);
+static void facility(unsigned char *, int len);
void rose_dump(unsigned char *data, int length, int hexdump)
{
- lprintf(T_ROSEHDR, "X.25: LCI %3.3X : ", (data[0] & 0x0F) + data[1]);
+ unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+ unsigned int len, hlen;
+ unsigned int lci = ((unsigned)(data[0] & 0x0F) << 8) + data[1];
+ lprintf(T_ROSEHDR, "X.25: LCI %3.3X : ", lci);
switch (data[2]) {
case CALL_REQUEST:
- data += 4;
- length -= 4;
+ len = 4;
+ hlen = (((data[3] >> 4) & 0x0F) + 1) / 2;
+ hlen += (((data[3] >> 0) & 0x0F) + 1) / 2;
+ if (hlen == 10)
+ {
+ dest = data+4;
+ source = data+9;
+ }
+ len += hlen;
+ data += len;
+ length -= len;
lprintf(T_ROSEHDR, "CALL REQUEST - ");
- lprintf(T_ADDR, "%s -> ", dump_x25_addr(data + ROSE_ADDR_LEN));
- lprintf(T_ADDR, "%s\n", dump_x25_addr(data + 0));
- data += ROSE_ADDR_LEN + ROSE_ADDR_LEN;
- length -= ROSE_ADDR_LEN + ROSE_ADDR_LEN;
- data_dump(data, length, 1);
+ if (length)
+ {
+ unsigned int flen = data[0]+1;
+ facility(data, length);
+ length -= flen;
+ data += flen;
+ if (length > 0)
+ data_dump(data, length, 1);
+ }
+ else
+ {
+ lprintf(T_ROSEHDR, "\n");
+ }
return;
case CALL_ACCEPTED:
@@ -57,6 +95,10 @@ void rose_dump(unsigned char *data, int length, int hexdump)
case CLEAR_REQUEST:
lprintf(T_ROSEHDR, "CLEAR REQUEST - Cause %s - Diag %d\n",
clear_code(data[3]), data[4]);
+ if (length > 6)
+ {
+ facility(data+6, length-6);
+ }
return;
case CLEAR_CONFIRMATION:
@@ -104,12 +146,61 @@ void rose_dump(unsigned char *data, int length, int hexdump)
}
if ((data[2] & 0x01) == DATA) {
- lprintf(T_ROSEHDR, "DATA R%d S%d %s%s%s\n",
+ lprintf(T_ROSEHDR, "DATA R%d S%d %s%s%s",
(data[2] >> 5) & 0x07, (data[2] >> 1) & 0x07,
(data[0] & QBIT) ? "Q" : "",
(data[0] & DBIT) ? "D" : "",
(data[2] & MBIT) ? "M" : "");
- data_dump(data + 3, length - 3, hexdump);
+ if ((length >= 5) && (data[0] & QBIT) && (data[3] == 0x7f))
+ {
+ /* pid transport */
+ int pid = data[4];
+ data += 5;
+ length -= 5;
+ switch (pid) {
+ case PID_SEGMENT:
+ lprintf(T_ROSEHDR," len %d\n", length - 5);
+ data_dump(data, length, hexdump);
+ break;
+ case PID_ARP:
+ lprintf(T_ROSEHDR," pid=ARP len %d\n", length - 5);
+ arp_dump(data, length);
+ break;
+ case PID_NETROM:
+ lprintf(T_ROSEHDR," pid=NET/ROM len %d\n", length - 5);
+ netrom_dump(data, length, hexdump);
+ break;
+ case PID_IP:
+ lprintf(T_ROSEHDR," pid=IP len %d\n", length - 5);
+ ip_dump(data, length, hexdump);
+ break;
+ case PID_X25:
+ lprintf(T_ROSEHDR, " pid=X.25 len %d\n", length - 5);
+ rose_dump(data, length, hexdump);
+ break;
+ case PID_TEXNET:
+ lprintf(T_ROSEHDR, " pid=TEXNET len %d\n", length - 5);
+ data_dump(data, length, hexdump);
+ break;
+ case PID_FLEXNET:
+ lprintf(T_ROSEHDR, " pid=FLEXNET len %d\n", length - 5);
+ flexnet_dump(data, length, hexdump);
+ break;
+ case PID_NO_L3:
+ lprintf(T_ROSEHDR, " pid=Text len %d\n", length - 5);
+ data_dump(data, length, hexdump);
+ break;
+ default:
+ lprintf(T_ROSEHDR, " pid=0x%x len %d\n", pid, length - 5);
+ data_dump(data, length, hexdump);
+ break;
+ }
+ }
+ else
+ {
+ lprintf(T_ROSEHDR, " len %d\n", length - 3);
+ data_dump(data + 3, length - 3, hexdump);
+ }
return;
}
@@ -209,7 +300,189 @@ static char *dump_x25_addr(unsigned char *data)
{
static char buffer[25];
- sprintf(buffer, "%02X%02X%02X%02X%02X", data[0], data[1], data[2], data[3], data[4]);
+ sprintf(buffer, "%02X%02X,%02X%02X%02X", data[0], data[1], data[2], data[3], data[4]);
return buffer;
}
+
+static char *dump_ax25_call(unsigned char *data, int l_data)
+{
+ static char buffer[25];
+ char *ptr = buffer;
+ int ssid;
+
+ while (l_data-- > 1)
+ {
+ *ptr = *data++ >> 1;
+ if (*ptr != ' ')
+ ++ptr;
+ }
+
+ *ptr++ = '-';
+ ssid = (*data & 0x1F) >> 1;
+ if (ssid >= 10)
+ {
+ *ptr++ = '1';
+ ssid -= 10;
+ }
+ *ptr++ = ssid + '0';
+ *ptr = 0;
+
+ return buffer;
+}
+
+static void facility(unsigned char *data, int lgtot)
+{
+ int lgfac, l, lg, fct, lgdigi, lgaddcall;
+ int lgad, lgaddr, lgadind, digi_fac;
+ char digis[80], digid[80];
+ char indorig[10], inddest[10];
+ char addstorig[20], addstdest[20];
+ char *d, *factot;
+ char buf[512];
+ char *result = buf;
+
+ factot = data;
+
+ lgfac = *data++;
+ lg = lgfac;
+
+ digi_fac = 0;
+ digid[0] = digis[0] = '\0';
+ indorig[0] = inddest[0] = '\0';
+
+ while (lg > 0)
+ {
+ fct = *data++;
+ lg--;
+ switch (fct)
+ {
+ case 0:
+ /* Marker=0 National Fac ou Marker=15 CCITT */
+ data++;
+ lg--;
+ break;
+ case 0x3F:
+ /* Used if call request via L2 digi instead of L3 */
+ lprintf (T_ROSEHDR, "Facility 3F%2.2X\n", *data++);
+ lg--;
+ break;
+ case 0x7F:
+ /* Random number to avoid loops */
+ lprintf (T_ROSEHDR, "NbAlea: %2.2X%2.2X\n", *data, *(data + 1));
+ data += 2;
+ lg -= 2;
+ break;
+ case 0xE9:
+ /* Destination digi (for compatibility) */
+ lgdigi = *data++;
+ if (!digi_fac)
+ strcpy(digid, dump_ax25_call(data, lgdigi));
+ data += lgdigi;
+ lg -= 1 + lgdigi;
+ break;
+ case 0xEB:
+ /* Origin digi (for compatibility) */
+ lgdigi = *data++;
+ if (!digi_fac)
+ strcpy(digis, dump_ax25_call(data, lgdigi));
+ data += lgdigi;
+ lg -= 1 + lgdigi;
+ break;
+ case 0xED:
+ /* Out of order : callsign */
+ lgaddcall = *data++;
+ lprintf(T_ROSEHDR, "at %s", dump_ax25_call(data, lgaddcall));
+ data += lgaddcall;
+ lg -= 1 + lgaddcall;
+ break;
+ case 0xEE:
+ /* Out of order : address */
+ lgaddcall = *data++;
+ ++data; /* Don't know... */
+ lprintf(T_ROSEHDR, " @%s\n", dump_x25_addr(data));
+ /* data_dump(data, lgaddcall, 1); */
+ data += lgaddcall;
+ lg -= 1 + lgaddcall;
+ break;
+ case 0xEF:
+ lgaddcall = *data++;
+ for (d = data, l = 0; l < lgaddcall ; l += 7, d += 7)
+ {
+ if (l > (6 * 7))
+ {
+ /* 6 digis maximum */
+ break;
+ }
+ if (d[6] & AX25_HBIT)
+ {
+ strcat(digis, dump_ax25_call(d, 7));
+ strcat(digis, " ");
+ }
+ else
+ {
+ strcat(digid, dump_ax25_call(d, 7));
+ strcat(digid, " ");
+ }
+ }
+ data += lgaddcall;
+ lg -= 1 + lgaddcall;
+ digi_fac = 1;
+ break;
+ case 0xC9:
+ /* Address and callsign of the remote node */
+ case 0xCB:
+ /* Address and callsign of the local node */
+ lgaddcall = *data++;
+ data++;
+ data += 3;
+ lgad = *data++;
+ lg -= 6;
+ lgaddr = lgad;
+
+ if (fct == 0xCB)
+ strcpy (addstorig, dump_x25_addr(data));
+ else
+ strcpy (addstdest, dump_x25_addr(data));
+
+ data += (lgad + 1) / 2;
+ lg -= (lgad + 1) / 2;
+ lgadind = lgaddcall - (lgad + 1) / 2 - 5;
+
+ if (fct == 0xCB)
+ {
+ strncpy (indorig, data, lgadind);
+ indorig[lgadind] = '\0';
+ }
+ else
+ {
+ strncpy (inddest, data, lgadind);
+ inddest[lgadind] = '\0';
+ }
+
+ data += lgadind;
+ lg -= lgadind;
+ break;
+ default:
+ lprintf (T_ROSEHDR, "Unknown Facility Type %2.2X\n", fct);
+ data_dump(factot, lgtot, 1);
+ lg = 0;
+ break;
+ }
+
+ result += strlen (result);
+ }
+
+ if (*indorig && *inddest)
+ {
+ /* Build the displayed string */
+ lprintf (T_ROSEHDR, "fm %-9s @%s", indorig, addstorig);
+ if (*digis)
+ lprintf (T_ROSEHDR, " via %s", digis);
+ lprintf (T_ROSEHDR, "\n");
+ lprintf (T_ROSEHDR, "to %-9s @%s", inddest, addstdest);
+ if (*digid)
+ lprintf (T_ROSEHDR, " via %s", digid);
+ lprintf (T_ROSEHDR, "\n");
+ }
+}
diff --git a/listen/tcpdump.c b/listen/tcpdump.c
index 7939f41..3a9520f 100644
--- a/listen/tcpdump.c
+++ b/listen/tcpdump.c
@@ -1,4 +1,4 @@
-/* @(#) $Header: tcpdump.c,v 1.5 91/05/09 07:38:56 deyke Exp $ */
+/* @(#) $Header: /home/ax25-cvs/ax25-apps/listen/tcpdump.c,v 1.1 2001/04/10 01:58:56 csmall Exp $ */
/* TCP header tracing routines
* Copyright 1991 Phil Karn, KA9Q
diff --git a/listen/udpdump.c b/listen/udpdump.c
index 7b1c184..4eb75a1 100644
--- a/listen/udpdump.c
+++ b/listen/udpdump.c
@@ -1,4 +1,4 @@
-/* @(#) $Header: udpdump.c,v 1.5 91/05/09 07:39:11 deyke Exp $ */
+/* @(#) $Header: /home/ax25-cvs/ax25-apps/listen/udpdump.c,v 1.1 2001/04/10 01:58:56 csmall Exp $ */
/* UDP packet tracing
* Copyright 1991 Phil Karn, KA9Q
diff --git a/mkinstalldirs b/mkinstalldirs
index 4f58503..4acbefc 100755
--- a/mkinstalldirs
+++ b/mkinstalldirs
@@ -4,7 +4,7 @@
# Created: 1993-05-16
# Public domain
-# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
+# $Id: mkinstalldirs,v 1.1 2001/04/10 01:58:24 csmall Exp $
errstatus=0
diff --git a/pathnames.h b/pathnames.h
index 624ecde..dc5468f 100644
--- a/pathnames.h
+++ b/pathnames.h
@@ -4,6 +4,7 @@
#define CONF_AX25ROUTED_FILE AX25_SYSCONFDIR"/ax25rtd.conf"
#define DATA_AX25ROUTED_CTL_SOCK AX25_LOCALSTATEDIR"/ax25rtd/control"
#define PROC_AX25_FILE "/proc/net/ax25"
+#define PROC_AX25PORTS_FILE "/proc/net/ax25_ports"
#define DATA_AX25ROUTED_AXRT_FILE AX25_LOCALSTATEDIR"/ax25rtd/ax25_route"
#define DATA_AX25ROUTED_IPRT_FILE AX25_LOCALSTATEDIR"/ax25rtd/ip_route"