From 88538c36bafd014c2f39793f0cf5c4359c740bd6 Mon Sep 17 00:00:00 2001 From: Thomas Osterried Date: Mon, 28 Nov 2005 20:13:21 +0000 Subject: - IP Address not mandatory anymore - New -b option. IFF_BROADCAST disabled by default now. --- kiss/kissattach.8 | 15 ++++++++++----- kiss/kissattach.c | 23 +++++++++++++++++++---- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/kiss/kissattach.8 b/kiss/kissattach.8 index 54bb648..9b81e40 100644 --- a/kiss/kissattach.8 +++ b/kiss/kissattach.8 @@ -2,9 +2,9 @@ .SH NAME kissattach, spattach \- Attach a KISS or 6PACK interface .SH SYNOPSIS -.B kissattach [-6] [-l] [-m mtu] [-v] tty port inetaddr +.B kissattach [-b] [-6] [-l] [-m mtu] [-v] tty port [inetaddr] .sp -.B spattach [-i inetaddr] [-l] [-m mtu] [-v] tty port +.B spattach [-b] [-l] [-m mtu] [-v] tty port [inetaddr] .SH DESCRIPTION .LP Attach a KISS or a 6PACK interface to what is normally a tty line connected @@ -23,9 +23,10 @@ TNC attached, although it could be a pseudo tty or a KISS port emulator such as an SCC card. The port arguments is the name of a port as given in the axports(5) file. .LP -The inetaddr argument is the IP address of the new interface. This is now a -mandatory argument although due to historical reasons this restriction is -lifted if the old -i option is used. +The inetaddr argument is the IP address of the new interface. Some time it +was mandatory argument (although due to historical reasons this restriction is +lifted if the old -i option is used). But there's really not a need for +the interface to have an IP address assigned to. .SH OPTIONS .TP 16 .BI "\-6" @@ -40,6 +41,10 @@ the program will complain about it, though still work. .BI \-l Log messages to the system log, the default is not to. .TP 16 +.BI \-b +Allow broadcasts on the interface (default no - because for e.g. samba +broadcasts are a pain..) +.TP 16 .BI "\-m mtu" Sets the mtu of the interface. If this value is not given then the value is taken from the paclen parameter in axports. diff --git a/kiss/kissattach.c b/kiss/kissattach.c index 6906ae4..18de11e 100644 --- a/kiss/kissattach.c +++ b/kiss/kissattach.c @@ -47,6 +47,7 @@ static char *progname = NULL; static char *kttyname = NULL; static char *portname = NULL; static char *inetaddr = NULL; +static int allow_broadcast = 0; static char *kiss_basename(char *s) { @@ -200,6 +201,10 @@ static int startiface(char *dev, struct hostent *hp) ifr.ifr_flags &= IFF_NOARP; ifr.ifr_flags |= IFF_UP; ifr.ifr_flags |= IFF_RUNNING; + if (allow_broadcast) + ifr.ifr_flags |= IFF_BROADCAST; /* samba broadcasts are a pain.. */ + else + ifr.ifr_flags &= ~(IFF_BROADCAST); /* samba broadcasts are a pain.. */ if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) { fprintf(stderr, "%s: ", progname); @@ -214,7 +219,7 @@ static int startiface(char *dev, struct hostent *hp) static void usage(void) { - fprintf(stderr, "usage: %s [-l] [-m mtu] [-v] ttyinterface port inetaddr\n", progname); + fprintf(stderr, "usage: %s [-b] [-l] [-m mtu] [-v] ttyinterface port [inetaddr]\n", progname); } int main(int argc, char *argv[]) @@ -230,11 +235,14 @@ int main(int argc, char *argv[]) if (!strcmp(progname, "spattach")) disc = N_6PACK; - while ((fd = getopt(argc, argv, "6i:lm:v")) != -1) { + while ((fd = getopt(argc, argv, "b6i:lm:v")) != -1) { switch (fd) { case '6': disc = N_6PACK; break; + case 'b': + allow_broadcast = 1; + break; case 'i': fprintf(stderr, "%s: -i flag depreciated, use new command line format instead.\n", progname); inetaddr = optarg; @@ -258,7 +266,11 @@ int main(int argc, char *argv[]) } } +#ifdef notdef if ((argc - optind) != 3 && ((argc - optind) != 2 || !inetaddr)) { +#else + if ((argc - optind) < 2) { +#endif usage(); return 1; } @@ -266,7 +278,7 @@ int main(int argc, char *argv[]) kttyname = argv[optind++]; portname = argv[optind++]; - if (!inetaddr) + if (argc-1 >= optind && !inetaddr) inetaddr = argv[optind]; if (tty_is_locked(kttyname)) { @@ -277,7 +289,7 @@ int main(int argc, char *argv[]) if (!readconfig(portname)) return 1; - if ((hp = gethostbyname(inetaddr)) == NULL) { + if (inetaddr && (hp = gethostbyname(inetaddr)) == NULL) { fprintf(stderr, "%s: invalid internet name/address - %s\n", progname, inetaddr); return 1; } @@ -320,8 +332,11 @@ int main(int argc, char *argv[]) return 1; } +#ifdef notdef + /* ax25 ifaces should not really need to have an IP address assigned to */ if (!startiface(dev, hp)) return 1; +#endif printf("AX.25 port %s bound to device %s\n", portname, dev); -- cgit v1.2.3