From: Michael Tremer Date: Sat, 6 Dec 2014 19:18:37 +0000 (+0100) Subject: Remove support for ISDN X-Git-Tag: 007~65 X-Git-Url: http://git.ipfire.org/?p=people%2Fms%2Fnetwork.git;a=commitdiff_plain;h=0608337a9ea0c318a331857cf6fdfeaf81784b79 Remove support for ISDN ISDN has never been deployed very much in the world except Germany and some other countries. Most of them went away from ISDN to VoIP for telephony and DSL or fibre for data connections. The bandwidth is very small with only 64k per channel and this has only been implemented for backup purposes if the primary connection cut off. Nowadays there is mobile connections with much more bandwidth available for this. Nobody is able (due to lack of ISDN) and willing to support this any more. Hence the entire support for ISDN is removed. --- diff --git a/Makefile.am b/Makefile.am index 36458829..9ba352f5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -125,7 +125,6 @@ dist_network_SCRIPTS = \ src/functions/functions.ip-tunnel \ src/functions/functions.ipv4 \ src/functions/functions.ipv6 \ - src/functions/functions.isdn \ src/functions/functions.list \ src/functions/functions.lock \ src/functions/functions.logging \ @@ -199,8 +198,6 @@ dist_hooks_zones_SCRIPTS = \ src/hooks/zones/6to4-tunnel \ src/hooks/zones/aiccu \ src/hooks/zones/bridge \ - src/hooks/zones/isdn \ - src/hooks/zones/isdn-server \ src/hooks/zones/modem \ src/hooks/zones/pppoe \ src/hooks/zones/pptp \ diff --git a/src/functions/functions.isdn b/src/functions/functions.isdn deleted file mode 100644 index 8d9a710c..00000000 --- a/src/functions/functions.isdn +++ /dev/null @@ -1,519 +0,0 @@ -#!/bin/bash -############################################################################### -# # -# IPFire.org - A linux based firewall # -# Copyright (C) 2011 Michael Tremer & Christian Schmidt # -# # -# 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 . # -# # -############################################################################### - -function isdn_config_dir() { - local device=${1} - local dir="${RUN_DIR}/isdn/${device}" - - [ -d "${dir}" ] || mkdir -p ${dir} - - echo "${dir}" -} - -function isdn_create_device() { - local device=${1} - - if device_exists ${device}; then - return ${EXIT_OK} - fi - - log INFO "Creating ISDN interface ${device}." - isdnctrl addif ${device} >/dev/null -} - -function isdn_remove_device() { - local device=${1} - - if ! device_exists ${device}; then - return ${EXIT_OK} - fi - - log INFO "Removing ISDN interface ${device}." - isdnctrl delif ${device} >/dev/null -} - -function isdn_add_slave() { - local device=${1} - local slave=${2} - - assert device_exists ${device} - assert isset slave - - log INFO "Creating ISDN slave interface ${slave} for device ${device}." - isdnctrl addslave ${device} ${slave} - local ret=$? - - case "${ret}" in - 0) - return ${EXIT_OK} - ;; - 255) - log ERROR "Could not create slave device for ${device}." - ;; - esac - - return ${EXIT_ERROR} -} - -function isdn_rem_slave() { - local device=${1} - local slave=${2} - - assert device_exists ${device} - assert isset slave - - log INFO "Removing ISDN slave interface ${slave}." - isdnctrl delslave ${device} ${slave} >/dev/null -} - -function isdn_addlink() { - local device=${1} - - assert device_exists ${device} - - log INFO "Adding link to ISDN interface ${device}." - isdnctrl addlink ${device} >/dev/null -} - -function isdn_get_encap() { - local device=${1} - - assert device_exists ${device} - - isdnctrl encap ${device} | awk '{ print $NF }' -} - -function isdn_set_encap() { - local device=${1} - local encap=${2} - - assert device_exists ${device} - assert isset encap - - case "${encap}" in - syncppp) ;; - *) - log ERROR "Cannot set unknown encapsulation: ${encap}" - return ${EXIT_ERROR} - ;; - esac - - isdnctrl encap ${device} ${encap} >/dev/null -} - -function isdn_get_l2proto() { - local device=${1} - - assert device_exists ${device} - - isdnctrl l2_prot ${device} | awk '{ print $NF }' -} - -function isdn_set_l2proto() { - local device=${1} - local proto=${2} - - assert device_exists ${device} - assert isset proto - - case "${proto}" in - hdlc) ;; - *) - log ERROR "Cannot set unknown l2 proto: ${proto}" - return ${EXIT_ERROR} - ;; - esac - - isdnctrl l2_prot ${device} ${proto} >/dev/null -} - -function isdn_get_l3proto() { - local device=${1} - - assert device_exists ${device} - - isdnctrl l3_prot ${device} | awk '{ print $NF }' -} - -function isdn_set_l3proto() { - local device=${1} - local proto=${2} - - assert device_exists ${device} - assert isset proto - - case "${proto}" in - trans) ;; - *) - log ERROR "Cannot set unknown l3 proto: ${proto}" - return ${EXIT_ERROR} - ;; - esac - - isdnctrl l3_prot ${device} ${proto} >/dev/null -} - -function isdn_set_dialmax() { - local device=${1} - local dialmax=${2} - - assert device_exists ${device} - assert [ ${dialmax} -gt 0 ] - - isdnctrl dialmax ${device} ${dialmax} >/dev/null -} - -function isdn_set_eaz() { - local device=${1} - local eaz=${2} - - assert device_exists ${device} - assert isset eaz - - isdnctrl eaz ${device} ${eaz} >/dev/null -} - -function isdn_set_dialmode() { - local device=${1} - local mode=${2} - - assert device_exists ${device} - - case "${proto}" in - auto) ;; - *) - log ERROR "Cannot set unknown dialmode: ${mode}" - return ${EXIT_ERROR} - ;; - esac - - isdnctrl dialmode ${device} ${mode} >/dev/null -} - -function isdn_set_huptimeout() { - local device=${1} - local timeout=${2} - - assert device_exists ${device} - assert isinteger timeout - - isdnctrl huptimeout ${device} ${mode} >/dev/null -} - -function isdn_addphone() { - local device=${1} - local type=${2} - local number=${3} - - assert device_exists ${device} - assert isoneof type in out - assert isset number - - isdnctrl addphone ${device} ${type} ${number} >/dev/null -} - -function isdn_dial() { - local device=${1} - shift - - assert device_exists ${device} - - local mode="persistent" - local channels="auto" - local ipppd_args - - while [ $# -gt 0 ]; do - case "${1}" in - --mode=*) - mode=${1#--mode=} - ;; - --channels=*) - channels=${1#--channels=} - ;; - *) - ipppd_args="${ipppd_args} ${1}" - ;; - esac - shift - done - - assert isset channels - assert isset mode - assert isoneof channels 1 2 auto - - # Start ippp daemon. - ipppd_start ${ipppd_args} - - case "${mode}" in - dialondemand) - isdn_set_dialmode ${device} auto - ;; - persistent) - case "${channels}" in - auto) - ibod_start ${device} - ;; - 1) - # Do nothing. - ;; - 2) - isdn_addlink ${device} - ;; - esac - - # Establish the connection immediately. - isdnctrl dial ${device} >/dev/null - ;; - *) - log ERROR "Unknown dial mode given: ${mode}." - return ${EXIT_ERROR} - ;; - esac -} - -function isdn_hangup() { - local device=${1} - - assert device_exists ${device} - - # Bring isdn device down. - ip link set ${device} down - - # Kill ippp daemon. - ipppd_stop ${device} -} - -function ipppd_start() { - local device=${1} - shift - - assert device_exists ${device} - - ipppd_write_config ${device} $@ - - # Actually run the service. - service_start "ipppd@${device}.service" -} - -function ipppd_write_config() { - local device=${1} - shift - - local value - local auth="chap" - local user - local mppe="on" - local mtu="1500" - local proxyarp="on" - local local_address - local remote_address - local netmask - local dns_servers - - # mode tells us if we are running in server or - # client mode. The collection of variables to - # be set depends on this. - local mode="client" - - while [ $# -gt 0 ]; do - case "${1}" in - --mode=*) - mode=${1#--mode=} - ;; - --auth=*) - auth=${1#--auth=} - ;; - --user=*) - user=${1#--user=} - ;; - --mppe=*) - mppe=${1#--mppe=} - ;; - --mtu=*) - mtu=${1#--mtu=} - ;; - --proxyarp=*) - value=${1#--proxyarp=} - if enabled value; then - proxyarp="on" - else - proxyarp="off" - fi - ;; - --netmask=*) - netmask=${1#--netmask=} - ;; - --local-address=*) - local_address=${1#--local-address=} - ;; - --remote-address=*) - remote_address=${1#--remote-address=} - ;; - --dns-server=*) - value=${1#--dns-server=} - # XXX check if this is actually an IP address - - dns_servers="${dns_servers} ${value}" - ;; - *) - log WARN "Unknown argument given: ${1}" - ;; - esac - shift - done - - # Check if all common variables are correctly set. - assert isset mtu - assert isinteger mtu - - case "${mode}" in - client) - # Check if all variables for client mode are set. - assert isset auth - assert isset user - ;; - server) - assert isset local_address - assert isset remote_address - assert isset netmask - ;; - *) - log CRITICAL "Invalid mode given: ${mode}" - exit ${EXIT_ERROR} - ;; - esac - - # Make a configuration file. - local config="$(isdn_config_dir ${device})/config" - - cat >${config} <>${config} <>${config} < ${config} - - # Set the device to watch. - echo "DEVICE ${device}" >> ${config} - - # We could set some more options here to - # configure when ibod is bringing the second - # channel up and down. I guess that is not - # required at the moment. - # See man ibod.cf. -} - -function ibod_stop() { - local device=${1} - - log INFO "Stopping ibod on device ${device}..." - service_stop "ibod@${device}.service" - - # Remove ibod configuration file. - rm -f $(ibod_config_file ${device}) -} diff --git a/src/hooks/zones/isdn b/src/hooks/zones/isdn deleted file mode 100644 index 37f337bb..00000000 --- a/src/hooks/zones/isdn +++ /dev/null @@ -1,205 +0,0 @@ -#!/bin/bash -############################################################################### -# # -# IPFire.org - A linux based firewall # -# Copyright (C) 2010 Michael Tremer & Christian Schmidt # -# # -# 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 . # -# # -############################################################################### - -. /usr/lib/network/header-zone - -HOOK_SETTINGS="HOOK AUTH LINKNAME USER SECRET PEERDNS DEFAULTROUTE MSN MTU" -HOOK_SETTINGS="${HOOK_SETTINGS} L2PROTO L3PROTO ENCAP PHONE" - -AUTH= -CHANNELS="auto" -DEFAULTROUTE=1 -ENCAP="syncppp" -L2PROTO="hdlc" -L3PROTO="trans" -LINKNAME="$(uuid)" -MSN= -MTU=1500 -PEERDNS=1 -TIMEOUT=10 -SECRET= -USER= -PHONE= - -MODE="persistent" - -ISDN_ALLOWED_AUTHS="chap pap" - -function hook_check() { - assert isset USER - assert isset SECRET - assert isset LINKNAME - assert isset DEFAULTROUTE - assert isset PEERDNS - assert isset TIMEOUT - assert isset PHONE - - assert isbool DEFAULTROUTE - assert isbool PEERDNS - assert isinteger MSN - assert isinteger TIMEOUT - - isset AUTH && assert isoneof AUTH ${ISDN_ALLOWED_AUTHS} -} - -function hook_parse_cmdline() { - local value - - while [ $# -gt 0 ]; do - case "$1" in - --user=*) - USER=${1#--user=} - ;; - --secret=*) - SECRET=${1#--secret=} - ;; - --linkname=*) - LINKNAME=${1#--name=} - ;; - --mtu=*) - MTU=${1#--mtu=} - ;; - --defaultroute=*) - value=${1#--defaultroute=} - if enabled value; then - DEFAULTROUTE=1 - else - DEFAULTROUTE=0 - fi - ;; - --dns=*) - value=${1#--dns=} - if enabled value; then - PEERDNS=1 - else - PEERDNS=0 - fi - ;; - --auth=*) - AUTH=${1#--auth=} - ;; - --device=*) - DEVICE=${1#--device=} - ;; - --msn=*) - MSN=${1#--msn=} - ;; - --timeout=*) - TIMEOUT=${1#--timeout=} - ;; - --phone=*) - PHONE="${PHONE} ${1#--phone=}" - ;; - *) - echo "Unknown option: $1" >&2 - exit ${EXIT_ERROR} - ;; - esac - shift - done -} - -function hook_up() { - local zone=${1} - shift - - assert isset zone - - zone_settings_read "${zone}" ${HOOK_SETTINGS} - - assert [ -e "/dev/${DEVICE}" ] - - # Creating necessary files - # XXX must be PPP_RUN - [ -d "${RED_RUN}/${LINKNAME}" ] || mkdir -p ${RED_RUN}/${LINKNAME} - - # Create device node. - isdn_create_device ${zone} - - # Apply configuration to the ISDN stack. - isdn_set_l2proto ${zone} ${L2PROTO} - isdn_set_l3proto ${zone} ${L3PROTO} - isdn_set_encap ${zone} ${ENCAP} - - isdn_set_eaz ${zone} ${MSN} - isdn_set_huptimeout ${zone} $(( ${TIMEOUT} * 60 )) - isdn_addphone ${zone} out ${PHONE} - - # Updating PPP credentials. - ppp_secret "${USER}" "${SECRET}" - - # Bring up connection. - isdn_dial ${zone} \ - --mode=${MODE} \ - --channels=${CHANNELS} \ - --user=${USER} \ - --mtu=${MTU} - - exit ${EXIT_OK} -} - -function hook_down() { - local zone=${1} - shift - - # Bring down ISDN interface. - isdn_hangup ${zone} - - # Remove ISDN device. - isdn_remove_device ${zone} - - exit ${EXIT_OK} -} - -function hook_status() { - local zone=${1} - assert isset zone - - cli_device_headline ${zone} - - zone_settings_read "${zone}" ${HOOK_SETTINGS} - - cli_headline 2 "Configuration:" - cli_print_fmt1 2 "User" "${USER}" - cli_print_fmt1 2 "Secret" "" - cli_space - - if device_exists ${zone}; then - cli_headline 3 "ISDN information:" - cli_print_fmt1 3 "L2 protocol" "$(isdn_get_l2proto ${zone})" - cli_print_fmt1 3 "L3 protocol" "$(isdn_get_l3proto ${zone})" - cli_print_fmt1 3 "Encapsulation" "$(isdn_get_encap ${zone})" - cli_space - fi - - # Exit if zone is down - zone_is_up ${zone} || exit ${EXIT_ERROR} - - # XXX display time since connection started - - cli_headline 2 "Point-to-Point protocol" - cli_print_fmt1 2 "IP address" "$(routing_db_get ${zone} local-ip-address)" - cli_print_fmt1 2 "Gateway" "$(routing_db_get ${zone} remote-ip-address)" - cli_print_fmt1 2 "DNS servers" "$(routing_db_get ${zone} dns)" - cli_space - - exit ${EXIT_OK} -} diff --git a/src/hooks/zones/isdn-server b/src/hooks/zones/isdn-server deleted file mode 100644 index 9c2adcd0..00000000 --- a/src/hooks/zones/isdn-server +++ /dev/null @@ -1,231 +0,0 @@ -#!/bin/bash -############################################################################### -# # -# IPFire.org - A linux based firewall # -# Copyright (C) 2010 Michael Tremer & Christian Schmidt # -# # -# 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 . # -# # -############################################################################### - -. /usr/lib/network/header-zone - -HOOK_SETTINGS="HOOK LOCAL_ADDRESS REMOTE_ADDRESS MSN MTU MRU" -HOOK_SETTINGS="${HOOK_SETTINGS} L2PROTO L3PROTO ENCAP" - -# The peer address of the ISDN server. -LOCAL_ADDRESS= -REMOTE_ADDRESS= - -AUTH= -ENCAP="syncppp" -L2PROTO="hdlc" -L3PROTO="trans" -LINKNAME="$(uuid)" -MSN= -MTU=1500 -TIMEOUT=10 - -MODE="persistent" - -function hook_check() { - assert isset LOCAL_ADDRESS - assert isset REMOTE_ADDRESS - - assert isset LINKNAME - assert isset TIMEOUT - - assert isinteger MSN - assert isinteger TIMEOUT - - isset AUTH && assert isoneof AUTH ${ISDN_ALLOWED_AUTHS} -} - -function hook_parse_cmdline() { - local value - - while [ $# -gt 0 ]; do - case "$1" in - --local-address=*) - LOCAL_ADDRESS=${1#--local-address=} - ;; - --remote-address=*) - REMOTE_ADDRESS=${1#--remote-address=} - ;; - --subnet=*) - SUBNET=${1#--subnet=} - ;; - --linkname=*) - LINKNAME=${1#--name=} - ;; - --mtu=*) - MTU=${1#--mtu=} - ;; - --defaultroute=*) - value=${1#--defaultroute=} - if enabled value; then - DEFAULTROUTE=1 - else - DEFAULTROUTE=0 - fi - ;; - --dns=*) - value=${1#--dns=} - if enabled value; then - PEERDNS=1 - else - PEERDNS=0 - fi - ;; - --auth=*) - AUTH=${1#--auth=} - ;; - --device=*) - DEVICE=${1#--device=} - ;; - --msn=*) - MSN=${1#--msn=} - ;; - --timeout=*) - TIMEOUT=${1#--timeout=} - ;; - --phone=*) - PHONE="${PHONE} ${1#--phone=}" - ;; - *) - echo "Unknown option: $1" >&2 - exit ${EXIT_ERROR} - ;; - esac - shift - done -} - -function hook_up() { - local zone=${1} - shift - - assert isset zone - - zone_settings_read "${zone}" ${HOOK_SETTINGS} - - assert [ -e "/dev/${DEVICE}" ] - - # Creating necessary files - # XXX must be PPP_RUN - [ -d "${RED_RUN}/${LINKNAME}" ] || mkdir -p ${RED_RUN}/${LINKNAME} - - # Create device node. - isdn_create_device ${zone} - - # Apply configuration to the ISDN stack. - isdn_set_l2proto ${zone} ${L2PROTO} - isdn_set_l3proto ${zone} ${L3PROTO} - isdn_set_encap ${zone} ${ENCAP} - - isdn_set_eaz ${zone} ${MSN} - isdn_set_huptimeout ${zone} $(( ${TIMEOUT} * 60 )) - - # Set our ip address. - ip_address_add ${zone} ${LOCAL_ADDRESS} - device_set_up ${zone} - - # Start ipppd in server mode and make it listening for - # incoming connections: - local options - - # Get a list of all DNS servers. - local dns_server - for dns_server in ${dns_servers}; do - options="${options} --dns-server=${dns_server}" - done - - # Convert netmask. - local prefix=$(ip_get_prefix ${LOCAL_ADDRESS}) - local netmask=$(ipv4_prefix2netmask ${prefix}) - - # Split prefix from LOCAL_ADDRESS. - local local_address=$(ip_split_prefix ${LOCAL_ADDRESS}) - - ipppd_start ${zone} \ - --mode="server" \ - --local-address="${local_address}" \ - --remote-address="${REMOTE_ADDRESS}" \ - --netmask="${netmask}" \ - --mtu=${MTU} \ - ${options} - - exit ${EXIT_OK} -} - -function hook_down() { - local zone=${1} - shift - - # Kill ipppd service. - ipppd_stop ${zone} - - # Bring down ISDN interface. - device_set_down ${zone} - - # Remove ISDN device. - isdn_remove_device ${zone} - - exit ${EXIT_OK} -} - -function hook_status() { - local zone=${1} - assert isset zone - - cli_device_headline ${zone} - - zone_settings_read "${zone}" ${HOOK_SETTINGS} - - cli_headline " Configuration:" - printf "${DEVICE_PRINT_LINE1}" "User:" "${USER}" - printf "${DEVICE_PRINT_LINE1}" "Secret:" "" - echo - printf "${DEVICE_PRINT_LINE1}" "MTU:" "${MTU}" - printf "${DEVICE_PRINT_LINE1}" "Use default route?" "$(enabled DEFAULTROUTE && echo "enabled" || echo "disabled")" - printf "${DEVICE_PRINT_LINE1}" "Use peer DNS?" "$(enabled PEERDNS && echo "enabled" || echo "disabled")" - echo - - if device_exists ${zone}; then - cli_headline " ISDN information:" - printf "${DEVICE_PRINT_LINE1}" "L2 protocol:" "$(isdn_get_l2proto ${zone})" - printf "${DEVICE_PRINT_LINE1}" "L3 protocol:" "$(isdn_get_l3proto ${zone})" - printf "${DEVICE_PRINT_LINE1}" "Encapsulation:" "$(isdn_get_encap ${zone})" - echo - fi - - # Exit if zone is down - if ! zone_is_up ${zone}; then - echo # Empty line - exit ${EXIT_ERROR} - fi - - # XXX display time since connection started - - cli_headline " Point-to-Point-over-Ethernet protocol:" - echo " IP-Address : $(routing_db_get ${zone} local-ip-address)" - echo " Gateway : $(routing_db_get ${zone} remote-ip-address)" - echo " DNS-Server : $(routing_db_get ${zone} dns)" - echo - echo " MAC-Remote : $(routing_db_get ${zone} remote-address)" - echo - echo " MTU : $(device_get_mtu ${zone})" - echo # Empty line - exit ${EXIT_OK} -}