debian/0000775000000000000000000000000011761112244007167 5ustar debian/README.Debian0000664000000000000000000000340207521356141011234 0ustar ibod for Debian --------------- This is ibod, originally written by Bjoern Smith . The current author of ibod is Jan Obladen . ibod is started automatically when your ippp0 link becomes active, and is stopped automatically when it drops. ibod does *not* configure slave links for you, see instructions in the isdnutils/ipppd packages for how you do that. Changes from the upstream version: * Applied patch from Bernd Harmsen to add UPLIMIT, DOWNLIMIT and STAYDOWN options to ibod.cf. * The ibod.cf file lives in /etc/isdn rather than /etc/ppp, to be consistent with the isdnutils suite of packages. * It has been modified so that it uses tcp wrappers around the xibod control port, so, for example, if you wanted to allow access to the control port only from localhost, you'd put the following in /etc/hosts.allow: ibod: 127.0.0.1 Note that for the client names you can only use the keyword ALL or IP addresses (NOT host or domain names). The idea for tcp wrappers was inspired by the portmap package. * Trap the error return from "write()" when the socket is closed prematurely, so that ibod doesn't start hogging the CPU. For some reason, the signal handler in the upstream isn't doing its job. * Some compiler warnings have been fixed, and a particularly noisy syslog() call has been silenced. * Manpage ibod.cf.4 has been renamed to ibod_cf.4, as this was being interpreted as being a manpage in the "cf" locale. I have not packaged xibod yet, but fully intend to do so. The upstream version of xibod only supports two channels, and so may not work with this version of ibod. -- Paul Martin , Tue, 30 Jul 2002 01:20:33 +0100 debian/changelog0000664000000000000000000000407511761112235011047 0ustar ibod (1.5.0-6) unstable; urgency=low * Fix typo in package description. (Closes: #299994) * Pick up --ld-as-needed patch from Ubuntu. Hey guys, why no bug? -- Paul Martin Tue, 29 May 2012 10:19:23 +0100 ibod (1.5.0-5) unstable; urgency=low * Convert to debhelper 9 and dh sequencer. * Split out changes into multiple quilt patches and use source format 3.0 (quilt). * Adjust Makefile to allow hardened build. -- Paul Martin Wed, 23 May 2012 14:12:32 +0100 ibod (1.5.0-4) unstable; urgency=high * Fix FTBFS error due to file permissions in orig.tar. (Closes: #264244) -- Paul Martin Wed, 18 Aug 2004 20:56:40 +0100 ibod (1.5.0-3) unstable; urgency=low * Change all occurrences of str_errlist[] to strerror(). * Fix building with 2.6 kernel headers (as now shipped with libc6). This ugly hack consists of #defining __ISDN_FSM_H__ so that other headers aren't included. (Closes: #223160) * Update to standards version 3.6.1.0 + Update DEB_BUILD_OPTIONS behaviour to new policy (noopt rather than debug). * Use dh_installppp now it's available, and change Build-Depends appropriately. (Closes: #212829) -- Paul Martin Fri, 12 Dec 2003 23:02:41 +0000 ibod (1.5.0-2) unstable; urgency=low * Updated to standards version 3.5.6. * Applied patch from Bernd Harmsen to add UPLIMIT, DOWNLIMIT and STAYDOWN options to ibod.cf * Removed emacs settings from debian/changelog. * Use and depend on debhelper 4. -- Paul Martin Tue, 13 Aug 2002 00:18:11 +0100 ibod (1.5.0-1) unstable; urgency=low * Initial Release. Closes: #86075 * ibod.h: Fixed default LIMIT (upstream had 7000, should have been 90) * ibod.c: Cleaned up a few compiler warnings * ibod.c: Caught error return from write, that doesn't seem to be caught by SIGPIPE signal handler. * ibod.c: Added tcp_wrappers. * ibod.c: commented out a syslog() that was being a bit too verbose. -- Paul Martin Sun, 25 Feb 2001 18:38:10 +0000 debian/control0000664000000000000000000000131011757172121010572 0ustar Source: ibod Section: net Priority: extra Maintainer: Paul Martin Build-Depends: debhelper (>> 9), libwrap0-dev Standards-Version: 3.9.3 Package: ibod Architecture: linux-any Depends: ${shlibs:Depends}, ${misc:Depends}, ipppd | isdnutils Description: ISDN MPPP bandwidth on demand daemon ibod is an ISDN MPPP bandwidth on demand daemon designed to operate in conjunction with isdn4linux. The program monitors inbound and outbound traffic on the ISDN interface. When the required bandwidth exceeds the capacity for the current number of ISDN B-channels, more (slave) channels are connected according to the MPPP protocol. When the traffic decreases, the slave channel(s) are disconnected. debian/copyright0000664000000000000000000000144511757160433011136 0ustar This package was debianized by Paul Martin on Thu, 15 Feb 2001 01:55:18 +0000. It was downloaded from http://www.datenwelt.net/oss/ibod/ Upstream Authors: Björn Smith (original author) and Jan Obladen (current maintainer) Changes for Debian (more details in README.Debian): * ibod.cf lives in /etc/isdn, not /etc/ppp. * Some trivial bugfixes. * Added tcp_wrappers to the control TCP socket. * Addition of UPLIMIT, DOWNLIMIT and STAYDOWN options. Copyright 1999 Björn Smith ibod was initially created by Björn Smith in 1999. It is distributed under the GNU General Public Licence version 2 (GPL). On Debian GNU/Linux systems, the complete text of the GNU General Public License may be found in `/usr/share/common-licenses/GPL-2'. debian/ibod.00-ibod.ppp.ip-up0000775000000000000000000000054007245201257013016 0ustar #!/bin/sh # 00ibod-up by Paul Martin 21 Feb 2001. You may treat this program as if # it were in the public domain. # 00ibod-up starts ibod when ippp0 comes up. test -f /usr/bin/ibod || exit 0 if [ "$PPP_IFACE" = "ippp0" ] then start-stop-daemon --start --quiet --background --make-pidfile \ --pidfile /var/run/ibod.pid --exec /usr/bin/ibod fi debian/ibod.zz-ibod.ppp.ip-down0000775000000000000000000000057607245344704013603 0ustar #!/bin/sh # 99ibod-down by Paul Martin 21 Feb 2001. You may treat this program as if # it were in the public domain. # 99ibod-down stops ibod when ippp0 goes down. test -f /usr/bin/ibod || exit 0 if [ "$PPP_IFACE" = "ippp0" ] then ( start-stop-daemon --stop --quiet \ --pidfile /var/run/ibod.pid --exec /usr/bin/ibod && \ rm /var/run/ibod.pid \ ) \ || true fi debian/ibod.preinst0000664000000000000000000000161507245353033011522 0ustar #! /bin/sh # preinst script for ibod # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `install' # * `install' # * `upgrade' # * `abort-upgrade' # # For details see /usr/share/doc/packaging-manual/ case "$1" in install|upgrade) if [ "$1" = "upgrade" ] then start-stop-daemon --stop --quiet --oknodo \ --pidfile /var/run/ibod.pid \ --exec /usr/bin/ibod 2>/dev/null || true rm /var/run/ibod.pid || true fi ;; abort-upgrade) ;; *) echo "preinst called with unknown argument \`$1'" >&2 exit 0 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0 debian/ibod.prerm0000664000000000000000000000200307245352707011162 0ustar #! /bin/sh # prerm script for ibod # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `remove' # * `upgrade' # * `failed-upgrade' # * `remove' `in-favour' # * `deconfigure' `in-favour' # `removing' # # for details, see /usr/share/doc/packaging-manual/ case "$1" in remove|upgrade|deconfigure) start-stop-daemon --stop --quiet --oknodo \ --pidfile /var/run/ibod.pid \ --exec /usr/bin/ibod 2>/dev/null || true rm /var/run/ibod.pid || true ;; failed-upgrade) ;; *) echo "prerm called with unknown argument \`$1'" >&2 exit 0 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0 debian/ibod.docs0000664000000000000000000000000007242633427010756 0ustar debian/ibod.dirs0000664000000000000000000000006307253431565011001 0ustar usr/bin etc/isdn etc/ppp/ip-up.d etc/ppp/ip-down.d debian/ibod.manpages0000664000000000000000000000002107245611153011617 0ustar ibod.1 ibod_cf.4 debian/rules0000775000000000000000000000016211756723276010267 0ustar #!/usr/bin/make -f %: dh $@ override_dh_installppp: dh_installppp --name=00-ibod dh_installppp --name=zz-ibod debian/compat0000664000000000000000000000000211756723037010401 0ustar 9 debian/source/0000775000000000000000000000000011756723511010500 5ustar debian/source/format0000664000000000000000000000001411756723511011706 0ustar 3.0 (quilt) debian/ibod.install0000664000000000000000000000002411756723401011477 0ustar ibod.cf /etc/isdn/ debian/patches/0000775000000000000000000000000011761111701010613 5ustar debian/patches/series0000664000000000000000000000014511761111570012034 0ustar debian-build.patch strerror.patch limits.patch tcpwrappers.patch buildfixes.patch ld-as-needed.patch debian/patches/limits.patch0000664000000000000000000002130311756736126013156 0ustar Index: ibod-1.5.0/ibod.c =================================================================== --- ibod-1.5.0.orig/ibod.c 2012-05-22 17:16:03.517555079 +0100 +++ ibod-1.5.0/ibod.c 2012-05-22 17:17:45.371441915 +0100 @@ -25,16 +25,18 @@ static int bring_down_slave(); static char *home; static Conf cf; -static struct timeval timeout, tv_last, tv_up; +static struct timeval timeout, tv_last, tv_up, tv_down; static int usageflags[ISDN_MAX_CHANNELS]; static char phone[ISDN_MAX_CHANNELS][20]; static Siobytes iobytes[ISDN_MAX_CHANNELS]; static unsigned long in_bytes_last, out_bytes_last; static unsigned long in_bytes_per_sec, out_bytes_per_sec; +static unsigned long current_sec_in_bytes, current_sec_out_bytes; static unsigned long channels_last; static int channels_now; static int msgsock = -1; /* Communication socket descriptor */ -static int limit; +static int uplimit; +static int downlimit; main(int argc, char *argv[]) @@ -204,9 +206,11 @@ cf.enable = ENABLE; cf.interval = INTERVAL; cf.filter = FILTER; - cf.limit = LIMIT; + cf.uplimit = UPLIMIT; + cf.downlimit = DOWNLIMIT; cf.stayup = STAYUP; cf.stayup_time = STAYUP_TIME; + cf.staydown_time= STAYDOWN_TIME; cf.max_channels = MAX_CHANNELS; /* Open config file */ @@ -256,12 +260,20 @@ cf.filter = atoi(value); } - if (strcmp(key, "LIMIT") == 0) { + if (strcmp(key, "UPLIMIT") == 0) { val = atoi(value); - if (cf.limit != val) + if (cf.uplimit != val) syslog(LOG_NOTICE, - "Parameter LIMIT reconfigured to %d\n", val); - cf.limit = atoi(value); + "Parameter UPLIMIT reconfigured to %d\n", val); + cf.uplimit = atoi(value); + } + + if (strcmp(key, "DOWNLIMIT") == 0) { + val = atoi(value); + if (cf.downlimit != val) + syslog(LOG_NOTICE, + "Parameter DOWNLIMIT reconfigured to %d\n", val); + cf.downlimit = atoi(value); } if (strcmp(key, "STAYUP") == 0) { @@ -280,6 +292,14 @@ cf.stayup_time = atoi(value); } + if (strcmp(key, "STAYDOWN_TIME") == 0) { + val = atoi(value); + if (cf.staydown_time != val) + syslog(LOG_NOTICE, + "Parameter STAYDOWN_TIME reconfigured to %d\n", val); + cf.staydown_time = atoi(value); + } + if (strcmp(key, "MAX_CHANNELS") == 0) { val = atoi(value); if (cf.max_channels != val) @@ -389,8 +409,8 @@ return; } - /* Calculate the total through put in bytes/sec */ - if (cf.filter < 1) { + /* Calculate the average through put in bytes/sec */ + if (cf.filter < 1 ) { in_bytes_per_sec = (in_bytes_now - in_bytes_last) * 1000 / ms_delta; out_bytes_per_sec = @@ -403,6 +423,13 @@ (out_bytes_now - out_bytes_last) * 1000 / ms_delta) / cf.filter; } + /* Calculate the current through put in bytes/sec */ + current_sec_in_bytes = + (in_bytes_now - in_bytes_last) * 1000 / ms_delta; + current_sec_out_bytes = + (out_bytes_now - out_bytes_last) * 1000 / ms_delta; + + in_bytes_last = in_bytes_now; out_bytes_last = out_bytes_now; @@ -418,24 +445,40 @@ return; } - limit = (8 * 1024 * channels_now * cf.limit) / 100; + uplimit = (8 * 1024 * channels_now * cf.uplimit) / 100; + downlimit = (8 * 1024 * channels_now * cf.downlimit) / 100; - syslog(LOG_NOTICE,"Set limit to %d bps - current in: %d bps, current out: %d bps\n", limit, in_bytes_per_sec, out_bytes_per_sec); +#ifdef DEBUG + syslog(LOG_NOTICE,"Set uplimit to %d and downlimit to %d bps - avr in: %ld bps, avr out: %ld - cur in: %ld bps, cur out: %ld bps\n", + uplimit, downlimit, in_bytes_per_sec, out_bytes_per_sec, current_sec_in_bytes, current_sec_out_bytes); +#endif + /* Bring up slave interface if current and average through put */ + /* is more than uplimit */ if (channels_now < cf.max_channels && - (in_bytes_per_sec > limit || out_bytes_per_sec > limit)) { + (in_bytes_per_sec > uplimit || out_bytes_per_sec > uplimit) && + (current_sec_in_bytes > uplimit || current_sec_out_bytes > uplimit)) { - /* Bring up slave interface */ - if (bring_up_slave() == -1) - exit(1); + /* Check that the min stay down timer has expired */ + gettimeofday(&tv_now, NULL); + if (tv_now.tv_sec - tv_down.tv_sec > cf.staydown_time) { - /* Start stay up timer */ - gettimeofday(&tv_up, NULL); + /* Bring up slave interface */ + if (bring_up_slave() == -1) + exit(1); + + /* Start stay up timer */ + gettimeofday(&tv_up, NULL); + } } + /* Bring down slave interface if current and average through put */ + /* is less than uplimit */ if ((channels_now > 1) && - (in_bytes_per_sec <= limit) && - (out_bytes_per_sec <= limit) && + (in_bytes_per_sec <= downlimit) && + (out_bytes_per_sec <= downlimit) && + (current_sec_in_bytes < downlimit) && + (current_sec_out_bytes < downlimit) && (cf.stayup == 0)) { /* Check that the min stay up timer has expired */ @@ -445,6 +488,10 @@ /* Bring down slave interface */ if (bring_down_slave() == -1) exit(1); + + /* Start stay down timer */ + gettimeofday(&tv_down, NULL); + } } Index: ibod-1.5.0/ibod.cf =================================================================== --- ibod-1.5.0.orig/ibod.cf 2012-05-22 17:09:01.249833997 +0100 +++ ibod-1.5.0/ibod.cf 2012-05-22 17:18:28.304237254 +0100 @@ -39,10 +39,20 @@ # Default is 5. # # LIMIT Specifies percentage loading of the channel at -# which it is necessary to up or down channels. -# Note that this has changed from version 1.4. +# which it is necessary to up or down channels. +# This sets both up and down limits. +# Note that this has changed from version 1.4. +# +# UPLIMIT Specifies percentage loading of the channel at +# which it is necessary to up channels. +# Note that this has changed from version 1.4. # Default is 90. # +# DOWNLIMIT Specifies percentage loading of the channel at +# which it is necessary to down channels. +# Note that this has changed from version 1.4. +# Default is 80. +# # STAYUP 0|1 Enable/disable slave channel stay up function. # If enabled the 2:nd cannel (slave link) will stay # up even if the average bytes/sec decrease the value @@ -57,9 +67,13 @@ # channel will unconditionally stay up after it has # been brought up. Default value is 30. # -# MAX_CHANNELS Defines the maximum of channels used for -# the ppp connection. -# Default is 2. +# STAYDOWN_TIME Defines the minimum time in seconds the 2:nd +# channel will unconditionally stay down after it has +# been brought up. Default value is 10. +# +# MAX_CHANNELS Defines the maximum of channels used for +# the ppp connection. +# Default is 2. # INTERVAL 500 FILTER 10 Index: ibod-1.5.0/ibod.cf.4 =================================================================== --- ibod-1.5.0.orig/ibod.cf.4 2012-05-22 17:09:01.249833997 +0100 +++ ibod-1.5.0/ibod.cf.4 2012-05-22 17:18:14.039973009 +0100 @@ -49,13 +49,25 @@ .I LIMIT Specifies percentage loading of the channel at which it is necessary to up or down channels. +This sets both up and down limits to the same value. Note that this has changed from version 1.4. -Default is 90%. + +.TP +.I UPLIMIT +Specifies percentage loading of the channel at +which it is necessary to up channels. +Default is 90. + +.TP +.I DOWNLIMIT +Specifies percentage loading of the channel at +which it is necessary to down channels. +Default is 80. .TP .I STAYUP 0|1 Enable/disable slave channel stay up function. -If enabled, the 2:nd cannel (slave link) will stay +If enabled, the second channel (slave link) will stay up even if the average bytes/sec decrease the value defined by LIMIT. In this case the slave link will stay up until hangup time is reached. @@ -66,11 +78,17 @@ .TP .I STAYUP_TIME -Defines the minimum time in seconds the 2:nd +Defines the minimum time in seconds the second channel will unconditionally stay up after it has been brought up. Default value is 30. .TP +.I STAYDOWN_TIME +Defines the minimum time in seconds the second +channel will unconditionally stay down after it +has been brought up. Default value is 10. + +.TP .I FULL Defines the maximum throughput in bytes/sec one channel can transmit. Default value is 7500. debian/patches/strerror.patch0000664000000000000000000001155211756736133013542 0ustar Index: ibod-1.5.0/ibod.h =================================================================== --- ibod-1.5.0.orig/ibod.h 2012-05-22 17:09:05.269908572 +0100 +++ ibod-1.5.0/ibod.h 2012-05-22 17:16:03.517555079 +0100 @@ -35,9 +35,11 @@ #define ENABLE 1 #define INTERVAL 500 #define FILTER 5 -#define LIMIT 7000 +#define UPLIMIT 90 +#define DOWNLIMIT 80 #define STAYUP 0 #define STAYUP_TIME 30 +#define STAYDOWN_TIME 10 #define FULL_THROUGHPUT 7500 #define MAX_CHANNELS 2 @@ -68,10 +70,12 @@ char dev[32]; int enable; int interval; - int limit; + int uplimit; + int downlimit; int filter; int stayup; int stayup_time; + int staydown_time; int full; int max_channels; } Conf; Index: ibod-1.5.0/ibod.c =================================================================== --- ibod-1.5.0.orig/ibod.c 2012-05-22 17:09:05.269908572 +0100 +++ ibod-1.5.0/ibod.c 2012-05-22 17:18:33.396331596 +0100 @@ -67,7 +67,7 @@ /* Create a socket for control panel communication */ if ((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) { - syslog(LOG_ERR, "creating socket: %s\n", sys_errlist[errno]); + syslog(LOG_ERR, "creating socket: %s\n", strerror(errno)); closelog(); exit(1); } @@ -76,7 +76,7 @@ server.sin_addr.s_addr = INADDR_ANY; server.sin_port = htons(IBOD_PORT); if (bind(s, (struct sockaddr *)&server, sizeof(struct sockaddr_in)) < 0) { - syslog(LOG_ERR, "binding stream socket: %s\n", sys_errlist[errno]); + syslog(LOG_ERR, "binding stream socket: %s\n", strerror(errno)); closelog(); exit(1); } @@ -102,14 +102,14 @@ max_fd = msgsock; if ((rc = select(max_fd + 1, &readfds, NULL, &execptfds, &timeout)) < 0) { - syslog(LOG_ERR, "select: %s\n", sys_errlist[errno]); + syslog(LOG_ERR, "select: %s\n", strerror(errno)); continue; } if (FD_ISSET(s, &readfds)) { msgsock = accept(s, (struct sockaddr *)0, (int *)0); if (msgsock == -1) - syslog(LOG_ERR, "accept: %s\n", sys_errlist[errno]); + syslog(LOG_ERR, "accept: %s\n", strerror(errno)); } if (msgsock != -1 && FD_ISSET(msgsock, &readfds)) { @@ -118,7 +118,7 @@ memset(buf, 0, sizeof buf); if ((rval = read(msgsock, buf, 1024)) < 0) syslog(LOG_ERR, "reading stream message: %s\n", - sys_errlist[errno]); + strerror(errno)); else { int cmd = *(int *)buf; @@ -178,7 +178,13 @@ memcpy(&buf[INBOUND_RATE_POS], &in_bytes_per_sec, POBJ_SIZE); memcpy(&buf[OUTBOUND_RATE_POS], &out_bytes_per_sec, POBJ_SIZE); - write(msgsock, buf, STATUS_FRAME_SIZE); + if (write(msgsock, buf, STATUS_FRAME_SIZE)==-1) { + /* error on write, close socket */ + close(msgsock); + msgsock = -1; + syslog(LOG_ERR, "writing stream message: %s\n", + strerror(errno)); + } } } @@ -308,7 +314,7 @@ static void pipehndl(int sig) { - syslog(LOG_ERR, "caught SIGPIPE: %s\n", sys_errlist[errno]); + syslog(LOG_ERR, "caught SIGPIPE: %s\n", strerror(errno)); close(msgsock); msgsock = -1; @@ -328,7 +334,7 @@ /* Open the info device */ if ((fd = open(ISDN_INFO_DEV, O_RDONLY | O_NDELAY)) < 0) { - syslog(LOG_ERR, "%s: %s\n", ISDN_INFO_DEV, sys_errlist[errno]); + syslog(LOG_ERR, "%s: %s\n", ISDN_INFO_DEV, strerror(errno)); closelog(); exit(1); } @@ -361,7 +367,7 @@ /* Get byte in/out for all channels */ if (ioctl(fd, IIOCGETCPS, &iobytes)) { - syslog(LOG_ERR, "%s: %s\n", IIOCGETCPS, sys_errlist[errno]); + syslog(LOG_ERR, "%s: %s\n", "IIOCGETCPS", strerror(errno)); closelog(); exit(1); } @@ -451,13 +457,13 @@ int fd, rc; if ((fd = open(ISDN_CTLR_DEV, O_RDWR)) < 0) { - syslog(LOG_ERR, "%s: %s\n", ISDN_CTLR_DEV, sys_errlist[errno]); + syslog(LOG_ERR, "%s: %s\n", ISDN_CTLR_DEV, strerror(errno)); closelog(); return -1; } if ((rc = ioctl(fd, IIOCNETALN, cf.dev)) < 0) { - syslog(LOG_ERR, "%s: %s\n", cf.dev, sys_errlist[errno]); + syslog(LOG_ERR, "%s: %s\n", cf.dev, strerror(errno)); closelog(); return -1; } @@ -480,13 +486,13 @@ int fd, rc; if ((fd = open(ISDN_CTLR_DEV, O_RDWR)) < 0) { - syslog(LOG_ERR, "%s: %s\n", ISDN_CTLR_DEV, sys_errlist[errno]); + syslog(LOG_ERR, "%s: %s\n", ISDN_CTLR_DEV, strerror(errno)); closelog(); return -1; } if ((rc = ioctl(fd, IIOCNETDLN, cf.dev)) < 0) { - syslog(LOG_ERR, "%s: %s\n", cf.dev, sys_errlist[errno]); + syslog(LOG_ERR, "%s: %s\n", cf.dev, strerror(errno)); closelog(); return -1; } debian/patches/debian-build.patch0000664000000000000000000000554711756737026014210 0ustar Description: Changes for building and running in the Debian environment. Author: Paul Martin Index: ibod-1.5.0/Makefile =================================================================== --- ibod-1.5.0.orig/Makefile 2012-05-22 17:25:25.939973967 +0100 +++ ibod-1.5.0/Makefile 2012-05-22 17:25:55.604523517 +0100 @@ -10,7 +10,24 @@ SRCS_MAN = ibod.1 ibod.cf.4 SRCS_ALL = $(SRCS_C) $(SRCS_H) $(SRCS_MISC) $(SRCS_MAN) -all: ibod +CC = gcc +DEFS = -DTCP_WRAPPERS -DIBOD_DEFAULT_DIR='"/etc/isdn"' +CFLAGS+= -Wall -g $(CPPFLAGS) +LDFLAGS+= -lwrap +INSTALL = install +INSTALL_FILE = $(INSTALL) -p -o root -g root -m 644 +INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755 +INSTALL_SCRIPT = $(INSTALL) -p -o root -g root -m 755 +INSTALL_DIR = $(INSTALL) -p -d -o root -g root -m 755 + + +all: ibod ibod_cf.4 + +ibod: ibod.c ibod.h Makefile + $(CC) $(CFLAGS) $(LDFLAGS) -o ibod ibod.c $(DEFS) + +ibod_cf.4: ibod.cf.4 + cp -a ibod.cf.4 ibod_cf.4 freeze: rcs -n$(RCSSYMBOL): $(SRCS_ALL) @@ -26,3 +43,9 @@ tar cvf tmp.tar ibod $(SRCS_MAN) ibod.cf; \ gzip tmp.tar; \ mv tmp.tar.gz ibod-$(VERSION)-bin.tar.gz + +clean: + rm *~ *.o ibod ibod_cf.4 2>/dev/null || true + +install: all + $(INSTALL_PROGRAM) -s ibod $(DESTDIR)/usr/bin Index: ibod-1.5.0/ibod.1 =================================================================== --- ibod-1.5.0.orig/ibod.1 2012-05-22 17:25:25.939973967 +0100 +++ ibod-1.5.0/ibod.1 2012-05-22 17:25:30.632060886 +0100 @@ -1,4 +1,4 @@ -.TH IBOD 1L \" -*- nroff -*- +.TH IBOD 1 \" -*- nroff -*- .SH NAME ibod \- ISDN MPPP bandwidth on demand daemon .SH SYNOPSIS @@ -12,7 +12,7 @@ It is normally started at boot time, but can be started and stopped at any time. The program monitors inbound and outbound traffic on the ISDN interface. When the required bandwidth exceeds the capacity -for one IDSN B-channel (64kbps) a second (slave) channel is connected +for one ISDN B-channel (64kbps) a second (slave) channel is connected according to the MPPP protocol. When the traffic decreases below one channel capacity, the slave channel is disconnected. .PP @@ -20,7 +20,7 @@ for details. .PP A configuration file -.I /etc/ppp/ibod.cf +.I /etc/isdn/ibod.cf is read initially. The device .I /dev/isdninfo @@ -51,7 +51,7 @@ .I ibod. .SH SEE ALSO -ibod.cf(4) and xibod(1) +ibod_cf(4) and xibod(1) .SH AUTHOR Bjoern Smith, Smith@Compound.SE Index: ibod-1.5.0/ibod.h =================================================================== --- ibod-1.5.0.orig/ibod.h 2012-05-22 17:25:25.939973967 +0100 +++ ibod-1.5.0/ibod.h 2012-05-22 17:25:30.632060886 +0100 @@ -41,7 +41,9 @@ #define FULL_THROUGHPUT 7500 #define MAX_CHANNELS 2 +#ifndef IBOD_DEFAULT_DIR #define IBOD_DEFAULT_DIR "/etc/ppp" +#endif #define MAX_STR_LEN 512 #define ISDN_INFO_DEV "/dev/isdninfo" #define ISDN_CTLR_DEV "/dev/isdnctrl" debian/patches/tcpwrappers.patch0000664000000000000000000000245711756742020014226 0ustar Index: ibod-1.5.0/ibod.c =================================================================== --- ibod-1.5.0.orig/ibod.c 2012-05-22 17:26:01.636635249 +0100 +++ ibod-1.5.0/ibod.c 2012-05-22 17:50:24.803659422 +0100 @@ -14,6 +14,10 @@ #include #include #include +#ifdef TCP_WRAPPERS +#include +#include +#endif #include "ibod.h" static int setattr(char *home); @@ -109,9 +113,24 @@ } if (FD_ISSET(s, &readfds)) { - msgsock = accept(s, (struct sockaddr *)0, (int *)0); - if (msgsock == -1) - syslog(LOG_ERR, "accept: %s\n", strerror(errno)); + struct sockaddr_in client; /* Socket protocol descriptor */ + int addrlen = sizeof(client); + + msgsock = accept(s, (struct sockaddr *)&client, &addrlen); + if (msgsock == -1) + syslog(LOG_ERR, "accept: %s\n", strerror(errno)); +#ifdef TCP_WRAPPERS + allow_severity=LOG_INFO; + deny_severity=LOG_WARNING; + + if (hosts_ctl("ibod", "", inet_ntoa(client.sin_addr),"")==0) { + /* Access denied */ + close(msgsock); + msgsock = -1; + syslog(deny_severity, "denied access from: %s\n", + inet_ntoa(client.sin_addr)); + } +#endif } if (msgsock != -1 && FD_ISSET(msgsock, &readfds)) { debian/patches/buildfixes.patch0000664000000000000000000000334311756742053014013 0ustar Index: ibod-1.5.0/ibod.c =================================================================== --- ibod-1.5.0.orig/ibod.c 2012-05-22 17:50:24.803659422 +0100 +++ ibod-1.5.0/ibod.c 2012-05-22 17:51:38.093014784 +0100 @@ -4,13 +4,17 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include +/* ugly hack to compile with 2.6 kernel headers */ +#define __ISDN_FSM_H__ #include #include #include @@ -43,9 +47,9 @@ static int downlimit; -main(int argc, char *argv[]) +int main(int argc, char *argv[]) { - fd_set readfds, writefds, execptfds; + fd_set readfds, /* writefds,*/ execptfds; int s; /* Listening socket descriptor */ struct sockaddr_in server; /* Socket protocol descriptor */ char buf[MAX_MSG_LEN]; Index: ibod-1.5.0/ibod.cf.4 =================================================================== --- ibod-1.5.0.orig/ibod.cf.4 2012-05-22 17:50:24.803659422 +0100 +++ ibod-1.5.0/ibod.cf.4 2012-05-22 17:51:38.093014784 +0100 @@ -106,3 +106,5 @@ Jan Obladen, obladen@datenwelt.net .br Bjoern Smith, Smith@Compound.SE +.br +Paul Martin Index: ibod-1.5.0/ibod.1 =================================================================== --- ibod-1.5.0.orig/ibod.1 2012-05-22 17:51:20.712693370 +0100 +++ ibod-1.5.0/ibod.1 2012-05-22 17:51:50.809249977 +0100 @@ -32,7 +32,7 @@ .B Ibod is also listening on TCP port 6050 for eventual connection from control panel -.Bxibod(1). +.B xibod(1). .SH SIGNALS Upon receiving SIGHUP, the configuration file is re-read. debian/patches/ld-as-needed.patch0000664000000000000000000000137211761111701014061 0ustar Index: ibod-1.5.0/Makefile =================================================================== --- ibod-1.5.0.orig/Makefile 2012-05-23 14:10:04.000000000 +0100 +++ ibod-1.5.0/Makefile 2012-05-29 10:15:39.701985405 +0100 @@ -13,7 +13,7 @@ CC = gcc DEFS = -DTCP_WRAPPERS -DIBOD_DEFAULT_DIR='"/etc/isdn"' CFLAGS+= -Wall -g $(CPPFLAGS) -LDFLAGS+= -lwrap +LIBS+= -lwrap INSTALL = install INSTALL_FILE = $(INSTALL) -p -o root -g root -m 644 INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755 @@ -24,7 +24,7 @@ all: ibod ibod_cf.4 ibod: ibod.c ibod.h Makefile - $(CC) $(CFLAGS) $(LDFLAGS) -o ibod ibod.c $(DEFS) + $(CC) $(CFLAGS) $(LDFLAGS) -o ibod ibod.c $(DEFS) $(LIBS) ibod_cf.4: ibod.cf.4 cp -a ibod.cf.4 ibod_cf.4