grml-btnet-0.04ubuntu1/0000775000000000000000000000000011626734327011737 5ustar grml-btnet-0.04ubuntu1/grml-btnetc.8.txt0000664000000000000000000000216510414016507015053 0ustar GRML-BTNETC(8) ============== Michael Gebetsroither NAME ---- grml-btnetc - program to join a bluetooth network SYNOPSIS -------- *grml-btnetc* [OPTIONS] '' DESCRIPTION ----------- *grml-btnetc* is a program that Provides an easy wrapper around pand and dhclient to quickly join a bluetooth network managed with a dhcp server. ACTIONS ------- *start*:: Trying to find a bluetooth network and join it. *stop*:: Kill the connection to the network. *help*:: Show the help message. OPTIONS ------- *-h, help*:: Show summary of options. *-v*:: Show what is going on (more v => more out). *-p (not implemented jet)*:: The bluetooth pin. EXAMPLES -------- *grml-btnetc -p 1234*:: Trying to search a reachable NAP and connect to it with pin 1234. *grml-btnetc stop*:: Kill the connection to the NAP. SEE ALSO -------- grml-btnet(8), grml-btnets(8), pand(1), hcid(8), hcid.conf(5), hciconfig(8), hcidump(1), sdpd(8), sdptool(1) AUTHOR ------ grml-btnetc was written by Michael Gebetsroither . This manual page was written by Michael Gebetsroither . grml-btnet-0.04ubuntu1/Makefile0000664000000000000000000000327610352314304013367 0ustar install_ = install name = grml-btnet etc = ${DESTDIR}/etc/ usr = ${DESTDIR}/usr usrbin = $(usr)/bin usrsbin = $(usr)/sbin usrshare = $(usr)/share/$(name) usrdoc = $(usr)/share/doc/$(name) man8 = $(usr)/share/man/man8/ %.html : %.txt ; asciidoc -b xhtml11 $^ %.gz : %.txt ; asciidoc -d manpage -b docbook $^ xsltproc /usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl `echo $^ |sed -e 's/.txt/.xml/'` gzip -f --best `echo $^ |sed -e 's/.txt//'` all: doc doc: doc_man doc_html doc_html: $(name).8.html grml-btnets.8.html grml-btnetc.8.html grml-btnet.8.html: grml-btnet.8.txt grml-btnets.8.html: grml-btnets.8.txt grml-btnetc.8.html: grml-btnetc.8.txt doc_man: $(name).8.gz grml-btnets.8.gz grml-btnetc.8.gz grml-btnet.8.gz: grml-btnet.8.txt grml-btnets.8.gz: grml-btnets.8.txt grml-btnetc.8.gz: grml-btnetc.8.txt install: all $(install_) -d -m 755 $(usrdoc) $(install_) -m 644 TODO $(usrdoc) $(install_) -m 644 $(name).8.html $(usrdoc) $(install_) -m 644 grml-btnets.8.html $(usrdoc) $(install_) -m 644 grml-btnetc.8.html $(usrdoc) $(install_) -d -m 755 $(man8) $(install_) -m 644 $(name).8.gz $(man8) $(install_) -m 644 grml-btnets.8.gz $(man8) $(install_) -m 644 grml-btnetc.8.gz $(man8) $(install_) -m 755 -d $(usrsbin) $(install_) -m 755 $(name) $(usrsbin) $(install_) -m 755 grml-btnets $(usrsbin) $(install_) -m 755 grml-btnetc $(usrsbin) $(install_) -m 755 -d $(usrshare) cp -r templates $(usrshare) $(install_) -m 755 -d $(DESTDIR)/var/lib/$(name) clean: rm -rf $(name).8.html $(name).8.xml $(name).8 $(name).8.gz rm -rf grml-btnets.8.html grml-btnets.8.xml grml-btnets.8 grml-btnets.8.gz rm -rf grml-btnetc.8.html grml-btnetc.8.xml grml-btnetc.8 grml-btnetc.8.gz grml-btnet-0.04ubuntu1/TODO0000664000000000000000000000002010346342726012413 0ustar - make it work grml-btnet-0.04ubuntu1/grml-btnet.8.txt0000664000000000000000000000121110364274065014710 0ustar GRML-BTNET(8) ============= Michael Gebetsroither NAME ---- grml-btnet - program to configure ip over bluetooth SYNOPSIS -------- *grml-btnet* [OPTIONS] '' DESCRIPTION ----------- *grml-btnet* is a program to quickly configure IP over bluetooth. ACTIONS ------- *help*:: Show the help message. OPTIONS ------- *-h, help*:: Show summary of options. *-v*:: Show what is going on (more v => more out). SEE ALSO -------- grml-btnets(8), grml-btnetc(8) AUTHOR ------ grml-btnet was written by Michael Gebetsroither . This manual page was written by Michael Gebetsroither . grml-btnet-0.04ubuntu1/grml-btnet0000775000000000000000000000420010411712745013723 0ustar #!/bin/sh # Filename: grml-btnets # Purpose: Program to do something # Authors: grml-team (grml.org), (c) Michael Gebetsroither # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. ################################################################################ ### ### __INCLUDES ### . /etc/grml/sh-lib #. /etc/grml/sysexits-sh ### ### __VARIABLES ### verbose_=0 PIN_FILE_='/etc/bluetooth/pin' # pin for bluetooth server services ### ### __FUNCTIONS ### function printUsage { cat < $PROG_NAME__ is the client config program for ip over bluetooth COMMANDS: help This help text start Start service stop Stop service start OPTIONS: -p The bluetooth pin (not implemented yet) -v verbose (show what is going on, v++) -h this help text EOT } function actionStart { pand -S -E -Q10 echo -n "waiting for connection: " while [ true ]; do pand -l |grep "bnep0" 2>&1 >/dev/null ret_=$? if [ $ret_ == '0' ]; then break fi echo -n '.' sleep 1 done echo "done" dhclient bnep0 } function actionStop { pand -K } ### ### __MAIN ### cat >&2 < grml-btnets client -> grml-btnetc EOT exit 1 while getopts "p:hv" opt; do case "$opt" in p) BTPIN_="${OPTARG}" ;; h) printUsage; exit 0 ;; v) let verbose_=$verbose_+1 ;; ?) printUsage; exit 64 ;; esac done shift $(($OPTIND - 1)) # set ARGV to the first not parsed commandline parameter setVerbose $verbose_ case "$1" in help) printUsage; exit 0 ;; esac checkRoot die "You have to be root to use this program" disableSyslog case "$1" in start) actionStart ;; stop) actionStop ;; "") actionStart ;; *) printUsage; exit 1;; esac exit 0 # END OF FILE ################################################################################ # vim:foldmethod=marker grml-btnet-0.04ubuntu1/debian/0000775000000000000000000000000012006470546013152 5ustar grml-btnet-0.04ubuntu1/debian/conffiles0000664000000000000000000000000010346342556015037 0ustar grml-btnet-0.04ubuntu1/debian/rules0000775000000000000000000000003511626734267014242 0ustar #!/usr/bin/make -f %: dh $@ grml-btnet-0.04ubuntu1/debian/dirs0000664000000000000000000000001110346342556014032 0ustar usr/sbin grml-btnet-0.04ubuntu1/debian/changelog0000664000000000000000000000264212006470546015030 0ustar grml-btnet (0.04ubuntu2) quantal; urgency=low * Switch Depends: to isc-dhcp-server following dhcp3-server to isc-dhcp-server transition. -- Andy Whitcroft Tue, 31 Jul 2012 14:41:20 +0100 grml-btnet (0.04ubuntu1) oneiric; urgency=low * debian/control: change section from 'grml' (non-existent) to 'admin', so the package does not get rejected by Launchpad. (LP: #837024) * .hg*: remove from native package. * debian/rules: use dh7. * debian/control: add ${misc:Depends}, bump debhelper version. * debian/compat: bump compat from deprecated '4'. * debian/copyright: updated FSF address.i -- Daniel Holbach Mon, 29 Aug 2011 18:00:40 +0200 grml-btnet (0.04) unstable; urgency=low * typo corrections -- Michael Gebetsroither Fri, 7 Apr 2006 01:40:40 +0200 grml-btnet (0.03) unstable; urgency=low * fixes for bash (return only from functions or sourced scripts) -- Michael Gebetsroither Mon, 27 Mar 2006 10:36:41 +0200 grml-btnet (0.02) unstable; urgency=low * changed init script bluez-utils to bluetooth * manpage fix in grml-btnet -- Michael Gebetsroither Sat, 21 Jan 2006 00:54:44 +0100 grml-btnet (0.01) unstable; urgency=low * Initial Release. -- Michael Gebetsroither Wed, 20 Dec 2005 21:39:23 +0200 Local variables: mode: debian-changelog End: grml-btnet-0.04ubuntu1/debian/copyright0000664000000000000000000000173311627112713015106 0ustar This is grml-vpn, written and maintained by Michael Gebetsroither on Sun, 20 Mar 2005 19:39:26 +0100. Copyright (C) 2003 Michael Gebetsroither 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 2 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 package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. On Debian systems, the complete text of the GNU General Public License can be found in `/usr/share/common-licenses/GPL'. grml-btnet-0.04ubuntu1/debian/compat0000664000000000000000000000000211626734236014356 0ustar 7 grml-btnet-0.04ubuntu1/debian/source/0000775000000000000000000000000011627112602014444 5ustar grml-btnet-0.04ubuntu1/debian/source/format0000664000000000000000000000001511627112602015653 0ustar 3.0 (native) grml-btnet-0.04ubuntu1/debian/control0000664000000000000000000000104112006470546014551 0ustar Source: grml-btnet Section: admin Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Michael Gebetsroither Build-Depends: debhelper (>= 4.0.0), xsltproc, docbook-xsl, asciidoc Standards-Version: 3.9.2 Package: grml-btnet Architecture: all Depends: grml-shlib (>=1.02.06), isc-dhcp-server, ipcalc, bluez-utils, bridge-utils, iptables, ${misc:Depends} Description: Programs to quickly build a bluetooth network Just start grml-btnet and choose what you want to do. grml-btnet-0.04ubuntu1/templates/0000775000000000000000000000000010412330657013723 5ustar grml-btnet-0.04ubuntu1/templates/dhcpd_config0000664000000000000000000000225310352133266016257 0ustar #!/bin/sh i like colors :) # # the following variables are available in the template: # # $INTERFACE_ (interface for the gateway) # $SERVER_IP_ (ip for the dhcpd) # $NETMASK_ (network mask) # $NAMESERVERS_ (nameservers for the nodes) # $IPRANGE_FROM_ (user configured iprange, first ip) # $IPRANGE_TO_ (user configured iprange, last ip) # $NETWORK_ (first ip in this subnet) # # NOTE: # templates are shellscript fragments and will be sourced from grml-btnet # # GLOBAL_README_END # # this is the template to create the config file for the dhcpd server # date_=`execute date warn` local T_dhcpd_config_nameserver_="`echo $NAMESERVERS_| tr -s ' ' |tr ' ' ','`" cat >"$DHCPD_CONFIG_FILE_" < # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. ################################################################################ ### ### __INCLUDES ### . /etc/grml/sh-lib #. /etc/grml/sysexits-sh ### ### __VARIABLES ### verbose_=0 PIN_FILE_='/etc/bluetooth/pin' # pin for bluetooth server services ### ### __FUNCTIONS ### function printUsage { cat < $PROG_NAME__ is the client config program for ip over bluetooth COMMANDS: help This help text start Start service stop Stop service start OPTIONS: -p The bluetooth pin (not implemented yet) -v verbose (show what is going on, v++) -h this help text EOT } function actionStart { pand -S -E -Q10 while [ true ]; do pand -l |grep "bnep0" 2>&1 >/dev/null ret_=$? if [[ $ret_ == '0' ]]; then break fi echo -n '.' sleep 1 done echo "connected" dhclient bnep0 } function actionStop { pand -K } ### ### __MAIN ### while getopts "p:hv" opt; do case "$opt" in p) BTPIN_="${OPTARG}" ;; h) printUsage; exit 0 ;; v) let verbose_=$verbose_+1 ;; ?) printUsage; exit 64 ;; esac done shift $(($OPTIND - 1)) # set ARGV to the first not parsed commandline parameter setVerbose $verbose_ case "$1" in help) printUsage; exit 0 ;; esac checkRoot die "You have to be root to use this program" disableSyslog case "$1" in start) actionStart ;; stop) actionStop ;; "") actionStart ;; *) printUsage; exit 1;; esac exit 0 # END OF FILE ################################################################################ # vim:foldmethod=marker grml-btnet-0.04ubuntu1/grml-btnets.8.txt0000664000000000000000000000457010414016477015103 0ustar GRML-BTNETS(8) ============= Michael Gebetsroither NAME ---- grml-btnets - program to setup a bluetooth network access point (NAP) SYNOPSIS -------- *grml-btnets* [OPTIONS] '' DESCRIPTION ----------- *grml-btnets* is a program that provides an easy wrapper around all the programms to create a ready to run network access point for bluetooth and additionally setup internet forwarding. If no pin is given for the bluetooth network, a random pin will be choosen. ACTIONS ------- *start*:: Start the network access point *stop*:: Stop the network access point *help*:: Show the help message. OPTIONS ------- *-h, help*:: Show summary of options. *-v*:: Show what is going on (more v => more out). *-s [subnet] (default=192.168.10.0/24)*:: The subnet for the bluetooth clients. There should be at least 8 IPs in this subnet (/28). *-i [interface] (default=eth0)*:: Enable IP-Forwarding for this interface, so that the bluetooth-network could, for example, connect to the internet. The nameservers come from your /etc/resolv.conf, so be aware to configure this before you run grml-btnets. Grml-btnets does not touch the ip_forward and iptables config without this option! Do not use this option if you already have a working internet gateway on your box. Grml-btnets assumes that the chain policy of forward is on accept. If this is not the case please let packages from interface grmlbtnet pass. *-p *:: The bluetooth pin. If no or an empty pin is given, a random one will be choosen and printed to stdout. EXAMPLES -------- *grml-btnets -p 1234 start*:: This creates a simple bluetooth access point (NAP) with default values. The subnet for the bluetooth network is 192.168.10.0/24. There will be no masquerading. *grml-btnets stop*:: Stops the NAP created with the command above. *grml-btnets -s 192.168.1.0 -i ppp0 start*:: This creates a NAP and the bluetooth clients get IPs within 192.168.1.0/24. This also creates masquerading out of ppp0 to let bluetooth clients onto the internet. *grml-btnets -i ppp0 stop*:: This command stops the NAP created with the commando above. SEE ALSO -------- grml-btnet(8), grml-btnetc(8), pand(1), hcid(8), hcid.conf(5), hciconfig(8), hcidump(1), sdpd(8), sdptool(1) AUTHOR ------ grml-btnets was written by Michael Gebetsroither . This manual page was written by Michael Gebetsroither . grml-btnet-0.04ubuntu1/grml-btnets0000775000000000000000000001315610414016434014113 0ustar #!/bin/sh # Filename: grml-btnets # Purpose: Program to do something # Authors: grml-team (grml.org), (c) Michael Gebetsroither # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. ################################################################################ ### ### __INCLUDES ### . /etc/grml/sh-lib #. /etc/grml/sysexits-sh ### ### __VARIABLES ### verbose_=0 TEMPLATE_CONFIG_DIR_='/usr/share/grml-btnet/templates' DHCPD_TEMPLATE_FILE_='/usr/share/grml-btnet/templates/dhcpd_config' DHCPD_CONFIG_FILE_='/var/lib/grml-btnet/dhcpd.conf' BTPIN_="" # pin for bluetooth PIN_FILE_='/etc/bluetooth/pin' # pin for bluetooth server services DEV_UP_DIR_='/etc/bluetooth/pan' DEV_UP_SCRIPT_="$DEV_UP_DIR_/dev-up" # will be executed if an interface comes up BR_IFACE_='grmlbtnet' # default bridge interface ENABLE_IPFORW_='false' # should ip-forward be enabled (default eth0) FORWARD_IFACE_='eth0' # gate to the internet NETWORK_="192.168.10.0" # the network SERVER_IP_="" # the ip of the computer running grml-btnets (the first ip in the subnet) # typically 192.168.10.1 NETMASK_="255.255.255.0" # the netmask, currently fixed at /24 IPRANGE_FROM_='' # host-min IPRANGE_TO_='' # host-max NAMESERVERS_='' # the nameserver(s) ### ### __FUNCTIONS ### function printUsage { cat < $PROG_NAME__ is the server config program for ip over bluetooth COMMANDS: help This help text start Start service stop Stop service start OPTIONS: -s [subnet] An empty subnet with netmask 255.255.255.0 (default=192.168.10.0/24) -i [iface] Enable ip-forwarding for this interface (default=eth0) -p The bluetooth pin -v verbose (show what is going on, v++) -h this help text EOT } function calcNetworkParams { IPRANGE_FROM_=`execute "ipcalc -nb $NETWORK_/$NETMASK_" warn |awk '/HostMin/{print $2}'` IPRANGE_TO_=`execute "ipcalc -nb $NETWORK_/$NETMASK_" warn |awk '/HostMax/{print $2}'` NETWORK_=`execute "ipcalc -nb $NETWORK_/$NETMASK_" warn |awk '/Network:/{print $2}'` NETWORK_=${NETWORK_%/*} SERVER_IP_="$IPRANGE_FROM_" NAMESERVERS_="`netGetNameservers warn |tr ' ' ','`" NAMESERVERS_="${NAMESERVERS_:-SERVER_IP_}" notice "IPRANGE_FROM_ = $IPRANGE_FROM_" notice "IPRANGE_TO_ = $IPRANGE_TO_" notice "NETWORK_ = $NETWORK_" notice "SERVER_IP_ = $SERVER_IP_" notice "NAMESERVERS_ = $NAMESERVERS_" } function createDevUpScript { mkdir -p $DEV_UP_DIR_ cat > $DEV_UP_SCRIPT_ < "$PIN_FILE_" } function unsetPin { echo -n "" > "$PIN_FILE_" } function startIpForw { echo 1 > /proc/sys/net/ipv4/ip_forward iptables -t nat -A POSTROUTING -o $FORWARD_IFACE_ -j MASQUERADE } function stopIpForw { echo 0 > /proc/sys/net/ipv4/ip_forward iptables -t nat -D POSTROUTING -o $FORWARD_IFACE_ -j MASQUERADE } function startDhcpd { execute "source $DHCPD_TEMPLATE_FILE_" warn || \ warn "Problems creating dhcpd config from \"$DHCPD_TEMPLATE_FILE_\"" dhcpd3 -cf $DHCPD_CONFIG_FILE_ $BR_IFACE_ || warn "Problems starting dhcpd3 server" } function stopDhcpd { local pid_="`ps aux |grep \"dhcpd3 .*$DHCPD_CONFIG_FILE_\" |grep -v \"grep dhcpd3 .*$DHCPD_CONFIG_FILE_\" |tr -s ' ' |awk '{print $2}'`" if [[ $pid_ == "" ]]; then warn "Could not find the dhcp server" return 1 fi notice "killing \"$pid_\" (self=$$)" kill "$pid_" &>/dev/null sleep 1 kill -9 "$pid_" &>/dev/null } function actionStart { if [[ $BTPIN_ == "" ]]; then BTPIN_=$RANDOM warn "You don't gave me a pin, pin is: $BTPIN_" fi calcNetworkParams execute "brctl addbr $BR_IFACE_" || die "bridge grml-btnet already exists" execute "brctl stp $BR_IFACE_ off" execute "brctl sethello $BR_IFACE_ 0" execute "brctl setfd $BR_IFACE_ 0" execute "ifconfig $BR_IFACE_ $SERVER_IP_ netmask $NETMASK_ up" setPin "$BTPIN_" /etc/init.d/bluetooth start createDevUpScript pand -s --autozap --persist -r NAP startDhcpd $ENABLE_IPFORW_ && startIpForw } function actionStop { pand -K killall pand &>/dev/null stopDhcpd killall -9 pand &>/dev/null /etc/init.d/bluetooth stop removeDevUpScript unsetPin ifconfig $BR_IFACE_ down brctl delbr $BR_IFACE_ $ENABLE_IPFORW_ && stopIpForw echo "Stopped grml-btnets" >&2 } ### ### __MAIN ### while getopts "s:i:p:hv" opt; do case "$opt" in s) NETWORK_="${OPTARG:-$NETWORK_}" ;; i) ENABLE_IPFORW_='true' FORWARD_IFACE_="${OPTARG:-$FORWARD_IFACE_}" ;; p) BTPIN_="${OPTARG:-$RANDOM}" ;; h) printUsage; exit 0 ;; v) let verbose_=$verbose_+1 ;; ?) printUsage; exit 64 ;; esac done shift $(($OPTIND - 1)) # set ARGV to the first not parsed commandline parameter setVerbose $verbose_ case "$1" in help) printUsage; exit 0 ;; esac checkRoot die "You have to be root to use this program" disableSyslog case "$1" in start) actionStart ;; stop) actionStop ;; "") actionStart ;; *) printUsage; exit 1;; esac exit 0 # END OF FILE ################################################################################ # vim:foldmethod=marker