From 78940da396ff95d1c53fc7289f72d1915588348d Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Wed, 17 May 2023 21:19:56 +0200 Subject: [PATCH] interfaces: avoid null route on fragile /64 and fix typo PR: https://forum.opnsense.org/index.php?topic=33999.0 --- src/opnsense/scripts/interfaces/ifctl.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/opnsense/scripts/interfaces/ifctl.sh b/src/opnsense/scripts/interfaces/ifctl.sh index 3cee698a2..70a913d84 100755 --- a/src/opnsense/scripts/interfaces/ifctl.sh +++ b/src/opnsense/scripts/interfaces/ifctl.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2022 Franco Fichtner +# Copyright (c) 2022-2023 Franco Fichtner # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -49,7 +49,11 @@ flush_routes() ;; prefix) # flush null route to delegated prefix - route delete -${AF} "$(cat ${FILE})" + for CONTENT in $(cat ${FILE}); do + if [ "${CONTENT##*/}" != "64" ]; then + route delete -${AF} "${CONTENT}" + fi + done ;; *) ;; @@ -206,12 +210,12 @@ fi for CONTENT in ${DO_CONTENTS}; do echo "${CONTENT}" >> ${FILE} # null route handling for delegated prefix - if [ ${MD} = "prefix" ]; then + if [ ${MD} = "prefix" -a "${CONTENT##*/}" != "64" ]; then route add -${AF} -blackhole ${CONTENT} ::1 fi done -if [ -n "${DO_COMMAND}${DO_CONTENT}" ]; then +if [ -n "${DO_COMMAND}${DO_CONTENTS}" ]; then exit 0 fi