[OpenWrt-Devel] [PATCH] ZRAM: enhacements including /tmp on ZRAM for Barrier Breaker

2014-10-22 Thread Tomasz Wasiak
Devices with less memory are still common so why limit ZRAM usage just to swap
when it could be very useful as for /tmp storage.

This patch changes 3 things:
 - sets default number of ZRAM devices to 2 (1st for /tmp, 2nd for swap)
 - adds ZRAM (default) support to procd's init (TMPFS is used when ZRAM is not
   available
 - changes zram-swap so it will use /dev/zram1 for 1st CPU, /dev/zram2 for 2nd
   and so on as /dev/zram0 is in use for /tmp.

Signed-off-by: Tomasz Wasiak 
---
 package/system/procd/patches/procd-support_for_tmp_on_zram.patch   |  
185 ++
 package/system/zram-swap/files/zram.init   |   
15 
 target/linux/generic/patches-3.10/998_zram_make_2_devices_by_default.patch |   
11 
 3 files changed, 203 insertions(+), 8 deletions(-)

--- a/package/system/procd/patches/procd-support_for_tmo_on_zram.patch
+++ b/package/system/procd/patches/procd-support_for_tmp_on_zram.patch
@@ -0,0 +1,185 @@
+--- a/initd/early.c
 b/initd/early.c
