git: e0f2b8aaf1ed - stable/13 - service/ipfw: Silence warning on restart

Lutz Donnerhacke donner at FreeBSD.org
Mon May 17 06:10:10 UTC 2021


The branch stable/13 has been updated by donner:

URL: https://cgit.FreeBSD.org/src/commit/?id=e0f2b8aaf1ed210c571b8a75749d072570eac88c

commit e0f2b8aaf1ed210c571b8a75749d072570eac88c
Author:     Lutz Donnerhacke <donner at FreeBSD.org>
AuthorDate: 2021-05-02 20:47:04 +0000
Commit:     Lutz Donnerhacke <donner at FreeBSD.org>
CommitDate: 2021-05-17 06:08:41 +0000

    service/ipfw: Silence warning on restart
    
    Once the ipfw0 interface has been created, ifconfig(8) create will
    throw a warning: "ifconfig: create: bad value" when trying to create
    it again.
    
    PR:             241013
    Submitted by:   Jose Luis Duran
    Approved by:    kp
    Differential Revision: https://reviews.freebsd.org/D30083
    
    (cherry picked from commit 5c4fe2ac81a5e05062266d684fb53b9faefd0d38)
---
 libexec/rc/rc.d/ipfw | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libexec/rc/rc.d/ipfw b/libexec/rc/rc.d/ipfw
index ece0a93ba6f4..fd1c97671d70 100755
--- a/libexec/rc/rc.d/ipfw
+++ b/libexec/rc/rc.d/ipfw
@@ -74,8 +74,14 @@ ipfw_start()
 		${SYSCTL} net.inet.ip.fw.verbose=1 >/dev/null
 	fi
 	if checkyesno firewall_logif; then
-		ifconfig ipfw0 create
-		echo 'Firewall logging pseudo-interface (ipfw0) created.'
+		if ! ifconfig ipfw0 >/dev/null 2>&1; then
+			ifconfig ipfw0 create
+			echo 'Firewall logging pseudo-interface (ipfw0)' \
+			    'created.'
+		else
+			echo 'Firewall logging pseudo-interface (ipfw0)' \
+			    'already created.'
+		fi
 	fi
 }
 


More information about the dev-commits-src-all mailing list