]> git.ipfire.org Git - ipfire-2.x.git/blame - config/udev/network-aqm
suricata: Change midstream policy to "pass-flow"
[ipfire-2.x.git] / config / udev / network-aqm
CommitLineData
3e78d712
MT
1#!/bin/bash
2############################################################################
3# #
4# This file is part of the IPFire Firewall. #
5# #
6# IPFire is free software; you can redistribute it and/or modify #
7# it under the terms of the GNU General Public License as published by #
8# the Free Software Foundation; either version 2 of the License, or #
9# (at your option) any later version. #
10# #
11# IPFire is distributed in the hope that it will be useful, #
12# but WITHOUT ANY WARRANTY; without even the implied warranty of #
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14# GNU General Public License for more details. #
15# #
16# You should have received a copy of the GNU General Public License #
17# along with IPFire; if not, write to the Free Software #
18# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
19# #
20# Copyright (C) 2007-2012 IPFire Team <info@ipfire.org>. #
21# #
22############################################################################
23
cfa5f916 24LOG_FACILITY="aqm"
3e78d712 25
cfa5f916 26log() {
3e78d712
MT
27 logger -t "${LOG_FACILITY}" $@
28}
29
30if [ -z "${INTERFACE}" ]; then
31 echo "INTERFACE variable was not set." >&2
32 exit 1
33fi
34
3e78d712
MT
35case "${ACTION}" in
36 add|register)
cfa5f916
MT
37 TYPE="$(</sys/class/net/${INTERFACE}/type)"
38
39 # Detect bridges
40 if [ -d "/sys/class/net/${INTERFACE}/bridge" ]; then
41 TYPE="bridge"
42 fi
43
44 args=()
45
46 # Configure some useful defaults depending on the interface
47 case "${INTERFACE},${TYPE}" in
48 # Ignore loopback
49 lo,*)
50 exit 0
51 ;;
52
53 # Ignore tun
54 tun*)
55 exit 0
56 ;;
57
58 # Ignore GRE/VTI
59 *,778|*,768)
60 exit 0
61 ;;
62
63 # Ignore bridges
64 *,bridge)
65 exit 0
66 ;;
67
8b439655
AF
68 # Ignore IMQ/IFB
69 imq*,*|ifb*,*)
70 exit 0
71 ;;
72
cfa06b67 73 # Handle dial-up connections on RED
cfa5f916 74 ppp*,512)
cfa06b67 75 args+=( "cake" "internet" "conservative" "ack-filter" )
cfa5f916
MT
76 ;;
77
78 # Treat any other interfaces as "Ethernet"
79 red*,*)
80 args+=( "cake" "internet" "ethernet" )
81 ;;
82
83 # All other interfaces are locally connected
84 *)
85 args+=( "cake" "ethernet" "metro" )
86 ;;
87 esac
88
89 # Change root qdisc to use cake
90 if ! tc qdisc replace root dev "${INTERFACE}" "${args[@]}"; then
91 log "Could not configure qdisc on ${INTERFACE} with parameters ${args[@]}"
3e78d712
MT
92 exit ${ret}
93 fi
94 ;;
95
96 remove|unregister)
97 # Nothing to do here.
98 ;;
99esac
100
101exit 0