summaryrefslogtreecommitdiffstats
path: root/0009-RH-multipathd-blacklist-all-by-default.patch
blob: df4b4c74472026a834413f8366a30b540fbba925 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From 61b2002c6b2752c15b431e400cd614edc8c5b039 Mon Sep 17 00:00:00 2001
From: Fabio M. Di Nitto <fdinitto@redhat.com>
Date: Mon, 19 Oct 2009 07:05:45 +0200
Subject: [PATCH 09/12] RH: multipathd blacklist all by default

If there is no configuration installed on the system, blacklist
everything by default.

BZ#528059

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
:100644 100644 e7e962e... 5aa1ab0... M	libmultipath/config.c
:100644 100644 86b1320... 7e90e75... M	libmultipath/config.h
 libmultipath/config.c |   18 +++++++++++++++++-
 libmultipath/config.h |    1 +
 2 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/libmultipath/config.c b/libmultipath/config.c
index e7e962e..5aa1ab0 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -19,6 +19,7 @@
 #include "blacklist.h"
 #include "defaults.h"
 #include "prio.h"
+#include "version.h"
 
 static int
 hwe_strmatch (struct hwentry *hwe1, struct hwentry *hwe2)
@@ -463,8 +464,23 @@ load_config (char * file)
 			condlog(0, "error parsing config file");
 			goto out;
 		}
+	} else {
+		condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices.");
+		condlog(0, "A default multipath.conf file is located at");
+		condlog(0,
+"/usr/share/doc/device-mapper-multipath-%d.%d.%d/multipath.conf",
+			MULTIPATH_VERSION(VERSION_CODE));
+		conf->blist_devnode = vector_alloc();
+		if (!conf->blist_devnode) {
+			condlog(0, "cannot allocate blacklist\n");
+			goto out;
+		}
+		if (store_ble(conf->blist_devnode, strdup(".*"),
+			      ORIGIN_NO_CONFIG)) {
+			condlog(0, "cannot store default no-config blacklist\n");
+			goto out;
+		}
 	}
-
 	/*
 	 * remove duplica in hwtable. config file takes precedence
 	 * over build-in hwtable
diff --git a/libmultipath/config.h b/libmultipath/config.h
index 86b1320..7e90e75 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -5,6 +5,7 @@
 
 #define ORIGIN_DEFAULT 0
 #define ORIGIN_CONFIG  1
+#define ORIGIN_NO_CONFIG 2
 
 enum devtypes {
 	DEV_NONE,
-- 
1.6.5.1