mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-11-01 19:07:47 +00:00
switch-fabric: add package that handles switch-fabric features
* add support for port mirroring * lagcp will be housed within this package aswell in future Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
34
feeds/ucentral/switch-fabric/Makefile
Normal file
34
feeds/ucentral/switch-fabric/Makefile
Normal file
@@ -0,0 +1,34 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=switch-fabric
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/switch-fabric
|
||||
SECTION:=ucentral
|
||||
CATEGORY:=uCentral
|
||||
TITLE:=switch-fabric
|
||||
endef
|
||||
|
||||
define Package/switch-fabric/description
|
||||
Allow configuring HW specific switch fabric features.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Build/Compile/Default
|
||||
|
||||
endef
|
||||
Build/Compile = $(Build/Compile/Default)
|
||||
|
||||
define Package/switch-fabric/install
|
||||
$(CP) ./files/* $(1)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,switch-fabric))
|
||||
19
feeds/ucentral/switch-fabric/files/etc/init.d/switch-fabric
Executable file
19
feeds/ucentral/switch-fabric/files/etc/init.d/switch-fabric
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=90
|
||||
USE_PROCD=1
|
||||
PROG=/usr/libexec/switch.sh
|
||||
|
||||
reload_service() {
|
||||
restart
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger switch
|
||||
}
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG"
|
||||
procd_close_instance
|
||||
}
|
||||
23
feeds/ucentral/switch-fabric/files/usr/libexec/switch.sh
Executable file
23
feeds/ucentral/switch-fabric/files/usr/libexec/switch.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
port_mirror() {
|
||||
for lan in $(ls -d /sys/class/net/lan* | cut -dn -f3 |sort -n); do
|
||||
tc qdisc del dev lan$lan clsact
|
||||
done
|
||||
|
||||
monitor=$(uci get switch.mirror.monitor)
|
||||
analysis=$(uci get switch.mirror.analysis)
|
||||
|
||||
[ -n "$monitor" -a -n "$analysis" ] || return
|
||||
|
||||
ifconfig $analysis up
|
||||
for port in $monitor; do
|
||||
tc qdisc add dev $port clsact
|
||||
tc filter add dev $port ingress matchall skip_sw action mirred egress mirror dev $analysis
|
||||
tc filter add dev $port egress matchall skip_sw action mirred egress mirror dev $analysis
|
||||
done
|
||||
}
|
||||
|
||||
port_mirror
|
||||
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"uuid": 2,
|
||||
|
||||
"switch": {
|
||||
"port-mirror": {
|
||||
"monitor-ports": [ "WAN2" ],
|
||||
"analysis-port": "WAN3"
|
||||
}
|
||||
},
|
||||
|
||||
"interfaces": [
|
||||
{
|
||||
"name": "WAN",
|
||||
"role": "upstream",
|
||||
"services": [ "lldp", "ssh" ],
|
||||
"ethernet": [
|
||||
{
|
||||
"select-ports": [
|
||||
"WAN*"
|
||||
]
|
||||
}
|
||||
],
|
||||
"ipv4": {
|
||||
"addressing": "dynamic"
|
||||
}
|
||||
}
|
||||
],
|
||||
"metrics": {
|
||||
"statistics": {
|
||||
"interval": 120,
|
||||
"types": [ "ssids", "lldp", "clients" ]
|
||||
},
|
||||
"health": {
|
||||
"interval": 120
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"lldp": {
|
||||
"describe": "uCentral",
|
||||
"location": "universe"
|
||||
},
|
||||
"ssh": {
|
||||
"port": 22
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user