mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +02:00
Add XDP program load/unload script
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
This commit is contained in:
@@ -92,6 +92,7 @@ etc/rc.d/init.d/unbound
|
|||||||
etc/rc.d/init.d/vnstat
|
etc/rc.d/init.d/vnstat
|
||||||
etc/rc.d/init.d/waitdrives
|
etc/rc.d/init.d/waitdrives
|
||||||
etc/rc.d/init.d/wlanclient
|
etc/rc.d/init.d/wlanclient
|
||||||
|
etc/rc.d/init.d/ddos
|
||||||
#etc/rc.d/rc0.d
|
#etc/rc.d/rc0.d
|
||||||
#etc/rc.d/rc0.d/K01imspetor
|
#etc/rc.d/rc0.d/K01imspetor
|
||||||
#etc/rc.d/rc0.d/K01motion
|
#etc/rc.d/rc0.d/K01motion
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ etc/rc.d/init.d/unbound
|
|||||||
etc/rc.d/init.d/vnstat
|
etc/rc.d/init.d/vnstat
|
||||||
etc/rc.d/init.d/waitdrives
|
etc/rc.d/init.d/waitdrives
|
||||||
etc/rc.d/init.d/wlanclient
|
etc/rc.d/init.d/wlanclient
|
||||||
|
etc/rc.d/init.d/ddos
|
||||||
#etc/rc.d/rc0.d
|
#etc/rc.d/rc0.d
|
||||||
#etc/rc.d/rc0.d/K01imspetor
|
#etc/rc.d/rc0.d/K01imspetor
|
||||||
#etc/rc.d/rc0.d/K01motion
|
#etc/rc.d/rc0.d/K01motion
|
||||||
|
|||||||
64
src/initscripts/system/ddos
Executable file
64
src/initscripts/system/ddos
Executable file
@@ -0,0 +1,64 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
###############################################################################
|
||||||
|
# #
|
||||||
|
# IPFire.org - A linux based firewall #
|
||||||
|
# Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
|
||||||
|
# Copyright (C) 2024 FireBeeOS <vincent.mc.li@gmail.com> #
|
||||||
|
# #
|
||||||
|
# This program 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 3 of the License, or #
|
||||||
|
# (at your option) any later version. #
|
||||||
|
# #
|
||||||
|
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. #
|
||||||
|
# #
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
. /etc/sysconfig/rc
|
||||||
|
. $rc_functions
|
||||||
|
|
||||||
|
eval $(/usr/local/bin/readhash /var/ipfire/ddos/settings)
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
if [ "$ENABLE_DDOS" == "on" ]; then
|
||||||
|
boot_mesg -n "Starting ddos..."
|
||||||
|
if [ -e /var/ipfire/red/active ]; then
|
||||||
|
boot_mesg ""
|
||||||
|
/usr/sbin/xdp-loader load red0 -m skb /usr/lib/bpf/xdp_synproxy.bpf.o
|
||||||
|
evaluate_retval
|
||||||
|
else
|
||||||
|
boot_mesg " ERROR! Red0 interface not online!"
|
||||||
|
echo_warning
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
|
stop)
|
||||||
|
boot_mesg "Stopping ddos..."
|
||||||
|
/usr/sbin/xdp-loader unload red0 -a
|
||||||
|
evaluate_retval
|
||||||
|
;;
|
||||||
|
|
||||||
|
restart)
|
||||||
|
$0 stop
|
||||||
|
sleep 1
|
||||||
|
$0 start
|
||||||
|
;;
|
||||||
|
|
||||||
|
status)
|
||||||
|
/usr/sbin/xdp-loader status red0
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {start|stop|restart|status}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
Reference in New Issue
Block a user