summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/multipath-tools/files/0027-RH-warn-on-invalid-regex-instead-of-failing.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-oe/recipes-support/multipath-tools/files/0027-RH-warn-on-invalid-regex-instead-of-failing.patch')
-rw-r--r--meta-oe/recipes-support/multipath-tools/files/0027-RH-warn-on-invalid-regex-instead-of-failing.patch76
1 files changed, 44 insertions, 32 deletions
diff --git a/meta-oe/recipes-support/multipath-tools/files/0027-RH-warn-on-invalid-regex-instead-of-failing.patch b/meta-oe/recipes-support/multipath-tools/files/0027-RH-warn-on-invalid-regex-instead-of-failing.patch
index a23e167393..57d04d02bb 100644
--- a/meta-oe/recipes-support/multipath-tools/files/0027-RH-warn-on-invalid-regex-instead-of-failing.patch
+++ b/meta-oe/recipes-support/multipath-tools/files/0027-RH-warn-on-invalid-regex-instead-of-failing.patch
@@ -1,7 +1,10 @@
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 1From d16de70b76919269561b4e404825f78286ea9a40 Mon Sep 17 00:00:00 2001
2From: Benjamin Marzinski <bmarzins@redhat.com> 2From: Changqing Li <changqing.li@windriver.com>
3Date: Mon, 6 Nov 2017 21:39:28 -0600 3Date: Mon, 26 Nov 2018 10:31:30 +0800
4Subject: [PATCH] RH: warn on invalid regex instead of failing 4Subject: [PATCH] From 0000000000000000000000000000000000000000 Mon Sep 17
5 00:00:00 2001 From: Benjamin Marzinski <bmarzins@redhat.com> Date: Mon, 6 Nov
6 2017 21:39:28 -0600 Subject: [PATCH] RH: warn on invalid regex instead of
7 failing
5 8
6multipath.conf used to allow "*" as a match everything regular expression, 9multipath.conf used to allow "*" as a match everything regular expression,
7instead of requiring ".*". Instead of erroring when the old style 10instead of requiring ".*". Instead of erroring when the old style
@@ -9,48 +12,56 @@ regular expressions are used, it should print a warning and convert
9them. 12them.
10 13
11Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> 14Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
15
16Upstream-Status: Pending
17
18update this patch to new version
19
20Signed-off-by: Changqing Li <changqing.li@windriver.com>
12--- 21---
13 libmultipath/dict.c | 27 +++++++++++++++++++++------ 22 libmultipath/dict.c | 29 ++++++++++++++++++++++-------
14 libmultipath/parser.c | 13 +++++++++++++ 23 libmultipath/parser.c | 13 +++++++++++++
15 libmultipath/parser.h | 1 + 24 libmultipath/parser.h | 2 +-
16 3 files changed, 35 insertions(+), 6 deletions(-) 25 3 files changed, 36 insertions(+), 8 deletions(-)
17 26
18diff --git a/libmultipath/dict.c b/libmultipath/dict.c 27diff --git a/libmultipath/dict.c b/libmultipath/dict.c
19index 7ad0f5a..ab808d6 100644 28index a81c051..0689763 100644
20--- a/libmultipath/dict.c 29--- a/libmultipath/dict.c
21+++ b/libmultipath/dict.c 30+++ b/libmultipath/dict.c
22@@ -55,6 +55,21 @@ set_str(vector strvec, void *ptr) 31@@ -59,6 +59,21 @@ set_str(vector strvec, void *ptr)
23 } 32 }
24 33
25 static int 34 static int
26+set_regex(vector strvec, void *ptr) 35+set_regex(vector strvec, void *ptr)
27+{ 36+{
28+ char **str_ptr = (char **)ptr; 37+ char **str_ptr = (char **)ptr;
29+ 38+
30+ if (*str_ptr) 39+ if (*str_ptr)
31+ FREE(*str_ptr); 40+ FREE(*str_ptr);
32+ *str_ptr = set_regex_value(strvec); 41+ *str_ptr = set_regex_value(strvec);
33+ 42+
34+ if (!*str_ptr) 43+ if (!*str_ptr)
35+ return 1; 44+ return 1;
36+ 45+
37+ return 0; 46+ return 0;
38+} 47+}
39+ 48+
40+static int 49+static int
41 set_yes_no(vector strvec, void *ptr) 50 set_yes_no(vector strvec, void *ptr)
42 { 51 {
43 char * buff; 52 char * buff;
44@@ -1271,7 +1286,7 @@ ble_ ## option ## _handler (struct config *conf, vector strvec) \ 53@@ -1346,8 +1361,8 @@ ble_ ## option ## _handler (struct config *conf, vector strvec) \
54 \
45 if (!conf->option) \ 55 if (!conf->option) \
46 return 1; \ 56 return 1; \
47 \ 57- \
48- buff = set_value(strvec); \ 58- buff = set_value(strvec); \
59+ \
49+ buff = set_regex_value(strvec); \ 60+ buff = set_regex_value(strvec); \
50 if (!buff) \ 61 if (!buff) \
51 return 1; \ 62 return 1; \
52 \ 63 \
53@@ -1287,7 +1302,7 @@ ble_ ## option ## _ ## name ## _handler (struct config *conf, vector strvec) \ 64@@ -1363,7 +1378,7 @@ ble_ ## option ## _ ## name ## _handler (struct config *conf, vector strvec) \
54 if (!conf->option) \ 65 if (!conf->option) \
55 return 1; \ 66 return 1; \
56 \ 67 \
@@ -59,7 +70,7 @@ index 7ad0f5a..ab808d6 100644
59 if (!buff) \ 70 if (!buff) \
60 return 1; \ 71 return 1; \
61 \ 72 \
62@@ -1388,16 +1403,16 @@ device_handler(struct config *conf, vector strvec) 73@@ -1466,16 +1481,16 @@ device_handler(struct config *conf, vector strvec)
63 return 0; 74 return 0;
64 } 75 }
65 76
@@ -81,37 +92,38 @@ index 7ad0f5a..ab808d6 100644
81 92
82 declare_hw_handler(hwhandler, set_str) 93 declare_hw_handler(hwhandler, set_str)
83diff --git a/libmultipath/parser.c b/libmultipath/parser.c 94diff --git a/libmultipath/parser.c b/libmultipath/parser.c
84index b8b7e0d..34b4ad2 100644 95index 92ef7cf..0e2cf49 100644
85--- a/libmultipath/parser.c 96--- a/libmultipath/parser.c
86+++ b/libmultipath/parser.c 97+++ b/libmultipath/parser.c
87@@ -380,6 +380,19 @@ set_value(vector strvec) 98@@ -384,6 +384,19 @@ set_value(vector strvec)
88 return alloc; 99 return alloc;
89 } 100 }
90 101
91+void * 102+void *
92+set_regex_value(vector strvec) 103+set_regex_value(vector strvec)
93+{ 104+{
94+ char *buff = set_value(strvec); 105+ char *buff = set_value(strvec);
95+ 106+
96+ if (buff && strcmp("*", buff) == 0) { 107+ if (buff && strcmp("*", buff) == 0) {
97+ condlog(0, "Invalid regular expression \"*\" in multipath.conf. Using \".*\""); 108+ condlog(0, "Invalid regular expression \"*\" in multipath.conf. Using \".*\"");
98+ FREE(buff); 109+ FREE(buff);
99+ return strdup(".*"); 110+ return strdup(".*");
100+ } 111+ }
101+ return buff; 112+ return buff;
102+} 113+}
103+ 114+
104 /* non-recursive configuration stream handler */ 115 /* non-recursive configuration stream handler */
105 static int kw_level = 0; 116 static int kw_level = 0;
106 117
107diff --git a/libmultipath/parser.h b/libmultipath/parser.h 118diff --git a/libmultipath/parser.h b/libmultipath/parser.h
108index 62906e9..b791705 100644 119index 62906e9..b6899fc 100644
109--- a/libmultipath/parser.h 120--- a/libmultipath/parser.h
110+++ b/libmultipath/parser.h 121+++ b/libmultipath/parser.h
111@@ -77,6 +77,7 @@ extern void dump_keywords(vector keydump, int level); 122@@ -76,7 +76,7 @@ extern int _install_keyword(vector keywords, char *string,
123 extern void dump_keywords(vector keydump, int level);
112 extern void free_keywords(vector keywords); 124 extern void free_keywords(vector keywords);
113 extern vector alloc_strvec(char *string); 125 extern vector alloc_strvec(char *string);
114 extern void *set_value(vector strvec); 126-extern void *set_value(vector strvec);
115+extern void *set_regex_value(vector strvec); 127+extern void *set_regex_value(vector strvec);
116 extern int process_file(struct config *conf, char *conf_file); 128 extern int process_file(struct config *conf, char *conf_file);
117 extern struct keyword * find_keyword(vector keywords, vector v, char * name); 129 extern struct keyword * find_keyword(vector keywords, vector v, char * name);