+@@ -12,34 +12,130 @@
+  * GNU General Public License for more details.
+  */
+ 
+-#include 
+-#include 
+-#include 
+-
+-#include 
++#include 
+ #include 
+-#include 
++#include 
+ #include 
++#include 
++#include 
++#include 
++#include 
++#include 
++#include 
++#include 
+ 
+ #include "../log.h"
+ #include "init.h"
+ 
++static long
++check_ramsize(void)
++{
++  FILE *fp;
++  char line[256];
++  char *key;
++  long val = 0;
++
++  fp = fopen("/proc/meminfo", "r");
++  if(fp == NULL)
++  {
++  ERROR("Can't open /proc/meminfo: %s\n", strerror(errno));
++  return errno;
++  }
++
++  while(fgets(line, sizeof(line), fp))
++  {
++  key = strtok(line, ":");
++  val = atol(strtok(NULL, " kB\n"));
++
++  if (!key || !val)
++  continue;
++
++  if (!strcasecmp(key, "MemTotal"))
++  break;
++  }
++
++  fclose(fp);
++
++  return val;
++}
++
++static int
++mount_zram_on_tmp(void)
++{
++  FILE *fp;
++  long zramsize = (check_ramsize() / 2);
++  pid_t pid;
++
++  if(!zramsize)
++  {
++  ERROR("Can't read size of RAM. Assuming 16 MB.\n");
++  zramsize = 8192;
++  }
++
++  fp = fopen("/sys/block/zram0/disksize", "r+");
++  if(fp == NULL)
++  {
++  ERROR("Can't open /sys/block/zram0/disksize: %s\n", 
strerror(errno));
++  return errno;
++  }
++
++  fprintf(fp, "%ld", (zramsize * 1024));
++
++  fclose(fp);
++
++  pid = fork();
++
++  if (!pid)
++  {
++  char *mkfs[] = { "/sbin/mke2fs", "-b", "4096", "-F", "-L", 
"TEMP", "-m", "0", "/dev/zram0", NULL };
++  int fd = open("/dev/null", O_RDWR);
++
++  if (fd > -1) {
++  dup2(fd, STDIN_FILENO);
++  dup2(fd, STDOUT_FILENO);
++  dup2(fd, STDERR_FILENO);
++  if (fd > STDERR_FILENO)
++  close(fd);
++  }
++
++  execvp(mkfs[0], mkfs);
++  ERROR("Can't exec /sbin/mke2fs\n");
++  exit(-1);
++  }
++
++  if (pid <= 0)
++  {
++  ERROR("Can't exec /sbin/mke2fs\n");
++  return -1;
++  } else {
++  waitpid(pid, NULL, 0);
++  }
++
++  if(mount("/dev/zram0", "/tmp", "ext2", MS_NOSUID | MS_NODEV | 
MS_NOATIME, "check=none,errors=continue,noquota") < 0)
++  {
++  ERROR("Can't mount /dev/zram0 on /tmp: %s\n", strerror(errno));
++  return errno;
++  }
++
++  LOG("Using up to %ld kB of RAM as ZRAM storage on /mnt\n", zramsize);
++  return 0;
++}
++
+ static void
+-early_mounts(void)
++mount_tmpfs_on_tmp(void)
+ {
+-  mount("proc", "/proc", "proc", MS_NOATIME, 0);
+-  mount("sysfs", "/sys", "sysfs", MS_NOATIME, 0);
++  char line[256];
++  long tmpfssize = (check_ramsize() / 2);
+ 
+-  mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, 
NULL);
+-  mkdir("/tmp/run", 0777);
+-  mkdir("/tmp/lock", 0777);
+-  mkdir("/tmp/state", 0777);
+-  symlink("/tmp", "/var");
++  if(!tmpfssize)
++  {
++  ERROR("Can't read size of RAM. Assuming 16 MB.\n");
++  tmpfssize = 8192;
++  }
+ 
+-  mount("tmpfs", "/dev", "tmpfs", MS_NOATIME, "mode=0755,size=512K");
+-  mkdir("/dev/shm", 0755);
+-  mkdir("/dev/pts", 0755);
+-  mount("devpts", "/dev/pts", "devpts", MS_NOATIME, "mode=600");
++  snprintf(line, 256, "size=%ldk", tmpfssize);
++  mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, 
line);
++  LOG("Using up to %ld kB of RAM as TMPFS storage on /tmp\n", tmpfssize);
+ }
+ 
+ static void
+@@ -50,6 +146,25 @@ early_dev(void)
+ }
+ 
+ static void
++early_mounts(void)
++{
++  mount("proc", "/proc", "proc", MS_NOATIME, 0);
++  mount("sysfs", "/sys

[OpenWrt-Devel] [PATCH] [package] util-linux-dmesg: Add missing install section

2014-10-22 Thread Tomasz Wasiak
Package util-linux-dmesg is broken (at least) in Barrier Breaker git repo
as you can select it within menuconfig, it will compile (as a part of
util-linux) but it will not install as install section is missing from
package Makefile.

Signed-off-by: Tomasz Wasiak 
---
 Makefile |6 ++
 1 file changed, 6 insertions(+)

--- a/package/utils/util-linux/Makefile
+++ b/package/utils/util-linux/Makefile
@@ -152,6 +152,7 @@ endef
 define Package/dmesg
 $(call Package/util-linux/Default)
   TITLE:=print or control the kernel ring buffer
+  DEPENDS:= +librt
 endef
 
 define Package/dmesg/description
@@ -438,6 +439,11 @@ define Package/cfdisk/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/cfdisk $(1)/usr/sbin/
 endef
 
+define Package/dmesg/install
+   $(INSTALL_DIR) $(1)/usr/sbin
+   $(INSTALL_BIN) $(PKG_BUILD_DIR)/dmesg $(1)/usr/sbin/
+endef
+
 define Package/fdisk/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/fdisk $(1)/usr/sbin/
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] [kernel generic] configuration: Better handling of LIB80211 configuration

2014-10-22 Thread Tomasz Wasiak
OpenWRT patch 255-lib80211_kconfig_hacks gives user possiblity to select
LIB80211 dependant settings (LIB80211_CRYPT_*) without having LIB80211
selected which is wrong.
My patch changes OpenWRT patch so LIB80211 is vissible and all
LIB80211_CRYPT_* options selects LIB80211 automatically.

Signed-off-by: Tomasz Wasiak 
---
 255-lib80211_kconfig_hacks.patch |   14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

--- a/target/linux/generic/patches-3.10/255-lib80211_kconfig_hacks.patch
+++ b/target/linux/generic/patches-3.10/255-lib80211_kconfig_hacks.patch
@@ -1,19 +1,31 @@
 --- a/net/wireless/Kconfig
 +++ b/net/wireless/Kconfig
-@@ -149,13 +149,13 @@ config LIB80211
+@@ -140,7 +140,7 @@ config CFG80211_WEXT
+ extensions with cfg80211-based drivers.
+ 
+ config LIB80211
+-  tristate
++  tristate "LIB80211"
+   default n
+   help
+ This options enables a library of common routines used
+@@ -149,13 +149,16 @@ config LIB80211
  Drivers should select this themselves if needed.
  
  config LIB80211_CRYPT_WEP
 -  tristate
 +  tristate "LIB80211_CRYPT_WEP"
++  select LIB80211
  
  config LIB80211_CRYPT_CCMP
 -  tristate
 +  tristate "LIB80211_CRYPT_CCMP"
++  select LIB80211
  
  config LIB80211_CRYPT_TKIP
 -  tristate
 +  tristate "LIB80211_CRYPT_TKIP"
++  select LIB80211
  
  config LIB80211_DEBUG
bool "lib80211 debugging messages"
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ZRAM: enhacements including /tmp on ZRAM for Barrier Breaker

2014-10-22 Thread John Crispin
Hi,

please send patches directly against the procd git tree.

John

On 22/10/2014 09:20, Tomasz Wasiak wrote:
> Devices with less memory are still common so why limit ZRAM usage
> just to swap when it could be very useful as for /tmp storage.
> 
> This patch changes 3 things: - sets default number of ZRAM devices
> to 2 (1st for /tmp, 2nd for swap) - adds ZRAM (default) support to
> procd's init (TMPFS is used when ZRAM is not available - changes
> zram-swap so it will use /dev/zram1 for 1st CPU, /dev/zram2 for
> 2nd and so on as /dev/zram0 is in use for /tmp.
> 
> Signed-off-by: Tomasz Wasiak  --- 
> package/system/procd/patches/procd-support_for_tmp_on_zram.patch
> |  185 ++ package/system/zram-swap/files/zram.init
> |   15 
> target/linux/generic/patches-3.10/998_zram_make_2_devices_by_default.patch
> |   11 3 files changed, 203 insertions(+), 8 deletions(-)
> 
> ---
> a/package/system/procd/patches/procd-support_for_tmo_on_zram.patch 
> +++
> b/package/system/procd/patches/procd-support_for_tmp_on_zram.patch 
> @@ -0,0 +1,185 @@ +--- a/initd/early.c  b/initd/early.c +@@
> -12,34 +12,130 @@ +  * GNU General Public License for more
> details. +  */ + +-#include  +-#include  
> +-#include  +- +-#include  ++#include
>  + #include  +-#include  ++#include
>  + #include  ++#include  ++#include
>  ++#include  ++#include  
> ++#include  ++#include  ++#include
>  + + #include "../log.h" + #include "init.h" + ++static
> long ++check_ramsize(void) ++{ ++ FILE *fp; ++char line[256]; ++
> char *key; ++ long val = 0; ++ ++ fp = fopen("/proc/meminfo",
> "r"); ++  if(fp == NULL) ++   { ++ERROR("Can't open 
> /proc/meminfo:
> %s\n", strerror(errno)); ++   return errno; ++} ++ ++
> while(fgets(line, sizeof(line), fp)) ++   { ++key = 
> strtok(line,
> ":"); ++  val = atol(strtok(NULL, " kB\n")); ++ ++
> if (!key ||
> !val) ++  continue; ++ ++ if (!strcasecmp(key, 
> "MemTotal")) ++
> break; ++ } ++ ++ fclose(fp); ++ ++   return val; ++} ++ ++static
> int ++mount_zram_on_tmp(void) ++{ ++  FILE *fp; ++long zramsize =
> (check_ramsize() / 2); ++ pid_t pid; ++ ++if(!zramsize) ++
> { ++
> ERROR("Can't read size of RAM. Assuming 16 MB.\n"); ++
> zramsize =
> 8192; ++  } ++ ++ fp = fopen("/sys/block/zram0/disksize", "r+"); ++
> if(fp == NULL) ++ { ++ERROR("Can't open
> /sys/block/zram0/disksize: %s\n", strerror(errno)); ++return
> errno; ++ } ++ ++ fprintf(fp, "%ld", (zramsize * 1024)); ++ ++
> fclose(fp); ++ ++ pid = fork(); ++ ++ if (!pid) ++{ ++
> char
> *mkfs[] = { "/sbin/mke2fs", "-b", "4096", "-F", "-L", "TEMP", "-m",
> "0", "/dev/zram0", NULL }; ++ int fd = open("/dev/null", O_RDWR); 
> ++ ++ if (fd > -1) { ++   dup2(fd, STDIN_FILENO); 
> ++  dup2(fd,
> STDOUT_FILENO); ++dup2(fd, STDERR_FILENO); ++ 
> if (fd >
> STDERR_FILENO) ++ close(fd); ++   } ++ ++ 
> execvp(mkfs[0],
> mkfs); ++ ERROR("Can't exec /sbin/mke2fs\n"); ++  
> exit(-1); ++} 
> ++ ++ if (pid <= 0) ++{ ++ERROR("Can't exec 
> /sbin/mke2fs\n"); ++
> return -1; ++ } else { ++ waitpid(pid, NULL, 0); ++   } ++ ++
> if(mount("/dev/zram0", "/tmp", "ext2", MS_NOSUID | MS_NODEV |
> MS_NOATIME, "check=none,errors=continue,noquota") < 0) ++ { ++
> ERROR("Can't mount /dev/zram0 on /tmp: %s\n", strerror(errno)); ++
> return errno; ++  } ++ ++ LOG("Using up to %ld kB of RAM as ZRAM
> storage on /mnt\n", zramsize); ++ return 0; ++} ++ + static void 
> +-early_mounts(void) ++mount_tmpfs_on_tmp(void) + { +-
> mount("proc", "/proc", "proc", MS_NOATIME, 0); +- mount("sysfs",
> "/sys", "sysfs", MS_NOATIME, 0); ++   char line[256]; ++  long
> tmpfssize = (check_ramsize() / 2); + +-   mount("tmpfs", "/tmp",
> "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, NULL); +-
> mkdir("/tmp/run", 0777); +-   mkdir("/tmp/lock", 0777); +-
> mkdir("/tmp/state", 0777); +- symlink("/tmp", "/var"); ++
> if(!tmpfssize) ++ { ++ERROR("Can't read size of RAM. Assuming 
> 16
> MB.\n"); ++   tmpfssize = 8192; ++} + +-  mount("tmpfs", "/dev",
> "tmpfs", MS_NOATIME, "mode=0755,size=512K"); +-   mkdir("/dev/shm",
> 0755); +- mkdir("/dev/pts", 0755); +- mount("devpts", "/dev/pts",
> "devpts", MS_NOATIME, "mode=600"); ++ snprintf(line, 256,
> "size=%ldk", tmpfssize); ++   mount("tmpfs", "/tmp", "tmpfs",
> MS_NOSUID | MS_NODEV | MS_NOATIME, line); ++  LOG("Using up to %ld
> kB of RAM as TMPFS storage on /tmp\n", tmpfssize); + } + + static
> void +@@ -50,6 +146,25 @@ early_dev(void) + } + + static void 
> ++early_mounts(void) ++{ ++   mount("proc", "/proc", "proc",
> MS_NOATIME, 0); ++mount("sysfs", "/

Re: [OpenWrt-Devel] Lots of missing packages!

2014-10-22 Thread valent.turko...@gmail.com
Thanks!

I guess I'm used to doing it the old way and usually documentation is
quite lagging and I usually update old info on the wiki all the
time... Thanks once more!

On Sat, Oct 18, 2014 at 10:30 PM, Matthias Strubel
 wrote:
> On 10/18/2014 08:45 PM, valent.turko...@gmail.com wrote:
>> On Wed, Aug 20, 2014 at 3:03 PM, Steven Barth  wrote:
>>> Please see https://forum.openwrt.org/viewtopic.php?id=52219
>>>
>>
>>
>> Because of this decission ImageBuilder is now completely useless in
>> Barrier Breaker 14.07. I tried building new image with few extra
>> packages but they aren't included in ImageBuilder archive, and I got
>> this message:
>>
>> Collected errors:
>>  * opkg_install_cmd: Cannot install package nano.
>>  * opkg_install_cmd: Cannot install package netcat.
>>  * opkg_install_cmd: Cannot install package openvpn.
>>  * opkg_install_cmd: Cannot install package tmux.
>>
>> So you are telling us thate tere are no maintainers for nano, netcat,
>> openvpn and tmux packages and that is why you remoded them from
>> ImageBuilder? Are these packages broken or just unmaintained? If they
>> aren't broken please include them back into ImageBuilder.
>> ___
>> openwrt-devel mailing list
>> openwrt-devel@lists.openwrt.org
>> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>>
>
> Hi,
>
> I think you can add those additional "repositories" to the repository.conf in 
> the extracted ImageBuilder folder.
> For BB, this should look like:
>
> src/gz barrier_breaker_base 
> http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/base
> src/gz barrier_breaker_luci 
> http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/luci
> src/gz barrier_breaker_management 
> http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/management
> src/gz barrier_breaker_oldpackages 
> http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/oldpackages
> src/gz barrier_breaker_packages 
> http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/packages
> src/gz barrier_breaker_routing 
> http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/routing
> src/gz barrier_breaker_telephony 
> http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/telephony
>
> Then, the build tool / opkg starts to lookup the requested packages in the 
> other repositories and fetches them automatically.
>
> BTW: That is already documented in: 
> http://wiki.openwrt.org/doc/howto/obtain.firmware.generate#usage
>
>
> Hope that helps,
> best regards
>
> Matthias
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ZRAM: enhacements including /tmp on ZRAM for Barrier Breaker

2014-10-22 Thread Tomasz Wasiak
Hello,

Here you are (of course it is just 1/3 of the original patch).
---
diff --git a/initd/early.c b/initd/early.c
index a9f6afb..b4a375f 100644
--- a/initd/early.c
+++ b/initd/early.c
@@ -12,34 +12,130 @@
  * GNU General Public License for more details.
  */
 
-#include 
-#include 
-#include 
-
-#include 
+#include 
 #include 
-#include 
+#include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #include "../log.h"
 #include "init.h"
 
+static long
+check_ramsize(void)
+{
+   FILE *fp;
+   char line[256];
+   char *key;
+   long val = 0;
+
+   fp = fopen("/proc/meminfo", "r");
+   if(fp == NULL)
+   {
+   ERROR("Can't open /proc/meminfo: %s\n", strerror(errno));
+   return errno;
+   }
+
+   while(fgets(line, sizeof(line), fp))
+   {
+   key = strtok(line, ":");
+   val = atol(strtok(NULL, " kB\n"));
+
+   if (!key || !val)
+   continue;
+
+   if (!strcasecmp(key, "MemTotal"))
+   break;
+   }
+
+   fclose(fp);
+
+   return val;
+}
+
+static int
+mount_zram_on_tmp(void)
+{
+   FILE *fp;
+   long zramsize = (check_ramsize() / 2);
+   pid_t pid;
+
+   if(!zramsize)
+   {
+   ERROR("Can't read size of RAM. Assuming 16 MB.\n");
+   zramsize = 8192;
+   }
+
+   fp = fopen("/sys/block/zram0/disksize", "r+");
+   if(fp == NULL)
+   {
+   ERROR("Can't open /sys/block/zram0/disksize: %s\n", 
strerror(errno));
+   return errno;
+   }
+
+   fprintf(fp, "%ld", (zramsize * 1024));
+
+   fclose(fp);
+
+   pid = fork();
+
+   if (!pid)
+   {
+   char *mkfs[] = { "/sbin/mke2fs", "-b", "4096", "-F", "-L", 
"TEMP", "-m", "0", "/dev/zram0", NULL };
+   int fd = open("/dev/null", O_RDWR);
+
+   if (fd > -1) {
+   dup2(fd, STDIN_FILENO);
+   dup2(fd, STDOUT_FILENO);
+   dup2(fd, STDERR_FILENO);
+   if (fd > STDERR_FILENO)
+   close(fd);
+   }
+
+   execvp(mkfs[0], mkfs);
+   ERROR("Can't exec /sbin/mke2fs\n");
+   exit(-1);
+   }
+
+   if (pid <= 0)
+   {
+   ERROR("Can't exec /sbin/mke2fs\n");
+   return -1;
+   } else {
+   waitpid(pid, NULL, 0);
+   }
+
+   if(mount("/dev/zram0", "/tmp", "ext2", MS_NOSUID | MS_NODEV | 
MS_NOATIME, "check=none,errors=continue,noquota") < 0)
+   {
+   ERROR("Can't mount /dev/zram0 on /tmp: %s\n", strerror(errno));
+   return errno;
+   }
+
+   LOG("Using up to %ld kB of RAM as ZRAM storage on /mnt\n", zramsize);
+   return 0;
+}
+
 static void
-early_mounts(void)
+mount_tmpfs_on_tmp(void)
 {
-   mount("proc", "/proc", "proc", MS_NOATIME, 0);
-   mount("sysfs", "/sys", "sysfs", MS_NOATIME, 0);
+   char line[256];
+   long tmpfssize = (check_ramsize() / 2);
 
-   mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, 
NULL);
-   mkdir("/tmp/run", 0777);
-   mkdir("/tmp/lock", 0777);
-   mkdir("/tmp/state", 0777);
-   symlink("/tmp", "/var");
+   if(!tmpfssize)
+   {
+   ERROR("Can't read size of RAM. Assuming 16 MB.\n");
+   tmpfssize = 8192;
+   }
 
-   mount("tmpfs", "/dev", "tmpfs", MS_NOATIME, "mode=0755,size=512K");
-   mkdir("/dev/shm", 0755);
-   mkdir("/dev/pts", 0755);
-   mount("devpts", "/dev/pts", "devpts", MS_NOATIME, "mode=600");
+   snprintf(line, 256, "size=%ldk", tmpfssize);
+   mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, 
line);
+   LOG("Using up to %ld kB of RAM as TMPFS storage on /tmp\n", tmpfssize);
 }
 
 static void
@@ -50,6 +146,25 @@ early_dev(void)
 }
 
 static void
+early_mounts(void)
+{
+   mount("proc", "/proc", "proc", MS_NOATIME, 0);
+   mount("sysfs", "/sys", "sysfs", MS_NOATIME, 0);
+   mount("tmpfs", "/dev", "tmpfs", MS_NOATIME, "mode=0755,size=512K");
+   mkdir("/dev/shm", 0755);
+   mkdir("/dev/pts", 0755);
+   mount("devpts", "/dev/pts", "devpts", MS_NOATIME, "mode=600");
+   early_dev();
+
+   if(mount_zram_on_tmp() !=0)
+   mount_tmpfs_on_tmp();
+   mkdir("/tmp/run", 0777);
+   mkdir("/tmp/lock", 0777);
+   mkdir("/tmp/state", 0777);
+   symlink("/tmp", "/var");
+}
+
+static void
 early_console(const char *dev)
 {
struct stat s;
@@ -89,7 +204,6 @@ early(void)
return;
 
early_mounts();
-   early_dev();
early_env();
early_console("/dev/console");
 


W dniu 22.10.2014 o 09:38, John Crispin pisze:
> Hi,
> 
> please send patches directly against the procd git tree.
> 
>   John
> 
> On 22/10/2014 09:20, Tomasz Wasia

[OpenWrt-Devel] mpcC85xx

2014-10-22 Thread Klaus Maus

Hi,

I am about to buy a TP-Link WDR4900 because of its powerful NAT 
throughput (https://forum.openwrt.org/viewtopic.php?pid=244167#p244167)


Some say that this router with his rather uncommon platform mpcC85xx 
has been abandoned. I'm not sure about this.


Could you clarify the state of the future support this router or SoC 
will have from your team? I won't buy it if it doesn't participate in 
further development of OpenWrt.


Thank you in advance.

Klaus

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] mpcC85xx

2014-10-22 Thread Bastian Bittorf
* Klaus Maus  [22.10.2014 10:57]:
> Could you clarify the state of the future support this router or SoC

i have some (~50) and the german Telekom uses the platform in the
trains, so i bet somebody will take core of it 8-) and it's FOSS
and ath9k based, so you will not totally loose the control.

bye, bastian
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] [kernel] update 3.10.49 to 3.10.58

2014-10-22 Thread Bastian Bittorf
kernel: update 3.10.49 to 3.10.58 (released 2014-oct-15)

All platforms which are using 3.10.x at the moment are upgraded.

Changelogs:
https://www.kernel.org/pub/linux/kernel/v3.x/ChangeLog-3.10.50
https://www.kernel.org/pub/linux/kernel/v3.x/ChangeLog-3.10.51
https://www.kernel.org/pub/linux/kernel/v3.x/ChangeLog-3.10.52
https://www.kernel.org/pub/linux/kernel/v3.x/ChangeLog-3.10.53
https://www.kernel.org/pub/linux/kernel/v3.x/ChangeLog-3.10.54
https://www.kernel.org/pub/linux/kernel/v3.x/ChangeLog-3.10.55
https://www.kernel.org/pub/linux/kernel/v3.x/ChangeLog-3.10.56
https://www.kernel.org/pub/linux/kernel/v3.x/ChangeLog-3.10.57
https://www.kernel.org/pub/linux/kernel/v3.x/ChangeLog-3.10.58

A new symbol 'X86_16BIT' appeared in 3.10.52 with commit 
34273f41d57ee8d854dcd2a1d754cbb546cb548f
("x86-espfix-make-it-possible-to-disable-16-bit-support.patch")
I defaults to 'unset', but it's worth a discussion to enable it
("turn off support for any 16-bit software").

Also removed the patch 0db3db45f5bd6df4bdc03bbd5dec672e16164c4e
("fix build failure on memcpy() in decompress.c")
and is obsolete by commit 29593fd5a8149462ed6fad0d522234facdaee6c8 upstream.
included in kernel 3.10.56

compile tested on all platforms with:
make tools/install
make toolchain/install
make target/linux/compile

user@box:~/user/openwrt$ cat /tmp/log.txt
[Wed Oct 22 00:36:02 CEST 2014] ./smoketest.sh: ar71xx - OK
[Wed Oct 22 00:53:22 CEST 2014] ./smoketest.sh: ar7 - OK
[Wed Oct 22 01:08:27 CEST 2014] ./smoketest.sh: au1000 - OK
[Wed Oct 22 01:21:43 CEST 2014] ./smoketest.sh: avr32 - OK
[Wed Oct 22 01:37:47 CEST 2014] ./smoketest.sh: cns21xx - OK
[Wed Oct 22 01:52:05 CEST 2014] ./smoketest.sh: cns3xxx - OK
[Wed Oct 22 02:10:23 CEST 2014] ./smoketest.sh: gemini - OK
[Wed Oct 22 02:29:07 CEST 2014] ./smoketest.sh: ixp4xx - OK
[Wed Oct 22 02:44:01 CEST 2014] ./smoketest.sh: malta - OK
[Wed Oct 22 02:55:57 CEST 2014] ./smoketest.sh: mpc85xx - OK
[Wed Oct 22 03:07:56 CEST 2014] ./smoketest.sh: orion - OK
[Wed Oct 22 03:24:30 CEST 2014] ./smoketest.sh: ppc40x - OK
[Wed Oct 22 03:40:19 CEST 2014] ./smoketest.sh: ppc44x - OK
[Wed Oct 22 03:55:29 CEST 2014] ./smoketest.sh: realview - OK
[Wed Oct 22 04:09:47 CEST 2014] ./smoketest.sh: sparc - OK
[Wed Oct 22 04:23:37 CEST 2014] ./smoketest.sh: x86 - OK
[Wed Oct 22 04:35:56 CEST 2014] ./smoketest.sh: xburst - OK

run tested on x86, au1000, ar71xx, mpc85xx and brcm47xx

Signed-off-by: Bastian Bittorf 
---
 include/kernel-version.mk  |2 +-
 target/linux/ar7/Makefile  |2 +-
 target/linux/ar71xx/Makefile   |2 +-
 target/linux/au1000/Makefile   |2 +-
 target/linux/avr32/Makefile|2 +-
 target/linux/cns21xx/Makefile  |2 +-
 target/linux/cns3xxx/Makefile  |2 +-
 target/linux/gemini/Makefile   |2 +-
 target/linux/generic/config-3.10   |1 +
 .../062-mips_decompressor_build_fix.patch  |   66 
 target/linux/ixp4xx/Makefile   |2 +-
 target/linux/malta/Makefile|2 +-
 target/linux/mpc85xx/Makefile  |2 +-
 target/linux/orion/Makefile|2 +-
 target/linux/ppc40x/Makefile   |2 +-
 target/linux/ppc44x/Makefile   |2 +-
 target/linux/realview/Makefile |2 +-
 target/linux/sparc/Makefile|2 +-
 target/linux/x86/Makefile  |2 +-
 target/linux/xburst/Makefile   |2 +-
 20 files changed, 19 insertions(+), 84 deletions(-)
 delete mode 100644 
target/linux/generic/patches-3.10/062-mips_decompressor_build_fix.patch

diff --git a/include/kernel-version.mk b/include/kernel-version.mk
index 3afe953..4eb6179 100644
--- a/include/kernel-version.mk
+++ b/include/kernel-version.mk
@@ -8,7 +8,7 @@ endif
 ifeq ($(LINUX_VERSION),3.8.13)
   LINUX_KERNEL_MD5SUM:=2af19d06cd47ec459519159cdd10542d
 endif
-ifeq ($(LINUX_VERSION),3.10.49)
+ifeq ($(LINUX_VERSION),3.10.58)
   LINUX_KERNEL_MD5SUM:=9774e12764e740d49c80eda77d0ef3eb
 endif
 ifeq ($(LINUX_VERSION),3.13.7)
diff --git a/target/linux/ar7/Makefile b/target/linux/ar7/Makefile
index 3f40e57..d8c98e9 100644
--- a/target/linux/ar7/Makefile
+++ b/target/linux/ar7/Makefile
@@ -13,7 +13,7 @@ FEATURES:=squashfs atm low_mem
 MAINTAINER:=Florian Fainelli 
 SUBTARGETS:=generic ac49x
 
-LINUX_VERSION:=3.10.49
+LINUX_VERSION:=3.10.58
 
 include $(INCLUDE_DIR)/target.mk
 
diff --git a/target/linux/ar71xx/Makefile b/target/linux/ar71xx/Makefile
index 1b40074..0bf1ed1 100644
--- a/target/linux/ar71xx/Makefile
+++ b/target/linux/ar71xx/Makefile
@@ -13,7 +13,7 @@ FEATURES:=mips16
 CPU_TYPE=34kc
 SUBTARGETS:=generic nand mikrotik
 
-LINUX_VERSION:=3.10.49
+LINUX_VERSION:=3.10.58
 
 include $(INCLUDE_DIR)/target.mk

Re: [OpenWrt-Devel] [PATCH] ZRAM: enhacements including /tmp on ZRAM for Barrier Breaker

2014-10-22 Thread John Crispin
Hi,

a few comments inline. i am not sure if we want this inside procd
directly. maybe we should put this into fstools and then call that code
from early init. i need to think about that before i can make a decision.

John



On 22/10/2014 10:30, Tomasz Wasiak wrote:
> Hello,
> 
> Here you are (of course it is just 1/3 of the original patch).
> ---
> diff --git a/initd/early.c b/initd/early.c
> index a9f6afb..b4a375f 100644
> --- a/initd/early.c
> +++ b/initd/early.c
> @@ -12,34 +12,130 @@
>   * GNU General Public License for more details.
>   */
>  
> -#include 
> -#include 
> -#include 
> -
> -#include 
> +#include 
>  #include 
> -#include 
> +#include 
>  #include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
>  
>  #include "../log.h"
>  #include "init.h"
>  
> +static long
> +check_ramsize(void)
> +{
> + FILE *fp;
> + char line[256];
> + char *key;
> + long val = 0;
> +
> + fp = fopen("/proc/meminfo", "r");
> + if(fp == NULL)
> + {

please use this coding style ->

if (fp == NULL) {

}


> + ERROR("Can't open /proc/meminfo: %s\n", strerror(errno));
> + return errno;
> + }
> +
> + while(fgets(line, sizeof(line), fp))
> + {

and here aswell

while () {

}

> + key = strtok(line, ":");
> + val = atol(strtok(NULL, " kB\n"));

what happens if strtok return NULL ?

> +
> + if (!key || !val)
> + continue;
> +
> + if (!strcasecmp(key, "MemTotal"))
> + break;
> + }
> +
> + fclose(fp);
> +
> + return val;
> +}
> +
> +static int
> +mount_zram_on_tmp(void)
> +{
> + FILE *fp;
> + long zramsize = (check_ramsize() / 2);

where does the /2 come from ? is this just "a good value to use" or is
there a technical reason that is must always be /2 and not /X

> + pid_t pid;
> +
> + if(!zramsize)
> + {
> + ERROR("Can't read size of RAM. Assuming 16 MB.\n");
> + zramsize = 8192;

dangerous, if the memory was not detected properly we have mayor issues
and should not do any magic with the memory. in this case we should just
continue without zram

> + }
> +
> + fp = fopen("/sys/block/zram0/disksize", "r+");
> + if(fp == NULL)
> + {
> + ERROR("Can't open /sys/block/zram0/disksize: %s\n", 
> strerror(errno));
> + return errno;
> + }
> +
> + fprintf(fp, "%ld", (zramsize * 1024));
> +
> + fclose(fp);
> +
> + pid = fork();
> +
> + if (!pid)
> + {
> + char *mkfs[] = { "/sbin/mke2fs", "-b", "4096", "-F", "-L", 
> "TEMP", "-m", "0", "/dev/zram0", NULL };
> + int fd = open("/dev/null", O_RDWR);
> +
> + if (fd > -1) {
> + dup2(fd, STDIN_FILENO);
> + dup2(fd, STDOUT_FILENO);
> + dup2(fd, STDERR_FILENO);
> + if (fd > STDERR_FILENO)
> + close(fd);
> + }
> +
> + execvp(mkfs[0], mkfs);
> + ERROR("Can't exec /sbin/mke2fs\n");
> + exit(-1);
> + }
> +
> + if (pid <= 0)
> + {
> + ERROR("Can't exec /sbin/mke2fs\n");
> + return -1;
> + } else {
> + waitpid(pid, NULL, 0);
> + }
> +
> + if(mount("/dev/zram0", "/tmp", "ext2", MS_NOSUID | MS_NODEV | 
> MS_NOATIME, "check=none,errors=continue,noquota") < 0)
> + {
> + ERROR("Can't mount /dev/zram0 on /tmp: %s\n", strerror(errno));
> + return errno;
> + }
> +
> + LOG("Using up to %ld kB of RAM as ZRAM storage on /mnt\n", zramsize);
> + return 0;
> +}
> +
>  static void
> -early_mounts(void)
> +mount_tmpfs_on_tmp(void)
>  {
> - mount("proc", "/proc", "proc", MS_NOATIME, 0);
> - mount("sysfs", "/sys", "sysfs", MS_NOATIME, 0);
> + char line[256];
> + long tmpfssize = (check_ramsize() / 2);

same here

>  
> - mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, 
> NULL);
> - mkdir("/tmp/run", 0777);
> - mkdir("/tmp/lock", 0777);
> - mkdir("/tmp/state", 0777);
> - symlink("/tmp", "/var");
> + if(!tmpfssize)
> + {
> + ERROR("Can't read size of RAM. Assuming 16 MB.\n");
> + tmpfssize = 8192;

same here

> + }
>  
> - mount("tmpfs", "/dev", "tmpfs", MS_NOATIME, "mode=0755,size=512K");
> - mkdir("/dev/shm", 0755);
> - mkdir("/dev/pts", 0755);
> - mount("devpts", "/dev/pts", "devpts", MS_NOATIME, "mode=600");
> + snprintf(line, 256, "size=%ldk", tmpfssize);
> + mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, 
> line);
> + LOG("Using up to %ld kB of RAM as TMPFS storage on /tmp\n", tmpfssize);
>  }
>  
>  static void
> @@ -50,6 +146,25 @@ early_dev(void)
>  }
>  
>  static void
> +early_mounts(void)
> +{
> + mount("proc", "/proc", "proc", MS_NOATIME, 0);
> + mount("sysf

[OpenWrt-Devel] [PATCH 2/3] netifd: Apply interface metric on subnet routes when reloading ip

2014-10-22 Thread Hans Dedecker
Signed-off-by: Hans Dedecker 
---
 interface-ip.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/interface-ip.c b/interface-ip.c
index 62d15fd..1459e9c 100644
--- a/interface-ip.c
+++ b/interface-ip.c
@@ -1154,9 +1154,11 @@ void interface_ip_set_enabled(struct 
interface_ip_settings *ip, bool enabled)
struct device_addr *addr;
struct device_route *route;
struct device *dev;
+   struct interface *iface;
 
ip->enabled = enabled;
-   dev = ip->iface->l3_dev.dev;
+   iface = ip->iface;
+   dev = iface->l3_dev.dev;
if (!dev)
return;
 
@@ -1164,10 +1166,16 @@ void interface_ip_set_enabled(struct 
interface_ip_settings *ip, bool enabled)
if (addr->enabled == enabled)
continue;
 
-   if (enabled)
+   if (enabled) {
system_add_address(dev, addr);
-   else
+   if ((addr->flags & DEVADDR_OFFLINK) || iface->metric)
+   interface_handle_subnet_route(iface, addr, 
true);
+
+   }
+   else {
+   interface_handle_subnet_route(iface, addr, false);
system_del_address(dev, addr);
+   }
addr->enabled = enabled;
}
 
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/3] netifd: Reinsert ip parameters

2014-10-22 Thread Hans Dedecker
Reinserts the config IP parameters as the config_ip
parameter of the new interface is set to false in
interface_alloc and thus not loading the config ip
options of the old interface

Signed-off-by: Hans Dedecker 
---
 interface.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/interface.c b/interface.c
index 4543250..733b5f1 100644
--- a/interface.c
+++ b/interface.c
@@ -1045,10 +1045,13 @@ interface_change_config(struct interface *if_old, 
struct interface *if_new)
}
 
if (reload_ip) {
+   bool config_ip_enabled = if_old->config_ip.enabled;
+   bool proto_ip_enabled = if_old->proto_ip.enabled;
+
interface_ip_set_enabled(&if_old->config_ip, false);
interface_ip_set_enabled(&if_old->proto_ip, false);
-   interface_ip_set_enabled(&if_old->proto_ip, 
if_new->proto_ip.enabled);
-   interface_ip_set_enabled(&if_old->config_ip, 
if_new->config_ip.enabled);
+   interface_ip_set_enabled(&if_old->proto_ip, proto_ip_enabled);
+   interface_ip_set_enabled(&if_old->config_ip, config_ip_enabled);
}
 
interface_write_resolv_conf();
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 3/3] netifd: Read current link state when processing netlink event

2014-10-22 Thread Hans Dedecker
Netifd commit b2dcb02570939d98b92c7c55db1c328693a5d52a introduces
a race condition resulting into infinite toggling interfaces
(eg static interfaces with linksensing enabled, vlan interfaces
with proto none (#18106)) when linksensing is enabled resulting into
a crash.
As netlink event messages will be queued on the netlink event socket
the included lower up interface flag will not always represent the
current link state when netifd processes the netlink messages;
by reading the current link state when a netlink event message is
parsed the correct info is passed to the device layer.
This will avoid continuous interface toggling (down/up) triggered
by link state changes based on outdated netlink interface info.
This solution replaces the patch which was introduced to solve
issue (#1806) for vlan devices as other protocol handlers suffered
from the same problem.

Signed-off-by: Hans Dedecker 
---
 device.h   |  2 --
 macvlan.c  |  1 -
 system-linux.c | 16 ++--
 vlan.c |  1 -
 vlandev.c  |  1 -
 5 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/device.h b/device.h
index adf72c5..73b2656 100644
--- a/device.h
+++ b/device.h
@@ -47,8 +47,6 @@ struct device_type {
struct list_head list;
const char *name;
 
-   bool keep_link_status;
-
const struct uci_blob_param_list *config_params;
 
struct device *(*create)(const char *name, struct blob_attr *attr);
diff --git a/macvlan.c b/macvlan.c
index 019a7ff..e5a4891 100644
--- a/macvlan.c
+++ b/macvlan.c
@@ -258,7 +258,6 @@ macvlan_create(const char *name, struct blob_attr *attr)
 const struct device_type macvlan_device_type = {
.name = "MAC VLAN",
.config_params = &macvlan_attr_list,
-   .keep_link_status = true,
 
.create = macvlan_create,
.config_init = macvlan_config_init,
diff --git a/system-linux.c b/system-linux.c
index 7ae9e27..8e0564c 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -299,16 +299,14 @@ static int system_get_disable_ipv6(struct device *dev, 
char *buf, const size_t b
dev->ifname, buf, buf_sz);
 }
 
-#ifndef IFF_LOWER_UP
-#define IFF_LOWER_UP   0x1
-#endif
-
 // Evaluate netlink messages
 static int cb_rtnl_event(struct nl_msg *msg, void *arg)
 {
struct nlmsghdr *nh = nlmsg_hdr(msg);
struct ifinfomsg *ifi = NLMSG_DATA(nh);
struct nlattr *nla[__IFLA_MAX];
+   int link_state = 0;
+   char buf[10];
 
if (nh->nlmsg_type != RTM_NEWLINK)
goto out;
@@ -322,8 +320,10 @@ static int cb_rtnl_event(struct nl_msg *msg, void *arg)
goto out;
 
device_set_ifindex(dev, ifi->ifi_index);
-   if (!dev->type->keep_link_status)
-   device_set_link(dev, ifi->ifi_flags & IFF_LOWER_UP ? true : 
false);
+   if (!system_get_dev_sysctl("/sys/class/net/%s/carrier", dev->ifname, 
buf, sizeof(buf)))
+   link_state = strtoul(buf, NULL, 0);
+
+   device_set_link(dev, link_state ? true : false);
 
 out:
return 0;
@@ -1020,6 +1020,10 @@ struct if_check_data {
int ret;
 };
 
+#ifndef IFF_LOWER_UP
+#define IFF_LOWER_UP   0x1
+#endif
+
 static int cb_if_check_valid(struct nl_msg *msg, void *arg)
 {
struct nlmsghdr *nh = nlmsg_hdr(msg);
diff --git a/vlan.c b/vlan.c
index 354e12f..28b1441 100644
--- a/vlan.c
+++ b/vlan.c
@@ -102,7 +102,6 @@ static struct device *get_vlan_device(struct device *dev, 
int id, bool create)
static const struct device_type vlan_type = {
.name = "VLAN",
.config_params = &device_attr_list,
-   .keep_link_status = true,
.free = free_vlan_if,
};
struct vlan_device *vldev;
diff --git a/vlandev.c b/vlandev.c
index 7b2038e..36a5c63 100644
--- a/vlandev.c
+++ b/vlandev.c
@@ -246,7 +246,6 @@ vlandev_create(const char *name, struct blob_attr *attr)
 const struct device_type vlandev_device_type = {
.name = "VLANDEV",
.config_params = &vlandev_attr_list,
-   .keep_link_status = true,
 
.create = vlandev_create,
.config_init = vlandev_config_init,
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ZRAM: enhacements including /tmp on ZRAM for Barrier Breaker

2014-10-22 Thread Tomasz Wasiak
Hello,

In my opinion early init is too late as we need /tmp sooner - for example to be 
able
to mount overlayfs (even init & procd needs writeable /tmp!). Maybe we can 
temporaily
mount "something" (RAMFS/TMPFS depending on kernel configuration) on /tmp and 
then
remount ZRAM but I do not think it will be better as we will have to copy stuff 
over...
I can provide patch using correct coding style if you need.

Please find answers to your comments below.

Regards,

Thomas

W dniu 22.10.2014 o 12:39, John Crispin pisze:
> Hi,
> 
> a few comments inline. i am not sure if we want this inside procd
> directly. maybe we should put this into fstools and then call that code
> from early init. i need to think about that before i can make a decision.
> 
>   John
> 
> 
> 
> On 22/10/2014 10:30, Tomasz Wasiak wrote:
>> Hello,
>>
>> Here you are (of course it is just 1/3 of the original patch).
>> ---
>> diff --git a/initd/early.c b/initd/early.c
>> index a9f6afb..b4a375f 100644
>> --- a/initd/early.c
>> +++ b/initd/early.c
>> @@ -12,34 +12,130 @@
>>   * GNU General Public License for more details.
>>   */
>>  
>> -#include 
>> -#include 
>> -#include 
>> -
>> -#include 
>> +#include 
>>  #include 
>> -#include 
>> +#include 
>>  #include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>>  
>>  #include "../log.h"
>>  #include "init.h"
>>  
>> +static long
>> +check_ramsize(void)
>> +{
>> +FILE *fp;
>> +char line[256];
>> +char *key;
>> +long val = 0;
>> +
>> +fp = fopen("/proc/meminfo", "r");
>> +if(fp == NULL)
>> +{
> 
> please use this coding style ->
> 
> if (fp == NULL) {
> 
> }
> 
> 
>> +ERROR("Can't open /proc/meminfo: %s\n", strerror(errno));
>> +return errno;
>> +}
>> +
>> +while(fgets(line, sizeof(line), fp))
>> +{
> 
> and here aswell
> 
> while () {
> 
> }
> 
>> +key = strtok(line, ":");
>> +val = atol(strtok(NULL, " kB\n"));
> 
> what happens if strtok return NULL ?
SIGSEGV :(
But that means that /proc/meminfo does not contain information about total 
memory.
Safer solution would be:

char *key, *val;

(...)

key = strtok(line, ":");
val = strtok(NULL, " kB\n");

(...)
break;

fclose(fp);

if(val != NULL)
return(atol(val));
else
return 0;
fi
}
> 
>> +
>> +if (!key || !val)
>> +continue;
>> +
>> +if (!strcasecmp(key, "MemTotal"))
>> +break;
>> +}
>> +
>> +fclose(fp);
>> +
>> +return val;
>> +}
>> +
>> +static int
>> +mount_zram_on_tmp(void)
>> +{
>> +FILE *fp;
>> +long zramsize = (check_ramsize() / 2);
> 
> where does the /2 come from ? is this just "a good value to use" or is
> there a technical reason that is must always be /2 and not /X

/2 is here because I would like to limit memory used by /tmp filesystem to half 
of RAM.
Now it is not limited so it can eat all memory! IMHO even if a device has only 
16 MB
of RAM 8 MB would be sufficient for /tmp (even when it will be pure 
RAMFS/TMPFS).

> 
>> +pid_t pid;
>> +
>> +if(!zramsize)
>> +{
>> +ERROR("Can't read size of RAM. Assuming 16 MB.\n");
>> +zramsize = 8192;
> 
> dangerous, if the memory was not detected properly we have mayor issues
> and should not do any magic with the memory. in this case we should just
> continue without zram

Of course but that way we are not able to limit /tmp memory usage. IMHO 
assumption that
device has at least 16 MB of RAM is not harmful as I do not think one can run 
newer builds
(based on 3.x kernels and modern toolchains) on any device equipped with 8 (or 
even less)
MB of RAM.

> 
>> +}
>> +
>> +fp = fopen("/sys/block/zram0/disksize", "r+");
>> +if(fp == NULL)
>> +{
>> +ERROR("Can't open /sys/block/zram0/disksize: %s\n", 
>> strerror(errno));
>> +return errno;
>> +}
>> +
>> +fprintf(fp, "%ld", (zramsize * 1024));
>> +
>> +fclose(fp);
>> +
>> +pid = fork();
>> +
>> +if (!pid)
>> +{
>> +char *mkfs[] = { "/sbin/mke2fs", "-b", "4096", "-F", "-L", 
>> "TEMP", "-m", "0", "/dev/zram0", NULL };
>> +int fd = open("/dev/null", O_RDWR);
>> +
>> +if (fd > -1) {
>> +dup2(fd, STDIN_FILENO);
>> +dup2(fd, STDOUT_FILENO);
>> +dup2(fd, STDERR_FILENO);
>> +if (fd > STDERR_FILENO)
>> +close(fd);
>> +}
>> +
>> +execvp(mkfs[0], mkfs);
>> +ERROR("Can't exec /sbin/mke2fs\n");
>> +exit(-1);
>> +}
>> +
>> +if (pid <= 0)
>> +{
>> +ERROR("Can't exec /sbin/mke2fs\n");
>> +return -1;
>> +} else {
>> +waitpid(pid, NULL, 0);
>> +}
>> 

Re: [OpenWrt-Devel] [PATCH 3/3] netifd: Read current link state when processing netlink event

2014-10-22 Thread Felix Fietkau
On 2014-10-22 14:14, Hans Dedecker wrote:
> Netifd commit b2dcb02570939d98b92c7c55db1c328693a5d52a introduces
> a race condition resulting into infinite toggling interfaces
> (eg static interfaces with linksensing enabled, vlan interfaces
> with proto none (#18106)) when linksensing is enabled resulting into
> a crash.
> As netlink event messages will be queued on the netlink event socket
> the included lower up interface flag will not always represent the
> current link state when netifd processes the netlink messages;
> by reading the current link state when a netlink event message is
> parsed the correct info is passed to the device layer.
> This will avoid continuous interface toggling (down/up) triggered
> by link state changes based on outdated netlink interface info.
> This solution replaces the patch which was introduced to solve
> issue (#1806) for vlan devices as other protocol handlers suffered
> from the same problem.
> 
> Signed-off-by: Hans Dedecker 
While I agree with the change to read the carrier directly, this patch
still has a remaining race condition.
I added keep_link_status, because the VLAN device event callbacks set
the VLAN device link status based on the link status of the parent device.
Please either leave in keep_link_status or remove link status handling
from the device event callbacks of VLAN devices.

- Felix
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ZRAM: enhacements including /tmp on ZRAM for Barrier Breaker

2014-10-22 Thread Fernando Frediani
By the way. Has anyone compiled and used BB 14.07 for devices with 16MB 
of RAM that went unsupported with AA release because of lack of ZRAM ?


Fernando

On 22/10/2014 08:20, Tomasz Wasiak wrote:

Devices with less memory are still common so why limit ZRAM usage just to swap
when it could be very useful as for /tmp storage.

This patch changes 3 things:
  - sets default number of ZRAM devices to 2 (1st for /tmp, 2nd for swap)
  - adds ZRAM (default) support to procd's init (TMPFS is used when ZRAM is not
available
  - changes zram-swap so it will use /dev/zram1 for 1st CPU, /dev/zram2 for 2nd
and so on as /dev/zram0 is in use for /tmp.

Signed-off-by: Tomasz Wasiak 
---
  package/system/procd/patches/procd-support_for_tmp_on_zram.patch   |  
185 ++
  package/system/zram-swap/files/zram.init   |  
 15
  target/linux/generic/patches-3.10/998_zram_make_2_devices_by_default.patch |  
 11
  3 files changed, 203 insertions(+), 8 deletions(-)

--- a/package/system/procd/patches/procd-support_for_tmo_on_zram.patch
+++ b/package/system/procd/patches/procd-support_for_tmp_on_zram.patch
@@ -0,0 +1,185 @@
+--- a/initd/early.c
 b/initd/early.c
+@@ -12,34 +12,130 @@
+  * GNU General Public License for more details.
+  */
+
+-#include 
+-#include 
+-#include 
+-
+-#include 
++#include 
+ #include 
+-#include 
++#include 
+ #include 
++#include 
++#include 
++#include 
++#include 
++#include 
++#include 
++#include 
+
+ #include "../log.h"
+ #include "init.h"
+
++static long
++check_ramsize(void)
++{
++  FILE *fp;
++  char line[256];
++  char *key;
++  long val = 0;
++
++  fp = fopen("/proc/meminfo", "r");
++  if(fp == NULL)
++  {
++  ERROR("Can't open /proc/meminfo: %s\n", strerror(errno));
++  return errno;
++  }
++
++  while(fgets(line, sizeof(line), fp))
++  {
++  key = strtok(line, ":");
++  val = atol(strtok(NULL, " kB\n"));
++
++  if (!key || !val)
++  continue;
++
++  if (!strcasecmp(key, "MemTotal"))
++  break;
++  }
++
++  fclose(fp);
++
++  return val;
++}
++
++static int
++mount_zram_on_tmp(void)
++{
++  FILE *fp;
++  long zramsize = (check_ramsize() / 2);
++  pid_t pid;
++
++  if(!zramsize)
++  {
++  ERROR("Can't read size of RAM. Assuming 16 MB.\n");
++  zramsize = 8192;
++  }
++
++  fp = fopen("/sys/block/zram0/disksize", "r+");
++  if(fp == NULL)
++  {
++  ERROR("Can't open /sys/block/zram0/disksize: %s\n", 
strerror(errno));
++  return errno;
++  }
++
++  fprintf(fp, "%ld", (zramsize * 1024));
++
++  fclose(fp);
++
++  pid = fork();
++
++  if (!pid)
++  {
++  char *mkfs[] = { "/sbin/mke2fs", "-b", "4096", "-F", "-L", "TEMP", "-m", 
"0", "/dev/zram0", NULL };
++  int fd = open("/dev/null", O_RDWR);
++
++  if (fd > -1) {
++  dup2(fd, STDIN_FILENO);
++  dup2(fd, STDOUT_FILENO);
++  dup2(fd, STDERR_FILENO);
++  if (fd > STDERR_FILENO)
++  close(fd);
++  }
++
++  execvp(mkfs[0], mkfs);
++  ERROR("Can't exec /sbin/mke2fs\n");
++  exit(-1);
++  }
++
++  if (pid <= 0)
++  {
++  ERROR("Can't exec /sbin/mke2fs\n");
++  return -1;
++  } else {
++  waitpid(pid, NULL, 0);
++  }
++
++  if(mount("/dev/zram0", "/tmp", "ext2", MS_NOSUID | MS_NODEV | MS_NOATIME, 
"check=none,errors=continue,noquota") < 0)
++  {
++  ERROR("Can't mount /dev/zram0 on /tmp: %s\n", strerror(errno));
++  return errno;
++  }
++
++  LOG("Using up to %ld kB of RAM as ZRAM storage on /mnt\n", zramsize);
++  return 0;
++}
++
+ static void
+-early_mounts(void)
++mount_tmpfs_on_tmp(void)
+ {
+-  mount("proc", "/proc", "proc", MS_NOATIME, 0);
+-  mount("sysfs", "/sys", "sysfs", MS_NOATIME, 0);
++  char line[256];
++  long tmpfssize = (check_ramsize() / 2);
+
+-  mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, 
NULL);
+-  mkdir("/tmp/run", 0777);
+-  mkdir("/tmp/lock", 0777);
+-  mkdir("/tmp/state", 0777);
+-  symlink("/tmp", "/var");
++  if(!tmpfssize)
++  {
++  ERROR("Can't read size of RAM. Assuming 16 MB.\n");
++  tmpfssize = 8192;
++  }
+
+-  mount("tmpfs", "/dev", "tmpfs", MS_NOATIME, "mode=0755,size=512K");
+-  mkdir("/dev/shm", 0755);
+-  mkdir("/dev/pts", 0755);
+-  mount("devpts", "/dev/pts", "devpts", MS_NOATIME, "mode=600");
++  snprintf(line, 256, "size=%ldk", tmpfssize);
++  mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, 
line);
++  LOG("Using up to %ld kB of RAM as TMPFS storage on /tmp\n"

[OpenWrt-Devel] [PATCH v2] generate list of license information for packages

2014-10-22 Thread thomas.langer
From: Thomas Langer 

Many packages define already metadata about their license (PKG_LICENSE),
but this is only included in the ipk files.

This change allows to create the information also on the build-host,
to get an overview on the used licenses.
In the full list, also all packages without this info are shown

Signed-off-by: Thomas Langer 
---
This is just the rebase of yesterday's patch against trunk.

diff --git a/include/package-dumpinfo.mk b/include/package-dumpinfo.mk
--- a/include/package-dumpinfo.mk
+++ b/include/package-dumpinfo.mk
@@ -45,7 +45,9 @@ Title: $(TITLE)
 Maintainer: $(MAINTAINER)
 $(if $(USERID),Require-User: $(USERID)
 )Source: $(PKG_SOURCE)
-Type: $(if $(Package/$(1)/targets),$(Package/$(1)/targets),$(if 
$(PKG_TARGETS),$(PKG_TARGETS),ipkg))
+$(if $(PKG_LICENSE),License: $(PKG_LICENSE)
+)$(if $(PKG_LICENSE_FILES),LicenseFiles: $(PKG_LICENSE_FILES)
+)Type: $(if $(Package/$(1)/targets),$(Package/$(1)/targets),$(if 
$(PKG_TARGETS),$(PKG_TARGETS),ipkg))
 $(if $(KCONFIG),Kernel-Config: $(KCONFIG)
 )$(if $(BUILDONLY),Build-Only: $(BUILDONLY)
 )$(if $(HIDDEN),Hidden: $(HIDDEN)
diff --git a/scripts/metadata.pl b/scripts/metadata.pl
--- a/scripts/metadata.pl
+++ b/scripts/metadata.pl
@@ -871,6 +871,28 @@ sub gen_package_feeds() {
}
 }
 
+sub gen_package_license($) {
+   my $level = shift;
+   parse_package_metadata($ARGV[0]) or exit 1;
+   foreach my $name (sort {uc($a) cmp uc($b)} keys %package) {
+   my $pkg = $package{$name};
+   if ($pkg->{name}) {
+   if ($pkg->{license}) {
+   print "$pkg->{name}: ";
+   print "$pkg->{license}\n";
+   if ($pkg->{licensefiles} && $level == 0) {
+   print "\tFiles: $pkg->{licensefiles}\n";
+   }
+   } else {
+   if ($level == 1) {
+   print "$pkg->{name}: Missing license! ";
+   print "Please fix $pkg->{makefile}\n";
+   }
+   }
+   }
+   }
+}
+
 sub parse_command() {
my $cmd = shift @ARGV;
for ($cmd) {
@@ -880,6 +902,8 @@ sub parse_command() {
/^kconfig/ and return gen_kconfig_overrides();
/^package_source$/ and return gen_package_source();
/^package_feeds$/ and return gen_package_feeds();
+   /^package_license$/ and return gen_package_license(0);
+   /^package_licensefull$/ and return gen_package_license(1);
}
print <{submenu} = $1;
/^Submenu-Depends: \s*(.+)\s*$/ and $pkg->{submenudep} = $1;
/^Source: \s*(.+)\s*$/ and $pkg->{source} = $1;
+   /^License: \s*(.+)\s*$/ and $pkg->{license} = $1;
+   /^LicenseFiles: \s*(.+)\s*$/ and $pkg->{licensefiles} = $1;
/^Default: \s*(.+)\s*$/ and $pkg->{default} = $1;
/^Provides: \s*(.+)\s*$/ and do {
my @vpkg = split /\s+/, $1;
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] mpcC85xx

2014-10-22 Thread Daniel Petre

On 22/10/14 11:33, Klaus Maus wrote:

Hi,

I am about to buy a TP-Link WDR4900 because of its powerful NAT
throughput (https://forum.openwrt.org/viewtopic.php?pid=244167#p244167)

Some say that this router with his rather uncommon platform mpcC85xx has
been abandoned. I'm not sure about this.



I built Barrier Breaker, r42961 for mine and with NAT it peaks at 415 
Mbit/s WAN - LAN with PPPoE.



Could you clarify the state of the future support this router or SoC
will have from your team? I won't buy it if it doesn't participate in
further development of OpenWrt.

Thank you in advance.

Klaus

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] mpcC85xx

2014-10-22 Thread cholin
Seems this target does not get as much attention as for example ar71xx.
Until now there is this nasty mac address bug that every wdr4900 has the
same mac address [1] (if you don't manually set it in /etc/config/network).

Regards
Nico

[1] https://dev.openwrt.org/ticket/14714

Am 22.10.2014 um 10:33 schrieb Klaus Maus:
> Hi,
> 
> I am about to buy a TP-Link WDR4900 because of its powerful NAT
> throughput (https://forum.openwrt.org/viewtopic.php?pid=244167#p244167)
> 
> Some say that this router with his rather uncommon platform mpcC85xx has
> been abandoned. I'm not sure about this.
> 
> Could you clarify the state of the future support this router or SoC
> will have from your team? I won't buy it if it doesn't participate in
> further development of OpenWrt.
> 
> Thank you in advance.
> 
> Klaus
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel




signature.asc
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] comgt: add ncm proto support

2014-10-22 Thread Sami Olmari
I wonder would this thread reach most of interested persons, not just
John whom I've talked with plenty :)

I have Huawei e3276, latest openwrt trunk, used kernel 3.14 (ar71xx
target), I have chosen proper drivers and comgt-ncm etc, but for any
reason when wan is set to assumedly proper settings, literally nothing
happends... logread has no new lines etc... I wonder what I miss still
or what is in error :)

/etc/config/network:
config interface 'wan'
option device '/dev/cdc-wdm0' #Tried with and without this
option proto 'wwan'
option apn 'opengate'

Logread shows device is there end regonised, but neither "ifup wan"
nor "etc/init.d/network restart" doesn't make it work, not single line
relating to this comes into log... Any debug I could do or please ask
if additional info needed.

 Sami Olmari

On Thu, Oct 9, 2014 at 5:47 PM, Bjørn Mork  wrote:
> John Crispin  writes:
>
>> i am currently using a vodafone k5105 which is a huawei rebrand. at
>> 150 euro its very expensive. any other good ones ?
>
> I find it impossible to recommend any specific modems because important
> firmware features like MBIM depend on both operator branding and
> geographical target area.  But I can list the MBIM modems I have:
>
> - Huawei E367 with MBIM firmware. I have no idea whether this is
>   available anywhere in the world today.  I know most of the E367s were
>   QMI only.  That's of course only a firmware issue, but that doesn't
>   help much as long as the firmware isn't available.
>
> - D-Link DWM-156 rev A7.  This might be a safer bet on the cheap side.
>   I haven't seen any non MBIM variants for that specific revision.  But
>   I wouldn't be suprised if they exist either, so the usual warnings
>   apply.
>
> The  rest of my MBIM modems are mini-PCIe or m.2, and also very
> expensive:
>
> - Ericsson H5321gw (with newer firmware), halfsize mini-PCIe
>
> - Sierra Wireless MC7710 (with newer firmware, depending on cfg),
>   fullsize mini-PCIe
>
> - Sierra Wireless EM7345, m.2 (3042)
>
>
> Bjørn
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 3/3] netifd: Read current link state when processing netlink event

2014-10-22 Thread Hans Dedecker
Hi Felix,

Thx for the feedback. Regarding the remaining race condition I assume you
refer
to the vlan device link status which can be set as enabled due to reading
directly
the carrier state in cb_rtnl_event while the parent interface is still link
status disabled?

I will rework my patch based on the keep_link_status changes and deliver a
new patch tomorrow.

Hans

On Wed, Oct 22, 2014 at 2:30 PM, Felix Fietkau  wrote:

> On 2014-10-22 14:14, Hans Dedecker wrote:
> > Netifd commit b2dcb02570939d98b92c7c55db1c328693a5d52a introduces
> > a race condition resulting into infinite toggling interfaces
> > (eg static interfaces with linksensing enabled, vlan interfaces
> > with proto none (#18106)) when linksensing is enabled resulting into
> > a crash.
> > As netlink event messages will be queued on the netlink event socket
> > the included lower up interface flag will not always represent the
> > current link state when netifd processes the netlink messages;
> > by reading the current link state when a netlink event message is
> > parsed the correct info is passed to the device layer.
> > This will avoid continuous interface toggling (down/up) triggered
> > by link state changes based on outdated netlink interface info.
> > This solution replaces the patch which was introduced to solve
> > issue (#1806) for vlan devices as other protocol handlers suffered
> > from the same problem.
> >
> > Signed-off-by: Hans Dedecker 
> While I agree with the change to read the carrier directly, this patch
> still has a remaining race condition.
> I added keep_link_status, because the VLAN device event callbacks set
> the VLAN device link status based on the link status of the parent device.
> Please either leave in keep_link_status or remove link status handling
> from the device event callbacks of VLAN devices.
>
> - Felix
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/4] openssl: disable srp

2014-10-22 Thread Etienne CHAMPETIER
this saves 10kb on libssl and 5kb on openssl-util

Signed-off-by: Etienne CHAMPETIER 
---
 package/libs/openssl/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index 707c314..5151707 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -89,7 +89,7 @@ endef
 
 OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-smime \
no-aes192 no-camellia no-ans1 no-krb5
-OPENSSL_OPTIONS:= shared no-err no-hw zlib-dynamic no-sse2 no-ssl2
+OPENSSL_OPTIONS:= shared no-err no-hw zlib-dynamic no-sse2 no-ssl2 no-srp
 
 ifdef CONFIG_OPENSSL_ENGINE_CRYPTO
   OPENSSL_OPTIONS += -DHAVE_CRYPTODEV
-- 
1.9.3
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/4] openssl: disable sslv2, add an option to enable sslv3

2014-10-22 Thread Etienne CHAMPETIER
disabling sslv2 save 10kb, disabling sslv3 save 1kb more
for now leave sslv3 enable by default

Signed-off-by: Etienne CHAMPETIER 
---
 package/libs/openssl/Config.in |  5 +
 package/libs/openssl/Makefile  | 14 +++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/package/libs/openssl/Config.in b/package/libs/openssl/Config.in
index 34eff28..3008eab 100644
--- a/package/libs/openssl/Config.in
+++ b/package/libs/openssl/Config.in
@@ -11,6 +11,11 @@ config OPENSSL_WITH_EC2M
 depends on OPENSSL_WITH_EC
 prompt "Enable ec2m support"
 
+config OPENSSL_WITH_SSL3
+   bool
+   default y
+   prompt "Enable sslv3 support"
+
 config OPENSSL_ENGINE_CRYPTO
bool
prompt "Crypto acceleration support"
diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index b51808b..707c314 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -23,8 +23,12 @@ PKG_MD5SUM:=f7175c9cd3c39bb1907ac8bba9df8ed3
 PKG_LICENSE:=SSLEAY OPENSSL
 PKG_LICENSE_FILES:=LICENSE
 PKG_BUILD_DEPENDS:=ocf-crypto-headers
-PKG_CONFIG_DEPENDS:=CONFIG_OPENSSL_ENGINE_CRYPTO CONFIG_OPENSSL_ENGINE_DIGEST \
-   CONFIG_OPENSSL_WITH_EC CONFIG_OPENSSL_WITH_EC2M
+PKG_CONFIG_DEPENDS:= \
+   CONFIG_OPENSSL_ENGINE_CRYPTO \
+   CONFIG_OPENSSL_ENGINE_DIGEST \
+   CONFIG_OPENSSL_WITH_EC \
+   CONFIG_OPENSSL_WITH_EC2M \
+   CONFIG_OPENSSL_WITH_SSL3
 
 include $(INCLUDE_DIR)/package.mk
 
@@ -85,7 +89,7 @@ endef
 
 OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-smime \
no-aes192 no-camellia no-ans1 no-krb5
-OPENSSL_OPTIONS:= shared no-err no-hw zlib-dynamic no-sse2
+OPENSSL_OPTIONS:= shared no-err no-hw zlib-dynamic no-sse2 no-ssl2
 
 ifdef CONFIG_OPENSSL_ENGINE_CRYPTO
   OPENSSL_OPTIONS += -DHAVE_CRYPTODEV
@@ -104,6 +108,10 @@ ifndef CONFIG_OPENSSL_WITH_EC2M
   OPENSSL_OPTIONS += no-ec2m
 endif
 
+ifndef CONFIG_OPENSSL_WITH_SSL3
+  OPENSSL_OPTIONS += no-ssl3
+endif
+
 ifeq ($(CONFIG_x86_64),y)
   OPENSSL_TARGET:=linux-x86_64
   OPENSSL_MAKEFLAGS += LIBDIR=lib
-- 
1.9.3
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 3/4] openssl: disable smime using no-cms option

2014-10-22 Thread Etienne CHAMPETIER
no-smime option doesn't seems to exists
this saves 20+5 kb

Signed-off-by: Etienne CHAMPETIER 
---
 package/libs/openssl/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index 5151707..9c4855f 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -87,9 +87,9 @@ This package contains the OpenSSL command-line utility.
 endef
 
 
-OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-smime \
+OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 \
no-aes192 no-camellia no-ans1 no-krb5
-OPENSSL_OPTIONS:= shared no-err no-hw zlib-dynamic no-sse2 no-ssl2 no-srp
+OPENSSL_OPTIONS:= shared no-err no-hw zlib-dynamic no-sse2 no-ssl2 no-srp 
no-cms
 
 ifdef CONFIG_OPENSSL_ENGINE_CRYPTO
   OPENSSL_OPTIONS += -DHAVE_CRYPTODEV
-- 
1.9.3
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 4/4] openssl: remove no-aes192 and no-ans1, it's doing nothing

2014-10-22 Thread Etienne CHAMPETIER
Signed-off-by: Etienne CHAMPETIER 
---
 package/libs/openssl/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index 9c4855f..31cd32d 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -87,8 +87,7 @@ This package contains the OpenSSL command-line utility.
 endef
 
 
-OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 \
-   no-aes192 no-camellia no-ans1 no-krb5
+OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-camellia no-krb5
 OPENSSL_OPTIONS:= shared no-err no-hw zlib-dynamic no-sse2 no-ssl2 no-srp 
no-cms
 
 ifdef CONFIG_OPENSSL_ENGINE_CRYPTO
-- 
1.9.3
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 1/4] openssl: disable sslv2, add an option to enable sslv3

2014-10-22 Thread Etienne Champetier
2014-10-22 21:28 GMT+02:00 Etienne CHAMPETIER 
:

> disabling sslv2 save 10kb, disabling sslv3 save 1kb more
> for now leave sslv3 enable by default
>
> Signed-off-by: Etienne CHAMPETIER 
> ---
>  package/libs/openssl/Config.in |  5 +
>  package/libs/openssl/Makefile  | 14 +++---
>  2 files changed, 16 insertions(+), 3 deletions(-)
>
> ...
>

Forgot to say, it's only compile tested
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ZRAM: enhacements including /tmp on ZRAM for Barrier Breaker

2014-10-22 Thread Tomasz Wasiak
I am going to test a totally not supported device with only 16MB of RAM if time 
permits. Unfortunately now I am having some strange issues with my development 
device - tmp on ZRAM works without any issues but I have to switch off swap on 
ZRAM as it was getting some random oops'es which might be connected to 
compressing one more time files on ZRAM device mounted as /tmp when they got 
swapped out. This device has 32 MB of RAM, and after booting shows ~ 15-16MB 
RAM available (~ 2-3 MB + caches and buffers). I have ~ 14 MB limit on /tmp 
ZRAM device and tried different swap on ZRAM size settings - from rather small 
(3200 kB) to 14 MB. It does not look like a no memory issue because it is able 
to work normally without swap even using unrestricted RAMFS or TMPFS volume 
mounted as /tmp.


Thomas

W dniu 22.10.2014 o 16:07, Fernando Frediani pisze:
> By the way. Has anyone compiled and used BB 14.07 for devices with 16MB of 
> RAM that went unsupported with AA release because of lack of ZRAM ?
> 
> Fernando
> 
> On 22/10/2014 08:20, Tomasz Wasiak wrote:
>> Devices with less memory are still common so why limit ZRAM usage just to 
>> swap
>> when it could be very useful as for /tmp storage.
>>
>> This patch changes 3 things:
>>   - sets default number of ZRAM devices to 2 (1st for /tmp, 2nd for swap)
>>   - adds ZRAM (default) support to procd's init (TMPFS is used when ZRAM is 
>> not
>> available
>>   - changes zram-swap so it will use /dev/zram1 for 1st CPU, /dev/zram2 for 
>> 2nd
>> and so on as /dev/zram0 is in use for /tmp.
>>
>> Signed-off-by: Tomasz Wasiak 
>> ---
>>   package/system/procd/patches/procd-support_for_tmp_on_zram.patch   
>> |  185 ++
>>   package/system/zram-swap/files/zram.init   
>> |   15
>>   target/linux/generic/patches-3.10/998_zram_make_2_devices_by_default.patch 
>> |   11
>>   3 files changed, 203 insertions(+), 8 deletions(-)
>>
>> --- a/package/system/procd/patches/procd-support_for_tmo_on_zram.patch
>> +++ b/package/system/procd/patches/procd-support_for_tmp_on_zram.patch
>> @@ -0,0 +1,185 @@
>> +--- a/initd/early.c
>>  b/initd/early.c
>> +@@ -12,34 +12,130 @@
>> +  * GNU General Public License for more details.
>> +  */
>> +
>> +-#include 
>> +-#include 
>> +-#include 
>> +-
>> +-#include 
>> ++#include 
>> + #include 
>> +-#include 
>> ++#include 
>> + #include 
>> ++#include 
>> ++#include 
>> ++#include 
>> ++#include 
>> ++#include 
>> ++#include 
>> ++#include 
>> +
>> + #include "../log.h"
>> + #include "init.h"
>> +
>> ++static long
>> ++check_ramsize(void)
>> ++{
>> ++FILE *fp;
>> ++char line[256];
>> ++char *key;
>> ++long val = 0;
>> ++
>> ++fp = fopen("/proc/meminfo", "r");
>> ++if(fp == NULL)
>> ++{
>> ++ERROR("Can't open /proc/meminfo: %s\n", strerror(errno));
>> ++return errno;
>> ++}
>> ++
>> ++while(fgets(line, sizeof(line), fp))
>> ++{
>> ++key = strtok(line, ":");
>> ++val = atol(strtok(NULL, " kB\n"));
>> ++
>> ++if (!key || !val)
>> ++continue;
>> ++
>> ++if (!strcasecmp(key, "MemTotal"))
>> ++break;
>> ++}
>> ++
>> ++fclose(fp);
>> ++
>> ++return val;
>> ++}
>> ++
>> ++static int
>> ++mount_zram_on_tmp(void)
>> ++{
>> ++FILE *fp;
>> ++long zramsize = (check_ramsize() / 2);
>> ++pid_t pid;
>> ++
>> ++if(!zramsize)
>> ++{
>> ++ERROR("Can't read size of RAM. Assuming 16 MB.\n");
>> ++zramsize = 8192;
>> ++}
>> ++
>> ++fp = fopen("/sys/block/zram0/disksize", "r+");
>> ++if(fp == NULL)
>> ++{
>> ++ERROR("Can't open /sys/block/zram0/disksize: %s\n", 
>> strerror(errno));
>> ++return errno;
>> ++}
>> ++
>> ++fprintf(fp, "%ld", (zramsize * 1024));
>> ++
>> ++fclose(fp);
>> ++
>> ++pid = fork();
>> ++
>> ++if (!pid)
>> ++{
>> ++char *mkfs[] = { "/sbin/mke2fs", "-b", "4096", "-F", "-L", "TEMP", 
>> "-m", "0", "/dev/zram0", NULL };
>> ++int fd = open("/dev/null", O_RDWR);
>> ++
>> ++if (fd > -1) {
>> ++dup2(fd, STDIN_FILENO);
>> ++dup2(fd, STDOUT_FILENO);
>> ++dup2(fd, STDERR_FILENO);
>> ++if (fd > STDERR_FILENO)
>> ++close(fd);
>> ++}
>> ++
>> ++execvp(mkfs[0], mkfs);
>> ++ERROR("Can't exec /sbin/mke2fs\n");
>> ++exit(-1);
>> ++}
>> ++
>> ++if (pid <= 0)
>> ++{
>> ++ERROR("Can't exec /sbin/mke2fs\n");
>> ++return -1;
>> ++} else {
>> ++waitpid(pid, NULL, 0);
>> ++}
>> ++
>> ++if(mount("/dev/zram0", "/tmp", "ext2", MS_NOSUID | MS_NODEV | 
>> MS_NOATIME, "check=none,errors=continue,noquota") < 0)
>> ++{
>> ++ERROR("Can't mount /dev/zram0 on /tmp: %s\n", strerror(errno));
>> ++return errno;
>> ++}
>> ++
>> ++LOG("Using up to %ld kB of RAM as ZRAM storage on /mnt\n", zramsize);
>> ++return 0;
>> +

Re: [OpenWrt-Devel] [PATCH 2/4] openssl: disable srp

2014-10-22 Thread Karl P
Please no on this one?  SRP is great, and it's never going to be used if it 
keeps getting turned off.  If you're going to use openssl, you're already 
choosing the "big" package, can we keep it at least mostly featureful?


I've been using TLS-PSK, but I'd rather use SRP.  (No, I'm not using it now)


On 10/22/2014 07:28 PM, Etienne CHAMPETIER wrote:

this saves 10kb on libssl and 5kb on openssl-util

Signed-off-by: Etienne CHAMPETIER 
---
  package/libs/openssl/Makefile | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index 707c314..5151707 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -89,7 +89,7 @@ endef

  OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-smime \
no-aes192 no-camellia no-ans1 no-krb5
-OPENSSL_OPTIONS:= shared no-err no-hw zlib-dynamic no-sse2 no-ssl2
+OPENSSL_OPTIONS:= shared no-err no-hw zlib-dynamic no-sse2 no-ssl2 no-srp

  ifdef CONFIG_OPENSSL_ENGINE_CRYPTO
OPENSSL_OPTIONS += -DHAVE_CRYPTODEV


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] please send nvram dump of some brcm47xx based devices

2014-10-22 Thread Axel Mammes
Here's an nvram dump for a WRT600N v1.1 running DD-WRT.

Passwords and certs have been removed.

altdns1=
altdns2=
altdns3=
apd_enable=0
apwatchdog_enable=0
apwatchdog_interval=15
auth_dnsmasq=1
autofw_port0=
block_activex=0
block_cookie=0
block_ident=0
block_java=0
block_loopback=0
block_multicast=0
block_proxy=0
block_snmp=0
block_wan=0
boardflags=0x110
boardnum=20070615
boardrev=0x10
boardtype=0x478
boot_wait=on
browser_method=USE_LAN
cardbus=0
cfe_ver=4.109.11.3_20070615
chilli_802.1Xauth=0
chilli_additional=
chilli_backup=0.0.0.0
chilli_dns1=0.0.0.0
chilli_enable=0
chilli_interface=eth0
chilli_macauth=0
chilli_macpasswd=password
chilli_net=192.168.182.0/24
chilli_pass=
chilli_radius=0.0.0.0
chilli_radiusnasid=
chilli_uamallowed=
chilli_uamanydns=0
chilli_uamsecret=
chilli_url=
clean_jffs2=0
clkfreq=300
clone_wan_mac=0
console_loglevel=7
cron_enable=1
cron_jobs=
ct_modules=
daylight_time=1
DD_BOARD=Linksys WRT600N v1.1
ddns_cache=
ddns_change=
ddns_conf=
ddns_custom_5=
ddns_dyndnstype_6=
ddns_dyndnstype=
ddns_enable_buf=
ddns_enable=0
ddns_force=10
ddns_hostname_2=
ddns_hostname_3=
ddns_hostname_4=
ddns_hostname_5=
ddns_hostname_6=
ddns_hostname_7=
ddns_hostname_8=
ddns_hostname_buf=
ddns_hostname=
ddns_passwd_2=
ddns_passwd_3=
ddns_passwd_4=
ddns_passwd_5=
ddns_passwd_6=
ddns_passwd_7=
ddns_passwd_8=
ddns_passwd_buf=
ddns_passwd=
ddns_time=
ddns_url=
ddns_username_2=
ddns_username_3=
ddns_username_4=
ddns_username_5=
ddns_username_6=
ddns_username_7=
ddns_username_8=
ddns_username_buf=
ddns_username=
ddns_wan_ip=1
ddns_wildcard_6=
ddns_wildcard_7=
ddns_wildcard=
def_hwaddr=00:00:00:00:00:00
def_whwaddr=00:00:00:00:00:00
default_downlevel=10
default_uplevel=10
dhcp_dnsmasq=1
dhcp_domain=wan
dhcp_lease=1440
dhcp_num=50
dhcp_start=100
dhcp_wins=wan
dhcpc_requestip=
dhcpc_vendorclass=
dhcpd_options=
dhcpd_usejffs=
dhcpd_usenvram=0
dhcpfwd_enable=0
dhcpfwd_ip=0.0.0.0
dist_type=mega
dmz_enable=0
dmz_ipaddr=0
dns_dnsmasq=1
dnsmasq_enable=1
dnsmasq_no_dns_rebind=1
dnsmasq_options=
dr_lan_rx=0
dr_lan_tx=0
dr_setting=0
dr_wan_rx=0
dr_wan_tx=0
dtag_vlan8=0
dyn_default=0
enable_game=0
enable_jffs2=0
et0macaddr=00:21:29:67:8A:98
et0mdcport=0
et0phyaddr=30
eth0_bridged=1
eth0_ipaddr=0.0.0.0
eth0_multicast=0
eth0_nat=1
eth0_netmask=0.0.0.0
eth1_bridged=1
eth1_ipaddr=0.0.0.0
eth1_multicast=0
eth1_nat=1
eth1_netmask=0.0.0.0
eth10_bridged=1
eth10_ipaddr=0.0.0.0
eth10_netmask=0.0.0.0
eth2_bridged=1
eth2_ipaddr=0.0.0.0
eth2_netmask=0.0.0.0
eth3_bridged=1
eth3_ipaddr=0.0.0.0
eth3_netmask=0.0.0.0
eth4_bridged=1
eth4_ipaddr=0.0.0.0
eth4_netmask=0.0.0.0
eth5_bridged=1
eth5_ipaddr=0.0.0.0
eth5_netmask=0.0.0.0
eth6_bridged=1
eth6_ipaddr=0.0.0.0
eth6_netmask=0.0.0.0
eth7_bridged=1
eth7_ipaddr=0.0.0.0
eth7_netmask=0.0.0.0
eth8_bridged=1
eth8_ipaddr=0.0.0.0
eth8_netmask=0.0.0.0
eth9_bridged=1
eth9_ipaddr=0.0.0.0
eth9_netmask=0.0.0.0
expert_mode=1
ezc_enable=1
ezc_version=2
filter_client0=
filter_dport_grp1=
filter_dport_grp10=
filter_dport_grp2=
filter_dport_grp3=
filter_dport_grp4=
filter_dport_grp5=
filter_dport_grp6=
filter_dport_grp7=
filter_dport_grp8=
filter_dport_grp9=
filter_id=1
filter_ip_grp1=
filter_ip_grp10=
filter_ip_grp2=
filter_ip_grp3=
filter_ip_grp4=
filter_ip_grp5=
filter_ip_grp6=
filter_ip_grp7=
filter_ip_grp8=
filter_ip_grp9=
filter_mac_grp1=
filter_mac_grp10=
filter_mac_grp2=
filter_mac_grp3=
filter_mac_grp4=
filter_mac_grp5=
filter_mac_grp6=
filter_mac_grp7=
filter_mac_grp8=
filter_mac_grp9=
filter_maclist=
filter_macmode=deny
filter_port_grp1=
filter_port_grp10=
filter_port_grp2=
filter_port_grp3=
filter_port_grp4=
filter_port_grp5=
filter_port_grp6=
filter_port_grp7=
filter_port_grp8=
filter_port_grp9=
filter_port=
filter_rule1=
filter_rule10=
filter_rule2=
filter_rule3=
filter_rule4=
filter_rule5=
filter_rule6=
filter_rule7=
filter_rule8=
filter_rule9=
filter_services_1=
filter_services=
filter_tod_buf1=
filter_tod_buf10=
filter_tod_buf2=
filter_tod_buf3=
filter_tod_buf4=
filter_tod_buf5=
filter_tod_buf6=
filter_tod_buf7=
filter_tod_buf8=
filter_tod_buf9=
filter_tod1=
filter_tod10=
filter_tod2=
filter_tod3=
filter_tod4=
filter_tod5=
filter_tod6=
filter_tod7=
filter_tod8=
filter_tod9=
filter_web_host1=
filter_web_host10=
filter_web_host11=
filter_web_host12=
filter_web_host13=
filter_web_host14=
filter_web_host2=
filter_web_host3=
filter_web_host4=
filter_web_host5=
filter_web_host6=
filter_web_host7=
filter_web_host8=
filter_web_host9=
filter_web_url1=
filter_web_url10=
filter_web_url11=
filter_web_url12=
filter_web_url13=
filter_web_url14=
filter_web_url15=
filter_web_url2=
filter_web_url3=
filter_web_url4=
filter_web_url5=
filter_web_url6=
filter_web_url7=
filter_web_url8=
filter_web_url9=
filter=off
fon_enable=0
fon_userlist=
fon_usernames=0
forward_entries=0
forward_port=
forward_spec=
forwardspec_entries=0
fullswitch_set=1
fullswitch=1
fw_disable=0
generate_key=0
gozila_action=0
hb_server_domain=
hb_server_ip=
hopdwell=1000
hopseq=6
hotss_customsplash=0
hotss_customuam=
hotss_customuamproto=h

Re: [OpenWrt-Devel] Netgear WNR1000 v3 N150 -- Is it possible to install OpenWRT on this without opening the box

2014-10-22 Thread Kristjan Onu

On 2014-08-15 09:42, Rafał Miłecki wrote:

On 14 August 2014 07:48, Rafał Miłecki  wrote:

On 14 August 2014 05:46, quickbooks office  wrote:

Is it possible to install Open WRT on Netgear WNR1000 v3 N150 without
opening the box up?


(...)

OpenWrt build bots should start generating firmware for your device in
few next days.


You can give it a try:
https://downloads.openwrt.org/snapshots/trunk/brcm47xx.mips74k/


Is there still a suitable firmware for WNR1000v3 in that directory?

I built OpenWRT from Git commit 0e82759adb84c5c5fc9c78243422446c550acd19 
and this produced the file bin/brcm47xx/openwrt-wnr1000_v3-squashfs.chk. 
That looks like the right firmware file. Can anyone confirm?

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel