ax25ipd
PATCH 1/1 ax25ipd
Hi Cathryn,
Thanks for your excellent work on ax25ipd.
I have been using ax25-apps.0.0.8-rc2 with your ax25ipd patch for a couple of months. I did not notice any issue, although I use devfs legacy pseudo tty and not Unix98 devices. However I know there are an increasing number of AX25 ROSE FPAC nodes using Unix98 /dev/ptmx /dev/pts devices.
I noticed that your patch included a few minor errors that I corrected. Also you added -pthread into ax25ipd Makefile while this file does not exist when unpacking ax25-tools-0.0.8-rc2.
Thus I moved this argument into apps configure file.
I included also a reference to Steve Fraser vk5asf work, adding provision for dynamic dns hosts in June 2005, and changed sub version number to 1.0.6
Patched ax25-apps package may be found here:
http://f6bvp.free.fr/logiciels/ax25/From%20other%20sources/ax25-apps-0.0.8-rc2.ax25ipd.dyndns.tar.bz2
Bernard Pidoux
ax25ipd/ax25ipd.h +27 -4
@@ -25,6 +25,18 @@* Terry Dawson, VK2KTJ, September 2001. */ +/* +Version 1.0.5 +added provision for dynamic dns hosts +Steve Fraser vk5asf, June 2005 +*/ + +/* +Version 1.0.6 + + +*/ +/* Define the current version number * * The first digit represents the major release (0 is a prototype release)
@@ -37,7 +49,7 @@* */ -#define VERS2 "Version 1.0.2" +#define VERS2 "Version 1.0.6"#define IPPROTO_AX25 93#define DEFAULT_UDP_PORT 10093
@@ -118,6 +130,11 @@#define AXRT_BCAST 1#define AXRT_DEFAULT 2 +#define AXRT_PERMANENT 4 +#define AXRT_LEARN 8 + + +#define IPSTORAGESIZE 6/* Bytes needed for call_to_ip */ /* start external prototypes */ /* end external prototypes */
@@ -133,12 +150,16 @@/* routing.c */ void route_init (void ); -void route_add (unsigned char *,unsigned char *,int ,unsigned int ); +void route_add (char *,unsigned char *,unsigned char *,int ,unsigned int ); +int route_ipmatch (struct sockaddr_in *,unsigned char *); +unsigned char *retrieveip (unsigned char *,unsigned char *); +void route_process (struct sockaddr_in *,unsigned char *);void bcast_add (unsigned char *); -unsigned char *call_to_ip (unsigned char *); +unsigned char *call_to_ip (unsigned char *,unsigned char *);int is_call_bcast (unsigned char *);void send_broadcast (unsigned char *,int );void dump_routes (void ); +void update_dns (unsigned );/* config.c */ void config_init (void );
@@ -151,11 +172,13 @@/* process.c */ void process_init (void );void from_kiss (unsigned char *,int ); -void from_ip (unsigned char *,int ); +void from_ip (unsigned char *,int ,struct sockaddr_in *);/* void do_broadcast(void); where did this go ?? xxx */ void do_beacon (void );int addrmatch (unsigned char *,unsigned char *); +int addrcompare (unsigned char *,unsigned char *);unsigned char *next_addr (unsigned char *); +unsigned char *from_addr (unsigned char *);void add_crc (unsigned char *,int );void dump_ax25frame (char *,unsigned char *,int );
ax25ipd/config.c +31 -8
@@ -292,6 +292,8 @@return 0 ; }else if (strcmp (p,"route" ) ==0 ) { +char *thost; + uport =0 ; flags =0 ;
@@ -305,15 +307,26 @@ q =strtok (NULL ," \t\n\r" );if (q ==NULL )return -1 ; - he =gethostbyname (q); -if (he !=NULL ) { -memcpy (tip, he->h_addr_list[0 ],4 ); - }else {/* maybe user specified a numeric addr? */ - j =inet_addr (q); -if (j ==-1 ) -return -5 ;/* if -1, bad deal! */ + thost =strdup (q); + j =inet_addr (q); +if (j !=-1 ){/* maybe user specified a numeric addr? */ + flags |=AXRT_PERMANENT ;/* Prevent useless dns check on dotted ip */ memcpy (tip, (char *) &j,4 ); +if (!j){/* IP of 0.0.0.0. Learn from incoming packets */ + flags |=AXRT_LEARN ; + } + } +else { + he =gethostbyname (q); +if (he !=NULL ) { +memcpy (tip, he->h_addr_list[0 ],4 ); + }else { + j =inet_addr ("0.0.0.0" );/* try to rescue this idea of checking later.*/ +memcpy (tip, (char *) &j,4 ); +fprintf (stderr,"ax25ipd: %s host IP address unknown - will probe it again later\n" ,thost); + } } +while ((q =strtok (NULL ," \t\n\r" )) !=NULL ) {if (strcmp (q,"udp" ) ==0 ) {
@@ -334,9 +347,19 @@if (strchr (q,'d' )) { flags |=AXRT_DEFAULT ; } + +/* Test for "permanent" flag */ +if (strchr (q,'p' )) { + flags |=AXRT_PERMANENT ; + } +/* Test for "learn" flag */ +if (strchr (q,'l' )) { + flags |=AXRT_LEARN ; + } } } -route_add (tip, tcall, uport, flags); +route_add (thost, tip, tcall, uport, flags); +free (thost);return 0 ; }else if (strcmp (p,"broadcast" ) ==0 ) {
ax25ipd/HISTORY.ax25ipd +51 -1
55 lines not on this page · raw message
ax25ipd/io.c +7 -3
@@ -378,10 +378,11 @@if (nb ==0 ) {fflush (stdout);fflush (stderr); +update_dns (60 *60 );// Once/hour /* just so we go back to the top of the loop! */ continue ; } - +update_dns (60 *60 );// once/hour if (FD_ISSET (ttyfd, &readfds)) { do { n = read(ttyfd, buf, MAX_FRAME);
@@ -418,7 +419,7 @@LOGL4 ("udpdata from=%s port=%d l=%d\n" , (char *)inet_ntoa (from. sin_addr),ntohs (from. sin_port), n); stats.udp_in++;if (n >0 ) -from_ip (buf, n); +from_ip (buf, n, &from); } }/* if udp_mode */
@@ -434,7 +435,7 @@LOGL4 ("ipdata from=%s l=%d, hl=%d\n" , (char *)inet_ntoa (from. sin_addr), n, hdr_len); stats.ip_in++;if (n > hdr_len) -from_ip (buf + hdr_len, n - hdr_len); +from_ip (buf + hdr_len, n - hdr_len, &from); }#ifdef USE_ICMP if (FD_ISSET (icmpsock, &readfds)) {
@@ -461,6 +462,9 @@if (l <=0 )return ; +if (* (unsigned *) targetip ==0 ){/* If the ip is set to 0 don't send anything. I'm not sure what sending to 0 does, but I don't like the idea. */ +return ; + }memcpy ((char *) &to.sin_addr, targetip,4 ); memcpy((char *) &to.sin_port,
ax25ipd/process.c +59 -2
100 lines not on this page · raw message
ax25ipd/routing.c +252 -8
344 lines not on this page · raw message
ax25ipd/run.bat +2 -0
@@ -0,0 +1,2 @@ +killall ax25ipd +./ax25ipd -c /etc/ax25/ax25ipd.conf
Hi,
Sorry, I forgot to include the patch of configure file.
configure 2010-03-06 13:59:19.000000000 +0100 renamed from configure 2009-06-21 20:18:29.000000000 +0200 +0 -0
@@ -13437,7 +13437,7 @@
if test "x$GCC" = "xyes"; then
if test -z "echo "$CFLAGS" | grep "\-Wall" 2> /dev/null" ; then
- CFLAGS="$CFLAGS -Wall"
+ CFLAGS="$CFLAGS -Wall -pthread"
fi
fi
Bernard Pidoux