Browse Source

update patches

Karsten Böddeker 7 years ago
parent
commit
133181ca70

+ 2 - 11
patches/0001-fix-ubnt-model-detection.patch → patches/0001-fix-UBNT-model-detection.patch

@@ -1,16 +1,10 @@
 From: Karsten Böddeker <freifunk@kb-light.de>
 Date: Mon, 4 Apr 2016 17:02:55 +0200
-Subject: [PATCH] fix UBNT model detection
-
----
- .../openwrt/1000-fix-UBNT-XM-model-detection.patch | 74 ++++++++++++++++++++++
- targets/ar71xx-generic/profiles.mk                 | 15 +++--
- 2 files changed, 85 insertions(+), 4 deletions(-)
- create mode 100644 patches/openwrt/1000-fix-UBNT-XM-model-detection.patch
+Subject: fix UBNT model detection
 
 diff --git a/patches/openwrt/1000-fix-UBNT-XM-model-detection.patch b/patches/openwrt/1000-fix-UBNT-XM-model-detection.patch
 new file mode 100644
-index 0000000..79180b4
+index 0000000..0824058
 --- /dev/null
 +++ b/patches/openwrt/1000-fix-UBNT-XM-model-detection.patch
 @@ -0,0 +1,74 @@
@@ -116,6 +110,3 @@ index 4a63667..da178ea 100644
  $(eval $(call GluonModel,UBNT,ubnt-nano-m-xw,ubiquiti-nanostation-m-xw))
  $(eval $(call GluonModel,UBNT,ubnt-rocket-m-xw,ubiquiti-rocket-m-xw))
  $(eval $(call GluonModel,UBNT,ubnt-uap-pro,ubiquiti-unifi-ap-pro))
--- 
-2.1.4
-

+ 1 - 9
patches/0002-openwrt-patch-iw.patch

@@ -1,11 +1,6 @@
 From: Karsten Böddeker <freifunk@kb-light.de>
 Date: Sat, 23 Apr 2016 15:20:30 +0200
-Subject: [PATCH] openwrt: patch iw
-
----
- .../1001-iw-patch-200-reduce-size-patch.patch      | 23 ++++++++++++++++++++++
- 1 file changed, 23 insertions(+)
- create mode 100644 patches/openwrt/1001-iw-patch-200-reduce-size-patch.patch
+Subject: openwrt: patch iw
 
 diff --git a/patches/openwrt/1001-iw-patch-200-reduce-size-patch.patch b/patches/openwrt/1001-iw-patch-200-reduce-size-patch.patch
 new file mode 100644
@@ -36,6 +31,3 @@ index 0000000..09c978e
 + +	bitrate.o vendor.o
 +  OBJS += sections.o
 +  
--- 
-2.1.4
-

+ 0 - 45
patches/0003-scripts-add-function-needed_var_in_array-to-check_si.patch

@@ -1,45 +0,0 @@
-From: Karsten Böddeker <freifunk@kb-light.de>
-Date: Thu, 30 Jun 2016 21:40:28 +0200
-Subject: [PATCH] scripts: add function needed_var_in_array to
- check_site_lib.lua
-
-The function need_var_in_array(varname, array, required) checks weather a value of a variable (specified by its name) is included in an array.
-If the variable is a table or array, the function checks the value of each element against the given array.
----
- scripts/check_site_lib.lua | 23 +++++++++++++++++++++++
- 1 file changed, 23 insertions(+)
-
-diff --git a/scripts/check_site_lib.lua b/scripts/check_site_lib.lua
-index 766b94a..9d581e9 100644
---- a/scripts/check_site_lib.lua
-+++ b/scripts/check_site_lib.lua
-@@ -103,3 +103,26 @@ function need_string_array(varname, required)
-    return assert(pcall(need_array, varname, function(e) assert_type(e, 'string') end, required),
- 		 "site.conf error: expected `" .. varname .. "' to be a string array")
- end
-+
-+function need_var_in_array(varname, array, required)
-+   local var = loadvar(varname)
-+
-+   if required == false and var == nil then
-+      return nil
-+   end
-+
-+   function var_in_array(var, array)
-+      for _, v in ipairs(array) do
-+         if v == var then
-+            return true
-+         end
-+      end
-+      return false
-+   end
-+
-+   for _,v in pairs(var) do
-+      assert(var_in_array(v, array), "site.conf error: `" .. v .. "' is not a valid value for " .. varname)
-+   end
-+
-+   return var
-+end
--- 
-2.1.4
-

+ 65 - 0
patches/0003-scripts-add-functions-need_one_of-and-need_array_of-to-check_site_lib.lua.patch

