Refresh 0001-libmultipath-update-3PARdata-builtin-config.patch

Add 0010-RH-warn-on-invalid-regex-instead-of-failing.patch
  * Change old-style multipath.conf regex "*" to a proper ".*" instead of
    failing
This commit is contained in:
Benjamin Marzinski 2017-11-07 13:05:41 -06:00
parent 21aef9ba0a
commit 5e7fb0583a
3 changed files with 131 additions and 2 deletions

View File

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 22 Jun 2017 15:49:06 -0500
Date: Mon, 26 Jun 2017 14:03:19 -0500
Subject: [PATCH] libmultipath: update 3PARdata builtin config
This updated config comes from hp.

View File

@ -0,0 +1,121 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Mon, 6 Nov 2017 21:39:28 -0600
Subject: [PATCH] RH: warn on invalid regex instead of failing
multipath.conf used to allow "*" as a match everything regular expression,
instead of requiring ".*". Instead of erroring when the old style
regular expressions are used, it should print a warning and convert
them.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/dict.c | 27 +++++++++++++++++++++------
libmultipath/parser.c | 13 +++++++++++++
libmultipath/parser.h | 1 +
3 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 82066f6..c68d6f1 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -51,6 +51,21 @@ set_str(vector strvec, void *ptr)
}
static int
+set_regex(vector strvec, void *ptr)
+{
+ char **str_ptr = (char **)ptr;
+
+ if (*str_ptr)
+ FREE(*str_ptr);
+ *str_ptr = set_regex_value(strvec);
+
+ if (!*str_ptr)
+ return 1;
+
+ return 0;
+}
+
+static int
set_yes_no(vector strvec, void *ptr)
{
char * buff;
@@ -1175,7 +1190,7 @@ ble_ ## option ## _handler (struct config *conf, vector strvec) \
if (!conf->option) \
return 1; \
\
- buff = set_value(strvec); \
+ buff = set_regex_value(strvec); \
if (!buff) \
return 1; \
\
@@ -1191,7 +1206,7 @@ ble_ ## option ## _ ## name ## _handler (struct config *conf, vector strvec) \
if (!conf->option) \
return 1; \
\
- buff = set_value(strvec); \
+ buff = set_regex_value(strvec); \
if (!buff) \
return 1; \
\
@@ -1286,16 +1301,16 @@ device_handler(struct config *conf, vector strvec)
return 0;
}
-declare_hw_handler(vendor, set_str)
+declare_hw_handler(vendor, set_regex)
declare_hw_snprint(vendor, print_str)
-declare_hw_handler(product, set_str)
+declare_hw_handler(product, set_regex)
declare_hw_snprint(product, print_str)
-declare_hw_handler(revision, set_str)
+declare_hw_handler(revision, set_regex)
declare_hw_snprint(revision, print_str)
-declare_hw_handler(bl_product, set_str)
+declare_hw_handler(bl_product, set_regex)
declare_hw_snprint(bl_product, print_str)
declare_hw_handler(hwhandler, set_str)
diff --git a/libmultipath/parser.c b/libmultipath/parser.c
index c47d891..74b4efe 100644
--- a/libmultipath/parser.c
+++ b/libmultipath/parser.c
@@ -346,6 +346,19 @@ set_value(vector strvec)
return alloc;
}
+void *
+set_regex_value(vector strvec)
+{
+ char *buff = set_value(strvec);
+
+ if (buff && strcmp("*", buff) == 0) {
+ condlog(0, "Invalid regular expression \"*\" in multipath.conf. Using \".*\"");
+ FREE(buff);
+ return strdup(".*");
+ }
+ return buff;
+}
+
/* non-recursive configuration stream handler */
static int kw_level = 0;
diff --git a/libmultipath/parser.h b/libmultipath/parser.h
index 519b805..96f40bd 100644
--- a/libmultipath/parser.h
+++ b/libmultipath/parser.h
@@ -73,6 +73,7 @@ extern void dump_keywords(vector keydump, int level);
extern void free_keywords(vector keywords);
extern vector alloc_strvec(char *string);
extern void *set_value(vector strvec);
+extern void *set_regex_value(vector strvec);
extern int process_file(struct config *conf, char *conf_file);
extern struct keyword * find_keyword(vector keywords, vector v, char * name);
int snprint_keyword(char *buff, int len, char *fmt, struct keyword *kw,
--
2.7.4

View File

@ -1,7 +1,7 @@
Summary: Tools to manage multipath devices using device-mapper
Name: device-mapper-multipath
Version: 0.7.1
Release: 7.git847cc43%{?dist}
Release: 8.git847cc43%{?dist}
License: GPL+
Group: System Environment/Base
URL: http://christophe.varoqui.free.fr/
@ -20,6 +20,7 @@ Patch0006: 0006-RH-use-rpm-optflags-if-present.patch
Patch0007: 0007-RH-add-mpathconf.patch
Patch0008: 0008-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch
Patch0009: 0009-RH-trigger-change-uevent-on-new-device-creation.patch
Patch0010: 0010-RH-warn-on-invalid-regex-instead-of-failing.patch
# runtime
Requires: %{name}-libs = %{version}-%{release}
@ -107,6 +108,7 @@ device-mapper-multipath's libdmmp C API library
%patch0007 -p1
%patch0008 -p1
%patch0009 -p1
%patch0010 -p1
cp %{SOURCE1} .
%build
@ -228,6 +230,12 @@ fi
%{_pkgconfdir}/libdmmp.pc
%changelog
* Tue Nov 7 2017 Benjamin Marzinski <bmarzins@redhat.com> 0.7.1-8.git847cc43
- Refresh 0001-libmultipath-update-3PARdata-builtin-config.patch
- Add 0010-RH-warn-on-invalid-regex-instead-of-failing.patch
* Change old-style multipath.conf regex "*" to a proper ".*" instead of
failing
* Wed Aug 2 2017 Benjamin Marzinski <bmarzins@redhat.com> 0.7.1-7.git847cc43
- Modify 0005-RH-don-t-start-without-a-config-file.patch
* Fix man page typos