mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-02-18 02:01:16 +01:00
layer2interface: removed; its content is moved to Broadcom target
This commit is contained in:
parent
35aa491288
commit
722b97d207
14 changed files with 0 additions and 1064 deletions
|
|
@ -1,42 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2013 Inteno
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=layer2interface
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/layer2interface
|
||||
CATEGORY:=Base system
|
||||
TITLE:=Tools for setting up layer2 interfaces
|
||||
endef
|
||||
|
||||
define Package/layer2interface/description
|
||||
layer2interface contains necessary tools to create
|
||||
layer2 interfaces
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./broadcom/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_mips),y)
|
||||
define Package/layer2interface/install
|
||||
$(CP) ./broadcom/* $(1)/
|
||||
endef
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
||||
define Package/layer2interface/install
|
||||
$(CP) ./broadcom/* $(1)/
|
||||
endef
|
||||
endif
|
||||
|
||||
$(eval $(call BuildPackage,layer2interface))
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
# DSL Modes
|
||||
config dsl-line line
|
||||
list mode gdmt
|
||||
list mode glite
|
||||
list mode t1413
|
||||
list mode adsl2
|
||||
list mode adsl2p
|
||||
list mode annexl
|
||||
list mode annexm
|
||||
list mode vdsl2
|
||||
list mode gfast
|
||||
list profile 8a
|
||||
list profile 8b
|
||||
list profile 8c
|
||||
list profile 8d
|
||||
list profile 12a
|
||||
list profile 12b
|
||||
list profile 17a
|
||||
list profile 30a
|
||||
list profile 35b
|
||||
option bitswap 1
|
||||
option sra 1
|
||||
option trellis
|
||||
option sesdrop
|
||||
# VDSL2 only
|
||||
option us0
|
||||
option dynamicd
|
||||
option dynamicf
|
||||
option sos
|
||||
|
||||
config atm-device atm0
|
||||
option name 'ATM'
|
||||
option vpi '8'
|
||||
option vci '35'
|
||||
option device atm0
|
||||
option link_type 'eoa' # EoA, IPoA, PPPoA, CIP
|
||||
option encapsulation 'llc' # llc, vcmux
|
||||
option qos_class 'ubr' # ubr, cbr, gfr, vbr-nrt, vbr-rt, ubr+, abr
|
||||
# option pcr '512'
|
||||
# option scr '256'
|
||||
# option mbs '1024'
|
||||
|
||||
config ptm-device ptm0
|
||||
option name 'PTM'
|
||||
option device 'ptm0'
|
||||
option priority '1'
|
||||
option portid '1'
|
||||
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
config dsltype 'vdsl'
|
||||
option 'enabled' 'on'
|
||||
|
||||
config dsltype 'adsl'
|
||||
option 'enabled' 'on'
|
||||
|
||||
config dslsettings 'capabilities'
|
||||
option 'GDmt' 'Enabled'
|
||||
option 'Glite' 'Enabled'
|
||||
option 'T1413' 'Enabled'
|
||||
option 'ADSL2' 'Enabled'
|
||||
option 'AnnexL' 'Enabled'
|
||||
option 'ADSL2plus' 'Enabled'
|
||||
option 'VDSL2' 'Enabled'
|
||||
option '8a' 'Enabled'
|
||||
option '8b' 'Enabled'
|
||||
option '8c' 'Enabled'
|
||||
option '8d' 'Enabled'
|
||||
option '12a' 'Enabled'
|
||||
option '12b' 'Enabled'
|
||||
option '17a' 'Enabled'
|
||||
option '30a' 'Enabled'
|
||||
option 'US0' 'on'
|
||||
option 'bitswap' 'on'
|
||||
option 'sra' 'on'
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
config atm_bridge
|
||||
option 'link_type' 'EoA'
|
||||
option 'encapseoa' 'llcsnap_eth'
|
||||
option 'unit' '0'
|
||||
option 'ifname' 'atm0.1'
|
||||
option 'baseifname' 'atm0'
|
||||
option 'vpi' '8'
|
||||
option 'vci' '35'
|
||||
option 'name' 'DSL8_35'
|
||||
option 'atmtype' 'ubr'
|
||||
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
config ethernet_interface 'Wan'
|
||||
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
config vdsl_interface
|
||||
option 'unit' '0'
|
||||
option 'ifname' 'ptm0.1'
|
||||
option 'baseifname' 'ptm0'
|
||||
option 'name' 'VDSL2'
|
||||
option 'dslat' '1'
|
||||
option 'ptmprio' '1'
|
||||
option 'ipqos' '1'
|
||||
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
#
|
||||
# Ethernet frame types
|
||||
# This file describes some of the various Ethernet
|
||||
# protocol types that are used on Ethernet networks.
|
||||
#
|
||||
# This list could be found on:
|
||||
# http://www.iana.org/assignments/ethernet-numbers
|
||||
#
|
||||
# <name> <hexnumber> <alias1>...<alias35> #Comment
|
||||
#
|
||||
IPv4 0800 ip ip4 # Internet IP (IPv4)
|
||||
X25 0805
|
||||
ARP 0806 ether-arp #
|
||||
FR_ARP 0808 # Frame Relay ARP [RFC1701]
|
||||
BPQ 08FF # G8BPQ AX.25 Ethernet Packet
|
||||
DEC 6000 # DEC Assigned proto
|
||||
DNA_DL 6001 # DEC DNA Dump/Load
|
||||
DNA_RC 6002 # DEC DNA Remote Console
|
||||
DNA_RT 6003 # DEC DNA Routing
|
||||
LAT 6004 # DEC LAT
|
||||
DIAG 6005 # DEC Diagnostics
|
||||
CUST 6006 # DEC Customer use
|
||||
SCA 6007 # DEC Systems Comms Arch
|
||||
TEB 6558 # Trans Ether Bridging [RFC1701]
|
||||
RAW_FR 6559 # Raw Frame Relay [RFC1701]
|
||||
AARP 80F3 # Appletalk AARP
|
||||
ATALK 809B # Appletalk
|
||||
802_1Q 8100 8021q 1q 802.1q dot1q # 802.1Q Virtual LAN tagged frame
|
||||
IPX 8137 # Novell IPX
|
||||
NetBEUI 8191 # NetBEUI
|
||||
IPv6 86DD ip6 # IP version 6
|
||||
PPP 880B # PPP
|
||||
ATMMPOA 884C # MultiProtocol over ATM
|
||||
PPP_DISC 8863 # PPPoE discovery messages
|
||||
PPP_SES 8864 # PPPoE session messages
|
||||
ATMFATE 8884 # Frame-based ATM Transport over Ethernet
|
||||
LOOP 9000 loopback # loop proto
|
||||
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
[ "$STATUS" == "up" -o "$STATUS" == "down" ] && /etc/init.d/dsl reload
|
||||
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
if [ "$STATUS" == "up" ]; then
|
||||
ubus call led.dsl set '{"state":"ok"}'
|
||||
elif [ "$STATUS" == "down" ]; then
|
||||
ubus call led.dsl set '{"state":"off"}'
|
||||
elif [ "$STATUS" == "training" ]; then
|
||||
ubus call led.dsl set '{"state":"alert"}'
|
||||
fi
|
||||
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
include /lib/network
|
||||
|
||||
# true if speed on interface is Gbit
|
||||
gigatest() {
|
||||
local speed=$(ethctl $INTERFACE media-type 2>&1 | awk '{if (NR == 2) print $6}')
|
||||
case "$speed" in
|
||||
1000*) return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# true if there is a link on any lan port
|
||||
lan_test () {
|
||||
local ledontest
|
||||
for dev in $(db get hw.board.ethernetLanPorts); do
|
||||
ledontest=$(cat /sys/class/net/$dev/operstate)
|
||||
if [ "$ledontest" == "up" ]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
case "$ACTION" in
|
||||
add|register)
|
||||
INTFNAME=$(interfacename $INTERFACE)
|
||||
OPERSTATE=$(cat /sys/class/net/$INTERFACE/operstate)
|
||||
# if [ "$OPERSTATE" == "up" ]; then
|
||||
if true ; then
|
||||
case "$INTFNAME" in
|
||||
GbE*)
|
||||
ubus call led.lan set '{"state" : "ok"}'
|
||||
ubus call led.gbe set '{"state" : "ok"}'
|
||||
ubus call led.gbe_phy_link set '{"state" : "ok"}'
|
||||
ubus call led.gbe_phy_speed set '{"state": "off"}'
|
||||
$(gigatest) && ubus call led.gbe_phy_speed set '{"state":"ok"}'
|
||||
;;
|
||||
LAN*)
|
||||
ubus call led.lan set '{"state":"ok"}'
|
||||
;;
|
||||
WAN*)
|
||||
ubus call led.wan set '{"state" : "ok"}'
|
||||
ubus call led.wan_phy_link set '{"state" : "ok"}'
|
||||
ubus call led.wan_phy_speed set '{"state" : "off"}'
|
||||
$(gigatest) && ubus call led.wan_phy_speed set '{"state":"ok"}'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
remove|unregister)
|
||||
INTFNAME=$(interfacename $INTERFACE)
|
||||
OPERSTATE=$(cat /sys/class/net/$INTERFACE/operstate)
|
||||
if [ "$OPERSTATE" == "down" ]; then
|
||||
case "$INTFNAME" in
|
||||
GbE*)
|
||||
ubus call led.gbe set '{"state" : "off"}'
|
||||
ubus call led.gbe_phy_link set '{"state" : "off"}'
|
||||
ubus call led.gbe_phy_speed set '{"state" : "off"}'
|
||||
$(lan_test) || ubus call led.lan set '{"state":"off"}'
|
||||
;;
|
||||
LAN*)
|
||||
$(lan_test) || ubus call led.lan set '{"state":"off"}'
|
||||
;;
|
||||
WAN*)
|
||||
ubus call led.wan set '{"state" : "off"}'
|
||||
ubus call led.wan_phy_speed set '{"state" : "off"}'
|
||||
ubus call led.wan_phy_link set '{"state" : "off"}'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
@ -1,515 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
. /lib/functions.sh
|
||||
include /lib/network
|
||||
|
||||
START=20
|
||||
USE_PROCD=1
|
||||
|
||||
DEVICE_ADDED=0
|
||||
|
||||
device_config_exists() {
|
||||
ubus call uci get '{"config":"network","type":"device"}' | grep -w name | grep -qw "$1" && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
configure_untagged_vlan() {
|
||||
local name="$1"
|
||||
local device="$2"
|
||||
local ifname="$3"
|
||||
|
||||
[ -n "$ifname" -a -n "$name" ] || return
|
||||
device_config_exists "$ifname" && return
|
||||
|
||||
uci -q set network.$name=device
|
||||
uci -q set network.$name.type=untagged
|
||||
uci -q set network.$name.ifname="$device"
|
||||
uci -q set network.$name.name="$ifname"
|
||||
uci -q commit network
|
||||
|
||||
DEVICE_ADDED=1
|
||||
}
|
||||
|
||||
# ATM #
|
||||
check_pvc() {
|
||||
local vpi=$1
|
||||
local vci=$2
|
||||
local ret
|
||||
|
||||
ret=$(xtmctl operate conn --show | awk -v test="$vpi/$vci" '{if ($3==test ) print $5 }')
|
||||
|
||||
case $ret in
|
||||
''|*[!0-9]*) return 0 ;;
|
||||
*) return $ret ;;
|
||||
esac
|
||||
}
|
||||
|
||||
check_xtm_list() {
|
||||
local qclass=$1
|
||||
local pcr scr mbs
|
||||
local ret
|
||||
|
||||
case $# in
|
||||
1)
|
||||
pcr=0
|
||||
scr=0
|
||||
mbs=0
|
||||
;;
|
||||
2)
|
||||
pcr=$2
|
||||
scr=0
|
||||
mbs=0
|
||||
;;
|
||||
4)
|
||||
pcr=$2
|
||||
scr=$3
|
||||
mbs=$4
|
||||
;;
|
||||
esac
|
||||
|
||||
ret=$(xtmctl operate tdte --show | awk -v test="$qclass" -v pcr="$pcr" -v scr="$scr" -v mbs="$mbs" '{if ($2==test && $3==pcr && $4==scr && $5==mbs ) print $1 }')
|
||||
|
||||
case $ret in
|
||||
''|*[!0-9]*) return 0 ;;
|
||||
*) return $ret ;;
|
||||
esac
|
||||
}
|
||||
|
||||
configure_atm_device() {
|
||||
local name vpi vci device link_type encapsulation qos_class pcr mbs scr
|
||||
|
||||
config_get name $1 name "ATM"
|
||||
config_get vpi $1 vpi "8"
|
||||
config_get vci $1 vci "35"
|
||||
config_get device $1 device "atm0"
|
||||
config_get link_type $1 link_type "eoa"
|
||||
config_get encapsulation $1 encapsulation "llc"
|
||||
config_get qos_class $1 qos_class "ubr"
|
||||
config_get pcr $1 pcr
|
||||
config_get mbs $1 mbs
|
||||
config_get scr $1 scr
|
||||
|
||||
check_pvc $vpi $vci
|
||||
ret=$?
|
||||
|
||||
if [ "$ret" -eq 0 ]; then
|
||||
check_xtm_list $qos_class $pcr $scr $mbs
|
||||
ret=$?
|
||||
|
||||
if [ "$ret" -eq 0 ]; then
|
||||
case $qos_class in # ubr, cbr, gfr, vbr-nrt, vbr-rt, ubr+, abr
|
||||
ubr)
|
||||
xtmctl operate tdte --add "$qos_class"
|
||||
;;
|
||||
ubr_pcr|ubr+)
|
||||
xtmctl operate tdte --add "$qos_class" $pcr
|
||||
;;
|
||||
cbr)
|
||||
xtmctl operate tdte --add "$qos_class" $pcr
|
||||
;;
|
||||
nrtvbr|vbr-nrt)
|
||||
xtmctl operate tdte --add "$qos_class" $pcr $scr $mbs
|
||||
;;
|
||||
rtvbr|vbr-rt)
|
||||
xtmctl operate tdte --add "$qos_class" $pcr $scr $mbs
|
||||
;;
|
||||
gfr)
|
||||
;;
|
||||
abr)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
case $link_type in # EoA, IPoA, PPPoA, CIP
|
||||
EoA|eoa)
|
||||
[ $encapsulation == "vcmux" ] && encapsulation="vcmux_eth" || encapsulation="llcsnap_eth"
|
||||
;;
|
||||
PPPoA|pppoa)
|
||||
[ $encapsulation == "vcmux" ] && encapsulation="vcmux_pppoa" || encapsulation="llcencaps_ppp"
|
||||
;;
|
||||
IPoA|ipoa)
|
||||
[ $encapsulation == "vcmux" ] && encapsulation="vcmux_ipoa" || encapsulation="llcsnap_rtip"
|
||||
;;
|
||||
CIP|cip)
|
||||
;;
|
||||
esac
|
||||
|
||||
check_xtm_list $qos_class $pcr $scr $mbs
|
||||
ret="$?"
|
||||
|
||||
xtmctl operate conn --add 1.$vpi.$vci aal5 $encapsulation 0 1 $ret
|
||||
xtmctl operate conn --addq 1.$vpi.$vci 0 wrr 1 dt # low priority queue
|
||||
xtmctl operate conn --addq 1.$vpi.$vci 1 wrr 1 dt # mid priority queue upstream ACK's and ping from LAN will use this queue
|
||||
xtmctl operate conn --addq 1.$vpi.$vci 7 wrr 1 dt # high priority queue, internal traffic dhcp igmp dns and icmp
|
||||
xtmctl operate conn --createnetdev 1.$vpi.$vci $device
|
||||
xtmctl operate intf --state 1 enable
|
||||
|
||||
configure_untagged_vlan "$name" "$device" "$device.1"
|
||||
[ $DEVICE_ADDED -eq 1 ] && ubus call network reload
|
||||
fi
|
||||
}
|
||||
|
||||
remove_atm_devices() {
|
||||
local vpi vci rest
|
||||
local vpivci=`xtmctl operate conn --show | grep "ATM\|mode" | awk '{if (NR!=1 && $1!="PTM") {print $3}}'`
|
||||
|
||||
for i in $vpivci
|
||||
do
|
||||
rest=${i#\/}
|
||||
vpi=${rest%%\/*}
|
||||
vci=${rest#*\/}
|
||||
echo "xtmctl operate conn --delete 1.$vpi.$vci"
|
||||
xtmctl operate conn --delete 1.$vpi.$vci
|
||||
echo "xtmctl operate conn --deletenetdev 1.$vpi.$vci"
|
||||
xtmctl operate conn --deletenetdev 1.$vpi.$vci
|
||||
done
|
||||
}
|
||||
|
||||
create_atm_devices() {
|
||||
echo "Creating ATM Device(s)"
|
||||
config_load dsl
|
||||
config_foreach configure_atm_device atm-device
|
||||
}
|
||||
# ATM END #
|
||||
|
||||
# PTM #
|
||||
check_ptm() {
|
||||
local ret
|
||||
local ptmprio=$1
|
||||
local dslat=$2
|
||||
|
||||
if [ "$ptmprio" -eq 2 ]; then
|
||||
ptmprio="high"
|
||||
else
|
||||
ptmprio="low"
|
||||
fi
|
||||
|
||||
ret=$(xtmctl operate conn --show | awk -v dslat="$dslat" -v ptmprio="$ptmprio" '{if ($2 == dslat && $3 == ptmprio ) print $2 }')
|
||||
|
||||
case $ret in
|
||||
''|*[!0-9]*) return 0 ;;
|
||||
*) return $ret ;;
|
||||
esac
|
||||
}
|
||||
|
||||
configure_ptm_device() {
|
||||
local name device priority portid
|
||||
|
||||
config_get name $1 name "PTM"
|
||||
config_get device $1 device "ptm0"
|
||||
config_get priority $1 priority 1
|
||||
config_get portid $1 portid 1
|
||||
|
||||
check_ptm $priority $portid
|
||||
ret=$?
|
||||
|
||||
if [ "$ret" -eq 0 ]; then
|
||||
xtmctl operate conn --add $portid.$priority
|
||||
xtmctl operate conn --addq $portid.$priority 0 wrr 1 dt -1 -1 3000 # low priority queue
|
||||
xtmctl operate conn --addq $portid.$priority 1 wrr 1 dt -1 -1 3000 # mid priority queue upstream ACK's and ping from LAN will use this queue
|
||||
xtmctl operate conn --addq $portid.$priority 7 wrr 1 dt -1 -1 3000 # high priority queue, internal traffic dhcp igmp dns and icmp
|
||||
echo "xtmctl operate conn --createnetdev $portid.$priority $device"
|
||||
xtmctl operate conn --createnetdev $portid.$priority $device
|
||||
xtmctl operate intf --state 1 enable
|
||||
|
||||
configure_untagged_vlan "$name" "$device" "$device.1"
|
||||
[ $DEVICE_ADDED -eq 1 ] && ubus call network reload
|
||||
fi
|
||||
}
|
||||
|
||||
remove_ptm_devices() {
|
||||
local delptm
|
||||
local x=0
|
||||
|
||||
IFS=$'\n'
|
||||
for i in `xtmctl operate conn --show | grep "PTM\|mode"`
|
||||
do
|
||||
if [ $x -eq 1 ]; then
|
||||
delptm=$(echo $i | awk '{if ($1!="ATM") print $2"."$11}')
|
||||
echo "xtmctl operate conn --delete $delptm"
|
||||
xtmctl operate conn --delete $delptm
|
||||
xtmctl operate conn --deletenetdev $delptm
|
||||
fi
|
||||
x=1
|
||||
done
|
||||
unset IFS
|
||||
}
|
||||
|
||||
create_ptm_devices() {
|
||||
echo "Creating PTM Device(s)"
|
||||
config_load dsl
|
||||
config_foreach configure_ptm_device ptm-device
|
||||
}
|
||||
# PTM END #
|
||||
|
||||
prioritize_arp()
|
||||
{
|
||||
ebtables -t nat -D POSTROUTING -j mark --mark-or 0x7 -p ARP >/dev/null
|
||||
ebtables -t nat -A POSTROUTING -j mark --mark-or 0x7 -p ARP >/dev/null
|
||||
}
|
||||
|
||||
remove_devices() {
|
||||
remove_atm_devices
|
||||
remove_ptm_devices
|
||||
}
|
||||
|
||||
create_devices() {
|
||||
local tpstc="$(xdslctl info --show | grep TPS-TC)"
|
||||
if echo "$tpstc" | grep -q "ATM Mode"; then
|
||||
create_atm_devices
|
||||
elif echo "$tpstc" | grep -q "PTM Mode"; then
|
||||
create_ptm_devices
|
||||
fi
|
||||
}
|
||||
|
||||
start_dsl() {
|
||||
local VDSL=0
|
||||
local GFAST=0
|
||||
local mod=""
|
||||
local modes=""
|
||||
local profile=""
|
||||
|
||||
config_load dsl
|
||||
|
||||
# Modes
|
||||
config_get mode line mode
|
||||
for mod in $mode; do
|
||||
[ $mod == "gdmt" ] && "${modes}d"
|
||||
[ $mod == "glite" ] && modes="${modes}l"
|
||||
[ $mod == "t1413" ] && modes="${modes}t"
|
||||
[ $mod == "adsl2" ] && modes="${modes}2"
|
||||
[ $mod == "adsl2p" ] && modes="${modes}p"
|
||||
[ $mod == "annexl" ] && modes="${modes}e"
|
||||
[ $mod == "annexm" ] && modes="${modes}m"
|
||||
[ $mod == "vdsl2" ] && modes="${modes}v" && VDSL=1
|
||||
[ $mod == "gfast" ] && modes="${modes}f" && GFAST=1
|
||||
done
|
||||
|
||||
# VDSL Profiles
|
||||
config_get profile line profile
|
||||
profile="$(echo $profile | sed 's/35b/BrcmPriv1/g')"
|
||||
|
||||
# Capabilities
|
||||
config_get_bool bitswap line bitswap 1
|
||||
[ $bitswap -eq 1 ] && bitswap="on" || bitswap="off"
|
||||
config_get_bool sra line sra 1
|
||||
[ $sra -eq 1 ] && sra="on" || sra="off"
|
||||
# config_get_bool trellis line trellis 1
|
||||
# config_get_bool sesdrop line sesdrop 1
|
||||
# VDSL2 only
|
||||
config_get_bool us0 line us0 1
|
||||
[ $us0 -eq 1 ] && us0="on" || us0="off"
|
||||
# config_get_bool dynamicd line dynamicd 1
|
||||
# config_get_bool dynamicf line dynamicf 1
|
||||
# config_get_bool sos line sos 1
|
||||
|
||||
|
||||
echo "Starting DSL"
|
||||
|
||||
xtmctl start
|
||||
xtmctl operate intf --state 1 enable
|
||||
|
||||
if [ $VDSL -eq 1 -o $GFAST -eq 1 ]; then
|
||||
echo "xdslctl start --up --mod $modes --profile "$profile" --sra $sra --bitswap $bitswap --us0 $us0"
|
||||
xdslctl start --up --mod $modes --profile "$profile" --sra $sra --bitswap $bitswap --us0 $us0
|
||||
else
|
||||
echo "xdslctl start --up --mod $modes --sra $sra --bitswap $bitswap"
|
||||
xdslctl start --up --mod $modes --sra $sra --bitswap $bitswap
|
||||
fi
|
||||
|
||||
if [ $GFAST -eq 1 ]; then
|
||||
# enable V43 tone set for GFAST
|
||||
echo "xdslctl configure1 --phycfg 0 0 0 0 0 0 0 0 0 0 0 0x400000 0x400000"
|
||||
xdslctl configure1 --phycfg 0 0 0 0 0 0 0 0 0 0 0 0x400000 0x400000
|
||||
fi
|
||||
}
|
||||
|
||||
# CONVERT OLD CONFIG #
|
||||
convert_old_atm() {
|
||||
local name ifname baseifname
|
||||
local vpi vci link_type atmtype pcr scr mbs
|
||||
local encapseoa encapspppoa encapsipoa encapsulation
|
||||
|
||||
config_get atmtype $1 atmtype "ubr"
|
||||
config_get link_type $1 link_type "EoA"
|
||||
config_get pcr $1 pcr
|
||||
config_get scr $1 scr
|
||||
config_get mbs $1 mbs
|
||||
config_get vpi $1 vpi "8"
|
||||
config_get vci $1 vci "35"
|
||||
config_get encapseoa $1 encapseoa
|
||||
config_get encapspppoa $1 encapspppoa
|
||||
config_get encapsipoa $1 encapsipoa
|
||||
config_get baseifname $1 baseifname "atm0"
|
||||
config_get name $1 name "ATM$vpi$vci"
|
||||
|
||||
uci -q set dsl.$baseifname=atm-device
|
||||
uci -q set dsl.$baseifname.name="$name"
|
||||
uci -q set dsl.$baseifname.device="$baseifname"
|
||||
uci -q set dsl.$baseifname.qos_class="$atmtype"
|
||||
uci -q set dsl.$baseifname.vpi="$vpi"
|
||||
uci -q set dsl.$baseifname.vci="$vci"
|
||||
uci -q set dsl.$baseifname.pcr="$pcr"
|
||||
uci -q set dsl.$baseifname.mbs="$mbs"
|
||||
uci -q set dsl.$baseifname.scr="$scr"
|
||||
|
||||
case $link_type in
|
||||
EoA)
|
||||
uci -q set dsl.$baseifname.link_type="eoa"
|
||||
[ "$encapseoa" == "vcmux_eth" ] && encapsulation="vcmux" || encapsulation="llc"
|
||||
uci -q set dsl.$baseifname.encapsulation="$encapsulation"
|
||||
;;
|
||||
PPPoA)
|
||||
uci -q set dsl.$baseifname.link_type="pppoa"
|
||||
[ "$encapspppoa" == "vcmux_pppoa" ] && encapsulation="vcmux" || encapsulation="llc"
|
||||
uci -q set dsl.$baseifname.encapsulation="$encapsulation"
|
||||
;;
|
||||
IPoA)
|
||||
uci -q set dsl.$baseifname.link_type="ipoa"
|
||||
[ "$encapsipoa" == "vcmux_ipoa" ] && encapsulation="vcmux" || encapsulation="llc"
|
||||
uci -q set dsl.$baseifname.encapsulation="$encapsulation"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
convert_old_ptm() {
|
||||
local name ifname baseifname
|
||||
local dslat ptmprio
|
||||
|
||||
config_get name $1 name "PTM"
|
||||
config_get baseifname $1 baseifname "ptm0"
|
||||
config_get dslat $1 dslat
|
||||
config_get ptmprio $1 ptmprio
|
||||
|
||||
uci -q set dsl.$baseifname=ptm-device
|
||||
uci -q set dsl.$baseifname.name="$name"
|
||||
uci -q set dsl.$baseifname.device="$baseifname"
|
||||
uci -q set dsl.$baseifname.priority="$ptmprio"
|
||||
uci -q set dsl.$baseifname.portid="$dslat"
|
||||
}
|
||||
|
||||
convert_old_dsl() {
|
||||
local cap
|
||||
|
||||
sed -i 's/Enabled/1/g' /etc/config/layer2_interface
|
||||
sed -i 's/Disabled/0/g' /etc/config/layer2_interface
|
||||
|
||||
|
||||
uci -q delete dsl.line.mode
|
||||
uci -q delete dsl.line.profile
|
||||
uci -q delete dsl.line.us0
|
||||
uci -q delete dsl.line.sra
|
||||
uci -q delete dsl.line.bitswap
|
||||
|
||||
config_load layer2_interface
|
||||
# Mode
|
||||
config_get_bool cap capabilities GDmt 1
|
||||
[ $cap -eq 1 ] && uci -q add_list dsl.line.mode=gdmt
|
||||
config_get_bool cap capabilities Glite 1
|
||||
[ $cap -eq 1 ] && uci -q add_list dsl.line.mode=glite
|
||||
config_get_bool cap capabilities T1413 1
|
||||
[ $cap -eq 1 ] && uci -q add_list dsl.line.mode=t1413
|
||||
config_get_bool cap capabilities ADSL2 1
|
||||
[ $cap -eq 1 ] && uci -q add_list dsl.line.mode=adsl2
|
||||
config_get_bool cap capabilities ADSL2plus 1
|
||||
[ $cap -eq 1 ] && uci -q add_list dsl.line.mode=adsl2p
|
||||
config_get_bool cap capabilities AnnexL 1
|
||||
[ $cap -eq 1 ] && uci -q add_list dsl.line.mode=annexl
|
||||
config_get_bool cap capabilities AnnexM 1
|
||||
[ $cap -eq 1 ] && uci -q add_list dsl.line.mode=annexm
|
||||
config_get_bool cap capabilities VDSL2 1
|
||||
[ $cap -eq 1 ] && uci -q add_list dsl.line.mode=vdsl2
|
||||
config_get_bool cap capabilities GFast 0
|
||||
[ $cap -eq 1 ] && uci -q add_list dsl.line.mode=gfast
|
||||
|
||||
# Profile
|
||||
config_get_bool cap capabilities 8a 1
|
||||
[ $cap -eq 1 ] && uci -q add_list dsl.line.profile=8a
|
||||
config_get_bool cap capabilities 8b 1
|
||||
[ $cap -eq 1 ] && uci -q add_list dsl.line.profile=8b
|
||||
config_get_bool cap capabilities 8c 1
|
||||
[ $cap -eq 1 ] && uci -q add_list dsl.line.profile=8c
|
||||
config_get_bool cap capabilities 8d 1
|
||||
[ $cap -eq 1 ] && uci -q add_list dsl.line.profile=8d
|
||||
config_get_bool cap capabilities 12a 1
|
||||
[ $cap -eq 1 ] && uci -q add_list dsl.line.profile=12a
|
||||
config_get_bool cap capabilities 12b 1
|
||||
[ $cap -eq 1 ] && uci -q add_list dsl.line.profile=12b
|
||||
config_get_bool cap capabilities 17a 1
|
||||
[ $cap -eq 1 ] && uci -q add_list dsl.line.profile=17a
|
||||
config_get_bool cap capabilities 30a 1
|
||||
[ $cap -eq 1 ] && uci -q add_list dsl.line.profile=30a
|
||||
config_get_bool cap capabilities 35b 0
|
||||
[ $cap -eq 1 ] && uci -q add_list dsl.line.profile=35b
|
||||
|
||||
# Capability
|
||||
config_get_bool cap capabilities US0 1
|
||||
uci -q set dsl.line.us0=$cap
|
||||
config_get_bool cap capabilities bitswap 1
|
||||
uci -q set dsl.line.bitswap=$cap
|
||||
config_get_bool cap capabilities sra 1
|
||||
uci -q set dsl.line.sra=$cap
|
||||
}
|
||||
|
||||
convert_old_config() {
|
||||
[ -f /etc/config/dsl ] || touch /etc/config/dsl
|
||||
|
||||
# DSL
|
||||
if uci -q get layer2_interface.capabilities >/dev/null; then
|
||||
convert_old_dsl
|
||||
fi
|
||||
|
||||
# ATM Devices
|
||||
if uci -q get layer2_interface_adsl.@atm_bridge[0] >/dev/null; then
|
||||
config_load layer2_interface_adsl
|
||||
config_foreach convert_old_atm atm_bridge
|
||||
fi
|
||||
|
||||
# PTM Devices
|
||||
if uci -q get layer2_interface_vdsl.@vdsl_interface[0] >/dev/null; then
|
||||
config_load layer2_interface_vdsl
|
||||
config_foreach convert_old_ptm vdsl_interface
|
||||
fi
|
||||
|
||||
uci -q commit dsl
|
||||
|
||||
# rm -f /etc/config/layer2_interface
|
||||
# rm -f /etc/config/layer2_interface_adsl
|
||||
# rm -f /etc/config/layer2_interface_vdsl
|
||||
}
|
||||
# CONVERT OLD CONFIG END#
|
||||
|
||||
start_service() {
|
||||
create_devices
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
remove_devices
|
||||
|
||||
# echo "Stopping DSL"
|
||||
# stop causes IRQ issues
|
||||
# xdslctl stop
|
||||
}
|
||||
|
||||
boot() {
|
||||
local HASADSL="$(db -q get hw.board.hasAdsl)"
|
||||
local HASVDSL="$(db -q get hw.board.hasVdsl)"
|
||||
[ "$HASADSL" == "1" -o "$HASVDSL" == "1" ] || return
|
||||
|
||||
convert_old_config
|
||||
|
||||
prioritize_arp
|
||||
start_dsl
|
||||
|
||||
start
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger dsl layer2_interface layer2_interface_adsl layer2_interface_vdsl
|
||||
}
|
||||
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
. /lib/functions.sh
|
||||
include /lib/network
|
||||
|
||||
START=20
|
||||
USE_PROCD=1
|
||||
|
||||
DEVICE_ADDED=0
|
||||
|
||||
device_config_exists() {
|
||||
ubus call uci get '{"config":"network","type":"device"}' | grep -w name | grep -qw "$1" && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
configure_ethernet_iface() {
|
||||
local name baseifname ifname
|
||||
|
||||
config_get name $1 name
|
||||
config_get baseifname $1 baseifname
|
||||
config_get ifname $1 ifname
|
||||
|
||||
[ -n "$ifname" -a -n "$name" ] || return
|
||||
device_config_exists "$ifname" && return
|
||||
|
||||
uci -q set network.$name=device
|
||||
uci -q set network.$name.type=untagged
|
||||
uci -q set network.$name.ifname="$baseifname"
|
||||
uci -q set network.$name.name="$ifname"
|
||||
|
||||
DEVICE_ADDED=1
|
||||
}
|
||||
|
||||
configure_vlan_iface() {
|
||||
local name baseifname ifname
|
||||
local vlan8021p vlan8021q
|
||||
|
||||
config_get name $1 name
|
||||
config_get baseifname $1 baseifname
|
||||
config_get ifname $1 ifname
|
||||
config_get vlan8021p $1 vlan8021p
|
||||
config_get vlan8021q $1 vlan8021q
|
||||
|
||||
[ -n "$ifname" -a -n "$name" ] || return
|
||||
device_config_exists "$ifname" && return
|
||||
|
||||
uci -q set network.$name=device
|
||||
uci -q set network.$name.type=8021q
|
||||
uci -q set network.$name.priority=$vlan8021p
|
||||
uci -q set network.$name.vid="$vlan8021q"
|
||||
uci -q set network.$name.ifname="$baseifname"
|
||||
uci -q set network.$name.name="$ifname"
|
||||
uci -q commit network
|
||||
|
||||
DEVICE_ADDED=1
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load layer2_interface_ethernet
|
||||
config_foreach configure_ethernet_iface ethernet_interface
|
||||
|
||||
config_load layer2_interface_vlan
|
||||
config_foreach configure_vlan_iface vlan_interface
|
||||
|
||||
[ $DEVICE_ADDED -eq 1 ] && ubus call network reload
|
||||
}
|
||||
|
||||
boot() {
|
||||
local baseifname port unit uplinkport
|
||||
|
||||
config_load layer2_interface_ethernet
|
||||
config_get baseifname Wan baseifname
|
||||
|
||||
[ -n "$baseifname" ] || baseifname="$(db -q get hw.board.ethernetWanPort)"
|
||||
|
||||
uplinkport=$(uci show ports | grep "uplink='1'" | cut -d'.' -f2)
|
||||
|
||||
if [ -n "$uplinkport" ]; then
|
||||
baseifname="$(uci -q get ports.$uplinkport.ifname)"
|
||||
else
|
||||
uplinkport=$(uci show ports | grep "ifname='$baseifname'" | cut -d'.' -f2)
|
||||
[ -n "$uplinkport" ] && uci -q set ports.$uplinkport.uplink=1 && uci commit ports
|
||||
fi
|
||||
|
||||
# if [ "$(db get hw.board.hardware)" != "EG300" ]; then
|
||||
# if [ "$(get_port_speed $baseifname)" != "1000FD" ]; then
|
||||
# ethctl $baseifname phy-power down
|
||||
# ethctl $baseifname phy-power up
|
||||
# fi
|
||||
# fi
|
||||
|
||||
for interf in $(db get hw.board.ethernetPortOrder); do
|
||||
ethswctl -c wan -i $interf -o disable
|
||||
done
|
||||
|
||||
unit=$(echo $(get_port_number $baseifname) | cut -d ' ' -f 1)
|
||||
port=$(echo $(get_port_number $baseifname) | cut -d ' ' -f 2)
|
||||
|
||||
ethswctl -c pause -n $unit -p $port -v 1
|
||||
|
||||
ethswctl -c hw-switching -o enable
|
||||
|
||||
if [ -n "$baseifname" ]; then
|
||||
ethswctl -c wan -i $baseifname -o enable
|
||||
fi
|
||||
|
||||
if [ "$(db get hw.board.tm)" == "1" ]; then
|
||||
for interf in $(db get hw.board.ethernetPortOrder); do
|
||||
tmctl porttminit --devtype ETH --if $interf --flag 1 || echo "ERROR: porttminit $interf failed!" > /dev/kmsg
|
||||
done
|
||||
fi
|
||||
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger layer2_interface_ethernet layer2_interface_vlan
|
||||
}
|
||||
|
||||
|
|
@ -1,171 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
hasEthWan="$(db -q get hw.board.hasEthWan)"
|
||||
hasEthWan=${hasEthWan:-1}
|
||||
hasAdsl="$(db -q get hw.board.hasAdsl)"
|
||||
hasVdsl="$(db -q get hw.board.hasVdsl)"
|
||||
|
||||
LANPORTS="$(db -q get hw.board.ethernetLanPorts)"
|
||||
|
||||
ETHDEV=""
|
||||
PTMDEV=""
|
||||
ATMDEV=""
|
||||
WANDEV=""
|
||||
WANIFNAME=""
|
||||
|
||||
device_config_exists() {
|
||||
ubus call uci get '{"config":"network","type":"device"}' | grep -w name | grep -qw "$1" && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
populate_dsl_settings() {
|
||||
if [ "$hasAdsl" == "0" -a "$hasVdsl" == "0" ]; then
|
||||
rm -f /etc/config/dsl
|
||||
return
|
||||
else
|
||||
touch /etc/config/dsl
|
||||
fi
|
||||
|
||||
if ! uci -q get dsl.line >/dev/null; then
|
||||
uci -q set dsl.line="dsl-line"
|
||||
if [ "$hasAdsl" == "1" ]; then
|
||||
# Mode
|
||||
uci -q add_list dsl.line.mode=gdmt
|
||||
uci -q add_list dsl.line.mode=glite
|
||||
uci -q add_list dsl.line.mode=t1413
|
||||
uci -q add_list dsl.line.mode=adsl2
|
||||
uci -q add_list dsl.line.mode=adsl2p
|
||||
uci -q add_list dsl.line.mode=annexl
|
||||
uci -q add_list dsl.line.mode=annexm
|
||||
uci -q add_list dsl.line.mode=vdsl2
|
||||
#uci -q add_list dsl.line.mode=gfast
|
||||
fi
|
||||
|
||||
if [ "$hasVdsl" == "1" ]; then
|
||||
# Mode
|
||||
uci -q add_list dsl.line.mode=vdsl2
|
||||
|
||||
# Profile
|
||||
uci -q add_list dsl.line.profile=8a
|
||||
uci -q add_list dsl.line.profile=8b
|
||||
uci -q add_list dsl.line.profile=8c
|
||||
uci -q add_list dsl.line.profile=8d
|
||||
uci -q add_list dsl.line.profile=12a
|
||||
uci -q add_list dsl.line.profile=12b
|
||||
uci -q add_list dsl.line.profile=17a
|
||||
uci -q add_list dsl.line.profile=30a
|
||||
#uci -q add_list dsl.line.profile=35b
|
||||
|
||||
# Capability
|
||||
uci -q set dsl.line.us0=1
|
||||
fi
|
||||
|
||||
# Capability
|
||||
uci -q set dsl.line.bitswap=1
|
||||
uci -q set dsl.line.sra=1
|
||||
fi
|
||||
|
||||
uci -q commit dsl
|
||||
}
|
||||
|
||||
populate_atm_device() {
|
||||
[ "$hasAdsl" == "0" ] && return
|
||||
|
||||
# ATM Device
|
||||
if ! uci -q get dsl.@atm-device[0] >/dev/null; then
|
||||
uci -q set dsl.atm0=atm-device
|
||||
uci -q set dsl.atm0.name="ATM835"
|
||||
uci -q set dsl.atm0.device="atm0"
|
||||
uci -q set dsl.atm0.vpi="8"
|
||||
uci -q set dsl.atm0.vci="35"
|
||||
uci -q set dsl.atm0.qos_class="ubr"
|
||||
uci -q set dsl.atm0.link_type="eoa"
|
||||
uci -q set dsl.atm0.encapsulation="llc"
|
||||
uci -q commit dsl
|
||||
else
|
||||
ATMDEV="$(uci -q get dsl.@atm-device[0].device)"
|
||||
fi
|
||||
|
||||
ATMDEV="${ATMDEV:-atm0}"
|
||||
|
||||
WANDEV="$ATMDEV.1"
|
||||
|
||||
WANIFNAME="$WANIFNAME $WANDEV"
|
||||
|
||||
device_config_exists "$WANDEV" && return
|
||||
|
||||
uci -q set network.atmwan=device
|
||||
uci -q set network.atmwan.type=untagged
|
||||
uci -q set network.atmwan.ifname="$ATMDEV"
|
||||
uci -q set network.atmwan.name="$WANDEV"
|
||||
}
|
||||
|
||||
populate_ptm_device() {
|
||||
[ "$hasVdsl" == "0" ] && return
|
||||
|
||||
# PTM Device
|
||||
if ! uci -q get dsl.@ptm-device[0] >/dev/null; then
|
||||
uci -q set dsl.ptm0=atm-device
|
||||
uci -q set dsl.ptm0.name="PTM"
|
||||
uci -q set dsl.ptm0.device="ptm0"
|
||||
uci -q set dsl.ptm0.priority="1"
|
||||
uci -q set dsl.ptm0.portid="1"
|
||||
uci -q commit dsl
|
||||
else
|
||||
PTMDEV="$(uci -q get dsl.@ptm-device[0].device)"
|
||||
fi
|
||||
|
||||
PTMDEV="${PTMDEV:-ptm0}"
|
||||
|
||||
WANDEV="$PTMDEV.1"
|
||||
|
||||
WANIFNAME="$WANIFNAME $WANDEV"
|
||||
|
||||
device_config_exists "$PTMDEV" && return
|
||||
|
||||
uci -q set network.ptmwan=device
|
||||
uci -q set network.ptmwan.type=untagged
|
||||
uci -q set network.ptmwan.ifname="$PTMDEV"
|
||||
uci -q set network.ptmwan.name="$WANDEV"
|
||||
}
|
||||
|
||||
populate_eth_device() {
|
||||
[ "$hasEthWan" == "0" ] && return
|
||||
|
||||
ETHDEV="$(db -q get hw.board.ethernetWanPort)"
|
||||
|
||||
WANDEV="$ETHDEV.1"
|
||||
|
||||
WANIFNAME="$WANIFNAME $WANDEV"
|
||||
|
||||
device_config_exists "$WANDEV" && return
|
||||
|
||||
uci -q set network.ethwan=device
|
||||
uci -q set network.ethwan.type=untagged
|
||||
uci -q set network.ethwan.ifname="$ETHDEV"
|
||||
uci -q set network.ethwan.name="$WANDEV"
|
||||
}
|
||||
|
||||
populate_network_config_ifnames() {
|
||||
# LAN ports
|
||||
uci -q get network.lan.ifname >/dev/null || uci -q set network.lan.ifname="$LANPORTS"
|
||||
|
||||
[ $((hasEthWan+hasAdsl+hasVdsl)) -eq 0 ] && {
|
||||
uci -q commit network
|
||||
return
|
||||
}
|
||||
|
||||
uci -q get network.wan.ifname >/dev/null || {
|
||||
uci -q set network.wan.type="anywan"
|
||||
WANIFNAME="$(echo $WANIFNAME | sed -e 's/^ *//')"
|
||||
uci -q set network.wan.ifname="$WANIFNAME"
|
||||
}
|
||||
|
||||
uci -q commit network
|
||||
}
|
||||
|
||||
populate_dsl_settings
|
||||
populate_atm_device
|
||||
populate_ptm_device
|
||||
populate_eth_device
|
||||
populate_network_config_ifnames
|
||||
Loading…
Add table
Reference in a new issue