[OpenWrt-Devel] coova-chilli: fix compilation error with --enable-redir

Message ID CACkgH72SJoRgwjWSMjSyU54qijLK2nzuJvY5YdfC50Et-avUog@mail.gmail.com
State New
Headers show
Series
  • [OpenWrt-Devel] coova-chilli: fix compilation error with --enable-redir
Related show

Commit Message

Xabier Oneca -- xOneca Sept. 28, 2018, 12:05 p.m.
musl lacks `allocated` member on `struct re_pattern_buffer`
(https://fossies.org/dox/musl-1.1.20/structre__pattern__buffer.html).

Patch inspired by drkhosla @github.com/coova/coova-chilli issue #200
(https://github.com/coova/coova-chilli/issues/200#issuecomment-253497070)

Signed-off-by: Xabier Oneca <xoneca@gmail.com>
---
 .../300-fix-compile-with-enable-redirurl.patch     | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644
net/coova-chilli/patches/300-fix-compile-with-enable-redirurl.patch

+     {
+       if ((ret = regcomp(re, regex, REG_EXTENDED | REG_NOSUB)) != 0) {
+         char error[512];
--
1.9.1

Patch

From 356a46491329eb9f6f743c5c567cb99c791a02a5 Mon Sep 17 00:00:00 2001
From: Xabier Oneca <xoneca@gmail.com>
Date: Fri, 28 Sep 2018 11:16:57 +0200
Subject: [PATCH] coova-chilli: fix compilation error with --enable-redir

musl lacks `allocated` member on `struct re_pattern_buffer`
(https://fossies.org/dox/musl-1.1.20/structre__pattern__buffer.html).

Patch inspired by the one posted by drkhosla at github.com/coova/coova-chilli
issue #200
(https://github.com/coova/coova-chilli/issues/200#issuecomment-253497070).

Signed-off-by: Xabier Oneca <xoneca@gmail.com>
---
 .../300-fix-compile-with-enable-redirurl.patch     | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 net/coova-chilli/patches/300-fix-compile-with-enable-redirurl.patch

diff --git a/net/coova-chilli/patches/300-fix-compile-with-enable-redirurl.patch b/net/coova-chilli/patches/300-fix-compile-with-enable-redirurl.patch
new file mode 100644
index 0000000..b7ae041
--- /dev/null
+++ b/net/coova-chilli/patches/300-fix-compile-with-enable-redirurl.patch
@@ -0,0 +1,25 @@ 
+--- a/src/options.c
++++ b/src/options.c
+@@ -377,7 +377,7 @@ int options_fromfd(int fd, bstring bt) {
+ 
+ #ifdef ENABLE_CHILLIREDIR
+   for (i = 0; i < MAX_REGEX_PASS_THROUGHS; i++) {
+-#if defined (__FreeBSD__) || defined (__APPLE__) || defined (__OpenBSD__) || defined (__NetBSD__)
++#if defined (__linux__) || defined (__FreeBSD__) || defined (__APPLE__) || defined (__OpenBSD__) || defined (__NetBSD__)
+     regfree(&_options.regex_pass_throughs[i].re_host);
+     regfree(&_options.regex_pass_throughs[i].re_path);
+     regfree(&_options.regex_pass_throughs[i].re_qs);
+--- a/src/main-redir.c
++++ b/src/main-redir.c
+@@ -508,11 +508,6 @@ check_regex(regex_t *re, char *regex, ch
+   syslog(LOG_DEBUG, "Checking %s =~ %s", s, regex);
+ #endif
+ 
+-#if defined (__FreeBSD__) || defined (__APPLE__) || defined (__OpenBSD__) || defined (__NetBSD__)
+-  if (!re->re_g)
+-#else
+-    if (!re->allocated)
+-#endif
+     {
+       if ((ret = regcomp(re, regex, REG_EXTENDED | REG_NOSUB)) != 0) {
+         char error[512];
-- 
1.9.1