ab0e4d
From 231c6e831262246af33696132c1be7c009477a96 Mon Sep 17 00:00:00 2001
ab0e4d
From: Patrick Talbert <ptalbert@redhat.com>
ab0e4d
Date: Fri, 30 Nov 2018 09:28:09 +0100
ab0e4d
Subject: [PATCH] 95fcoe: Add the rd.nofcoe option to disable the FCoE module
ab0e4d
 from the command line
ab0e4d
ab0e4d
Images built with the fcoe module will always run the lldpad
ab0e4d
service as part of their pre-trigger scripts if the network
ab0e4d
is active. This prevents network installations in
ab0e4d
environments where, for security reasons, LLDPDU frames
ab0e4d
cause a switchport shutdown.
ab0e4d
ab0e4d
Add a new rd.nofcoe option to cause dracut to skip the
ab0e4d
lldpad.sh script and the entire 95-fcoe module.
ab0e4d
ab0e4d
Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
ab0e4d
(cherry picked from commit 7c6d2ad916bd536dc2f082fd96ef837a5031e497)
ab0e4d
ab0e4d
Resolves: #1885621
ab0e4d
---
ab0e4d
 dracut.cmdline.7.asc           | 3 +++
ab0e4d
 modules.d/95fcoe/lldpad.sh     | 5 +++++
ab0e4d
 modules.d/95fcoe/parse-fcoe.sh | 5 +++++
ab0e4d
 3 files changed, 13 insertions(+)
ab0e4d
ab0e4d
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
ab0e4d
index e220defb..bf745575 100644
ab0e4d
--- a/dracut.cmdline.7.asc
ab0e4d
+++ b/dracut.cmdline.7.asc
ab0e4d
@@ -779,6 +779,9 @@ iscsistart -b --param node.session.timeo.replacement_timeout=30
ab0e4d
 
ab0e4d
 FCoE
ab0e4d
 ~~~~
ab0e4d
+**rd.nofcoe=0**::
ab0e4d
+    disable FCoE and lldpad
ab0e4d
+
ab0e4d
 **fcoe=**__<edd|interface|MAC>__:__{dcb|nodcb}__:__{fabric|vn2vn}__::
ab0e4d
     Try to connect to a FCoE SAN through the NIC specified by _<interface>_ or
ab0e4d
     _<MAC>_ or EDD settings. The second argument specifies if DCB
ab0e4d
diff --git a/modules.d/95fcoe/lldpad.sh b/modules.d/95fcoe/lldpad.sh
ab0e4d
index d06a3bd8..c32feeed 100755
ab0e4d
--- a/modules.d/95fcoe/lldpad.sh
ab0e4d
+++ b/modules.d/95fcoe/lldpad.sh
ab0e4d
@@ -1,5 +1,10 @@
ab0e4d
 #!/bin/bash
ab0e4d
 
ab0e4d
+if ! getargbool 0 rd.nofcoe ; then
ab0e4d
+	info "rd.nofcoe=0: skipping lldpad activation"
ab0e4d
+	exit 0
ab0e4d
+fi
ab0e4d
+
ab0e4d
 # Note lldpad will stay running after switchroot, the system initscripts
ab0e4d
 # are to kill it and start a new lldpad to take over. Data is transfered
ab0e4d
 # between the 2 using a shm segment
ab0e4d
diff --git a/modules.d/95fcoe/parse-fcoe.sh b/modules.d/95fcoe/parse-fcoe.sh
ab0e4d
index 12701cdb..7a6ff755 100755
ab0e4d
--- a/modules.d/95fcoe/parse-fcoe.sh
ab0e4d
+++ b/modules.d/95fcoe/parse-fcoe.sh
ab0e4d
@@ -13,6 +13,11 @@
ab0e4d
 # fcoe=eth0:nodcb:vn2vn
ab0e4d
 # fcoe=4a:3f:4c:04:f8:d7:nodcb:fabric
ab0e4d
 
ab0e4d
+if ! getargbool 0 rd.nofcoe ; then
ab0e4d
+	info "rd.nofcoe=0: skipping fcoe"
ab0e4d
+	exit 0
ab0e4d
+fi
ab0e4d
+
ab0e4d
 [ -z "$fcoe" ] && fcoe=$(getarg fcoe=)
ab0e4d
 
ab0e4d
 # If it's not set we don't continue
ab0e4d