N1URO's ax25 start/stop script - good for init.d!

What happened to /dev/ttyq0-/dev/ptyq0 and the likes?


In the newer linux systems, the pseudo tty's have been eliminated for a more
dynamic structure as needed using a master /dev/ptmx pseudo terminal. There are
many 'hacks' available on how to do this. Personally I find creating a static terminal
helps eliminate any configuration issues and is easier to debug! Also instead of
using the infamous FPAC based ax25-up/ax25-down scripts, you can do this all in
one script that's SYSV compatable! I place this in /usr/local/bin and call it
simply "ax25".

I also create hardcoded pseudo terminals using the "socat" package. This package
allows you to create the old devices in /dev you're used to seeing before and also
allow you to hard-code your ax25ipd.conf to a specific device you can use all the
time. This package is not part of a default install so you will need to use apt
or yum, or whatever package management system for your disto is to retrieve it,
or compile the source. For each pair of terminals you'll need two lines. You will
see them in the script. The script follows:

#! /bin/sh

case "$1" in
        modprobe mkiss
        modprobe ax25
        modprobe netrom

        # create pseudo tty devices:
        socat PIPE:/dev/ttyq0 PIPE:/dev/ptyq0 &
        socat PTY,link=/dev/ttyq0 PTY,link=/dev/ptyq0 &
        sleep 3

        /usr/local/sbin/kissattach -m 256 /dev/ptyq0 ax0
        /usr/local/sbin/ax25ipd -c /etc/ax25/ax25ipd.conf > /tmp/axip

        ifconfig ax0 netmask up
        ifconfig nr0 down
        nrattach -i -m 512 nr0
        ifconfig nr0 netmask hw netrom N1URO-12 up
        /usr/local/sbin/netromd -c -i -p 1 -t 15
        exit 0

        killall -TERM mheardd
        killall -TERM netromd
        killall -TERM ax25d
        killall -TERM ax25ipd
        killall -TERM kissattach
        killall -TERM socat
        ifconfig nr0 down
        ifconfig ax0 down
        modprobe -r netrom
        modprobe -r ax25
        modprobe -r mkiss
        exit 0

	echo "Usage: ax25 {start|stop}"
	exit 0


exit 0

You can add anything else you require into this script such as your favorite ripv2
daemon, ip route commands, iptables commands, etc. I hope this has helped get you

73 de N1URO