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