Files
bpfire/config/udev/network-aqm
Michael Tremer ec0ba68a15 udev: Rename enable_codel to network-aqm
This is a more generic term since CoDel is no longer being used

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2022-01-16 15:17:50 +00:00

97 lines
2.8 KiB
Bash

#!/bin/bash
############################################################################
# #
# This file is part of the IPFire Firewall. #
# #
# IPFire 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. #
# #
# IPFire 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 IPFire; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
# #
# Copyright (C) 2007-2012 IPFire Team <info@ipfire.org>. #
# #
############################################################################
LOG_FACILITY="aqm"
log() {
logger -t "${LOG_FACILITY}" $@
}
if [ -z "${INTERFACE}" ]; then
echo "INTERFACE variable was not set." >&2
exit 1
fi
case "${ACTION}" in
add|register)
TYPE="$(</sys/class/net/${INTERFACE}/type)"
# Detect bridges
if [ -d "/sys/class/net/${INTERFACE}/bridge" ]; then
TYPE="bridge"
fi
args=()
# Configure some useful defaults depending on the interface
case "${INTERFACE},${TYPE}" in
# Ignore loopback
lo,*)
exit 0
;;
# Ignore tun
tun*)
exit 0
;;
# Ignore GRE/VTI
*,778|*,768)
exit 0
;;
# Ignore bridges
*,bridge)
exit 0
;;
# Handle RED PPPoE (default to VDSL2)
ppp*,512)
args+=( "cake" "internet" "pppoe-ptm" "ack-filter" )
;;
# Treat any other interfaces as "Ethernet"
red*,*)
args+=( "cake" "internet" "ethernet" )
;;
# All other interfaces are locally connected
*)
args+=( "cake" "ethernet" "metro" )
;;
esac
# Change root qdisc to use cake
if ! tc qdisc replace root dev "${INTERFACE}" "${args[@]}"; then
log "Could not configure qdisc on ${INTERFACE} with parameters ${args[@]}"
exit ${ret}
fi
;;
remove|unregister)
# Nothing to do here.
;;
esac
exit 0