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