@@ -0,0 +1,65 @@
+From: Karsten Böddeker <freifunk@kb-light.de>
+Date: Wed, 3 Aug 2016 10:50:24 +0200
+Subject: scripts: add functions need_one_of and need_array_of to check_site_lib.lua
+
+need_one_of(varname, array, required) checks weather the value of the specified variable is part of given array.
+need_array_of(varname, array, required) is similar to need_one_of() but assume that varname points to an array.
+
+diff --git a/scripts/check_site_lib.lua b/scripts/check_site_lib.lua
+index 766b94a..49a7f50 100644
+--- a/scripts/check_site_lib.lua
++++ b/scripts/check_site_lib.lua
+@@ -7,6 +7,27 @@ local function loadvar(varname)
+    end
+ end
+ 
++local function array_to_string(array)
++   local string = ''
++   for _, v in ipairs(array) do
++      if #string >= 1 then
++         string = string .. ', '
++      end
++      string = string .. v
++   end
++   return '[' .. string .. ']'
++end
++
++local function assert_one_of(var, array, msg)
++   for _, v in ipairs(array) do
++      if v == var then
++         return true
++      end
++   end
++
++   error(msg)
++end
++
+ local function assert_type(var, t, msg)
+    assert(type(var) == t, msg)
+ end
+@@ -99,7 +120,25 @@ function need_table(varname, subcheck, required)
+    return var
+ end
+ 
++function need_one_of(varname, array, required)
++   local var = loadvar(varname)
++
++   if required == false and var == nil then
++      return nil
++   end
++
++   assert_one_of(var, array, "site.conf error: expected `" .. varname .. "' to be one of given array: " .. array_to_string(array))
++
++   return var
++end
++
+ function need_string_array(varname, required)
+    return assert(pcall(need_array, varname, function(e) assert_type(e, 'string') end, required),
+ 		 "site.conf error: expected `" .. varname .. "' to be a string array")
+ end
++
++function need_array_of(varname, array, required)
++   local ok, var = pcall(need_array, varname, function(e) assert_one_of(e, array) end,required)
++   assert(ok, "site.conf error: expected `" .. varname .. "' to be a subset of given array: " .. array_to_string(array))
++   return var
++end

+ 13 - 22
patches/0004-gluon-core-make-wifi-rates-configurable-by-site.conf.patch

@@ -1,28 +1,22 @@
 From: Karsten Böddeker <freifunk@kb-light.de>
-Date: Fri, 1 Jul 2016 14:53:39 +0200
-Subject: [PATCH] gluon-core: make wifi rates configurable by site.conf
+Date: Wed, 3 Aug 2016 11:02:20 +0200
+Subject: gluon-core: make wifi rates configurable by site.conf
 
 and add documentation
----
- docs/site-example/site.conf                             |  8 ++++++++
- docs/user/site.rst                                      |  8 ++++++++
- package/gluon-core/check_site.lua                       |  8 ++++++++
- package/gluon-core/files/lib/gluon/upgrade/200-wireless | 12 ++++++++++++
- 4 files changed, 36 insertions(+)
 
 diff --git a/docs/site-example/site.conf b/docs/site-example/site.conf
-index b58f525..1f67aab 100644
+index b58f525..25624c3 100644
 --- a/docs/site-example/site.conf
 +++ b/docs/site-example/site.conf
 @@ -35,6 +35,14 @@
      -- Wireless channel.
      channel = 1,
  
-+    -- List of supported wifi rates (optional, implies basic_rate)
++    -- List of supported wifi rates (optional)
 +    -- Example removes 802.11b compatibility for better performance
 +    supported_rates = {6000, 9000, 12000, 18000, 24000, 36000, 48000, 54000},
 +
-+    -- List of basic wifi rates (optional)
++    -- List of basic wifi rates (optional, required if supported_rates is set)
 +    -- Example removes 802.11b compatibility for better performance
 +    basic_rate = {6000, 9000, 18000, 36000, 54000},
 +
@@ -30,7 +24,7 @@ index b58f525..1f67aab 100644
      ap = {
        ssid = 'entenhausen.freifunk.net',
 diff --git a/docs/user/site.rst b/docs/user/site.rst
-index b26a28a..1ba9b4a 100644
+index b26a28a..4af64b5 100644
 --- a/docs/user/site.rst
 +++ b/docs/user/site.rst
 @@ -95,6 +95,12 @@ wifi24 : optional
@@ -39,8 +33,8 @@ index b26a28a..1ba9b4a 100644
  
 +    Additionally it is possible to configure the ``supported_rates`` and ``basic_rate``
 +    of each radio. Both are optional, by default hostapd/driver dictate the rates.
-+    ``supported_rates`` implies ``basic_rate``, because ``basic_rate`` has to be a subset
-+    of ``supported_rates``.
++    If ``supported_rates`` is set, ``basic_rate`` is required, because ``basic_rate``
++    has to be a subset of ``supported_rates``.
 +    The example below disables 802.11b rates.
 +
      ``ap`` requires a single parameter, a string, named ``ssid`` which sets the
@@ -56,7 +50,7 @@ index b26a28a..1ba9b4a 100644
             ssid = 'entenhausen.freifunk.net',
           },
 diff --git a/package/gluon-core/check_site.lua b/package/gluon-core/check_site.lua
-index 1647d77..555360a 100644
+index 1647d77..2239271 100644
 --- a/package/gluon-core/check_site.lua
 +++ b/package/gluon-core/check_site.lua
 @@ -28,5 +28,13 @@ for _, config in ipairs({'wifi24', 'wifi5'}) do
@@ -64,12 +58,12 @@ index 1647d77..555360a 100644
  
      need_number(config .. '.channel')
 +
-+    local rates={1000, 2000, 5500, 6000, 9000, 11000, 12000, 18000, 24000, 36000, 48000, 54000}
-+    local supported_rates =  need_var_in_array(config .. '.supported_rates', rates, false)
++    local rates = {1000, 2000, 5500, 6000, 9000, 11000, 12000, 18000, 24000, 36000, 48000, 54000}
++    local supported_rates = need_array_of(config .. '.supported_rates', rates, false)
 +    if supported_rates then
-+      need_var_in_array(config .. '.basic_rate', supported_rates, true)
++      need_array_of(config .. '.basic_rate', supported_rates, true)
 +    else
-+      need_var_in_array(config .. '.basic_rate', rates, false)
++      need_array_of(config .. '.basic_rate', rates, false)
 +    end
    end
  end
@@ -96,6 +90,3 @@ index 5a98a70..d217428 100755
    end
  end
  
--- 
-2.1.4
-