sulu-vendorextn: remove parental control extn

This commit is contained in:
Vivek Kumar Dutta 2025-09-19 16:20:26 +05:30
parent a225cc2e3f
commit 37d313ccc5
No known key found for this signature in database
GPG key ID: 4E09F5AD8265FD4C
3 changed files with 0 additions and 411 deletions

View file

@ -27,7 +27,6 @@ define Package/sulu-vendorext/install
$(BBFDM_INSTALL_MS_PLUGIN) ./extn/X_GENEXIS_EU_guest_wifi_5.json $(1) sysmngr
$(BBFDM_INSTALL_MS_PLUGIN) ./extn/X_GENEXIS_EU.json $(1) sysmngr
$(BBFDM_INSTALL_MS_PLUGIN) ./extn/X_GENEXIS_EU_mesh.json $(1) sysmngr
$(BBFDM_INSTALL_MS_PLUGIN) ./extn/X_GENEXIS_EU_parental_control.json $(1) sysmngr
$(BBFDM_INSTALL_MS_PLUGIN) ./extn/X_GENEXIS_EU_voip.json $(1) sysmngr
$(BBFDM_INSTALL_MS_PLUGIN) ./extn/X_GENEXIS_EU_wan.json $(1) sysmngr
$(BBFDM_INSTALL_MS_PLUGIN) ./extn/X_GENEXIS_EU_guest_wifi_2_4.json $(1) sysmngr

View file

@ -1,272 +0,0 @@
{
"Device.DeviceInfo.X_GENEXIS_EU.ParentalControl.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": false,
"array": false,
"RuleNumberOfEntries": {
"type": "unsignedInt",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": false,
"mapping": [
{
"type": "uci",
"uci": {
"file": "parental_control",
"section": {
"type": "filter"
},
"option": {
"name": "@Count"
}
}
}
]
},
"Device.DeviceInfo.X_GENEXIS_EU.ParentalControl.Rule.{i}.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": true,
"array": true,
"mapping": {
"type": "uci",
"uci": {
"file": "parental_control",
"section": {
"type": "filter"
},
"dmmapfile": "dmmap_pc_rule"
}
},
"Name": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "parental_control",
"section": {
"type": "filter",
"index": "@i-1"
},
"option": {
"name": "name"
}
}
}
]
},
"Devices": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"list": {
"datatype": "string"
},
"mapping": [
{
"type": "uci",
"uci": {
"file": "parental_control",
"section": {
"type": "filter",
"index": "@i-1"
},
"list": {
"name": "devices"
}
}
}
]
},
"Schedules": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"list": {
"datatype": "string"
},
"mapping": [
{
"type": "uci",
"uci": {
"file": "parental_control",
"section": {
"type": "filter",
"index": "@i-1"
},
"list": {
"name": "schedules"
}
}
}
]
}
},
"ScheduleNumberOfEntries": {
"type": "unsignedInt",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": false,
"mapping": [
{
"type": "uci",
"uci": {
"file": "parental_control",
"section": {
"type": "schedule"
},
"option": {
"name": "@Count"
}
}
}
]
},
"Device.DeviceInfo.X_GENEXIS_EU.ParentalControl.Schedule.{i}.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": true,
"array": true,
"mapping": {
"type": "uci",
"uci": {
"file": "parental_control",
"section": {
"type": "schedule"
},
"dmmapfile": "dmmap_pc_schedule"
}
},
"Name": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "parental_control",
"section": {
"type": "schedule",
"index": "@i-1"
},
"option": {
"name": "name"
}
}
}
]
},
"Start": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "parental_control",
"section": {
"type": "schedule",
"index": "@i-1"
},
"option": {
"name": "start"
}
}
}
]
},
"End": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "parental_control",
"section": {
"type": "schedule",
"index": "@i-1"
},
"option": {
"name": "end"
}
}
}
]
},
"Days": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"list": {
"datatype": "string"
},
"mapping": [
{
"type": "uci",
"uci": {
"file": "parental_control",
"section": {
"type": "schedule",
"index": "@i-1"
},
"list": {
"name": "days"
}
}
}
]
}
}
}
}

View file

