uronode-2.15/0000755000175000017500000000000014134443125012007 5ustar n1uron1urouronode-2.15/README.flexd0000644000175000017500000000266412575157457014021 0ustar n1uron1uroIf you find that your flexd isn't properly working, scroll down to line 120 where it says: char buffer[256], port[14], path[AX25_MAX_DIGIS*10] and adjust the buffer per your neighbor's screens. The formula is: 2 data frames: 256 3 data frames: 512 4 data frames: 1024 Unfortunately the configure script can't autosense this because in some cases, flexd doesn't already exist yet. To determine how many frames you're receiving, use the (ax)listen tool and count the frames after making a manual connect. Ex: ax2: fm N1URO-15 to N1URO-1 ctl SABM+ ax2: fm N1URO-1 to N1URO-15 ctl UA- ax2: fm N1URO-1 to N1URO-15 ctl I00^ pid=F0(Text) len 256 0000 PC/FlexNet V3.3g - Welcome to the N1URO FlexNet-Digi. This node 0040 is located at .Unionville, Hartford County, Connecticut [FN31ns] 0080 . This version of pc/Flexnet.and all related services are hosted 00C0 under the Linux operating system. Enjoy!..Basic commands are:.< ax2: fm N1URO-1 to N1URO-15 ctl I01^ pid=F0(Text) len 176 0000 A>rea destinations file.onnect .estinations list..< 0040 H>elp (more detailed command list).inks.list...ailBox (BBS 0080 URO:N1URO-4).uit this node..alk ..=> Here I made a manual connect from my URONode to my pc/FlexNet node. After the protocol handshakes there's 2 frames prior to the => prompt. So using the formula above, my line needs to be 256 for the buffer size. Hope this may help those with flexd errors. 73 de Brian N1URO uronode-2.15/Makefile.in0000644000175000017500000000733214001125617014055 0ustar n1uron1uroall: nodeusers uronode axdigi calibrate @FLEXNET@ CC = gcc LD = gcc # CFLAGS = -O2 -g -s -Wno-unused-result -Wstrict-prototypes CFLAGS = -DUNIX -g3 -DDEBUG LDFLAGS = LIBS = -lax25 -lax25io include Makefile.include COMMON_SRC = user.c util.c NODE_SRC = node.c cmdparse.c config.c command.c jheard.c axcalluser.c \ gateway.c extcmd.c procinfo.c router.c system.c sysinfo.c ipc.c NODEUSERS_SRC = nodeusers.c FLEXD_SRC = flexd.c procinfo.c DIGI_SRC = axdigi.c CALIBRATE_SRC = calibrate.c COMMON_OBJS = $(COMMON_SRC:.c=.o) NODE_OBJS = $(NODE_SRC:.c=.o) NODEUSERS_OBJS = $(NODEUSERS_SRC:.c=.o) FLEXD_OBJS = $(FLEXD_SRC:.c=.o) DIGI_OBJS = $(DIGI_SRC:.c=.o) CALIBRATE_OBJS = $(CALIBRATE_SRC:.c=.o) .c.o: $(CC) $(CFLAGS) -c $< install: installbin installman installhelp installconf install -b -m 755 -D -d $(VAR_DIR) install -b -m 755 -D -d $(VAR_DIR)/node install -b -m 644 -p etc/loggedin $(VAR_DIR)/node install -b -m 644 -p etc/lastlog $(VAR_DIR)/node install -b -m 755 -D -d $(VAR_DIR)/flex install -b -m 644 -p etc/gateways $(VAR_DIR)/flex installbin: all install -m 755 -s -p uronode $(SBIN_DIR) install -m 755 -s -p nodeusers $(SBIN_DIR) install -m 755 -s -p axdigi $(SBIN_DIR) install -m 755 -s -p calibrate $(SBIN_DIR) @IN@ install -m 755 -s -p flexd $(SBIN_DIR) installhelp: install -b -m 755 -D -d $(VAR_DIR) install -b -m 755 -D -d $(VAR_DIR)/node/help install -b -m 644 -p etc/help/*.hlp $(VAR_DIR)/node/help installconf: installhelp install -b -m 755 -D -d $(ETC_DIR) install -b -m 600 -p etc/uronode.announce $(ETC_DIR) install -b -m 600 -p etc/uronode.conf $(ETC_DIR) install -b -m 600 -p etc/uronode.perms $(ETC_DIR) install -b -m 600 -p etc/uronode.info $(ETC_DIR) install -b -m 600 -p etc/uronode.motd $(ETC_DIR) install -b -m 600 -p etc/uronode.users $(ETC_DIR) install -b -m 600 -p etc/uronode.routes $(ETC_DIR) install -b -m 600 -p etc/flexd.conf $(ETC_DIR) installman: install -m 755 -D -d $(MAN_DIR)/man1 $(MAN_DIR)/man5 $(MAN_DIR)/man8 install -m 644 -p man/nodeusers.1 $(MAN_DIR)/man1 install -m 644 -p man/uronode.conf.5 $(MAN_DIR)/man5 install -m 644 -p man/uronode.perms.5 $(MAN_DIR)/man5 install -m 644 -p man/flexd.conf.5 $(MAN_DIR)/man5 install -m 644 -p man/uronode.8 $(MAN_DIR)/man8 install -m 644 -p man/calibrate.8 $(MAN_DIR)/man8 install -m 644 -p man/axdigi.8 $(MAN_DIR)/man8 install -m 644 -p man/flexd.8 $(MAN_DIR)/man8 upgrade: installbin installman installhelp install -b -m 600 -p etc/uronode.announce $(ETC_DIR) install -m 755 -p uronode $(SBIN_DIR) install -m 755 -p nodeusers $(SBIN_DIR) install -m 755 -p calibrate $(SBIN_DIR) @IN@ install -m 755 -p flexd $(SBIN_DIR) install -m 755 -p axdigi $(SBIN_DIR) clean: rm -f *.o *~ *.bak *.orig make.debug nodeusers uronode flexd axdigi calibrate rm -f etc/*~ etc/*.bak etc/*.orig rm -f etc/help/*~ etc/help/*.bak etc/help/*.orig distclean: clean rm -f .depend Makefile.include config.h rm -f uronode nodeusers axdigi calibrate @FLEXNET@ rm -f Makefile make.debug depend: $(CC) $(CFLAGS) -M $(COMMON_SRC) $(NODE_SRC) $(NODEUSERS_SRC) $(FLEXD_SRC) $(CALIBRATE_SRC) > .depend uronode: $(COMMON_OBJS) $(NODE_OBJS) $(LD) $(LDFLAGS) -o uronode $(COMMON_OBJS) $(NODE_OBJS) $(LIBS) $(ZLIB) nodeusers: $(COMMON_OBJS) $(NODEUSERS_OBJS) $(LD) $(LDFLAGS) -o nodeusers $(COMMON_OBJS) $(NODEUSERS_OBJS) $(LIBS) $(ZLIB) flexd: $(FLEXD_OBJS) $(LD) $(LDFLAGS) -o flexd $(FLEXD_OBJS) $(LIBS) $(ZLIB) calibrate: $(CALIBRATE_OBJS) $(LD) $(LDFLAGS) -o calibrate $(CALIBRATE_OBJS) $(LIBS) $(ZLIB) axdigi: $(DIGI_OBJS) $(LD) $(LDFLAGS) -o axdigi $(DIGI_OBJS) $(LIBS) $(ZLIB) ifeq (.depend,$(wildcard .depend)) include .depend endif uronode-2.15/sysinfo.h0000644000175000017500000000154412642547315013666 0ustar n1uron1uro#ifndef SYSINFO_H #define SYSINFO_H extern int loadavg(double *av1, double *av5, double *av15); extern int uptime (double *uptime_secs, double *idle_secs); extern int load_meminfo(void); // extern int meminfo(const char *s); /* unsigned** meminfo(void); enum meminfo_row { meminfo_main = 0, meminfo_free, meminfo_buffers, meminfo_cached, meminfo_scached, meminfo_active, meminfo_inactive, meminfo_htotal, meminfo_hfree, meminfo_ltotal, meminfo_lfree, meminfo_stotal, meminfo_sfree, meminfo_dirty, meminfo_writeback, meminfo_anonpages, meminfo_mapped, meminfo_slab, meminfo_sreclaim, meminfo_sunreclaim, meminfo_pagetables, meminfo_nfs_unstab, meminfo_bounce, meminfo_climit, meminfo_cas, meminfo_vmtotal, meminfo_vmused, meminfo_vmchunk }; enum meminfo_col { meminfo_total = 0 }; unsigned read_total_main(void); */ #endif /* SYSINFO_H */ uronode-2.15/system.c0000644000175000017500000003764314065107133013513 0ustar n1uron1uro#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "node.h" #include "procinfo.h" #include "config.h" /* VE3TOK - Dec20, 2014 */ #define USER_NOBODY "nobody" #define NUMPTY 176 #define SYSTEM_TIMEOUT 7200 #define LAST_DATA_SIZE 120 int shell=0; char *envp[16], *argp[16], mbox[40]; char other_id[20]; int in_queue=0; int pid=-1; char ptyname[80], Password[256]; int ptyfd; /*---------------------------------------------------------------------------*/ int cusgets(char *buf, int buflen, ax25io *iop) { int c, len = 0; while (len < (buflen - 1)) { c = axio_getc(iop); if (c == -1) { if (len > 0) { buf[len] = 0; return (len); } else return -1; } /* NULL also interpreted as EOL */ if (c == '\n' || c == '\r' || c == 0) { buf[len++] = c; buf[len] = 0; return (len); } buf[len++] = c; } buf[buflen - 1] = 0; return (buflen-1); } /*---------------------------------------------------------------------------*/ #define _XOPEN_SOURCE int find_pty(char *ptyname) { char master[80]; int fd; int num; static int lastnum = -1; for(num = lastnum + 1; ; num++) { if (num >= NUMPTY) num = 0; // sprintf(master, "/dev/ptmx%c%x", 'p' + (num >> 4), num & 0xf); sprintf(master, "/dev/ptmx", O_RDWR); /* sprintf(master, "/dev/pts/%x", num & 0xf); */ if ((fd = open(master, O_RDWR | O_NONBLOCK, 0600)) >= 0) { sprintf(ptyname, "/dev/ptmx", 'p' + (num >> 4), num & 0xf); /* sprintf(ptyname, "/dev/pts/%x", num & 0xf); */ lastnum = num; return fd; } if (num == lastnum) break; } return -1; } /*---------------------------------------------------------------------------*/ void login_close(void) { struct utmp utmpbuf, *ut; FILE *fp; if (ptyfd > 0) { chown(ptyname, 0, 0); chmod(ptyname, 0666); ioctl(ptyfd, TCFLSH, 2); close(ptyfd); } if (pid>0) { kill(pid, SIGHUP); pid=0; } memset(&utmpbuf, 0, sizeof(utmpbuf)); setutent(); utmpbuf.ut_type=LOGIN_PROCESS; strcpy(utmpbuf.ut_line, ptyname+5); strcpy(utmpbuf.ut_id, ptyname+strlen(ptyname)-2); ut=getutid(&utmpbuf); ut->ut_type=DEAD_PROCESS; memset(ut->ut_host,0,UT_HOSTSIZE); memset(ut->ut_user,0,UT_NAMESIZE); time((time_t *)&ut->ut_time); /* ut->ut_xtime = (unsigned int)time(NULL); */ pututline(ut); endutent(); if ((fp = fopen(_PATH_WTMP, "r+")) != NULL) { fseek(fp, 0L, SEEK_END); fwrite(ut, sizeof(utmpbuf), 1, fp); fclose(fp); } if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} Welcome back.\n", NodeId); } else { axio_printf(NodeIo,"Welcome back."); } } /*---------------------------------------------------------------------------*/ int login_open(struct passwd *pw, char *command) { if ((ptyfd=find_pty(ptyname)) < 0) { syslog(LOG_ERR, "Error opening pseudo terminal for %s", pw->pw_name); return -1; } syslog(LOG_INFO, "Opened pseudo terminal (%s) for %s", ptyname, pw->pw_name); pid=fork(); if (pid==-1) { syslog(LOG_ERR, "Cannot fork for %s", pw->pw_name); return -1; } if (pid==0) { /* child */ struct termios termios; struct utmp utmpbuf; int i; for(i=0;ipw_name); /* Username */ strcpy(utmpbuf.ut_host, "local:uronode"); utmpbuf.ut_addr=0x7f000000; time((time_t *)&utmpbuf.ut_time); /* Time entry was made */ /* utmpbuf.ut_xtime = (unsigned int)time(NULL); */ setutent(); pututline(&utmpbuf); endutent(); setgid(pw->pw_gid); setuid(pw->pw_uid); execve(command, argp, envp); exit(1); } if (pid!=0) { int k, cnt; fd_set fds_read, fds_err; struct timeval tv; char buf[1500]; while(1) { FD_ZERO(&fds_read); FD_ZERO(&fds_err); FD_SET(STDIN_FILENO, &fds_read); /* FD_SET(User.fd, &fds_err); */ FD_SET(ptyfd, &fds_read); /* FD_SET(ptyfd, &fds_err); */ if (User.ul_type==AF_INET) { tv.tv_usec=25; tv.tv_sec=0; } else { tv.tv_usec=750; tv.tv_sec=0; } if (in_queue>0) k=select(ptyfd+1, &fds_read, NULL, &fds_err, &tv); else k=select(ptyfd+1, &fds_read, NULL, &fds_err, NULL); if (k == -1) { if (errno!=EINTR) { syslog(LOG_DEBUG,"I/O select"); break; } } if (k == 0) { if (in_queue>0) { axio_flush(NodeIo); in_queue=0; } } /* if (FD_ISSET(User.fd, &fds_err)) { syslog(LOG_DEBUG,"I/O end: error channel, user"); break; } if (FD_ISSET(ptyfd, &fds_err)) { syslog(LOG_DEBUG,"I/O end: error channel, application"); break; } */ if (FD_ISSET(STDIN_FILENO, &fds_read)) { alarm(SYSTEM_TIMEOUT); cnt=cusgets(buf, sizeof(buf), NodeIo); if (cnt < 0) { syslog(LOG_DEBUG,"I/O end: stdio channel, user"); break; } else { write(ptyfd, buf, cnt); } } if (FD_ISSET(ptyfd, &fds_read)) { alarm(SYSTEM_TIMEOUT); cnt = read(ptyfd, buf, sizeof(buf)); if (cnt < 0) { syslog(LOG_DEBUG,"I/O end: stdio channel, application"); break; } for(k = 0 ; k < cnt ; k++) { if (buf[k]=='\n' && (User.ul_type==AF_AX25 || User.ul_type==AF_FLEXNET || User.ul_type==AF_NETROM)) continue; axio_putc(buf[k], NodeIo); } in_queue+=cnt; } } login_close(); } return 0; } /*---------------------------------------------------------------------------*/ int check_passwd(void) { char buffer[400]="", tmp[100]=""; int pass[5], level,i; long timet; char answer[81]=""; char buf[2048]; level=strlen(Password); timet=time(NULL); srandom((int) timet); for(i=0;i<5;i++) pass[i]=(int) (level * (random()/(RAND_MAX+1.0))); sprintf(buffer,"%10.10ld%s",timet,Password); axio_printf(NodeIo,"%s %d %d %d %d %d [%010.10ld]\n", PassPrompt,pass[0]+1,pass[1]+1,pass[2]+1,pass[3]+1,pass[4]+1,timet); sprintf(answer,"%c%c%c%c%c",Password[pass[0]],Password[pass[1]],Password[pass[2]],Password[pass[3]],Password[pass[4]]); axio_flush(NodeIo); axio_gets(buf, sizeof(buf), NodeIo); if(strlen(buf)==32) i=strcmp(buf,tmp); else i=strcmp(buf,answer); if(i) { axio_printf(NodeIo,"Password incorrect!"); return 0; } if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } axio_printf(NodeIo,"URONode Shell engaged - use EXTREME caution! \n\n"); return 1; } /*---------------------------------------------------------------------------*/ int do_system(int argc, char **argv) { int i; struct passwd *pw=NULL; argp[0]=argv[0]; for(i=1;i<(argc);i++) argp[i]=argv[i]; argp[argc]=NULL; axio_puts("",NodeIo); if (other_id!=NULL && strcmp(other_id, USER_NOBODY)!=0) pw=getpwnam(other_id); if (pw==NULL) { if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } node_msg("Permission denied\n"); syslog(LOG_INFO, "system: %s attempted command %s", User.call, argv[0]); axio_puts("",NodeIo); return 1; } if (strncmp(argv[0],"sysop",strlen(argv[0]))==0) { if (shell==1) { User.state = STATE_EXTCMD; User.dl_type = AF_UNSPEC; strcpy(User.dl_name, "sysop"); strupr(User.dl_name); update_user(); if (check_passwd()==0) return 0; login_open(pw, "/bin/bash"); axio_puts("",NodeIo); return 0; } else { if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } node_msg("permission denied"); axio_puts("",NodeIo); return 1; }; } if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } node_msg("unknown command"); return 0; } int examine_user(void) { FILE *users; char call[10], buf[1024], *cp, *ep; char flags[40]; strcpy(other_id, USER_NOBODY); if ((users=fopen(CONF_USERS_FILE, "r"))==NULL) { node_msg("system: cannot open authority file: %s", CONF_USERS_FILE); syslog(LOG_ERR, "system: cannot open authority file: %s", CONF_USERS_FILE); axio_puts("",NodeIo); return 1; } strcpy(call, User.call); cp=strchr(call, '-'); if (cp) *cp='\0'; while(fgets(buf, 1024, users)) { ep=strchr(buf, '#'); if (ep) *ep='\0'; if (*buf==0) continue; cp=strtok(buf, ":\t\n\r"); if (cp==NULL) continue; if (strcasecmp(cp, call)==0) { cp=strtok(NULL, ":\t\n\r"); if (cp==NULL) continue; strcpy(Password, cp); cp=strtok(NULL, ":\t\n\r"); if (cp==NULL) continue; strcpy(other_id, cp); cp=strtok(NULL, ":\t\n\r"); if (cp==NULL) continue; strcpy(flags, cp); } } if (strcmp(other_id, USER_NOBODY)==0) return 0; cp=strtok(flags, " ,;-/\t\n\r"); if (cp==NULL) return 0; do { if (strcmp(cp, "shell")==0) { shell=1; // add_internal_cmd(&Nodecmds, "SYSop", 1, do_system); } cp=strtok(NULL, " ,;-/\t\n\r"); } while(cp!=NULL); return 0; } struct nodelastlog { char ll_user[8]; long ll_time; char ll_line[LAST_DATA_SIZE]; char ll_host[LAST_DATA_SIZE]; int ll_count; }; struct ipheardlastlog { char ii_host[LAST_DATA_SIZE]; }; void lastlog(void) { struct nodelastlog ll; int last; int count=0; int hit=0; int UserId=0; char tty[LAST_DATA_SIZE]; char hostname[LAST_DATA_SIZE]; char hostname6[LAST_DATA_SIZE]; char usercall[10]; char *cp; int escape; strcpy(usercall, User.call); cp=strchr(usercall, '-'); if (cp) *cp='\0'; strcpy(tty, ""); switch (User.ul_type) { case AF_FLEXNET: strcpy(hostname, "FlexNet"); break; case AF_AX25: strcpy(hostname, "["); strcat(hostname, "AX25"); strcat(hostname, "] "); strcat(hostname, User.call); if (strlen(User.ul_name)>0) { strcat(hostname, " via "); strcat(hostname, User.ul_name); } break; case AF_NETROM: strcpy(hostname, "<"); strcat(hostname, User.ul_port); strcat(hostname, "> "); strcat(hostname, User.call); if (strlen(User.ul_name)>0) { strcat(hostname, "@"); strcat(hostname, User.ul_name); } break; #ifdef HAVE_ROSE case AF_ROSE: strcpy(hostname, User.call); if (strlen(User.ul_name)>0) { strcat(hostname, " at "); strcat(hostname, User.ul_name); } break; #endif case AF_INET: strcpy(hostname, User.call); strcat(hostname, " from ip "); strcat(hostname, User.ul_name); break; case AF_INET6: strcpy(hostname6, User.ul_name); strcat(hostname, User.call); strcat(hostname, " on IPv6"); break; case AF_UNSPEC: strcpy(hostname, User.call); strcat(hostname, " on local"); break; default: strcpy(hostname, ""); break; } if ((last = open(DATA_NODE_LAST_FILE, O_RDWR, 0)) >= 0) { lseek(last, (off_t)UserId * sizeof(ll), L_SET); while (read(last, (char *)&ll, sizeof(ll)) == sizeof(ll) && ll.ll_time != 0) { if (strcmp(ll.ll_user,usercall)==0) { escape = (check_perms(PERM_NOESC, 0L) == 0) ? -1 : EscChar; #ifdef HAVEMOTD /* if (User.ul_type != AF_NETROM) { axio_printf(NodeIo," Escape is: %s%c\n", escape < 32 ? "CTRL-" : "", escape < 32 ? (escape + 'A' - 1) : escape); axio_printf(NodeIo,"Last login: %.*s ",24-5,(char *)ctime(&ll.ll_time)); if (*ll.ll_host != '\0') axio_printf(NodeIo,"\n From: %.*s\n",(int)sizeof(ll.ll_host), ll.ll_host); else axio_printf(NodeIo," on %.*s\n",(int)sizeof(ll.ll_line), ll.ll_line); } */ #endif count=ll.ll_count; hit++; break; } else UserId++; } lseek(last, (off_t)UserId * sizeof(ll), L_SET); } memset((char *)&ll, 0, sizeof(ll)); if ((hit==0) && (User.ul_type != AF_NETROM)) { axio_printf(NodeIo,"Welcome, new user! Please use the Info and ? commands.\n\n"); count=0; } ll.ll_count=count+1; (void)time(&ll.ll_time); strncpy(ll.ll_line, tty, sizeof(ll.ll_line)); strncpy(ll.ll_user, usercall, sizeof(ll.ll_user)); if (hostname) strncpy(ll.ll_host, hostname, sizeof(ll.ll_host)); write(last, (char *)&ll, sizeof(ll)); close(last); } int do_last(int argc, char **argv) { int last; struct nodelastlog ll; int Entries=0; char call[10], *cp; if ((last = open(DATA_NODE_LAST_FILE, O_RDONLY, 0)) <= 0) { node_perror(DATA_NODE_LAST_FILE, errno); return -1; } if (argc < 2) { if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } axio_printf(NodeIo,"Usage: Who "); close(last); if (User.ul_type == AF_NETROM) { node_msg(""); } return 0; } if (strcmp(argv[1],"*")==0) { cp=NULL; if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[01;37m"); } axio_printf(NodeIo,"Logins for ALL:\n", call); if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[0m"); } } else { if (!ax25_aton_entry(argv[1], call)) { strcpy(call,strupr(argv[1])); cp=strchr(call,'-'); if (cp) *cp='\0'; cp=call; if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[01;37m"); } axio_printf(NodeIo,"Last online information for %s:\n", call); if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[0m"); } } else { if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } axio_printf(NodeIo,"Usage: Who \n"); if (User.ul_type == AF_NETROM) { node_msg(""); } close(last); return -1; } } lseek(last, (off_t)Entries * sizeof(ll), L_SET); /* while (Entries < 20 && (read(last, (char *)&ll, sizeof(ll)) == sizeof(ll) && ll.ll_time != 0)) { */ while (read(last, (char *)&ll, sizeof(ll)) == sizeof(ll) && ll.ll_time !=0) { if (cp && strcasecmp(cp,ll.ll_user)!=0) continue; if (Entries==0) { axio_printf(NodeIo,"User Last Online Count From\n"); axio_printf(NodeIo,"------ -------------------- ----- -----------------------------"); } axio_printf(NodeIo,"\n%-10s ", ll.ll_user); axio_printf(NodeIo,"%.*s ",24-5,(char *)ctime(&ll.ll_time)); axio_printf(NodeIo,"%-5d ",ll.ll_count); if (*ll.ll_host != '\0') axio_printf(NodeIo," %.*s",(int)sizeof(ll.ll_host), ll.ll_host); else axio_printf(NodeIo," on %.*s",(int)sizeof(ll.ll_line), ll.ll_line); Entries++; } lseek(last, (off_t)Entries * sizeof(ll), L_SET); close(last); if (!cp && Entries==0) axio_printf(NodeIo,"No users in the lastlog database."); if (cp && Entries==0) axio_printf(NodeIo,"%s Never logged in.", call); if (User.ul_type == AF_NETROM) { node_msg(""); } return 0; } uronode-2.15/config.h.in0000644000175000017500000000226213031252432014026 0ustar n1uron1uro#ifndef CONFIG_H #define CONFIG_H /* * Some global #defines for programmers to use for conditional compilation */ @HAVEAX25@ @HAVEFLEX@ @HAVEROSE@ @HAVENETROM@ @HAVEZLIB@ @HAVEMHEARD@ @HAVEAUTOROUTE@ @HAVETCPIP@ #define PROC_AX25_CALLS_FILE "/proc/net/ax25_calls" /* * node specific */ #define CONF_NODE_FILE "@ETC_DIR@/uronode.conf" #define CONF_NODE_PERMS_FILE "@ETC_DIR@/uronode.perms" @HAVEMOTD@ @MOTDPATH@ #define CONF_NODE_INFO_FILE "@ETC_DIR@/uronode.info" #define CONF_NODE_ANN_FILE "@ETC_DIR@/uronode.announce" #define AX_ROUTES_FILE "@ETC_DIR@/uronode.routes" #define CONF_USERS_FILE "@ETC_DIR@/uronode.users" #define FLEXD_CONF_FILE "@ETC_DIR@/flexd.conf" #define FLEXD_TEMP_PATH "@VAR_DIR@/flex/" #define FLEXD_PID_FILE "/var/run/flexd.pid" #define FLEX_GT_FILE "@VAR_DIR@/flex/gateways" #define FLEX_DST_FILE "@VAR_DIR@/flex/destinations" #define DATA_MHEARD_FILE "@VAR_DIR@/mheard/mheard.dat" #define DATA_NODE_LOGIN_FILE "@VAR_DIR@/node/loggedin" #define DATA_NODE_HELP_DIR "@VAR_DIR@/node/help/" #define DATA_NODE_LAST_FILE "@VAR_DIR@/node/lastlog" #define DATA_NODE_IP_FILE "@VAR_DIR@/node/iplog" #endif uronode-2.15/axcalluser.h0000644000175000017500000000102312421572320014314 0ustar n1uron1uro#ifndef AXCALLUSER_H #define AXCALLUSER_H /* Simple functions to return userid of a callsign, and */ /* username of a userid, by reading appropriate files. */ /* Surely there's a better way to do 'getusername', but */ /* this works. */ /* Dave Brown N2RJT 5/5/96 */ /* return userid of given callsign, or -1 if not found */ int axcalluserid(char *callsign); /* return username of given userid, or NULL if not found */ char *getusername(int userid); #endif uronode-2.15/nodeusers.c0000644000175000017500000000334512421572320014164 0ustar n1uron1uro#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "node.h" #include "config.h" char *NodeId = "Nodeusers:"; int LogLevel = LOGLVL_NONE; ax25io *NodeIo = NULL; static void pipe_handler(int sig) { syslog(LOG_ERR, "received SIGPIPE"); axio_end(NodeIo); exit(1); } int main(int argc, char **argv) { int n, len = 1024; char *cp = UNSPEC_EOL; int inet = 0; int logging = 0; while ((n = getopt(argc, argv, "ail")) != -1) { switch (n) { case 'a': cp = AX25_EOL; len = 128; break; case 'i': cp = INET_EOL; inet = 1; break; case 'l': logging = 1; break; default: fprintf(stderr, "usage: nodeusers [-a] [-i] [-l]\r\n"); return 1; } } if (logging) openlog("nodeusers", LOG_PID, LOG_DAEMON); signal(SIGPIPE, pipe_handler); NodeIo = axio_init(STDIN_FILENO, STDOUT_FILENO, len, cp); if (NodeIo == NULL) { fprintf(stderr, "nodeusers: axio_init failes\r\n"); return 1; } if (inet && axio_getline(NodeIo) == NULL) { if (logging) syslog(LOG_ERR, "axio_getline: %m"); axio_printf(NodeIo,"\n"); axio_end(NodeIo); return 1; } n = user_count(); axio_printf(NodeIo,"\n%s (%s), %d user%s.\n", VERSION, COMPILING, n, n == 1 ? "" : "s"); user_list(0, NULL); if (n > 0) axio_printf(NodeIo,"\n"); if (axio_flush(NodeIo) == -1 && logging) syslog(LOG_ERR, "axio_flush: %m"); axio_end(NodeIo); usleep(500000L); closelog(); return 0; } uronode-2.15/license0000664000175000017500000010451614021655174013371 0ustar n1uron1uro GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 3 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, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . uronode-2.15/FAQ0000644000175000017500000000322112421572320012334 0ustar n1uron1uroWelcome to the official FAQ file for URONode. The purpose of this file is to help explain better about URONode and what the various features were designed for. Since this file will be maintained via URONode Sysop reports, I'll consider this file a constant 'work in progress' type file. When using URONode or really any other linux node flavor, keep in mind that the actual node program itself is only a front-end for the users to do various functions your linux server may have to provide. Node really doesn't do any sort of control features whatsoever, it merely acts as a sort of proxy to your linux daemons. Those features are toggled on/off at compile time by the operator of the node. I've taken time to rework the configure script to give the node ops more flexibility in what they wish to service their end users with. Nothing about URONode was ever designed as a 'replacement' for any existing services such as email and convers. I'm not even going to suggest one chooses to run URONode as a replacement for LinuxNode by Tomi, AWZNode, or even FlexNode. The goals I set when starting this project were moreso to custom fit my unique setup and its something I can share with the amateur community at the same time. URONode is NOT: A replacement for *NOS A replacement for Email A replacement for PBBS A replacement for convers A FlexNet router URONode IS: A user front-end with some additional features to help compliment those existing features an end user may need but for whatever reason doesn't have access to at the moment, while allowing links to various entities such as AX.25 links, Net/Rom routing, FlexNet destinations, general and amprnet TCP/IP services. uronode-2.15/user.c0000644000175000017500000001466213627545374013161 0ustar n1uron1uro#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "node.h" #include "sysinfo.h" struct user User = {0}; static long CallerPos = -1L; void login_user(void) { FILE *f; struct user u; long pos = 0L; long free = -1L; struct stat statbuf; if (stat(DATA_NODE_LOGIN_FILE, &statbuf) == -1) { node_perror(DATA_NODE_LOGIN_FILE, errno); return; } if (statbuf.st_size % sizeof(struct user) != 0) { node_msg("%s: Incorrect size", DATA_NODE_LOGIN_FILE); node_log(LOGLVL_ERROR, "%s: Incorrect size", DATA_NODE_LOGIN_FILE); return; } time(&User.logintime); User.cmdtime = User.logintime; User.pid = getpid(); if ((f = fopen(DATA_NODE_LOGIN_FILE, "r+")) == NULL) { node_perror(DATA_NODE_LOGIN_FILE, errno); return; } if (flock(fileno(f), LOCK_EX) == -1) { node_perror("login_user: flock", errno); fclose(f); return; } while (fread(&u, sizeof(u), 1, f) == 1) { if (u.pid == -1 || (kill(u.pid, 0) == -1 && errno == ESRCH)) { free = pos; break; } pos += sizeof(u); } if (free != -1L && fseek(f, free, 0L) == -1) { node_perror("login_user: fseek", errno); fclose(f); return; } fflush(f); CallerPos = ftell(f); fwrite(&User, sizeof(User), 1, f); fflush(f); flock(fileno(f), LOCK_UN); fclose(f); } void logout_user(void) { FILE *f; if (CallerPos == -1L) return; if ((f = fopen(DATA_NODE_LOGIN_FILE, "r+")) == NULL) { node_perror(DATA_NODE_LOGIN_FILE, errno); return; } if (fseek(f, CallerPos, 0) == -1) { node_perror("logout_user: fseek", errno); fclose(f); return; } User.pid = -1; fwrite(&User, sizeof(User), 1, f); fclose(f); } void update_user(void) { FILE *f; if (CallerPos == -1L) return; if ((f = fopen(DATA_NODE_LOGIN_FILE, "r+")) == NULL) { node_perror(DATA_NODE_LOGIN_FILE, errno); return; } if (fseek(f, CallerPos, 0) == -1) { node_perror("update_user: fseek", errno); fclose(f); return; } fwrite(&User, sizeof(User), 1, f); fclose(f); } int user_count(void) { FILE *f; struct user u; int cnt = 0; if ((f = fopen(DATA_NODE_LOGIN_FILE, "r")) == NULL) { node_perror(DATA_NODE_LOGIN_FILE, errno); return 0; } while (fread(&u, sizeof(u), 1, f) == 1) if (u.pid != -1 && (kill(u.pid, 0) != -1 || errno != ESRCH)) cnt++; fclose(f); return cnt; } int user_list(int argc, char **argv) { FILE *f; struct user u; struct tm *tp; struct proc_nr_nodes *np; char buf[80]; long l; axio_puts("",NodeIo); if ((f = fopen(DATA_NODE_LOGIN_FILE, "r")) == NULL) { node_perror(DATA_NODE_LOGIN_FILE, errno); return 0; } if (User.ul_type == AF_NETROM) { axio_printf(NodeIo, "%s} %s", NodeId, VERSION); } if (User.ul_type == AF_INET) { axio_printf(NodeIo, "\e[01;35m"); } else { axio_printf(NodeIo, "Current users:"); } if (user_count() == 0) { axio_printf(NodeIo, " No users online.\n"); } if (User.ul_type == AF_INET) { axio_printf(NodeIo,"\e[0;m"); } if (user_count() != 0) /* axio_printf(NodeIo,"") */ ; while (fread(&u, sizeof(u), 1, f) == 1) { if (u.pid == -1 || (kill(u.pid, 0) == -1 && errno == ESRCH)) continue; switch (u.ul_type) { case AF_FLEXNET: sprintf(buf, "\nFlexNet (%.9s)", u.call); break; case AF_AX25: sprintf(buf, "\nUplink (%.9s on interface %.10s)", u.call, u.ul_name); break; case AF_NETROM: if ((np = find_node(u.ul_name, NULL)) != NULL) { sprintf(buf, "\nCircuit (%.9s %.18s)", u.call, print_node(np->alias, np->call)); } else { sprintf(buf, "\nCircuit (%.9s %.18s)", u.call, u.ul_name); } break; #ifdef HAVE_ROSE case AF_ROSE: sprintf(buf, "\nROSE (%.9s %.18s)", u.call, u.ul_name); break; #endif case AF_INET: sprintf(buf, "\nTelnet (%.9s @ %.16s)", u.call, u.ul_name); break; case AF_INET6: sprintf(buf, "\nTelnet6 (%.9s via IPv6)", u.call); break; case AF_UNSPEC: sprintf(buf, "\nHost (%.9s on local)", u.call); break; default: sprintf(buf, "\n?????? (%.9s %.18s)", u.call, u.ul_name); break; } axio_printf(NodeIo,"%-37.37s ", buf); switch (u.state) { case STATE_QUIT: logout_user(); break; case STATE_LOGIN: axio_puts(" -> Logging in",NodeIo); break; case STATE_IDLE: time(&l); l -= u.cmdtime; tp = gmtime(&l); axio_printf(NodeIo," -> Idle (%d:%02d:%02d:%02d)", tp->tm_yday, tp->tm_hour, tp->tm_min, tp->tm_sec); break; case STATE_TRYING: switch (u.dl_type) { case AF_FLEXNET: axio_printf(NodeIo," -> Trying (%s)", u.dl_name); break; case AF_AX25: axio_printf(NodeIo," -> Trying (%s on interface %s)", u.dl_name, u.dl_port); break; case AF_NETROM: axio_printf(NodeIo," -> Trying (%s)", u.dl_name); break; #ifdef HAVE_ROSE case AF_ROSE: axio_printf(NodeIo," -> Trying (%s)", u.dl_name); break; #endif case AF_INET: axio_printf(NodeIo," -> Trying (%s:%s)", u.dl_name, u.dl_port); break; default: axio_puts(" -> ???",NodeIo); break; } break; case STATE_CONNECTED: switch (u.dl_type) { case AF_FLEXNET: axio_printf(NodeIo,"<--> FlexNet (%s)", u.dl_name); break; case AF_AX25: axio_printf(NodeIo,"<--> Downlink (%s on interface %s)", u.dl_name, u.dl_port); break; case AF_NETROM: axio_printf(NodeIo,"<--> Circuit (%s)", u.dl_name); break; #ifdef HAVE_ROSE case AF_ROSE: axio_printf(NodeIo,"<--> ROSE (%s)", u.dl_name); break; #endif case AF_INET: axio_printf(NodeIo,"<--> Telnet (%s:%s)", u.dl_name, u.dl_port); break; default: axio_printf(NodeIo,"<--> ???"); break; } break; case STATE_PINGING: axio_printf(NodeIo,"<--> Pinging (%s)", u.dl_name); break; case STATE_EXTCMD: axio_printf(NodeIo,"<--> Extcmd (%s)", u.dl_name); break; default: axio_puts(" -> ??????",NodeIo); break; } axio_puts("",NodeIo); } if (User.ul_type == AF_NETROM) { node_msg(""); } fclose(f); return 0; } uronode-2.15/calibrate.c0000644000175000017500000000505712624665541014122 0ustar n1uron1uro/* * calibrate : Modem calibration utility * Most code is portion of beacon.c of the standard ax25-utils package * F1OAT 980321 * mods by N1URO 151123 */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define BUFLEN 256 #define NBFRAMES 100 #define TEMPO 1000 static void Usage(void) { fprintf(stderr, "Usage : calibrate [-t ms] interface\n"); exit(1); } int main(int argc, char *argv[]) { struct full_sockaddr_ax25 dest; struct full_sockaddr_ax25 src; int i, s, dlen, len, tempo = TEMPO; char *port; char *srccall = NULL, *destcall = "CAL"; char buffer[BUFLEN]; fd_set rfds; struct timeval tv; if (argc < 2) Usage(); while ((s = getopt(argc, argv, "t:")) != -1) { switch (s) { case 't': tempo = atoi(optarg); break; case ':': fprintf(stderr, "calibrate: option -t needs a duration in ms\n"); return 1; case '?': Usage(); return 1; } } if (optind == argc) { Usage(); return 1; } port = argv[optind]; if (ax25_config_load_ports() == 0) { fprintf(stderr, "calibrate: no AX.25 interfaces defined\n"); return 1; } if ((srccall = ax25_config_get_addr(port)) == NULL) { fprintf(stderr, "calibrate: invalid AX.25 interface setting - %s\n", port); return 1; } if ((dlen = ax25_aton(destcall, &dest)) == -1) { fprintf(stderr, "calibrate: unable to convert callsign '%s'\n", destcall); return 1; } if ((len = ax25_aton(srccall, &src)) == -1) { fprintf(stderr, "calibrate: unable to convert callsign '%s'\n", srccall); return 1; } if ((s = socket(AF_AX25, SOCK_DGRAM, 0)) == -1) { perror("socket"); return 1; } if (bind(s, (struct sockaddr *)&src, len) == -1) { perror("bind"); return 1; } printf("Press return to stop calibrate\n"); for (i = 0 ; i < BUFLEN ; i++) buffer[i] = 0x55; for (i = 0 ; i < NBFRAMES ; i++) { /* fd_set rfds; struct timeval tv; */ tv.tv_sec = tempo / 1000; tv.tv_usec = (tempo % 1000) * 1000; FD_ZERO(&rfds); FD_SET(0, &rfds); if (select(1, &rfds, NULL, NULL, &tv) == 1) break; buffer[0] = (i / 100) + '0'; buffer[1] = ((i % 100) / 10) + '0'; buffer[2] = (i % 10) + '0'; if (sendto(s, buffer, BUFLEN, 0, (struct sockaddr *)&dest, dlen) == -1) { perror("sendto"); } } close(s); return 0; } uronode-2.15/INSTALL0000644000175000017500000000460212511263327013043 0ustar n1uron1uro1. COMPILING and INSTALLING To compile and run URONode you will need to have libax25-0.0.4 or newer installed on your system. It should work on any platform where libax25 can be compiled and installed. Note however that it will NOT work with 2.0.x kernels. To install you should first run: ./configure and answer to the questions it makes. ** IF ** this is an ** UPGRADE **: and if you said no to configure running a "make", just type: make; make upgrade This will *not* overwrite your config files, and will freshen up your binaries only. If you told the configure script to make, then all you need to type to upgrade is: make upgrade. ** IF ** this is a new install: If all files needed are present everything should work. Next: make (if you said "no" to the configure script launching it for you) make install make installhelp Optionally you may want to run also: make installconf to install the default configuration files. Note however this copy example files in /usr/local/etc/ax25 but with ".ex". You should rename it by removing ".ex" at the end of filenames. After that you need to edit the configuration files to suit your system. The manual pages for uronode.conf(5) and uronode.perms(5) should give an idea of what to put into these files. The AX25-HOWTO is a must read also. 2. RUNNING URONode is intended to be called from ax25d or inetd. It doesn't need any command line arguments. See the uronode(8) manual page. To run URONode from ax25d, /usr/local/etc/ax25/ax25d.conf should have something like this in it: # AX25 Port ax0 # Belows SSID can not be the same as your netrom node SSID! [N1URO-2 VIA ax0] default * * * * * * - root /usr/local/sbin/uronode uronode # NETROM Port default * * * * * * - root /usr/local/sbin/uronode uronode add uronode as a service in /etc/services: uronode 3694/tcp # Node/URONode packet if you use inetd - /etc/inetd.conf could have something like this in it: # Listen at telnet port -> URONode uronode stream tcp nowait root /usr/local/sbin/uronode uronode if you use xinetd - /etc/xinetd.d/uronode should look like this: service uronode { disable = no socket_type = stream protocol = tcp user = root server = /usr/local/sbin/uronode wait = no instances = 20 } uronode-2.15/flexd.c0000644000175000017500000002702713147111550013262 0ustar n1uron1uro#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "config.h" #include "node.h" #include "procinfo.h" #define DEFAULT_POLL_TIME 600 #define MINIMUM_POLL_TIME 300 int poll_time=DEFAULT_POLL_TIME; char flexgate[10]="\0"; char mycall[10]="\0"; char prompt1[1]="\0"; char prompt2[1]="\0"; struct ax_routes *gw; int s; void (*sigterm_defhnd)(int); void read_conf(void) { FILE *fp, *fgt; char buf[1024], line[1024], *cp; int i=0,k; char digipath[AX25_MAX_DIGIS*10]; if ((fp=fopen(FLEXD_CONF_FILE, "r")) == NULL) { fprintf(stderr, "flexd config: Cannot open config file: %s\n", FLEXD_CONF_FILE); exit(1); } if ((fgt=fopen(FLEX_GT_FILE, "w")) == NULL) { fprintf(stderr, "flexd config: Cannot open flexnet gateways file: %s\n", FLEX_GT_FILE); fclose(fp); exit(1); } fputs("addr callsign dev digipeaters\n", fgt); while(fgets(buf, sizeof(buf), fp)) { if(*buf=='#' || *buf==' ') continue; /* comment line/empty line */ cp=strchr(buf, '#'); if (cp) *cp='\0'; cp=strtok(buf, " \t\n\r"); if(cp==NULL) continue; /* empty line */ if(strcasecmp(cp,"pollinterval")==0) { /* set poll interval */ cp=strtok(NULL, " \t\n\r"); if(cp==NULL) { fprintf(stderr, "flexd config: Poll Interval needs an argument\n"); fclose(fp); fclose(fgt); exit(1); } poll_time=safe_atoi(cp); if (poll_timedigis[k]==NULL) break; strcat(digipath," "); strcat(digipath, gw->digis[k]); } sprintf(line, "%05d %-8s %4s %s\n", i++, gw->dest_call, ax25_config_get_dev(gw->dev), digipath); fputs(line, fgt); } } } fprintf(stderr,"FlexD started.\n"); fclose(fgt); fclose(fp); } int download_dest(char *gateway, char *fname) { FILE *tmp; char buffer[512], port[14], path[AX25_MAX_DIGIS*10]; /* Increased buffer to 512 from 256 - ve3tok 31 Mar, 2016 */ char *addr, *commands[10], *dlist[9]; /* Destination + 8 digipeaters */ fd_set read_fd; int n, addrlen, cmd_send=0, cmd_ack=0, c, k; struct full_sockaddr_ax25 axbind, axconnect; struct timeval tv; gw=find_route(gateway, NULL); if (gw==NULL) { fprintf(stderr, "flexd connect: FlexGate %s not found in route file: %s\n", gateway, AX_ROUTES_FILE); return 1; } else { *path='\0'; for(k=0;kdigis[k][0]=='\0') dlist[k+1]=NULL; else dlist[k+1]=gw->digis[k]; } dlist[0]=gw->dest_call; strcpy(port,gw->dev); } if ((addr = ax25_config_get_addr(port)) == NULL) { sprintf(buffer, "flexd connect: invalid AX.25 port name - %s\n", port); write(STDOUT_FILENO, buffer, strlen(buffer)); return 1; } /* * Open the socket into the kernel. */ if ((s = socket(AF_AX25, SOCK_SEQPACKET, 0)) < 0) { sprintf(buffer, "flexd connect: cannot open AX.25 socket, %s\n", strerror(errno)); write(STDOUT_FILENO, buffer, strlen(buffer)); return 1; } /* * Set our AX.25 callsign and AX.25 port callsign accordingly. */ if (*mycall=='\0') sprintf(buffer, "%s %s", addr, addr); else sprintf(buffer, "%s %s", mycall, addr); ax25_aton(buffer, &axbind); axbind.fsa_ax25.sax25_family = AF_AX25; addrlen=sizeof(struct full_sockaddr_ax25); if (bind(s, (struct sockaddr *)&axbind, addrlen) != 0) { sprintf(buffer, "flexd connect: cannot bind AX.25 socket, %s\n", strerror(errno)); write(STDOUT_FILENO, buffer, strlen(buffer)); close(s); return 1; } /* * Lets try and connect to the far end. */ addrlen=sizeof(struct full_sockaddr_ax25); axconnect.fsa_ax25.sax25_family = AF_AX25; if (fcntl(s, F_SETFL, O_NONBLOCK) == -1) { sprintf(buffer, "flexd connect: fcntl on socket: %s\n", strerror(errno)); write(STDOUT_FILENO, buffer, strlen(buffer)); close(s); return 1; } if (ax25_aton_arglist((const char **)dlist, &axconnect) == -1) { sprintf(buffer, "flexd connect: invalid destination callsign or digipeater\n"); write(STDOUT_FILENO, buffer, strlen(buffer)); close(s); return 1; } if (connect(s, (struct sockaddr *)&axconnect, addrlen) == -1 && errno != EINPROGRESS) { switch (errno) { case ECONNREFUSED: strcpy(buffer, "*** Connection refused - aborting\n"); break; case ENETUNREACH: strcpy(buffer, "*** No known route - aborting\n"); break; case EINTR: strcpy(buffer, "*** Connection timed out - aborting\n"); break; default: sprintf(buffer, "*** Cannot connect, %s\n", strerror(errno)); break; } write(STDOUT_FILENO, buffer, strlen(buffer)); close(s); return 1; } while (1) { FD_ZERO(&read_fd); FD_SET(s, &read_fd); tv.tv_sec=180; tv.tv_usec=0; k=select(s + 3, &read_fd, NULL, 0, &tv); if (k<1) { /* error or timeout */ break; } if (FD_ISSET(s, &read_fd)) { // int ret, retlen; int ret = 0; int retlen = 0; char *cp; /* See if we got connected or if this was an error */ getsockopt(s, SOL_SOCKET, SO_ERROR, &ret, &retlen); if (ret != 0) { cp = strdup(strerror(ret)); strlwr(cp); sprintf(buffer, "flexd connect: Failure with %s\nError: %s\n", gateway, cp); write(STDOUT_FILENO, buffer, strlen(buffer)); free(cp); close(s); return 1; } break; } } commands[0]="d\r\n"; commands[1]="q\r\n"; commands[2]=NULL; /* * Loop until one end of the connection goes away. */ if ((tmp=fopen(fname, "w")) == NULL) { fprintf(stderr, "flexd connect: Cannot open temporary file: %s\n", fname); close(s); return 1; } for (;;) { FD_ZERO(&read_fd); FD_SET(s, &read_fd); tv.tv_sec=180; tv.tv_usec=0; k=select(s + 1, &read_fd, NULL, NULL, &tv); if (k<1) { /* error or timeout */ break; } if (FD_ISSET(s, &read_fd)) { if ((n = read(s, buffer, 512)) == -1) break; // if ((n = read(s, buffer, 256)) == -1) break; for(c=0;c') { // if (buffer[c]=='%s' && c")) i++; /* system prompt */ if(i==0) continue; /* skip connect text */ if(*cp=='#' || *cp=='=' || *cp==' ' || *cp=='*' || *cp=='-' || *cp==':') continue; /* comment line/system prompt */ if(strncmp(cp,"73!",3)==0) continue; /* End greeting */ /* CALL SSID-ESID RTT */ do { call=cp; if (call==NULL) break; if (strlen(call)>6) break; if (strchr(call,'-')) break; if (ax25_aton_entry(call,ax)!=0) break; if (!ax25_validate(ax)) break; ssid=strtok(NULL, " \t\n\r"); if (ssid==NULL) break; if (!strchr(ssid,'-')) break; rtt=strtok(NULL, " \t\n\r"); if (rtt==NULL) break; if (atoi(rtt)==0) break; sprintf(line, "%-8s %-5s %6d %05d\n", call, ssid, safe_atoi(rtt), 0); fputs(line, fdst); cp=strtok(NULL, " \t\n\r"); } while(cp!=NULL); } fclose(fdst); fclose(tmp); return 0; } int update_flex(void) { char fname[80]; sprintf(fname, "%s/.session.%s", FLEXD_TEMP_PATH, flexgate); if (download_dest(flexgate, fname)==0) parse_dest(flexgate, fname); remove(fname); return 0; } void hup_handler(int sig) { signal(SIGHUP, SIG_IGN); fprintf(stderr, "SIGHUP caught by FlexD, restarting... \n"); read_conf(); update_flex(); signal(SIGHUP, hup_handler); /* Restore hangup handler */ } void alarm_handler(int sig) { signal(SIGALRM, SIG_IGN); update_flex(); signal(SIGALRM, alarm_handler); /* Restore alarm handler */ alarm(poll_time); } void quit_handler(int sig) { signal(SIGTERM, SIG_IGN); unlink(FLEXD_PID_FILE); fprintf(stderr, "FlexD quitting.\n\r"); signal(SIGTERM, sigterm_defhnd); raise(SIGTERM); return; } int main(int argc, char *argv[]) { FILE *pidfile; if (argc > 1) { if (strcmp(argv[1], "-v") == 0 || strcmp(argv[1], "-h") ==0) { printf("FlexD version %s.\n\r", VERSION); printf("Copywrite (c) 2000-2003 by Roy PE1RJA and Stefano IZ5AWZ\n\r"); printf("Copywrite (c) 2003 - present by Brian Rogers - N1URO.\n\r"); printf("FlexD is free software and you are welcome to redistribute it\n\r"); printf("under the terms of GNU General Public Licence as published\n\r"); printf("by Free Software Foundation; either version 2 of the License, or\n\r"); printf("(at your option) any later version.\n\r"); printf("\n\r"); printf("FlexD comes with NO WARRANTY. Use at your own risk.\n\r"); return 0; } } signal(SIGPIPE, SIG_IGN); if (ax25_config_load_ports() == 0) { fprintf(stderr, "flexd error: No AX25 port data configured\n"); return 1; } read_conf(); if (!daemon_start(TRUE)) { fprintf(stderr, "flexd: cannot become a daemon\n"); return 1; } pidfile = fopen(FLEXD_PID_FILE, "w"); fprintf(pidfile, "%d\n", (int)getpid()); fclose(pidfile); update_flex(); signal(SIGHUP, hup_handler); signal(SIGALRM, alarm_handler); sigterm_defhnd = signal(SIGTERM, quit_handler); // if (sigterm_defhnd == SIG_ERR) // sigterm_defhnd = SIG_DFL; alarm(poll_time); for(;;) pause(); return 0; } uronode-2.15/README0000644000175000017500000001076712470421222012675 0ustar n1uron1uroPlease check out the file INSTALL to compile and install URONode. Also please read the CHANGES.* file for all version history changes.URONode README file September 09, 2013 Note: Please read the CHANGES file for detailed information about the changes from AWZNode to URONode and what I've done with it... along with current version info! - Brian N1URO Hi linuxers! First all, I thanks PE1RJA and OH2BNS for their very great job! ***************************************************************************** The v0.5.x release is a temporary version of URONode running and compiling under linux 2.4.x, with glibc 6 and new ax25 and ax25io libraries. v0.0.11 ***************************************************************************** UROnode is based on AWZ|LinuxNode by Tomi Manninen OH2BNS and FlexNode by Roy PE1RJA. It was born initially for the aripisa.ampr.org system by Stefano Noferi IZ5AWZ of ARI Ham Radio Association of Pisa (ITALY). Users in URONode can connect all ham packet world: all AX25, NETROM, ROSE, FLEXNET, ITANET, TCP/IP nodes in the world are now near. Comment from Stefano: I have a "packet" dream: all the packet networks can interchange connections. My version of node software for Linux is an attempt to realize this idea and I hope it can help the ham radio digital world to come back one. ;) I thanks ARI association of Pisa and Alex Del Chicca IK5PWJ, for their trust and supports. This README file, the documentation etc. are very incomplete! Sorry, but my free time is very very very... very little.. :) If you decide to use URONode, send me a mail. Routing features include: (in order preferance) - netrom routing - fixed routes Create and/or modify /usr/local/etc/ax25/uronode.routes, the format of this file is in the example file uronode.route.ex. Now fixed link nodes in this file have an alias and 3 connection modes, can be queried using the Links command and can be connected directly using: Connect | (ie. without specifying the downlink port) - flexnet destination lists A separate daemon (flexd) queries a neighbouring flexnet node for its reachable destinations, these destinations are stored on the local disk and can be queried using the Dest command and can be connected directly using: Connect Config file: flexd.conf: MyCall # the callsign used during the connection PollInterval # how often the destinations are downloaded FlexGate # the neighbouring flexnet node The pollinterval is specified in seconds and the callsign after flexgate must be defined in uronode.routes !! - mheard based routing When users are using your node the mheard tables are filled with callsigns, callsigns heard on ports can be connected directly with the Connect command, without specifying the downlink port. Other features: - local users of the linux machine can be granted access to the mailreader and optionally to the shell. Config file: /etc/ax25/node.users :::[mail][,shell] call : the callsign of the user that is allowed to access special features password : a string pasword username : the (real)-username on the linux side options : mail - the user has permission to access his or her mailbox shell - the user has permission to access the shell Users with the mail option enabled will receive messages like "New mail has arrived", mostly when the stated condition is met ;-) - all users can send messages to a callsign associated in the kernel table with a linux username ("send" command). - now the sysop can modified the node prompt and password prompt - "!" command show system statistics - old "SEssions" command is now "MSessions" - now "MHeard" command can be used without port specification - changed the output of several query programs (like ports/routes etc.) also included more netrom specific output in these commands - included a lastlog, which shows the time, date and port of your previous session, if this is your first connect, you are requested to read the info text The official FTP Site of URONode is: https://sourceforge.net/projects/uronode/?source=directory ftp://ftp.n1uro.net/packet/ The official Forums site is: http://www.tapr.org/mailman/listinfo/uronode URONode is also a part of Fedora 20 and higher. "yum install uronode" to install the .rpm package. Please check out the file INSTALL to compile and install URONode. Also please read the CHANGES.* file for all version history changes. uronode-2.15/procinfo.h0000644000175000017500000000476112436770310014011 0ustar n1uron1uro#ifndef _PROCINFO_H #define _PROCINFO_H #define PROC_NR_FILE "/proc/net/nr" #define PROC_DEV_FILE "/proc/net/dev" /* VE3TOK 30Nov2014 - A number of defines moved to config.h */ #define CONN_TYPE_DIRECT 'D' #define CONN_TYPE_NODE 'N' #define CONN_TYPE_DIGI 'V' struct proc_dev { char interface[6]; int rx_bytes; int rx_packets; int rx_errs; int rx_drop; int rx_fifo; int rx_frame; int rx_compressed; int rx_multicast; int tx_bytes; int tx_packets; int tx_errs; int tx_drop; int tx_fifo; int tx_colls; int tx_carrier; int tx_compressed; struct proc_dev *next; }; /* * /var/ax25/flex/gateways: (example) * addr callsign dev dest digipeaters * 00001 PI4TUE ax1 935 */ struct flex_gt { int addr; char call[10]; char dev[14]; char digis[AX25_MAX_DIGIS][10]; struct flex_gt *next; }; /* * /usr/local/var/ax25/flex/destinations: (example) * callsign ssid rtt gateway * 9A0XZG 0-15 2575 00001 * DB0AAA 0-0 63 00001 */ struct flex_dst { char dest_call[10]; unsigned short ssida; unsigned short sside; unsigned long rtt; int addr; struct flex_dst *next; }; struct ax_routes { char dest_call[10]; char alias[10]; char dev[14]; char conn_type[1]; char description[50]; char digis[AX25_MAX_DIGIS][10]; struct ax_routes *next; }; extern int safe_atoi(const char *s); extern char *safe_strncpy(char *dest, char *src, int n); extern struct proc_dev *read_proc_dev(void); extern void free_proc_dev(struct proc_dev *ap); extern struct flex_gt *read_flex_gt(void); extern void free_flex_gt(struct flex_gt *fp); extern struct flex_dst *read_flex_dst(void); extern void free_flex_dst(struct flex_dst *fp); extern struct ax_routes *read_ax_routes(void); extern void free_ax_routes(struct ax_routes *ap); extern struct ax_routes *find_route(char *dest_call, struct ax_routes *list); extern struct flex_dst *find_dest(char *dest_call, struct flex_dst *list); extern struct flex_gt *find_gateway(int addr, struct flex_gt *list); extern struct ax_routes *find_mheard(char *dest_call); #endif /* _PROCINFO_H */ uronode-2.15/gateway.c0000644000175000017500000007776413610411211013626 0ustar n1uron1uro#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "sysinfo.h" #include "procinfo.h" #include "node.h" static void invert_ssid(char *out, char *in) { char *cp; if ((cp = strchr(in, '-')) != NULL) { *cp = 0; sprintf(out, "%s-%d", in, 15 - atoi(cp + 1)); *cp = '-'; } else { sprintf(out, "%s-15", in); } } /* * Initiate a AX.25, NET/ROM, ROSE or TCP connection to the host * specified by `address'. */ static ax25io *connect_to(char **addr, int family, int escape, int compr) { int fd; ax25io *riop; fd_set read_fdset; fd_set write_fdset; int salen; union { struct full_sockaddr_ax25 ax; #ifdef HAVE_ROSE struct sockaddr_rose rs; #endif struct sockaddr_in in; } sa; char call[10], path[20], *cp, *eol; int ret, retlen = sizeof(int); int paclen; struct hostent *hp; struct servent *sp; struct user u; #ifdef HAVE_NETROM struct proc_nr_nodes *np; #endif strcpy(call, User.call); /* * Fill in protocol spesific stuff. */ switch (family) { #ifdef HAVE_ROSE case AF_ROSE: if (aliascmd==0) { if (check_perms(PERM_ROSE, 0L) == -1) { axio_printf(NodeIo,"Permission denied"); if (User.ul_type == AF_NETROM) { node_msg(""); } node_log(LOGLVL_GW, "Permission denied: rose"); return NULL; } } if ((fd = socket(AF_ROSE, SOCK_SEQPACKET, 0)) < 0) { node_perror("connect_to: socket", errno); return NULL; } sa.rs.srose_family = AF_ROSE; sa.rs.srose_ndigis = 0; ax25_aton_entry(call, sa.rs.srose_call.ax25_call); rose_aton(rs_config_get_addr(NULL), sa.rs.srose_addr.rose_addr); salen = sizeof(struct sockaddr_rose); if (bind(fd, (struct sockaddr *)&sa, salen) == -1) { node_perror("connect_to: bind", errno); close(fd); return NULL; } memset(path, 0, 11); memcpy(path, rs_config_get_addr(NULL), 4); salen = strlen(addr[1]); if ((salen != 6) && (salen != 10)) { if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } axio_printf(NodeIo,"Invalid ROSE address"); if (User.ul_type == AF_NETROM) { node_msg(""); } return(NULL); } memcpy(path + (10-salen), addr[1], salen); sprintf(User.dl_name, "%s @ %s", addr[0], path); sa.rs.srose_family = AF_ROSE; sa.rs.srose_ndigis = 0; if (ax25_aton_entry(addr[0], sa.rs.srose_call.ax25_call) < 0) { close(fd); return NULL; } if (rose_aton(path, sa.rs.srose_addr.rose_addr) < 0) { close(fd); return NULL; } if (addr[2] != NULL) { if (ax25_aton_entry(addr[2], sa.rs.srose_digi.ax25_call) < 0) { close(fd); return NULL; } sa.rs.srose_ndigis = 1; } salen = sizeof(struct sockaddr_rose); paclen = rs_config_get_paclen(NULL); eol = ROSE_EOL; /* Uncomment the below if you wish to have the node show a 'Trying' state */ if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[01;35m"); } if (User.ul_type != AF_NETROM) { axio_printf(NodeIo,"Trying %s... aborts. ", User.dl_name); } break; #endif #ifdef HAVE_NETROM case AF_NETROM: if (aliascmd==0) { if (check_perms(PERM_NETROM, 0L) == -1) { axio_printf(NodeIo,"Permission denied"); if (User.ul_type == AF_NETROM) { node_msg(""); } node_log(LOGLVL_GW, "Permission denied: netrom"); return NULL; } } if ((fd = socket(AF_NETROM, SOCK_SEQPACKET, 0)) < 0) { node_perror("connect_to: socket", errno); return NULL; } /* Why on earth is this different from ax.25 ????? */ sprintf(path, "%s %s", nr_config_get_addr(NrPort), call); ax25_aton(path, &sa.ax); sa.ax.fsa_ax25.sax25_family = AF_NETROM; salen = sizeof(struct full_sockaddr_ax25); if (bind(fd, (struct sockaddr *)&sa, salen) == -1) { node_perror("connect_to: bind", errno); close(fd); return NULL; } if ((np = find_node(addr[0], NULL)) == NULL) { axio_printf(NodeIo,"No such node"); if (User.ul_type == AF_NETROM) { node_msg(""); } return NULL; } strcpy(User.dl_name, print_node(np->alias, np->call)); if (ax25_aton(np->call, &sa.ax) == -1) { close(fd); return NULL; } sa.ax.fsa_ax25.sax25_family = AF_NETROM; salen = sizeof(struct sockaddr_ax25); paclen = nr_config_get_paclen(NrPort); eol = NETROM_EOL; /* Uncomment the below if you wish the node to show a 'Trying' state */ if (check_perms(PERM_ANSI, 0L) != -1) { if (User.ul_type == AF_NETROM) { break; } if (User.ul_type != AF_NETROM) { node_msg("\e[01;36mTrying %s... aborts. ", User.dl_name); } break; #endif #ifdef HAVE_AX25 case AF_FLEXNET: case AF_AX25: if (aliascmd==0) { if (check_perms(PERM_AX25, 0L) == -1 || (is_hidden(addr[0]) && check_perms(PERM_HIDDEN, 0L) == -1)) { axio_printf(NodeIo,"Not a user interface."); if (User.ul_type == AF_NETROM) { node_msg(""); } node_log(LOGLVL_GW, "Permission denied: ax.25 port %s", addr[0]); return NULL; } } if (ax25_config_get_addr(addr[0]) == NULL) { if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } axio_printf(NodeIo,"Invalid interface: %s", addr[0]); if (User.ul_type == AF_NETROM) { node_msg(""); } return NULL; } if ((fd = socket(AF_AX25, SOCK_SEQPACKET, 0)) < 0) { node_perror("connect_to: socket", errno); return NULL; } /* * Invert the SSID only if user is coming in with AX.25 * and going out on the same port he is coming in via. */ /* if (User.ul_type == AF_AX25 && !strcasecmp(addr[0], User.ul_name)) */ invert_ssid(call, User.call); sprintf(path, "%s %s", call, ax25_config_get_addr(addr[0])); ax25_aton(path, &sa.ax); sa.ax.fsa_ax25.sax25_family = AF_AX25; salen = sizeof(struct full_sockaddr_ax25); if (bind(fd, (struct sockaddr *)&sa, salen) < 0) { node_perror("connect_to: bind", errno); close(fd); return NULL; } if (ax25_aton_arglist((const char **)addr+1, &sa.ax) < 0) { close(fd); return NULL; } strcpy(User.dl_name, strupr(addr[1])); strcpy(User.dl_port, strlwr(addr[0])); sa.ax.fsa_ax25.sax25_family = AF_AX25; salen = sizeof(struct full_sockaddr_ax25); paclen = ax25_config_get_paclen(addr[0]); eol = AX25_EOL; /* Uncomment the below if you wish the node to show a 'Trying' state */ /* if (family==AF_FLEXNET) node_msg("Trying %s via FlexNet... Type to abort", User.dl_name); */ if ((family==AF_FLEXNET) || (family == AF_AX25)) { if (!strcmp(User.dl_port,User.ul_name)) { if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[05;31m"); } axio_printf(NodeIo,"\aLoop detected on "); } if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[0;m"); } if (User.ul_type == AF_NETROM) { axio_printf(NodeIo, "%s} ", NodeId); } if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[01;33m"); } if (check_perms(PERM_ANSI, 0L) == -1) { axio_printf(NodeIo,"link setup (%s)...", User.dl_port); } if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"link setup (%s)...\e[0;m", User.dl_port); } } /* else node_msg("Trying %s on %s... Type to abort", User.dl_name, User.dl_port); */ break; #endif case AF_INET6: case AF_INET: if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { node_perror("connect_to: socket", errno); return NULL; } if ((hp = gethostbyname(addr[0])) == NULL) { if (User.ul_type == AF_NETROM) { axio_printf(NodeIo, "%s} ", NodeId); } axio_printf(NodeIo,"Unknown host %s", addr[0]); if (User.ul_type == AF_NETROM) { node_msg(""); } close(fd); return NULL; } sa.in.sin_family = AF_INET; sa.in.sin_addr.s_addr = ((struct in_addr *)(hp->h_addr))->s_addr; sp = NULL; if (addr[1] == NULL) sp = getservbyname("telnet", "tcp"); if (sp == NULL) sp = getservbyname(addr[1], "tcp"); if (sp == NULL) sp = getservbyport(htons(atoi(addr[1])), "tcp"); if (sp != NULL) { sa.in.sin_port = sp->s_port; } else if (atoi(addr[1]) != 0) { sa.in.sin_port = htons(atoi(addr[1])); } else { axio_printf(NodeIo,"%s Unknown service %s", NodeId, addr[1]); if (User.ul_type == AF_NETROM) { node_msg(""); } close(fd); return NULL; } strcpy(User.dl_name, inet_ntoa(sa.in.sin_addr)); if (sp != NULL) strcpy(User.dl_port, sp->s_name); else sprintf(User.dl_port, "%d", ntohs(sa.in.sin_port)); salen = sizeof(struct sockaddr_in); paclen = 1024; eol = INET_EOL; if (aliascmd==0) { if (check_perms(PERM_TELNET, sa.in.sin_addr.s_addr) == -1) { if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } axio_printf(NodeIo,"Permission denied."); if (User.ul_type == AF_NETROM) { node_msg(""); } node_log(LOGLVL_GW, "Permission denied: telnet %s.", User.dl_name); close(fd); return NULL; } } if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[01;36m"); } if (User.ul_type != AF_NETROM) { axio_printf(NodeIo,"Trying %s:%s... aborts. ", User.dl_name, User.dl_port); // escape < 32 ? "CTRL-" : "", // escape < 32 ? (escape + 'A' - 1) : escape); axio_flush(NodeIo); } } if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[0m"); } break; default: if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } axio_printf(NodeIo,"Unsupported protocol."); if (User.ul_type == AF_NETROM) { node_msg(""); } return NULL; } axio_flush(NodeIo); /* * Ok. Now set up a non-blocking connect... */ if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) { node_perror("connect_to: fcntl - fd", errno); close(fd); return NULL; } if (fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK) == -1) { node_perror("connect_to: fcntl - stdin", errno); close(fd); return NULL; } if (connect(fd, (struct sockaddr *)&sa, salen) == -1 && errno != EINPROGRESS) { node_perror("Duplicate connection not allowed", errno); close(fd); return NULL; } User.dl_type = family; User.state = STATE_TRYING; update_user(); /* * ... and wait for it to finish (or user to abort). */ while (1) { FD_ZERO(&read_fdset); FD_ZERO(&write_fdset); FD_SET(fd, &write_fdset); FD_SET(STDIN_FILENO, &read_fdset); if (select(fd + 1, &read_fdset, &write_fdset, 0, 0) == -1) { node_perror("connect_to: select", errno); break; } if (FD_ISSET(fd, &write_fdset)) { /* See if we got connected or if this was an error */ getsockopt(fd, SOL_SOCKET, SO_ERROR, &ret, &retlen); if (ret != 0) { /* * This is STUPID !!!! * FBB interprets "Connection refused" as * success because it contains the string * "Connect"... * But I'm NOT going to toss away valuable * information (the strerror() info). * Fortunately (???) FBB is case sensitive * when examining the return string so * simply converting the strerror() message * to lower case fixes the problem. Ugly * but it _should_ work. */ cp = strdup(strerror(ret)); strlwr(cp); if (family==AF_FLEXNET) { axio_printf(NodeIo,"\n*** failure with %s", User.dl_name); if (User.ul_type == AF_NETROM) { node_msg(""); } } else if (User.ul_type == AF_NETROM) { axio_printf(NodeIo, "\n%s} Failure with %s: %s\n", NodeId, User.dl_name, cp); } else { axio_printf(NodeIo,"\nFailure with %s: %s", User.dl_name, cp); } node_log(LOGLVL_GW, "Failure with %s: %s", User.dl_name, cp); free(cp); close(fd); return NULL; } break; } if (FD_ISSET(STDIN_FILENO, &read_fdset)) { errno = 0; if (axio_getline(NodeIo) != NULL) { if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[05;31m"); } axio_printf(NodeIo,"Aborted."); if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[0;m"); } if (User.ul_type == AF_NETROM) { node_msg(""); } close(fd); return NULL; } else if (errno != EAGAIN) { close(fd); return NULL; } } } if (User.dl_type == AF_INET) { if ((User.ul_type == AF_NETROM) || (User.ul_type == AF_ROSE)) { axio_printf(NodeIo,"%s} ", NodeId); } if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[01;32m"); } if (User.ul_type != AF_NETROM) { node_msg("\nSocket established to %s:%s", User.dl_name, User.dl_port); } else { node_msg("Socket established to %s:%s", User.dl_name, User.dl_port); } if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[0;m"); } } else /* if (family==AF_FLEXNET) { if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[01;32m"); } node_msg("\n*** connected to %s", User.dl_name); if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[0;m"); } } else */ if ((family==AF_AX25) || (family==AF_FLEXNET) || (family==AF_ROSE)) { if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[01;32m"); } if ((family==AF_AX25) || (family==AF_FLEXNET)) { /* node_msg("\n"); */ } node_msg("\n*** connected to %s", User.dl_name); if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[0;m"); } } else if (family == AF_NETROM) { if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[01;32m"); } if ((User.ul_type == AF_INET) || (User.ul_type == AF_INET6)) { axio_printf(NodeIo,"Virtual circuit established to %s\n", User.dl_name); } if (User.ul_type == AF_NETROM) { if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[0;m"); } axio_printf(NodeIo,"%s} ", NodeId); if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[01;32m"); } axio_printf(NodeIo, "Connected to %s\n", User.dl_name); } if ((User.ul_type == AF_AX25) || (User.ul_type == AF_ROSE)) { axio_printf(NodeIo,"*** connected to %s\n", User.dl_name); } if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[0;m"); } } /* else if (family == AF_NETROM) { node_msg("%s} Connected to %s\n", NodeId, User.dl_name); } else { if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[01;32m"); } node_msg("*** connected to %s\n", User.dl_name, escape < 32 ? "CTRL-" : "", escape < 32 ? (escape + 'A' - 1) : escape); } if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[0;m"); } */ axio_flush(NodeIo); node_log(LOGLVL_GW, "%s Connected to %s", NodeId, User.dl_name); errno = 0; if ((riop = axio_init(fd, fd, paclen, eol)) == NULL) { node_perror("connect_to: Initializing I/O failed", errno); close(fd); return NULL; } if (compr && axio_compr(riop, compr) < 0) node_msg("connect_to: axio_compr failed"); User.state = STATE_CONNECTED; update_user(); return riop; } int do_connect(int argc, char **argv) { int i, k; ax25io *riop; struct ax_routes *ax; struct flex_dst *flx; struct flex_gt *flgt; int c, compress, family = AF_UNSPEC, stay, escape; char *nodoconn = NULL; fd_set fdset; char *connstr = NULL; axio_puts("",NodeIo); stay = 0; if (!strcasecmp(argv[argc - 1], "s")) { stay = 1; argv[--argc] = NULL; } else if (!strcasecmp(argv[argc - 1], "d")) { stay = 0; argv[--argc] = NULL; } compress = 0; c = argv[0][0]; #ifdef HAVE_ZLIB_H if (*argv[0] == 'z') { compress = 1; c = argv[0][1]; } #endif if (argc < 2) { if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } if (c == 't') axio_printf(NodeIo,"Usage: telnet [] [d|s]"); else axio_printf(NodeIo,"Usage: connect [] [via ...] [d|s]"); if (User.ul_type == AF_NETROM) { node_msg(""); } return 0; } if (c == 't') family = AF_INET; else if (argc > 2) { // #ifdef HAVE_ROSE if (strspn(argv[2], "0123456789") == strlen(argv[2])) family = AF_ROSE; else // #endif family = AF_AX25; } else if (argc == 2) { /* Determine destination */ /* call buffer increased by VE3TOK */ static char call[10]; strncpy(call, strupr(argv[1]), 10); /* if (find_node(argv[1], NULL)!=NULL) { family = AF_NETROM; } else */ if ((flx=find_dest(argv[1], NULL))!=NULL) { /* Check FlexNet */ k=1; flgt=find_gateway(flx->addr, NULL); argv[k++]=ax25_config_get_name(flgt->dev); argv[k++]=call; while((k-3)digis[k-3][0]!='\0') argv[k]=flgt->digis[(k++)-3]; argv[k++]=flgt->call; argv[k]=NULL; argc=k; family = AF_FLEXNET; } else if (find_node(argv[1], NULL)!=NULL) { family = AF_NETROM; } else if ((ax=find_route(argv[1], NULL))!=NULL) { /* Check AX25 Links */ k=1; switch(*ax->conn_type) { case CONN_TYPE_DIRECT: { argv[k++]=ax->dev; argv[k++]=ax->dest_call; break; } case CONN_TYPE_DIGI: { argv[k++]=ax->dev; argv[k++]=ax->dest_call; while((k-3)digis[k-3][0]!='\0') argv[k]=ax->digis[(k++)-3]; break; } case CONN_TYPE_NODE: { argv[k++]=ax->dev; argv[k++]=ax->digis[0]; nodoconn=ax->dest_call; break; } } argv[k]=NULL; argc=k; family = AF_AX25; } /* else if ((flx=find_dest(argv[1], NULL))!=NULL) { Check FlexNet k=1; flgt=find_gateway(flx->addr, NULL); argv[k++]=ax25_config_get_name(flgt->dev); argv[k++]=call; while((k-3)digis[k-3][0]!='\0') argv[k]=flgt->digis[(k++)-3]; argv[k++]=flgt->call; argv[k]=NULL; argc=k; family = AF_FLEXNET; else if (find_node(argv[1], NULL)!=NULL) { family = AF_NETROM; } */ #ifdef HAVE_AUTOROUTE else if ((ax=find_mheard(argv[1]))!=NULL) { /* Check Mheard database */ k=1; /* K2MF supplied code */ /* This code *actually* reads mheard.dat and fixes * the digi path the way it should be. -N1URO */ argv[k++] = ax->dev; argv[k++] = ax->dest_call; /* First count the number of digipeaters in the path * from the destination */ i = k - 3; while(i < AX25_MAX_DIGIS) { if(ax->digis[i][0] == '\0') break; i++; } /* Then construct the reverse digipeater path back to * the destination */ while(i && ax->digis[i - 1][0] != '\0') argv[k++] = ax->digis[--i]; /* end K2MF code */ argv[k]=NULL; argc=k; family = AF_AX25; } #endif else { /* Give up */ if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } if (strcmp(argv[1], "##TEMP") == 0) { axio_printf(NodeIo,"%s is not connectable. Use the callsign-ssid.", argv[1]); } else { axio_printf(NodeIo,"%s not found. Please retry your entry.", argv[1]); } family = AF_UNSPEC; // free_flex_dst(flx); // free_ax_routes(ax); if (User.ul_type == AF_NETROM) { node_msg(""); } return 0; } } if (family == AF_INET && argc > 3) connstr = argv[3]; escape = (check_perms(PERM_NOESC, 0L) == 0) ? -1 : EscChar; riop = connect_to(++argv, family, escape, compress); if (riop == NULL) { if (fcntl(STDIN_FILENO, F_SETFL, 0) == -1) node_perror("do_connect: fcntl - stdin", errno); return 0; } if (family == AF_INET) axio_tnmode(riop, 1); if (connstr) { axio_printf(riop, "%s\n", connstr); axio_flush(riop); } /* * If eol conventions are compatible, switch to binary mode, * else switch to special gateway mode. */ if (axio_cmpeol(riop, NodeIo) == 0) { axio_eolmode(riop, EOLMODE_BINARY); axio_eolmode(NodeIo, EOLMODE_BINARY); } else { axio_eolmode(riop, EOLMODE_GW); axio_eolmode(NodeIo, EOLMODE_GW); } if (nodoconn != NULL) axio_printf(riop, "C %s\n",nodoconn); while (1) { FD_ZERO(&fdset); FD_SET(riop->ifd, &fdset); FD_SET(STDIN_FILENO, &fdset); if (select(32, &fdset, 0, 0, 0) == -1) { node_perror("do_connect: select", errno); break; } if (FD_ISSET(riop->ifd, &fdset)) { alarm(ConnTimeout); while((c = axio_getc(riop)) != -1) axio_putc(c, NodeIo); if (errno != EAGAIN) { if (errno && errno != ENOTCONN) axio_printf(NodeIo,"%s", strerror(errno)); break; } } if (FD_ISSET(STDIN_FILENO, &fdset)) { alarm(ConnTimeout); while((c = axio_getc(NodeIo)) != -1) { if (escape != -1 && c == escape) break; axio_putc(c, riop); } if (escape != -1 && c == escape) { axio_eolmode(NodeIo, EOLMODE_TEXT); axio_getline(NodeIo); break; } if (errno != EAGAIN) { stay = 0; break; } } axio_flush(riop); axio_flush(NodeIo); } axio_end(riop); node_log(LOGLVL_GW, "Disconnected from %s", User.dl_name); #ifdef HAVEMOTD /* if (User.ul_type != AF_NETROM) { */ /* if (stay) { */ axio_eolmode(NodeIo, EOLMODE_TEXT); if (fcntl(STDIN_FILENO, F_SETFL, 0) == -1) node_perror("do_connect: fcntl - stdin", errno); if (User.ul_type == AF_INET) { if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[01;31m"); } axio_printf(NodeIo, "Returning you to the shell..."); } else if ((User.ul_type == AF_AX25) && (!stay)) { axio_flush(NodeIo); axio_end_all(); logout_user(); ipc_close(); node_log(LOGLVL_LOGIN, "%s @ %s logged out", User.call, User.ul_name); free_cmdlist(Nodecmds); Nodecmds = NULL; exit(0); } if (User.ul_type == AF_AX25) { if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[01;31m"); } axio_printf(NodeIo,"\r*** reconnected to %s", FlexId); if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[0;m"); } } if (User.ul_type == AF_ROSE) { if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[01;31m"); } axio_printf(NodeIo,"\r*** reconnected to %s", RoseId); if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[0;m"); } } if (User.ul_type == AF_INET) { if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[0m"); } } /* } */ /* } */ if ((User.ul_type == AF_NETROM) && (!stay)) { node_logout("No reconnect"); } if ((User.ul_type == AF_NETROM) && (stay)) { axio_printf(NodeIo,"%s} ", NodeId); if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[01;31mWelcome back.\n\e[0;m"); } if (check_perms(PERM_ANSI, 0L) == -1) { axio_printf(NodeIo,"Welcome back.\n"); } } #else node_logout("No reconnect"); #endif // free_flex_dst(flx); // free_ax_routes(ax); return 0; } int do_finger(int argc, char **argv) { ax25io *riop; int i, compress; char *name, *addr[3], *cp; compress = 0; /* if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } */ axio_puts("",NodeIo); if (argc < 2) { if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } axio_printf(NodeIo,"Usage: finger user@."); if (User.ul_type == AF_NETROM) { node_msg(""); } return 0; } else if ((cp = strchr(argv[1], '@')) != NULL) { *cp = 0; name = argv[1]; addr[0] = ++cp; } else { name = argv[1]; addr[0] = "localhost"; if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } axio_printf(NodeIo,"Usage: finger user@."); if (User.ul_type == AF_NETROM) { node_msg(""); } return 0; } addr[1] = "finger"; addr[2] = NULL; riop = connect_to(addr, AF_INET, 0, compress); /* If you uncommented 'Trying' state on, uncomment this also. */ /* escape = (check_perms(PERM_NOESC, 0L) == 0) ? -1 : EscChar; */ if (riop != NULL) { if (fcntl(riop->ifd, F_SETFL, 0) == -1) node_perror("do_finger: fcntl - fd", errno); axio_printf(NodeIo,"[%s]\n", addr[0]); axio_printf(riop, "%s\n", name); axio_flush(riop); while((i = axio_getc(riop)) != -1) axio_putc(i, NodeIo); axio_end(riop); if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[01;31m"); } axio_printf(NodeIo,"Finger complete."); if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[0;m"); } if (User.ul_type == AF_NETROM) { node_msg(""); } } axio_eolmode(NodeIo, EOLMODE_TEXT); if (fcntl(STDIN_FILENO, F_SETFL, 0) == -1) node_perror("do_finger: fcntl - stdin", errno); return 0; } /* * Returns difference of tv1 and tv2 in milliseconds. */ static long calc_rtt(struct timeval tv1, struct timeval tv2) { struct timeval tv; tv.tv_usec = tv1.tv_usec - tv2.tv_usec; tv.tv_sec = tv1.tv_sec - tv2.tv_sec; if (tv.tv_usec < 0) { tv.tv_sec -= 1L; tv.tv_usec += 1000000L; } return ((tv.tv_sec * 1000L) + (tv.tv_usec / 1000L)); } /* * Checksum routine for Internet Protocol family headers (C Version) */ static unsigned short in_cksum(unsigned char *addr, int len) { register int nleft = len; register unsigned char *w = addr; register unsigned int sum = 0; unsigned short answer = 0; /* * Our algorithm is simple, using a 32 bit accumulator (sum), we add * sequential 16 bit words to it, and at the end, fold back all the * carry bits from the top 16 bits into the lower 16 bits. */ while (nleft > 1) { sum += (*(w + 1) << 8) + *(w); w += 2; nleft -= 2; } /* mop up an odd byte, if necessary */ if (nleft == 1) { sum += *w; } /* add back carry outs from top 16 bits to low 16 bits */ sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */ sum += (sum >> 16); /* add carry */ answer = ~sum; /* truncate to 16 bits */ return answer; } int do_ping(int argc, char **argv) { static int sequence = 0; unsigned char buf[256]; struct hostent *hp; struct sockaddr_in to, from; struct protoent *prot; struct icmphdr *icp; struct timeval tv1, tv2; struct iphdr *ip; fd_set fdset; int fd, i, id, len = sizeof(struct icmphdr); int salen = sizeof(struct sockaddr); /* if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } */ axio_puts("",NodeIo); if (argc < 2) { if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } axio_printf(NodeIo,"Usage: ping []"); if (User.ul_type == AF_NETROM) { node_msg(""); } return 0; } if (argc > 2) { len = atoi(argv[2]) + sizeof(struct icmphdr); // if (len > 256) { if (len > 136) { if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } axio_printf(NodeIo,"Maximum ping size is %d", 136 - sizeof(struct icmphdr)); if (User.ul_type == AF_NETROM) { node_msg(""); } return 0; } } if ((hp = gethostbyname(argv[1])) == NULL) { if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } axio_printf(NodeIo,"Unknown host %s", argv[1]); if (User.ul_type == AF_NETROM) { node_msg(""); } return 0; } memset(&to, 0, sizeof(to)); to.sin_family = AF_INET; to.sin_addr.s_addr = ((struct in_addr *)(hp->h_addr))->s_addr; if ((prot = getprotobyname("icmp")) == NULL) { if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } axio_printf(NodeIo,"Unknown protocol icmp"); if (User.ul_type == AF_NETROM) { node_msg(""); } return 0; } if ((fd = socket(AF_INET, SOCK_RAW, prot->p_proto)) == -1) { node_perror("do_ping: socket", errno); return 0; } if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[01;32mPing engaged, hit to abort.\n\e[0m"); } if (check_perms(PERM_ANSI, 0L) == -1) { axio_printf(NodeIo, "Ping engaged, hit to abort.\n"); } if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[01;35mICMP Echo request sent to: \e[0m"); } if (check_perms(PERM_ANSI, 0L) == -1) { axio_printf(NodeIo, "ICMP Echo request sent to: "); } node_msg("%s", inet_ntoa(to.sin_addr)); axio_flush(NodeIo); strcpy(User.dl_name, inet_ntoa(to.sin_addr)); User.dl_type = AF_INET; User.state = STATE_PINGING; update_user(); /* * Fill the data portion (if any) with some garbage. */ for (i = sizeof(struct icmphdr); i < len; i++) buf[i] = (i - sizeof(struct icmphdr)) & 0xff; /* * Fill in the icmp header. */ id = getpid() & 0xffff; icp = (struct icmphdr *)buf; icp->type = ICMP_ECHO; icp->code = 0; icp->checksum = 0; icp->un.echo.id = id; icp->un.echo.sequence = sequence++; /* * Calculate checksum. */ icp->checksum = in_cksum(buf, len); /* * Take the time and send the packet. */ gettimeofday(&tv1, NULL); if (sendto(fd, buf, len, 0, (struct sockaddr *)&to, salen) != len) { node_perror("do_ping: sendto", errno); close(fd); return 0; } /* * Now wait for it to come back (or user to abort). */ if (fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK) == -1) { node_perror("do_ping: fcntl - stdin", errno); close(fd); return 0; } while (1) { FD_ZERO(&fdset); FD_SET(fd, &fdset); FD_SET(STDIN_FILENO, &fdset); if (select(fd + 1, &fdset, 0, 0, 0) == -1) { node_perror("do_ping: select", errno); break; } if (FD_ISSET(fd, &fdset)) { if ((len = recvfrom(fd, buf, 256, 0, (struct sockaddr *)&from, &salen)) == -1) { node_perror("do_ping: recvfrom", errno); break; } gettimeofday(&tv2, NULL); ip = (struct iphdr *)buf; /* Is it long enough? */ if (len >= (ip->ihl << 2) + sizeof(struct icmphdr)) { len -= ip->ihl << 2; icp = (struct icmphdr *)(buf + (ip->ihl << 2)); /* Is it ours? */ if (icp->type == ICMP_ECHOREPLY && icp->un.echo.id == id && icp->un.echo.sequence == sequence - 1) { if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[01;35mICMP Echo reply received from: \e[0m"); } if (check_perms(PERM_ANSI, 0L) == -1) { axio_printf(NodeIo, "ICMP Echo reply received from: "); } node_msg("%s", inet_ntoa(to.sin_addr)); if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[01;31m"); } /* if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } */ axio_printf(NodeIo, "Ping completed in: %ldms (ttl=%d)", calc_rtt(tv2, tv1), ip->ttl); if (User.ul_type == AF_NETROM) { node_msg(""); } if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[0;m"); } break; } } } if (FD_ISSET(STDIN_FILENO, &fdset)) { if (axio_getline(NodeIo) != NULL) { if (User.ul_type == AF_NETROM){ axio_printf(NodeIo,"%s} ", NodeId); } // if (User.ul_type == AF_INET) { if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[05;31m"); // } } axio_printf(NodeIo,"Ping aborted."); // if (User.ul_type == AF_INET) { if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[0;m"); } // } if (User.ul_type == AF_NETROM) { node_msg(""); } break; } else if (errno != EAGAIN) { break; } } } if (fcntl(STDIN_FILENO, F_SETFL, 0) == -1) node_perror("do_ping: fcntl - stdin", errno); close(fd); return 0; } uronode-2.15/router.c0000644000175000017500000001751314036352055013504 0ustar n1uron1uro#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "procinfo.h" #include "node.h" int do_links(int argc, char **argv) { struct ax_routes *axrt, *p; char digipath[AX25_MAX_DIGIS*10]; char tipoconn[9]; int i=0; axio_puts("",NodeIo); if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } if ((axrt=read_ax_routes()) == NULL) { if (errno) node_perror("do_links: read_ax_routes", errno); else axio_printf(NodeIo,"No known links"); if (User.ul_type == AF_NETROM) { node_msg(""); } return 0; } /* "links" */ if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[01;33m"); } if (argc == 1) { node_msg("AX25 Links:"); if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[0;m"); } axio_printf(NodeIo,"Call Alias Description\n"); axio_printf(NodeIo,"--------- --------- -----------"); for(p=axrt;p!=NULL;p=p->next) axio_printf(NodeIo,"\n%-9s %-9s %s", p->dest_call, p->alias, p->description); free_ax_routes(axrt); if (User.ul_type == AF_NETROM) { node_msg(""); } return 0; } /* "links d" */ if ((*argv[1]=='d') && (strlen(argv[1])==1)) { node_msg("AX25 Direct Links:"); if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[0;m"); } axio_printf(NodeIo,"Call Alias Interf Description\n"); axio_printf(NodeIo,"--------- --------- ------- -----------"); for(p=axrt;p!=NULL;p=p->next) { if (*p->conn_type==CONN_TYPE_DIRECT) axio_printf(NodeIo,"\n%-9s %-9s %-7s %s", p->dest_call, p->alias, p->dev, p->description); } free_ax_routes(axrt); if (User.ul_type == AF_NETROM) { node_msg(""); } return 0; } /* "links n" */ if ((*argv[1]=='n') && (strlen(argv[1])==1)) { node_msg("AX25 Links via other nodes:"); if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[0;m"); } axio_printf(NodeIo,"Call Alias Interf Routing Description\n"); axio_printf(NodeIo,"--------- --------- ------- --------- -----------"); for(p=axrt;p!=NULL;p=p->next) { if (*p->conn_type==CONN_TYPE_NODE) axio_printf(NodeIo,"\n%-9s %-9s %-7s %-9s %s", p->dest_call, p->alias, p->dev, p->digis[0], p->description); } free_ax_routes(axrt); if (User.ul_type == AF_NETROM) { node_msg(""); } return 0; } /* // "links r" if ((*argv[1]=='r') && (strlen(argv[1])==1)) { node_msg("ROSE Links:"); if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[0;m"); } axio_printf(NodeIo,"Call Dnic Interf Description\n"); axio_printf(NodeIo,"--------- --------- ------- -----------"); for(p=axrt;p!=NULL;p=p->next) { if (*p->conn_type==CONN_TYPE_ROSE) axio_printf(NodeIo,"\n%-9s %-9s %-7s %s", p->dest_call, p->alias, p->dev, p->description); } free_ax_routes(axrt); if (User.ul_type == AF_NETROM) { node_msg(""); } return 0; } */ /* "links v" */ if ((*argv[1]=='v') && (strlen(argv[1])==1)) { node_msg("AX25 Links via digipeaters:"); if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[0;m"); } axio_printf(NodeIo,"Call Alias Interf Digipeaters\n"); axio_printf(NodeIo,"--------- --------- ------- -----------"); for(p=axrt;p!=NULL;p=p->next) { *digipath='\0'; for(i=0;idigis[i]==NULL) break; if (i!=0) strcat(digipath," "); strcat(digipath, p->digis[i]); } if (*p->conn_type==CONN_TYPE_DIGI) axio_printf(NodeIo,"\n%-9s %-9s %-7s %s", p->dest_call, p->alias, p->dev, digipath); } free_ax_routes(axrt); if (User.ul_type == AF_NETROM) { node_msg(""); } return 0; } /* "links " */ p=find_route(argv[1], axrt); if(p!=NULL) { node_msg("AX25 Link to %s:", p->dest_call); if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[0;m"); } axio_printf(NodeIo,"Call Alias Interf Type Description\n"); axio_printf(NodeIo,"--------- --------- ------- -------- -----------"); switch(*p->conn_type) { case CONN_TYPE_DIRECT: { strcpy(tipoconn,"Direct"); break; } case CONN_TYPE_NODE: { strcpy(tipoconn,"Via Node"); break; } case CONN_TYPE_DIGI: { strcpy(tipoconn,"Via Digi"); break; } } axio_printf(NodeIo,"\n%-9s %-9s %-7s %-10s %s", p->dest_call, p->alias, p->dev, tipoconn, p->description); if (User.ul_type == AF_NETROM) { node_msg(""); } } else { axio_printf(NodeIo,"No such link"); if (User.ul_type == AF_NETROM) { node_msg(""); } } free_ax_routes(axrt); return 0; } /* ssid buffer increased by 1 by VE3TOK */ int do_dest(int argc, char **argv) { struct flex_dst *fdst, *p; struct flex_gt *flgt, *q; char ssid[6]; int i=0; axio_puts("",NodeIo); if (User.ul_type == AF_NETROM) { axio_printf(NodeIo,"%s} ", NodeId); } if ((fdst=read_flex_dst()) == NULL) { axio_printf(NodeIo,"No known destinations"); if (User.ul_type == AF_NETROM) { node_msg(""); } return 0; } /* "dest" */ if (argc == 1) { if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[01;33m"); } if (User.ul_type != AF_AX25) { axio_printf(NodeIo,"FlexNet Destinations:\n"); } if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[0;m"); } for (p=fdst;p!=NULL;p=p->next) { sprintf(ssid, "%d-%d", p->ssida, p->sside); axio_printf(NodeIo,"%-7s %-5s %4ld%c",p->dest_call,ssid,p->rtt,(++i % 4) ? ' ' : '\n'); } if ((User.ul_type == AF_NETROM) && (i % 4) == 0) { } if ((User.ul_type == AF_NETROM) && (i % 4) != 0) { node_msg(""); } else // if ((User.ul_type != AF_NETROM) && (i % 4) != 0) { if ((User.ul_type != AF_NETROM) && ((i % 4) == 0)) { } free_flex_dst(fdst); return 0; } if ((flgt=read_flex_gt()) == NULL) { node_perror("do_dest: read_flex_gt", errno); if (User.ul_type == AF_NETROM) { node_msg(""); } return 0; } /* "dest *" */ if (*argv[1]=='*') { if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[01;33m"); } node_msg("FlexNet Destinations:"); if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[0;m"); } axio_printf(NodeIo,"Dest SSID RTT Gateway\n"); axio_printf(NodeIo,"-------- ----- ----- --------"); for(p=fdst;p!=NULL;p=p->next) { sprintf(ssid, "%d-%d", p->ssida, p->sside); q=find_gateway(p->addr,flgt); axio_printf(NodeIo,"\n%-8s %-5s %5ld %-8s", p->dest_call, ssid, p->rtt, q!=NULL?q->call:"?"); } free_flex_dst(fdst); free_flex_gt(flgt); if (User.ul_type == AF_NETROM) { node_msg(""); } return 0; } /* "dest " */ p=find_dest(argv[1], fdst); if(p!=NULL) { if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo,"\e[01;33m"); } node_msg("FlexNet Destination %s:", p->dest_call); if (check_perms(PERM_ANSI, 0L) != -1) { axio_printf(NodeIo, "\e[0;m"); } axio_printf(NodeIo,"Dest SSID RTT Gateway\n"); axio_printf(NodeIo,"-------- ----- ----- -------"); sprintf(ssid, "%d-%d", p->ssida, p->sside); q=find_gateway(p->addr,flgt); axio_printf(NodeIo,"\n%-8s %-5s %5ld %-8s", p->dest_call, ssid, p->rtt, q!=NULL?q->call:"?"); if (User.ul_type == AF_NETROM) { node_msg(""); } } else { axio_printf(NodeIo,"No such destination"); if (User.ul_type == AF_NETROM) { node_msg(""); } } free_flex_dst(fdst); free_flex_gt(flgt); return 0; } uronode-2.15/etc/0000755000175000017500000000000013627547406012577 5ustar n1uron1urouronode-2.15/etc/lastlog0000644000175000017500000000000012421572320014135 0ustar n1uron1urouronode-2.15/etc/uronode.users0000644000175000017500000000030712421572320015315 0ustar n1uron1uro# /etc/ax25/uronode.users URONode example configuration file # Shell access for Sysop users # callsign:password:local linux username:shell # xx#xx:password:xx#xx:shell # yy#yy:password:thomas:shell uronode-2.15/etc/uronode.conf0000644000175000017500000000471013076411254015110 0ustar n1uron1uro# /etc/ax25/uronode.conf - URONode example configuration file # # see uronode.conf(5) # Idle timeout (seconds). # This is how long we hold onto a dead link. 0 disables (this is NOT # recommended! Time is in seconds. IdleTimeout 900 # Timeout when gatewaying (seconds). # This (in seconds) is a keep-alive for dead connects out of the node. ConnTimeout 600 # Visible hostname. Will be shown at telnet login. # set this to your ampr.org hostname. HostName xx#xx.ampr.org # SysOp email address # Set this to your email address - preferred to use an ampr.org email. Email # "Local" network. # This is your local amprnet subnet in full. Do NOT use 44.0.0.0/8! LocalNet 44.0.0.0/32 # Command aliases. See uronode.conf(5) for the meaning of the uppercase # letters in the name of the alias. Examples below: Alias CAllbook "telnet %{3:144.167.99.66} 2000 %1 s" Alias CONVers "telnet %{2:44.88.0.9} 3600 \"/n %u %{1:1}\"" Alias DXCluster "telnet %{2:44.88.0.9} 9001 %1 s" Alias WX "telnet %{3:38.102.137.140} %1 s" # Hidden ports. # List interfaces you wish not to display. Not suggested. #HiddenPorts inet # External commands. See uronode.conf(5) for the meaning of the uppercase # letters in the name of the extcmd. # # Flags: 1 Run command through pipe # 2 Reconnected flag # 3 Run through pipe and reconnect # ExtCmd NEtstat 1 nobody /bin/netstat netstat --inet # Node ID. # This displays before all output texts when the user connects into # your node via NetRom. Set to "" to leave blank. # Note: This -must- be defined or will display as "(null)". A space # is hardcoded in. Example: UROHUB:N1URO-2 do NOT add the bracket # afterwards "}" this is predefined in URONode. # NodeId XXXXXX:XX#XX-# # Ax25/Flex ID. # This displays before some strings and at logout to the end user when # they connect in via ax25 as defined in your ax25d.conf file. If # you don't define this "(null)" will be presented to the end user. Its # suggested you take this from your ax25d config which either faces a # flexnet system OR your 2-meter user interface. Note: do NOT make this # ssid the same as your NetRom SSID here or in ax25d.conf. FlexId XX#XX-# # ROSE ssid@network - if none, enter in: none. RoseId XX#XX-#@####,###### # Netrom port name. This port is used for outgoing netrom connects. NrPort nr0 # Syslog Logging level - suggest leaving this at 3 for debugging. 0 # halts logging. LogLevel 3 # The default escape character (CTRL-T) # EscapeChar ^T uronode-2.15/etc/uronode.motd0000644000175000017500000000033712421572320015122 0ustar n1uron1uroThis is copy of URONode is located in , , [XX##xx] (grid) Type "?" for commands or H for more detailed help on a command. *** please edit /etc/ax25/uronode.motd to change this text uronode-2.15/etc/uronode.announce0000644000175000017500000000017513031252432015762 0ustar n1uron1uroPlace your news/announcements in here. Good place for announcing club meetings, club announcements, area flea markets, etc. uronode-2.15/etc/flexd.conf0000644000175000017500000000043612445203255014537 0ustar n1uron1uro# /etc/ax25/flexd.conf URONode example configuration file # see man flexd.conf # The callsign-ssid you wish to poll your flex neighbor with: MyCall xx0xx # How often do we poll our flex neighbor (in seconds): PollInterval 300 # The FlexNet node we're to poll: FlexGate xx0xx-# uronode-2.15/etc/uronode.perms0000644000175000017500000000076712421572320015314 0ustar n1uron1uro# /etc/ax25/uronode.perms - URONode example permissions file # # see uronode.perms(5) # # Note: The flags have been changed as of 2014/08/23 # # user type port passwd perms # User oh2bns can login without password from anywhere else but 'inet'. # #xx0xx inet * qwerty 95 #xx0xx * * * 95 n1uro * * * 255 # OH2RBI is a bbs so it needs escape disabled. # #xx0xx * * * 287 # Default permissions per connection type. # * ax25 * * 31 * netrom * * 31 * local * * 31 * ampr * * 31 * inet * * 0 * host * * 31 uronode-2.15/etc/loggedin0000644000175000017500000000000012421572320014260 0ustar n1uron1urouronode-2.15/etc/uronode.info0000644000175000017500000000021712421572320015107 0ustar n1uron1uroThis is a new system running URONode. *** please edit /etc/ax25/uronode.info to change this text to display information about your system. uronode-2.15/etc/uronode.routes0000644000175000017500000000135012421572320015474 0ustar n1uron1uro# /etc/ax25/uronode.routes URONode example configuration file # This is used for quick ax25 connects so users need not add an interface # when making a connect. You also need a statement in here for flexd to # poll your flexnet neighbor. # URONode shows links with this order. Examples below: # Direct Routing # route d 'description' # #route n1uro-1 fxuro ax0 d 'N1URO FlexNet Hub' # Routing across another node with sending a string "C " # route n 'description' # #route n1uro-14 WMASS ax0 n 'N1URO-NOS' n1uro-1 # Routing via digipeaters # route v 'description' # #route n1uro-9 MACTFX ax0 v 'N1URO Xnet' n1uro-1 uronode-2.15/etc/help/0000755000175000017500000000000013774440700013517 5ustar n1uron1urouronode-2.15/etc/help/routes.hlp0000644000175000017500000000130712421572320015536 0ustar n1uron1uro USAGE Routes DESCRIPTION Shows the NET/ROM route table of the local host (eg. the nodes which the local node directly talks with). These nodes are used to reach the other nodes on the node table. Fields shown are: Link - Is there an AX25 connection active to this node Port - Which port is this route on Callsign - The callsign of the neighbour node Quality - A relative quality for the path (0-255) Destinations - Number of other nodes reached via this route Lock - Is the quality of this route locked by the operator QSO - Number of NET/ROM session entiesuronode-2.15/etc/help/jlong.hlp0000644000175000017500000000035712734615537015351 0ustar n1uron1uro USAGE JLong DESCRIPTION Gives a list of ALL heard AX25 stations on all interfaces. This may be a VERY LONG LIST. If you're on HF you may timeout. Add an interface to see a long list for just that interface. uronode-2.15/etc/help/help.hlp0000644000175000017500000000055212421572320015146 0ustar n1uron1uro USAGE Help [] DESCRIPTION Gives help for the specified command or this text if no command is specified. Commands can not be abbreviated. Use the "?" command to retrieve a list of available commands, except for the COLOR command which you need to contact your sysop to add. "Help color" to see about the color schema. uronode-2.15/etc/help/mail.hlp0000644000175000017500000000042012421572320015132 0ustar n1uron1uro USAGE Mail DESCRIPTION Access your mailbox and send mail to other users if you have mail waiting. (only available for sysops and some users). Note: this feature is initially disabled, contact the sysop if you like to have it enabled. uronode-2.15/etc/help/sessions.hlp0000644000175000017500000000057212421572320016066 0ustar n1uron1uro USAGE SEssions [* | ] DESCRIPTION Gives a list of active AX25 and NET/ROM connections to and from the local host. With an asterisk (*) as an argument shows also AX25 and NET/ROM sockets in listening state. With a callsign as an argument gives a list of all connections with either source or destination callsign . uronode-2.15/etc/help/ping.hlp0000644000175000017500000000077512650600266015167 0ustar n1uron1uro USAGE PIng [] DESCRIPTION Checks if a host can be reached trough the network by sending an ICMP Echo Request packet to the host and waiting for it to reply. If a reply is received the round-trip-time (RTT) between the local and remote hosts is shown. If an optional length is specified the data portion of the packet is filled with length number of bytes up to 128. EXAMPLES ping aripisa.ampr.org ping n1uro.ampr.org 128 uronode-2.15/etc/help/color.hlp0000644000175000017500000000100312421572320015324 0ustar n1uron1uro USAGE DESCRIPTION Adds ANSI color to the system for you. Send a message to the sysop and request that they add 512 to your permissions flag for the interface(s) you connect in from to get the color schema. You *must* use an ANSI compliant terminal such as Qmodem, Telix, telnet, etc. Interfaces available: Schema: ax25 ax25 - yellow netrom netrom - cyan internet internet- magenta amprnet system - white localhost starts - green stops - red alarms - flashing red uronode-2.15/etc/help/message.hlp0000644000175000017500000000064612421572320015646 0ustar n1uron1uro USAGE MEssage DESCRIPTION Send email to users (now only available for messages to sysop). Note: sysop has to enable your mail flag for you to be able to receive mail, otherwise you may only send from here. *Sysop Note: use your adduser or userconf program and create the users account as well as adding the mail flag to the configuration file. Select: /bin/false for a shell. uronode-2.15/etc/help/links.hlp0000644000175000017500000000115412421572320015335 0ustar n1uron1uro USAGE Links [ d | n | v | ] DESCRIPTION Shows the AX25 link table of the local node. The destinations on this list can be reached using the Connect command without knowing the actual network path used (assuming the network is OK). The optional parameter d show the AX25 nodes directly linked. The optional parameter n show the AX25 nodes linked connecting another node and passing a string type "C XX0XX". The optional parameter v show the AX25 links via digipeaters. You can also specify a destination callsign to get the verbose information for a single destination.uronode-2.15/etc/help/connect.hlp0000644000175000017500000000230212421572320015642 0ustar n1uron1uro USAGE Connect [s|d] For NET/ROM or Links Connect [via ...] [s|d] For AX25 Connect
[] [d|s] For ROSE Connect [s|d] For FlexNet DESCRIPTION Initiates an AX25, NET/ROM, ROSE or Flexnet connection to a remote host. If more than two parameters are entered and the second parameter is ten charachers in length then it is interpreted as a ROSE connection, otherwise the first parameter is interpreted as a port name and AX25 is used to make the connection via that port. If only one parameter is given the connection is made searching for the callsign in NET/ROM nodes, in AX25 Fixed links, in FlexNet destinations and last in Mheard database in this order. If a single `s' is entered as the last parameter, then when the remote host disconnects you will be returned to this node. If a single `d' is entered as the last parameter, you will be disconnected from this node too. Default behaviour depends on how the user connects in: NetRom - defaults to disconnect all others - defaults to reconnect uronode-2.15/etc/help/telnet.hlp0000644000175000017500000000167212421572320015515 0ustar n1uron1uro USAGE Telnet [] [s|d] DESCRIPTION Initiates a telnet session to a remote host using TCP/IP. You might not be able to connect to a given host due to the local operator's policy of using this node, or simply because the host is unreachable due to a network failure. You can use the ping command to check if a host is reachable. By default, the telnet command connects to the TCP port 23 (allocated for telnet). You can specify another TCP port or a TCP port name. If a single `s' is entered as the last parameter, then when the remote host disconnects you will be returned to this node. This is only valid if the user connects into your node via NetRom, otherwise the user is automatically reconnected to the node. EXAMPLES telnet aripisa.ampr.org telnet aripisa.ampr.org 1024 telnet 44.134.208.29 s telnet 44.88.0.9 23 s uronode-2.15/etc/help/desti.hlp0000644000175000017500000000102112421572320015316 0ustar n1uron1uro USAGE Dest [*|] DESCRIPTION Shows the FlexNet destination table of the local node. The destinations on this list can be reached using the Connect command without knowing the actual network path used (assuming the network is OK). The optional parameter * toggles verbose mode, showing the ssid mask, the round-trip-time and the path used to reach each node. You can also specify a node callsign to get the verbose information for a single node.uronode-2.15/etc/help/zconnect.hlp0000644000175000017500000000224212421572320016037 0ustar n1uron1uro USAGE ZConnect [s|d] For NET/ROM or Links ZConnect [via ...] [s|d] For AX25 ZConnect
[] [d|s] For ROSE ZConnect [s|d] For FlexNet DESCRIPTION Compresses an AX25, NET/ROM, ROSE or Flexnet connection to a remote host. If more than two parameters are entered and the second parameter is ten charachers in length then it is interpreted as a ROSE connection, otherwise the first parameter is interpreted as a port name and AX25 is used to make the connection via that port. If only one parameter is given the connection is made searching for the callsign in NET/ROM nodes, in AX25 Fixed links, in FlexNet destinations and last in Mheard database in this order. If a single `s' is entered as the last parameter, then when the remote host disconnects you will be returned to this node. If a single `d' is entered as the last parameter, you will be disconnected from this node too. Default behaviour (neither `s' nor `d' entered) depends on sysop configuration. uronode-2.15/etc/help/ztelnet.hlp0000644000175000017500000000175212421572320015706 0ustar n1uron1uro USAGE ZTelnet [] [s|d] DESCRIPTION Compresses a telnet session to a remote host using TCP/IP. You might not be able to connect to a given host due to the local operator's policy of using this node, or simply because the host is unreachable due to a network failure. You can use the ping command to check if a host is reachable. By default, the telnet command connects to the TCP port 23 (allocated for telnet). You can specify another TCP port or a TCP port name. If a single `s' is entered as the last parameter, then when the remote host disconnects you will be returned to this node. If a single `d' is entered as the last parameter, you will be disconnected from this node too. Default behaviour (neither `s' nor `d' entered) depends on sysop configuration. EXAMPLES ztelnet aripisa.ampr.org ztelnet aripisa.ampr.org 1024 ztelnet 44.134.208.29 uronode-2.15/etc/help/info.hlp0000644000175000017500000000033412421572320015147 0ustar n1uron1uro USAGE Info DESCRIPTION Displays the version information and the contents of the /etc/ax25/uronode.info file, which describes those aspects of the system that the sysop likes to brag about. uronode-2.15/etc/help/users.hlp0000644000175000017500000000027712421572320015363 0ustar n1uron1uro USAGE Users DESCRIPTION Shows a list of users currently connected to the local node, where the users are coming from, and what are they doing at the moment. uronode-2.15/etc/help/finger.hlp0000644000175000017500000000055712421572320015475 0ustar n1uron1uro USAGE Finger [][@] DESCRIPTION Retrieves information about users of a system. If the user name is omitted, shows the users currently logged on the host. If the hostname is omitted, defaults to the local host. EXAMPLES finger @aripisa.ampr.org finger iz5awz@aripisa.ampr.org finger iz5awzuronode-2.15/etc/help/who.hlp0000644000175000017500000000031212421572320015005 0ustar n1uron1uro USAGE Who ( | *) DESCRIPTION Shows a list when the user with the callsign last connected to this node. Use the asterisk to print out the entire log table. uronode-2.15/etc/help/bye.hlp0000644000175000017500000000010712421572320014771 0ustar n1uron1uro USAGE Bye DESCRIPTION Disconnects you from this node.uronode-2.15/etc/help/netstat.hlp0000644000175000017500000000017112421572320015675 0ustar n1uron1uro USAGE NEtstat DESCRIPTION Gives a list of active TCP/IP connections to and from the local host.uronode-2.15/etc/help/nodes.hlp0000644000175000017500000000121712421572320015325 0ustar n1uron1uro USAGE Nodes [*|] DESCRIPTION Shows the NET/ROM node table of the local host. The nodes on this list can be reached using the Connect command without knowing the actual network path used (assuming the network is OK). The optional parameter * toggles verbose mode, showing the Obsolescence counter, relative path quality and the port and neighbour node used to reach each node. You can also specify a node callsign to get the verbose information for a single node. In that case a "which" field that tells what route the kernel will use to reach the node is shown. uronode-2.15/etc/help/jheard.hlp0000644000175000017500000000037112734614731015464 0ustar n1uron1uro USAGE Jheard [] DESCRIPTION Gives a list of the last 20 heard AX25 stations on all interfaces and, if specified, on the specified interface. Use the "INterfaces" command to get a list of available interfaces. uronode-2.15/etc/help/host.hlp0000644000175000017500000000061412421572320015172 0ustar n1uron1uro USAGE Host | DESCRIPTION Tells information about an Internet host. The host can be identified using a host name (for example, aripisa.ampr.org) or an IP address (for example, 44.134.208.29). Returns the host name, IP addresses and known aliases for the host. The information is gathered from the DNS (domain name service).uronode-2.15/etc/help/status.hlp0000644000175000017500000000136513676625036015564 0ustar n1uron1uro USAGE STatus [ong] DESCRIPTION Returns information about the status of the Linux system which this URONode runs on. All information is taken directly from the operating system. By itself STatus will show 4 lines of basic status of the system: Version, System time, Hostname, and Uptime. When followed with a Long or L it will give you more detailed information about the host. The "load average" values indicate the average amount of processes waiting for processor time during the last 1, 5 and 15 minutes. Load average of 1.0 would mean that the all of the processor time is used by the processes, and all processes still get all of the time they can use. uronode-2.15/etc/help/quit.hlp0000644000175000017500000000011112421572320015167 0ustar n1uron1uro USAGE Quit DESCRIPTION Disconnects you from this node. uronode-2.15/etc/help/msg.hlp0000644000175000017500000000073712421572320015011 0ustar n1uron1uro USAGE MSg DESCRIPTION Sends a one-line message to another user of the node. The user in question must be in idle state (ie. not connected/connecting anywhere or running a program). If the user has an SSID other than zero, the SSID must be specified. If multiple users are logged in with the same callsign/SSID pair, those who are in idle state, get the message. EXAMPLES msg k2mf Hello, Bawee! uronode-2.15/etc/help/rose.hlp0000644000175000017500000000007012421572320015161 0ustar n1uron1uro c n1uro-8 3100860906 uronode-2.15/etc/help/version.hlp0000644000175000017500000000012712421572320015701 0ustar n1uron1uro USAGE Version DESCRIPTION Displays the software version information, uronode-2.15/etc/help/escape.hlp0000644000175000017500000000106712421572320015460 0ustar n1uron1uro USAGE Escape DESCRIPTION Sets the character will be treated as the signal to close down any open connection made from the node. You can specify the escape character in a number of ways. They are: the actual binary character ^T to set it to Control-T (or any other control character) 0xNN to set it to hexadecimal value NN 0NNN to set it to Octal value NNN NNN to set it to decimal value NNN (no leading zero!) -1 to disable this featureuronode-2.15/etc/help/ports.hlp0000644000175000017500000000102012421572320015354 0ustar n1uron1uro USAGE Ports DESCRIPTION Shows the available AX25 ports. Shown are the port name, a short description for the port, the number of sessions via the port (qso) and the number received and transmitted packets via the port. The port name is used when using the Connect command to connect to an user or service not running NET/ROM or FlexNet (eg. not visible in the Nodes and Destinations lists). The port name is also visible in the Route, MHeard and MSession lists.uronode-2.15/etc/gateways0000644000175000017500000000000012421572320014314 0ustar n1uron1urouronode-2.15/jheard.c0000644000175000017500000001523313052124125013406 0ustar n1uron1uro/* Routine rewritten mainly by Barry K2MF (Mr. MFNOS) and Brian N1URO */ #include #include #include #include #include #include #include #include #include #include #include #include #include "config.h" /* Bob VE3TOK 30Nov2014 */ #include "procinfo.h" #include "node.h" struct mheard_list { struct mheard_struct data; struct mheard_list *next; }; int do_jheard (int argc,char **argv) { FILE *fp; struct mheard_struct mh; struct mheard_list *list = NULL, *new, *tmp, *p; char *s, *t, *u; int mhcount = 0; axio_puts("",NodeIo); if(User.ul_type == AF_NETROM) axio_printf(NodeIo,"%s} ",NodeId); if(argc > 0) { if(ax25_config_get_dev(argv[1]) == NULL) // || (check_perms(PERM_HIDDEN, 0) == -1 // && is_hidden(argv[1]))) { { axio_printf(NodeIo,"Invalid interface: %s", argv[1]); if(User.ul_type == AF_NETROM) node_msg(""); return 0; } } if((fp = fopen(DATA_MHEARD_FILE,"r")) == NULL) { node_perror(DATA_MHEARD_FILE,errno); return 0; } while(mhcount < 20 && fread(&mh,sizeof(struct mheard_struct),1,fp) == 1) { if(argc > 1) { if(strcmp(argv[1],mh.portname)) continue; } // if(check_perms(PERM_HIDDEN,0) == -1 && is_hidden(mh.portname)) // continue; if((new = calloc(1,sizeof(struct mheard_list))) == NULL) { node_perror("do_mheard: calloc",errno); break; } new->data = mh; if(list == NULL || mh.last_heard > list->data.last_heard) { tmp = list; list = new; } else { for(p = list; p->next != NULL; p = p->next) { if(mh.last_heard > p->next->data.last_heard) break; } tmp = p->next; p->next = new; } new->next = tmp; mhcount++; } fclose(fp); if(check_perms(PERM_ANSI,0L) != -1) axio_printf(NodeIo,"\e[01;33m"); node_msg("Just Heard list:"); if(check_perms(PERM_ANSI,0L) != -1) axio_printf(NodeIo,"\e[0;m"); axio_printf(NodeIo,"Callsign Device Packets Date & Time Frame Type(s)\n"); axio_printf(NodeIo,"--------- ------ -------- --------------- -------------"); while(list != NULL) { s = ctime(&list->data.last_heard); s[19] = 0; s += 4; t = ax25_ntoa(&list->data.from_call); if((u = strstr(t,"-0")) != NULL) *u = '\0'; axio_printf(NodeIo,"\n%-9s %-6s %-8d %s",t,list->data.portname,list->data.count,s); if(list->data.mode & MHEARD_MODE_ARP) axio_printf(NodeIo," ARP"); if(list->data.mode & MHEARD_MODE_FLEXNET) axio_printf(NodeIo," FlexNet"); if(list->data.mode & MHEARD_MODE_IP_DG) axio_printf(NodeIo," IP-DG"); if(list->data.mode & MHEARD_MODE_IP_VC) axio_printf(NodeIo," IP-VC"); if(list->data.mode & MHEARD_MODE_NETROM) axio_printf(NodeIo," NetRom"); if(list->data.mode & MHEARD_MODE_ROSE) axio_printf(NodeIo," Rose"); if(list->data.mode & MHEARD_MODE_SEGMENT) axio_printf(NodeIo," Segment"); if(list->data.mode & MHEARD_MODE_TEXNET) axio_printf(NodeIo," TexNet"); if(list->data.mode & MHEARD_MODE_TEXT) axio_printf(NodeIo," Text"); if(list->data.mode & MHEARD_MODE_PSATFT) axio_printf(NodeIo," PacsatFT"); if(list->data.mode & MHEARD_MODE_PSATPB) axio_printf(NodeIo," PacsatPB"); if(list->data.mode & MHEARD_MODE_UNKNOWN) axio_printf(NodeIo," Unknown"); tmp = list; list = list->next; free(tmp); } if(User.ul_type == AF_NETROM) node_msg(""); return 0; } int do_jlong (int argc,char **argv) { FILE *fp; struct mheard_struct mh; struct mheard_list *list = NULL, *new, *tmp, *p; char *s, *t, *u; int mhcount = 0; axio_puts("",NodeIo); if(User.ul_type == AF_NETROM) axio_printf(NodeIo,"%s} ",NodeId); if(argc > 0) { if(ax25_config_get_dev(argv[1]) == NULL ) // || (check_perms(PERM_HIDDEN, 0) == -1 // && is_hidden(argv[1]))) { axio_printf(NodeIo,"Invalid interface: %s", argv[1]); if(User.ul_type == AF_NETROM) node_msg(""); return 0; } } if((fp = fopen(DATA_MHEARD_FILE,"r")) == NULL) { node_perror(DATA_MHEARD_FILE,errno); return 0; } while (fread(&mh,sizeof(struct mheard_struct),1,fp) == 1) { if(argc > 1) { if(strcmp(argv[1],mh.portname)) continue; } // if(check_perms(PERM_HIDDEN,0) == -1 && is_hidden(mh.portname)) // continue; if((new = calloc(1,sizeof(struct mheard_list))) == NULL) { node_perror("do_mheard: calloc",errno); break; } new->data = mh; if(list == NULL || mh.last_heard > list->data.last_heard) { tmp = list; list = new; } else { for(p = list; p->next != NULL; p = p->next) { if(mh.last_heard > p->next->data.last_heard) break; } tmp = p->next; p->next = new; } new->next = tmp; mhcount++; } fclose(fp); if(check_perms(PERM_ANSI,0L) != -1) axio_printf(NodeIo,"\e[01;33m"); node_msg("Just Heard Long list (May timeout HFers):"); if(check_perms(PERM_ANSI,0L) != -1) axio_printf(NodeIo,"\e[0;m"); axio_printf(NodeIo,"Callsign Device Packets Date & Time Frame Type(s)\n"); axio_printf(NodeIo,"--------- ------ -------- --------------- -------------"); while(list != NULL) { s = ctime(&list->data.last_heard); s[19] = 0; s += 4; t = ax25_ntoa(&list->data.from_call); if((u = strstr(t,"-0")) != NULL) *u = '\0'; axio_printf(NodeIo,"\n%-9s %-6s %-8d %s",t,list->data.portname,list->data.count,s); if(list->data.mode & MHEARD_MODE_ARP) axio_printf(NodeIo," ARP"); if(list->data.mode & MHEARD_MODE_FLEXNET) axio_printf(NodeIo," FlexNet"); if(list->data.mode & MHEARD_MODE_IP_DG) axio_printf(NodeIo," IP-DG"); if(list->data.mode & MHEARD_MODE_IP_VC) axio_printf(NodeIo," IP-VC"); if(list->data.mode & MHEARD_MODE_NETROM) axio_printf(NodeIo," NetRom"); if(list->data.mode & MHEARD_MODE_ROSE) axio_printf(NodeIo," Rose"); if(list->data.mode & MHEARD_MODE_SEGMENT) axio_printf(NodeIo," Segment"); if(list->data.mode & MHEARD_MODE_TEXNET) axio_printf(NodeIo," TexNet"); if(list->data.mode & MHEARD_MODE_TEXT) axio_printf(NodeIo," Text"); if(list->data.mode & MHEARD_MODE_PSATFT) axio_printf(NodeIo," PacsatFT"); if(list->data.mode & MHEARD_MODE_PSATPB) axio_printf(NodeIo," PacsatPB"); if(list->data.mode & MHEARD_MODE_UNKNOWN) axio_printf(NodeIo," Unknown"); tmp = list; list = list->next; free(tmp); } if(User.ul_type == AF_NETROM) node_msg(""); return 0; } uronode-2.15/Makefile.include.in0000644000175000017500000000032412421572320015472 0ustar n1uron1uro# Processor architecture ARCH = @ARCH@ # Paths ETC_DIR = @ETC_DIR@ SBIN_DIR = @SBIN_DIR@ BIN_DIR = @BIN_DIR@ LIB_DIR = @LIB_DIR@ MAN_DIR = @MAN_DIR@ VAR_DIR = @VAR_DIR@ # Is Zlib available? ZLIB = @ZLIB@uronode-2.15/sysinfo.c0000644000175000017500000001441312642547315013660 0ustar n1uron1uro/* * This code is slightly modified from the procps package. */ #include #include #include #include #include #include #include #include #include #include #include #include "node.h" #include "sysinfo.h" char *xmalloc(size_t); char *fixup_null_alloc(size_t); int read_utmp(char *); int list_entries(int); int who(void); #define UPTIME_FILE "/proc/uptime" #define LOADAVG_FILE "/proc/loadavg" #define MEMINFO_FILE "/proc/meminfo" #define STRUCT_UTMP struct utmp static STRUCT_UTMP *utmp_contents; #ifndef UTMP_FILE #define UTMP_FILE "/var/run/utmp" #endif #ifndef EMAILLEN #define EMAILLEN 64 #endif #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 64 #endif #ifndef S_IWGRP #define S_IWGRP 020 #endif static char buf[800]; /* This macro opens FILE only if necessary and seeks to 0 so that successive calls to the functions are more efficient. It also reads the current contents of the file into the global buf. */ #define FILE_TO_BUF(FILE) { \ static int n, fd = -1; \ if (fd == -1 && (fd = open(FILE, O_RDONLY)) == -1) { \ close(fd); \ return 0; \ } \ lseek(fd, 0L, SEEK_SET); \ if ((n = read(fd, buf, sizeof buf - 1)) < 0) { \ close(fd); \ fd = -1; \ return 0; \ } \ buf[n] = '\0'; \ } #define SET_IF_DESIRED(x,y) if (x) *(x) = (y) /* evals 'x' twice */ int uptime(double *uptime_secs, double *idle_secs) { double up=0, idle=0; FILE_TO_BUF(UPTIME_FILE) if (sscanf(buf, "%lf %lf", &up, &idle) < 2) { printf("Bad data in %s\n", UPTIME_FILE ); return 0; } SET_IF_DESIRED(uptime_secs, up); SET_IF_DESIRED(idle_secs, idle); return up; /* assume never be zero seconds in practice */ } int loadavg(double *av1, double *av5, double *av15) { double avg_1=0, avg_5=0, avg_15=0; FILE_TO_BUF(LOADAVG_FILE) if (sscanf(buf, "%lf %lf %lf", &avg_1, &avg_5, &avg_15) < 3) { printf("Bad data in %s\n", LOADAVG_FILE ); return 0; } SET_IF_DESIRED(av1, avg_1); SET_IF_DESIRED(av5, avg_5); SET_IF_DESIRED(av15, avg_15); return 1; } /* The following /proc/meminfo parsing routine assumes the following format: [