@ -1,138 +0,0 @@
#!/bin/sh
. /lib/functions.sh
# Create a iptables chain for schedules
# For each schedule, create a chain for devices
#
# FORWARD
# '--> SCHEDULES
# '--> MACS
# Note: max 28 chars for iptables chain names - unnamed sections add 10
# long named schedule sections need special treatment
CHAIN=PARENTAL
CHAIN_LEN=$(expr length "$CHAIN")
CHAIN_MAX_LEN=28
add_device() {
local mac="$1"
local chain="$2"
iptables -A "$chain" -m mac --mac-source "$mac" -j DROP
}
process_rule() {
local rule="$1"
local schedule="$2"
local chain="$3"
local is_enabled
local schedule_name
local schedules
# check if rule is enabled
config_get is_enabled "$rule" "enabled" 1
[ "$is_enabled" = "0" ] && return
# check if schedule is part of this rule
config_get schedule_name "$schedule" "name" "$schedule"
stringify_schedules() {
local schedule="$1"
schedules="${schedules:+$schedules }$schedule"
}
config_list_foreach "$rule" "schedules" stringify_schedules
if list_contains schedules "$schedule_name"; then
# add devices from this rule to device chain for this schedule
config_list_foreach "$rule" "devices" add_device "$chain"
fi
}
generate_truncated_hash() {
input_string="$1"
max_length="$2"
# Generate SHA-256 hash, output in hexadecimal, and truncate to the desired length
echo -n "$input_string" | openssl dgst -sha256 | sed 's/^.* //g' | cut -c1-"$max_length"
}
process_schedule() {
local schedule="$1"
local is_enabled
local start_time
local end_time
local days=""
local subchain
local subchain_len
# check if schedule is enabled
config_get is_enabled "$schedule" "enabled" 1
[ "$is_enabled" = "0" ] && return
# truncate long schedule ids so they don't exceed iptables limit
subchain_len=$(expr $(expr length "$schedule") + $CHAIN_LEN + 1)
if [ $subchain_len -gt $CHAIN_MAX_LEN ]; then
subchain_len=$(expr $CHAIN_MAX_LEN - $CHAIN_LEN - 1)
subchain="$(generate_truncated_hash "$schedule" "$subchain_len")"
else
subchain="$schedule"
fi
# create a device chain for this schedule
if ! iptables -L "${CHAIN}_$subchain" >/dev/null 2>&1; then
iptables -N "${CHAIN}_$subchain"
fi
config_get start_time "$schedule" "start"
config_get end_time "$schedule" "end"
stringify_days() {
local day="$1"
days="${days:+$days,}$day"
}
config_list_foreach "$schedule" "days" stringify_days
# add filter that points to device chain
if [ "$end_time" \< "$start_time" ]; then
# contiguous is used to span midnight, but not allowed otherwise
iptables -A ${CHAIN} -m time --timestart "$start_time" --timestop "$end_time" --weekdays "$days" --contiguous --kerneltz -j "${CHAIN}_$subchain"
else
iptables -A ${CHAIN} -m time --timestart "$start_time" --timestop "$end_time" --weekdays "$days" --kerneltz -j "${CHAIN}_$subchain"
fi
# process any rules containing this schedule to add devices to chain
config_foreach process_rule filter "$schedule" "${CHAIN}_$subchain"
# return from the chain to keep processing schedules if no hits
iptables -A "${CHAIN}_$subchain" -j RETURN
}
# flush the chains
iptables -D FORWARD -j ${CHAIN} >/dev/null 2>&1
iptables -S | grep -E "\-N ${CHAIN}" | awk '{print $2}' | while read chain;
do
iptables -F "$chain"
iptables -X "$chain"
done
# if feature is disabled, just flush and return
[ "$(uci -q get parental_control.@global[0].enabled)" = "0" ] && return
# add parental control chain
iptables -N ${CHAIN}
iptables -I FORWARD 1 -j ${CHAIN}
config_load parental_control
# add schedules in parental control chain
config_foreach process_schedule schedule
# return to input chain after all schedules have been checked
iptables -A ${CHAIN} -j RETURN
# Flush hwnat
/usr/bin/hw_nat -!
/usr/sbin/conntrack -F