Re: [OpenWrt-Devel] adding seccomp and service jailing to procd

2015-03-28 Thread Kevin Darbyshire-Bryant
On 27/03/2015 14:37, John Crispin wrote:
>
> On 27/03/2015 13:45, Etienne Champetier wrote:
>> Hi,
>>
>>
>> 2015-03-27 10:42 GMT+01:00 John Crispin > >:
>>
>> OpenWrt service hardening and jailing
>> =
>>
>>
>> <...>
>>  
>>
>> If there are features that we are not aware of yet or that we forgot to
>> list, then please let us know about them.
>>
>> Comments and ideas are welcome ...
>> ___
>>

Hi John,

Thanks for the dnsmasq 'root' fix that I saw go through...not tested yet.

A thought:  Is there care needed here to cope with those configuration
options that are very obviously exposed in Luci?  For example: dnsmasq
lease file defaults to /tmp/dhcp.leases *but* I tend to move that file
to a USB storage location so it survives router reboots.  As it stands
it looks like the init script is unaware of picking up this config
option and jailing the correct file, defaulting to /tmp/dhcp.leases.   I
can really see the security benefits to 'jail' though, great idea.

Thanks for your time.

Kevin




smime.p7s
Description: S/MIME Cryptographic Signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] build: fix CMake assembly builds with ccache

2015-03-28 Thread Matthias Schiffer
CMAKE_ASM_COMPILER is automatically set to CMAKE_C_COMPILER by CMake, but
CMAKE_C_COMPILER_ARG1 is lost. This causes assembly builds to fail when ccache
is enabled (for example the package fastd on x86).

Fix this by explicitly defining CMAKE_ASM_COMPILER and CMAKE_ASM_COMPILER_ARG1.

Signed-off-by: Matthias Schiffer 
---
 include/cmake.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/cmake.mk b/include/cmake.mk
index c1fd7d9..49fba26 100644
--- a/include/cmake.mk
+++ b/include/cmake.mk
@@ -49,6 +49,8 @@ define Build/Configure/Default
-DCMAKE_C_COMPILER_ARG1="$(CMAKE_C_COMPILER_ARG1)" \
-DCMAKE_CXX_COMPILER="$(CMAKE_CXX_COMPILER)" \
-DCMAKE_CXX_COMPILER_ARG1="$(CMAKE_CXX_COMPILER_ARG1)" \
+   -DCMAKE_ASM_COMPILER="$(CMAKE_C_COMPILER)" \
+   -DCMAKE_ASM_COMPILER_ARG1="$(CMAKE_C_COMPILER_ARG1)" \
-DCMAKE_EXE_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS)" \
-DCMAKE_MODULE_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS)" \
-DCMAKE_SHARED_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS)" \
-- 
2.3.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] x86 failing to build (including buildbot)

2015-03-28 Thread Luiz Angelo Daros de Luca
Hello,

Building for i386 target is failing with this error:

ERROR: Missing site config for architecture "i386" !
   The missing file will cause configure scripts to fail during
compilation.
   Please provide a "openwrt/trunk/include/site/i386" file and restart
the build.

As shown in
http://buildbot.openwrt.org:8010/builders/x86/builds/885/steps/compile_1/logs/stdio

I hacked a solution localy symlinking i486 to i386

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


[OpenWrt-Devel] [PATCH 1/5] omap: remove patch wlcore Add-support-for-DT-platform-data

2015-03-28 Thread Dirk Neukirchen
- does not compile with 3.18
compile error: 'struct wl12xx_platform_data' has no member named 'gpio'

- different version was sent 2015 but cannot be tested by me
see "[PATCH v7 0/6] wlcore: add device-tree support" series
in linux-omap

Signed-off-by: Dirk Neukirchen 
---
 ...0-wlcore-Add-support-for-DT-platform-data.patch | 158 -
 1 file changed, 158 deletions(-)
 delete mode 100644 
target/linux/omap/patches-3.18/900-wlcore-Add-support-for-DT-platform-data.patch

diff --git 
a/target/linux/omap/patches-3.18/900-wlcore-Add-support-for-DT-platform-data.patch
 
b/target/linux/omap/patches-3.18/900-wlcore-Add-support-for-DT-platform-data.patch
deleted file mode 100644
index 8fcf771..000
--- 
a/target/linux/omap/patches-3.18/900-wlcore-Add-support-for-DT-platform-data.patch
+++ /dev/null
@@ -1,158 +0,0 @@
-When running with DT, we no longer have a board file that can set up the
-platform data for wlcore. Allow this data to be passed from DT.
-
-Since some platforms use a gpio-irq, add support for passing either the
-irq number or the gpio number. For the latter case, the driver will
-request the gpio and convert it to the irq number. If an irq is
-specified, it'll be used as is.
-
-[Arik - the pdev_data pointer does not belong to us and is freed when
-the device is released. Dereference to our private data first.]
-
-Signed-off-by: Ido Yariv 
-Signed-off-by: Arik Nemtsov 

- drivers/net/wireless/ti/wlcore/sdio.c | 71 ---
- include/linux/wl12xx.h|  3 +-
- 2 files changed, 67 insertions(+), 7 deletions(-)
-
 a/drivers/net/wireless/ti/wlcore/sdio.c
-+++ b/drivers/net/wireless/ti/wlcore/sdio.c
-@@ -34,6 +34,7 @@
- #include 
- #include 
- #include 
-+#include 
- 
- #include "wlcore.h"
- #include "wl12xx_80211.h"
-@@ -214,6 +215,61 @@ static struct wl1271_if_operations sdio_
-   .set_block_size = wl1271_sdio_set_block_size,
- };
- 
-+static const struct of_device_id wlcore_of_match[] = {
-+  {
-+  .compatible = "wlcore",
-+  },
-+  {}
-+};
-+MODULE_DEVICE_TABLE(of, wlcore_of_match);
-+
-+static struct wl12xx_platform_data *get_platform_data(struct device *dev)
-+{
-+  struct wl12xx_platform_data *pdata;
-+  struct device_node *np;
-+  u32 gpio;
-+
-+  pdata = wl12xx_get_platform_data();
-+  if (!IS_ERR(pdata))
-+  return kmemdup(pdata, sizeof(*pdata), GFP_KERNEL);
-+
-+  np = of_find_matching_node(NULL, wlcore_of_match);
-+  if (!np) {
-+  dev_err(dev, "No platform data set\n");
-+  return NULL;
-+  }
-+
-+  pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
-+  if (!pdata) {
-+  dev_err(dev, "Can't allocate platform data\n");
-+  return NULL;
-+  }
-+
-+  if (of_property_read_u32(np, "irq", &pdata->irq)) {
-+  if (!of_property_read_u32(np, "gpio", &gpio) &&
-+  !gpio_request_one(gpio, GPIOF_IN, "wlcore_irq")) {
-+  pdata->gpio = gpio;
-+  pdata->irq = gpio_to_irq(gpio);
-+  }
-+  }
-+
-+  /* Optional fields */
-+  pdata->use_eeprom = of_property_read_bool(np, "use-eeprom");
-+  of_property_read_u32(np, "board-ref-clock", &pdata->board_ref_clock);
-+  of_property_read_u32(np, "board-tcxo-clock", &pdata->board_tcxo_clock);
-+  of_property_read_u32(np, "platform-quirks", &pdata->platform_quirks);
-+
-+  return pdata;
-+}
-+
-+static void del_platform_data(struct wl12xx_platform_data *pdata)
-+{
-+  if (pdata->gpio)
-+  gpio_free(pdata->gpio);
-+
-+  kfree(pdata);
-+}
-+
- static int wl1271_probe(struct sdio_func *func,
- const struct sdio_device_id *id)
- {
-@@ -245,12 +301,9 @@ static int wl1271_probe(struct sdio_func
-   /* Use block mode for transferring over one block size of data */
-   func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;
- 
--  pdev_data.pdata = wl12xx_get_platform_data();
--  if (IS_ERR(pdev_data.pdata)) {
--  ret = PTR_ERR(pdev_data.pdata);
--  dev_err(glue->dev, "missing wlan platform data: %d\n", ret);
-+  pdev_data.pdata = get_platform_data(&func->dev);
-+  if (!(pdev_data.pdata))
-   goto out_free_glue;
--  }
- 
-   /* if sdio can keep power while host is suspended, enable wow */
-   mmcflags = sdio_get_host_pm_caps(func);
-@@ -279,7 +332,7 @@ static int wl1271_probe(struct sdio_func
-   if (!glue->core) {
-   dev_err(glue->dev, "can't allocate platform_device");
-   ret = -ENOMEM;
--  goto out_free_glue;
-+  goto out_free_pdata;
-   }
- 
-   glue->core->dev.parent = &func->dev;
-@@ -313,6 +366,9 @@ static int wl1271_probe(struct sdio_func
- out_dev_put:
-   platform_device_put(glue->core);
- 
-+out_free_pdata:
-+  del_platform_data(pdev_data.pdata);
-+
- out_free_glue:
-   kfree(glu

[OpenWrt-Devel] [PATCH 2/5] kernel: fix kmod-usb-phy-omap-usb2

2015-03-28 Thread Dirk Neukirchen
upstream change in Kernel 3.18
commit: "phy: rename struct omap_control_usb to struct omap_control_phy"

Signed-off-by: Dirk Neukirchen 
---
 package/kernel/linux/modules/usb.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/kernel/linux/modules/usb.mk 
b/package/kernel/linux/modules/usb.mk
index 7a63829..5a7d976 100644
--- a/package/kernel/linux/modules/usb.mk
+++ b/package/kernel/linux/modules/usb.mk
@@ -150,11 +150,11 @@ define KernelPackage/usb-phy-omap-usb2
   TITLE:=Support for OMAP2 USB PHY
   KCONFIG:= \
CONFIG_OMAP_USB2 \
-   CONFIG_OMAP_CONTROL_USB
+   CONFIG_OMAP_CONTROL_PHY
   DEPENDS:=@TARGET_omap
   FILES:= \
$(LINUX_DIR)/drivers/phy/phy-omap-usb2.ko \
-   $(LINUX_DIR)/drivers/usb/phy/phy-omap-control.ko
+   $(LINUX_DIR)/drivers/phy/phy-omap-control.ko
   AUTOLOAD:=$(call AutoLoad,45,phy-omap-control phy-omap-usb2)
   $(call AddDepends/usb)
 endef
-- 
2.3.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 5/5] omap: add missing symbols

2015-03-28 Thread Dirk Neukirchen
enabled by default like other TWL4030 symbols

Signed-off-by: Dirk Neukirchen 
---
 target/linux/omap/config-3.18 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/linux/omap/config-3.18 b/target/linux/omap/config-3.18
index 178d26f..a06a350 100644
--- a/target/linux/omap/config-3.18
+++ b/target/linux/omap/config-3.18
@@ -482,6 +482,7 @@ CONFIG_SCHED_HRTICK=y
 # CONFIG_SCSI_DMA is not set
 CONFIG_SENSORS_LM75=y
 # CONFIG_SENSORS_PWM_FAN is not set
+CONFIG_SENSORS_TWL4030_MADC=y
 CONFIG_SERIAL_8250_EXTENDED=y
 CONFIG_SERIAL_8250_SHARE_IRQ=y
 CONFIG_SERIAL_OF_PLATFORM=y
@@ -558,6 +559,7 @@ CONFIG_TI_PRIV_EDMA=y
 CONFIG_TOUCHSCREEN_TI_AM335X_TSC=y
 CONFIG_TREE_RCU=y
 CONFIG_TWL4030_CORE=y
+CONFIG_TWL4030_MADC=y
 CONFIG_TWL4030_POWER=y
 CONFIG_TWL4030_WATCHDOG=y
 CONFIG_TWL6040_CORE=y
-- 
2.3.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 3/5] kernel: fix kmod-usb2-omap usb module

2015-03-28 Thread Dirk Neukirchen
CONFIG_MFD_OMAP_USB_HOST is needed for working USB on BeagleBoard

tested on BeagleBoard C4 (EBVBeagle)

Signed-off-by: Dirk Neukirchen 
---
 package/kernel/linux/modules/usb.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/package/kernel/linux/modules/usb.mk 
b/package/kernel/linux/modules/usb.mk
index 5a7d976..6fe01d9 100644
--- a/package/kernel/linux/modules/usb.mk
+++ b/package/kernel/linux/modules/usb.mk
@@ -373,7 +373,9 @@ $(eval $(call KernelPackage,usb2-fsl))
 define KernelPackage/usb2-omap
   TITLE:=Support for USB2 for OMAP
   DEPENDS:=@TARGET_omap +kmod-usb-phy-nop +kmod-usb-phy-am335x +kmod-usb2
-  KCONFIG:=CONFIG_USB_EHCI_HCD_OMAP
+  KCONFIG:=\
+   CONFIG_MFD_OMAP_USB_HOST=y \
+   CONFIG_USB_EHCI_HCD_OMAP
   FILES:=$(LINUX_DIR)/drivers/usb/host/ehci-omap.ko
   AUTOLOAD:=$(call AutoLoad,39,ehci-omap)
   $(call AddDepends/usb)
-- 
2.3.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 4/5] omap: add profile for BeagleBoard

2015-03-28 Thread Dirk Neukirchen
original BeagleBoard has no Ethernet
provide a profile with all available USB Ethernet adapters
EBVBeagle comes with a kmod-usb-net-mcs7830 compatible device

tested with BeagleBoard C4

Signed-off-by: Dirk Neukirchen 
---
 target/linux/omap/profiles/beagleboard.mk | 24 
 1 file changed, 24 insertions(+)
 create mode 100644 target/linux/omap/profiles/beagleboard.mk

diff --git a/target/linux/omap/profiles/beagleboard.mk 
b/target/linux/omap/profiles/beagleboard.mk
new file mode 100644
index 000..1624bbb
--- /dev/null
+++ b/target/linux/omap/profiles/beagleboard.mk
@@ -0,0 +1,24 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/BEAGLEBOARD
+   NAME:=EBV BeagleBoard
+   FEATURES:= usb ext4 targz
+   DEFAULT_PACKAGES += kmod-usb2 kmod-usb2-omap \
+   kmod-usb-net kmod-usb-net-asix \
+   kmod-usb-net-asix-ax88179 kmod-usb-net-hso \
+   kmod-usb-net-kaweth kmod-usb-net-pegasus \
+   kmod-usb-net-mcs7830 kmod-usb-net-smsc95xx \
+   kmod-usb-net-dm9601-ether
+endef
+
+define Profile/BEAGLEBOARD/Description
+   Package set for the BEAGLEBOARD and similar devices.
+   Contains various USB-NET drivers for boards without Ethernet.
+endef
+
+$(eval $(call Profile,BEAGLEBOARD))
\ No newline at end of file
-- 
2.3.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] seccomp patch lead to build failures

2015-03-28 Thread Dirk Neukirchen
On 26.03.2015 21:32, John Crispin wrote:
> 
> 
> On 26/03/2015 19:17, Dirk Neukirchen wrote:
>> procd: add jail support 45010
>>
>> leads to build errors on some? arches
>>
>> On omap I get:
>> /jail/seccomp-bpf.h:72:3: error: #w$
>>  # warning "Platform does not support seccomp filter yet"
>>
>> which fails the build completely (-Werror issue)
>>
>> I think there are some issues with other arch/detection when building 
>> libseccomp
>> especially for PowerPC arch:
>> - 
>> http://buildbot.openwrt.org:8010/broken_packages/mpc85xx/libseccomp/compile.txt
>> - http://buildbot.openwrt.org:8010/broken_packages/mpc83xx/
>>
>> because I think atm there is no powerpc support:
>> I looked in: https://github.com/seccomp/libseccomp/tree/master/src
> 
> Hi Dirk,
> 
> pushed a fix, please test it and let me know if the problem is gone
> 
>   John
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
> 

Thanks for the quick fix - build error on omap is gone

I submitted a patch series that contains a fix for omap 3.18 
containing missing symbols so buildbot will be unbroken
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/3] kernel: video.mk: [media] sn9c102: remove deprecated driver

2015-03-28 Thread Dirk Neukirchen
driver in staging since 3.14
removed upstream in 3.17

from upstream commit message:
Most webcams covered by this driver are now supported by gspca.
Nobody has the hardware or is willing to convert the remaining devices to gspca.

Signed-off-by: Dirk Neukirchen 
---
 package/kernel/linux/modules/video.mk | 16 
 1 file changed, 16 deletions(-)

diff --git a/package/kernel/linux/modules/video.mk 
b/package/kernel/linux/modules/video.mk
index 2bf8054..25ef9cb 100644
--- a/package/kernel/linux/modules/video.mk
+++ b/package/kernel/linux/modules/video.mk
@@ -164,22 +164,6 @@ endef
 $(eval $(call KernelPackage,video-cpia2))
 
 
-define KernelPackage/video-sn9c102
-  TITLE:=SN9C102 Camera Chip support
-  DEPENDS:=@USB_SUPPORT +kmod-usb-core
-  KCONFIG:=CONFIG_USB_SN9C102
-  FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/sn9c102/sn9c102.ko
-  AUTOLOAD:=$(call AutoProbe,gspca_sn9c20x)
-  $(call AddDepends/camera)
-endef
-
-define KernelPackage/video-sn9c102/description
- Kernel modules for supporting SN9C102 camera chips
-endef
-
-$(eval $(call KernelPackage,video-sn9c102))
-
-
 define KernelPackage/video-pwc
   TITLE:=Philips USB webcam support
   DEPENDS:=@USB_SUPPORT +kmod-usb-core +kmod-video-videobuf2
-- 
2.3.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/3] kernel: remove mp-alg

2015-03-28 Thread Dirk Neukirchen
from upstream
commit title: "[IPV4]: The scheduled removal of multipath cached routing 
support."
removed in Kernel 2.6.23 (2007)
Reasons: very buggy, no maintainer, no fixes

Signed-off-by: Dirk Neukirchen 
---
 package/kernel/linux/modules/netsupport.mk | 27 ---
 1 file changed, 27 deletions(-)

diff --git a/package/kernel/linux/modules/netsupport.mk 
b/package/kernel/linux/modules/netsupport.mk
index 9de1ce2..4ac23c6 100644
--- a/package/kernel/linux/modules/netsupport.mk
+++ b/package/kernel/linux/modules/netsupport.mk
@@ -843,33 +843,6 @@ endef
 $(eval $(call KernelPackage,ax25))
 
 
-define KernelPackage/mp-alg
-  SUBMENU:=$(NETWORK_SUPPORT_MENU)
-  TITLE:=ECMP caching algorithms
-  KCONFIG:= \
-   CONFIG_IP_ROUTE_MULTIPATH_RR \
-   CONFIG_IP_ROUTE_MULTIPATH_RANDOM \
-   CONFIG_IP_ROUTE_MULTIPATH_WRANDOM \
-   CONFIG_IP_ROUTE_MULTIPATH_DRR
-  FILES:= \
-   $(LINUX_DIR)/net/ipv4/multipath_rr.ko \
-   $(LINUX_DIR)/net/ipv4/multipath_random.ko \
-   $(LINUX_DIR)/net/ipv4/multipath_wrandom.ko \
-   $(LINUX_DIR)/net/ipv4/multipath_drr.ko
-  AUTOLOAD:=$(call AutoLoad,35,multipath_rr multipath_random multipath_wrandom 
multipath_drr)
-endef
-
-define KernelPackage/mp-alg/description
- Kernel modules that provide several different algorithms for multipath
- route selection from the route cache. The iproute "mpath" argument allows
- specifying which algorithm to use for routes.
- quagga (at least <=0.99.6) requires a multipath patch to support this
- cached mp route feature.
-endef
-
-$(eval $(call KernelPackage,mp-alg))
-
-
 define KernelPackage/pktgen
   SUBMENU:=$(NETWORK_SUPPORT_MENU)
   DEPENDS:=@!TARGET_uml
-- 
2.3.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 3/3] netfilter: add missing module/symbol

2015-03-28 Thread Dirk Neukirchen
ipv4 symbol was added but ipv6 symbol is missing

Signed-off-by: Dirk Neukirchen 
---
 include/netfilter.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/netfilter.mk b/include/netfilter.mk
index cfeb0bd..e95744f 100644
--- a/include/netfilter.mk
+++ b/include/netfilter.mk
@@ -335,6 +335,7 @@ $(eval $(if $(NF_KMOD),$(call 
nf_add,NFT_CORE,CONFIG_NF_TABLES_IPV6, $(P_V6)nf_t
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CHAIN_ROUTE_IPV6, 
$(P_V6)nft_chain_route_ipv6, ge 3.14.0),))
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_REDIR, 
$(P_XT)nft_redir, ge 3.19.0),))
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_REDIR_IPV4, 
$(P_V4)nft_redir_ipv4, ge 3.19.0),))
+$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_REDIR_IPV6, 
$(P_V6)nft_redir_ipv6, ge 3.19.0),))
 
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_NAT, $(P_XT)nft_nat, 
ge 3.14.0),))
 $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NF_NAT_MASQUERADE_IPV4, 
$(P_V4)nf_nat_masquerade_ipv4, ge 3.18.0),))
-- 
2.3.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/2] [packages] add support for Huawei NCM modems

2015-03-28 Thread Maarten Deprez
Adds support for Huawei NCM modems, which expect ndisdup commands at a
separate cdc-wdm device, supported by kmod-usb-net-huawei-cdc-ncm.
This builds on the work of Oskari Rauta at
https://sites.google.com/site/variousopenwrt/huawei-e3267 . In
particular, i added a lot of resilience. It has provided me with a
stable connection on Huawei E303 and E398 modems during the last few
months.

Signed-off-by: Maarten Deprez 


diff --git a/net/huawei-ncm/Makefile b/net/huawei-ncm/Makefile
new file mode 100644
index 000..27a0bcc
--- /dev/null
+++ b/net/huawei-ncm/Makefile
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2015 Maarten Deprez 
+endef
+
+define Package/huawei-ncm/description
+ Protocol scripts to make and maintain connections to 3G/4G networks
over huawei NCM modems
+endef
+
+define Build/Prepare
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/huawei-ncm/install
+$(INSTALL_DIR) $(1)/lib/netifd/proto
+$(INSTALL_BIN) ./files/lib/netifd/proto/huawei_ncm.sh
$(1)/lib/netifd/proto/huawei_ncm.sh
+$(INSTALL_DIR) $(1)/usr/bin
+$(INSTALL_BIN) ./files/usr/bin/* $(1)/usr/bin/
+$(INSTALL_DIR) $(1)/usr/sbin
+$(INSTALL_BIN) ./files/usr/sbin/* $(1)/usr/sbin/
+$(INSTALL_DIR) $(1)/usr/lib/huawei-ncm
+$(INSTALL_DATA) ./files/usr/lib/huawei-ncm/*.sh $(1)/usr/lib/huawei-ncm/
+endef
+
+$(eval $(call BuildPackage,huawei-ncm))
diff --git a/net/huawei-ncm/files/lib/netifd/proto/huawei_ncm.sh
b/net/huawei-ncm/files/lib/netifd/proto/huawei_ncm.sh
new file mode 100755
index 000..a75880c
--- /dev/null
+++ b/net/huawei-ncm/files/lib/netifd/proto/huawei_ncm.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+. /lib/functions.sh
+. ../netifd-proto.sh
+init_proto "$@"
+
+proto_huawei_ncm_init_config() {
+renew_handler=1
+
+proto_config_add_string 'pin'
+proto_config_add_string 'apn'
+proto_config_add_string 'mode'
+proto_config_add_string 'freq'
+proto_config_add_string 'timeout'
+proto_config_add_string 'interval'
+}
+
+proto_huawei_ncm_setup() {
+local config="$1"
+local iface="$2"
+
+local pin apn mode freq timeout interval
+json_get_vars pin apn mode freq timeout interval
+
+proto_export "INTERFACE=$config"
+proto_run_command "$config" /usr/sbin/huawei-ncm-connect -vvv \
+-p /var/run/huawei-ncm-$iface.pid \
+-s /lib/netifd/dhcp.script \
+-m "${mode:-2,0}" \
+-f "${freq:-0}" \
+-n "$pin" \
+-t "${timeout:-15}" \
+-i "${interval:-60}" \
+"$iface" \
+"$apn"
+
+}
+
+proto_huawei_ncm_renew() {
+local config="$1"
+proto_kill_command "$config" SIGHUP
+}
+
+proto_huawei_ncm_teardown() {
+local config="$1"
+proto_kill_command "$config"
+}
+
+add_protocol huawei_ncm
diff --git a/net/huawei-ncm/files/usr/bin/huawei-ncm-cells
b/net/huawei-ncm/files/usr/bin/huawei-ncm-cells
new file mode 100755
index 000..9443a96
--- /dev/null
+++ b/net/huawei-ncm/files/usr/bin/huawei-ncm-cells
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+VERBOSITY=1
+IFACE="$1"
+
+
+### includes
+
+. /usr/lib/huawei-ncm/error.sh
+. /usr/lib/huawei-ncm/find-modem.sh
+. /usr/lib/huawei-ncm/modem.sh
+
+
+### find and init modem
+
+find_modem
+MODEM="$PCUI"
+init_modem
+
+m=$(modem '^CELLINFO=?') || exit $?
+
+for i in $(echo "$m" | sed -e 's/[()]//g' -e 's/,/\n/g'); do
+
+n="$(modem "^CELLINFO=$i"
'^[0-9]\+,[0-9]\+,-[0-9]\+,-[0-9]\+$')" || exit $?
+
+[ -n "$n" ] || continue
+
+printf '%s [%d dBm / %d dBm]\n' \
+"$(echo "$n" | cut -d, -f1)" \
+"$(echo "$n" | cut -d, -f3)" \
+"$(echo "$n" | cut -d, -f4)"
+
+done
diff --git a/net/huawei-ncm/files/usr/bin/huawei-ncm-info
b/net/huawei-ncm/files/usr/bin/huawei-ncm-info
new file mode 100755
index 000..1b358cd
--- /dev/null
+++ b/net/huawei-ncm/files/usr/bin/huawei-ncm-info
@@ -0,0 +1,116 @@
+#!/bin/sh
+
+VERBOSITY=1
+IFACE="$1"
+
+
+### includes
+
+. /usr/lib/huawei-ncm/error.sh
+. /usr/lib/huawei-ncm/find-modem.sh
+. /usr/lib/huawei-ncm/modem.sh
+
+
+### find and init modem
+
+find_modem
+init_modem "$PCUI"
+
+
+### product information
+
+modem I . |
+while read i; do
+
+case "$i" in
+Manufacturer:*)
+echo -n "vendor ";;
+Model:*)
+echo -n "model ";;
+Revision:*)
+echo -n "firmware ";;
+IMEI:*)
+echo -n "imei ";;
+*) continue;;
+esac
+
+echo "$i" | sed 's/^[^:]*: //'
+
+done
+
+
+### network
+
+m="$(modem '+COPS?')" || exit $?
+echo -n "provider "
+echo "$m" | cut -d, -f3 | sed 's/"//g'
+
+
+### mode
+
+m="$(modem '^SYSCFG?')" || exit $?
+echo -n "mode "
+
+case "$(echo "$m" | cut -d, -f1,2)" in
+2,0) echo "Auto";;
+2,1) echo "GSM, WCDMA";;
+2,2) echo "WCDMA, GSM";;
+13,*) echo "GSM";;
+14,*) echo "WCDMA";;
+*) echo "Unknown";;
+esac
+
+
+### data bandwidth
+
+m="$(modem '+CGEQNEG=1')" || exit $?
+printf "uplink %s kbps\n" "$(echo "$m" | cut -d, -f3)"
+printf "d

[OpenWrt-Devel] [PATCH 2/2] [luci] add Huawei NCM protocol

2015-03-28 Thread Maarten Deprez
Adds Huawei NCM protocol as well as huawei modem status support for
Luci. Based on the work  of Oskari Rauta at
https://sites.google.com/site/variousopenwrt/huawei-e3267 . This
version adds frequency locking, between other things.

Signed-off-by: Maarten Deprez 



diff --git a/protocols/luci-proto-huawei-ncm/Makefile
b/protocols/luci-proto-huawei-ncm/Makefile
new file mode 100644
index 000..720b590
--- /dev/null
+++ b/protocols/luci-proto-huawei-ncm/Makefile
@@ -0,0 +1,14 @@
+#
+# Copyright (C) 2014-2015 Maarten Deprez 
+#
+# This is free software, licensed under the Apache License, Version 2.0 .
+#
+
+include $(TOPDIR)/rules.mk
+
+LUCI_TITLE:=Support for Huawei NCM
+LUCI_DEPENDS:=+huawei-ncm
+
+include ../../luci.mk
+
+# call BuildPackage - OpenWrt buildroot signature
diff --git 
a/protocols/luci-proto-huawei-ncm/htdocs/luci-static/resources/huawei_ncm_xhr.js
b/protocols/luci-proto-huawei-ncm/htdocs/luci-static/resources/huawei_ncm_xhr.js
new file mode 100644
index 000..a3962c9
--- /dev/null
+++ 
b/protocols/luci-proto-huawei-ncm/htdocs/luci-static/resources/huawei_ncm_xhr.js
@@ -0,0 +1,247 @@
+/*
+ * xhr.js - XMLHttpRequest helper class
+ */
+
+var gotinfoD = "0";
+var hwrefreshD = "0";
+var modemdevD = ""
+
+XHR2 = function()
+{
+this.reinit = function()
+{
+if (window.XMLHttpRequest) {
+this._xmlHttp = new XMLHttpRequest();
+}
+else if (window.ActiveXObject) {
+this._xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
+}
+else {
+alert("dongle_xhr.js: XMLHttpRequest is not supported by
this browser!");
+}
+}
+
+this.busy = function() {
+if (!this._xmlHttp)
+return false;
+
+switch (this._xmlHttp.readyState)
+{
+case 1:
+case 2:
+case 3:
+return true;
+
+default:
+return false;
+}
+}
+
+this.abort = function() {
+if (this.busy())
+this._xmlHttp.abort();
+}
+
+this.get = function(url,data,callback)
+{
+this.reinit();
+
+var xhr2  = this._xmlHttp;
+var code = this._encode(data);
+
+url = location.protocol + '//' + location.host + url;
+
+if (code)
+if (url.substr(url.length-1,1) == '&')
+url += code;
+else
+url += '?' + code;
+
+xhr2.open('GET', url, true);
+
+xhr2.onreadystatechange = function()
+{
+if (xhr2.readyState == 4) {
+var json = null;
+if (xhr2.getResponseHeader("Content-Type") ==
"application/json") {
+try {
+json = eval('(' + xhr2.responseText + ')');
+}
+catch(e) {
+json = null;
+}
+}
+
+callback(xhr2, json);
+}
+}
+
+xhr2.send(null);
+}
+
+this.post = function(url,data,callback)
+{
+this.reinit();
+
+var xhr2  = this._xmlHttp;
+var code = this._encode(data);
+
+xhr2.onreadystatechange = function()
+{
+if (xhr2.readyState == 4)
+callback(xhr2);
+}
+
+xhr2.open('POST', url, true);
+xhr2.setRequestHeader('Content-type',
'application/x-www-form-urlencoded');
+xhr2.setRequestHeader('Content-length', code.length);
+xhr2.setRequestHeader('Connection', 'close');
+xhr2.send(code);
+}
+
+this.cancel = function()
+{
+this._xmlHttp.onreadystatechange = function(){};
+this._xmlHttp.abort();
+}
+
+this.send_form = function(form,callback,extra_values)
+{
+var code = '';
+
+for (var i = 0; i < form.elements.length; i++)
+{
+var e = form.elements[i];
+
+if (e.options)
+{
+code += (code ? '&' : '') +
+form.elements[i].name + '=' + encodeURIComponent(
+e.options[e.selectedIndex].value
+);
+}
+else if (e.length)
+{
+for (var j = 0; j < e.length; j++)
+if (e[j].name) {
+code += (code ? '&' : '') +
+e[j].name + '=' + encodeURIComponent(e[j].value);
+}
+}
+else
+{
+code += (code ? '&' : '') +
+e.name + '=' + encodeURIComponent(e.value);
+}
+}
+
+if (typeof extra_values == 'object')
+for (var key in extra_values)
+code += (code ? '&' : '') +
+key + '=' + encodeURIComponent(extra_values[key]);
+
+return(
+(form.method == 'get')
+? this.get(form.getAttribute('action'), code, callba

Re: [OpenWrt-Devel] [PATCH 1/2] [packages] add support for Huawei NCM modems

2015-03-28 Thread Cezary Jackiewicz
Dnia 2015-03-28, o godz. 17:28:50
Maarten Deprez  napisaƂ(a):

> Adds support for Huawei NCM modems, which expect ndisdup commands at a
> separate cdc-wdm device, supported by kmod-usb-net-huawei-cdc-ncm.
> This builds on the work of Oskari Rauta at
> https://sites.google.com/site/variousopenwrt/huawei-e3267 . In
> particular, i added a lot of resilience. It has provided me with a
> stable connection on Huawei E303 and E398 modems during the last few
> months.

[...]

> +$(eval $(call BuildPackage,huawei-ncm))
> diff --git a/net/huawei-ncm/files/lib/netifd/proto/huawei_ncm.sh

Why you do that? ncm from gcom-ncm is enough, you do not have to do 
specifically the new protocol. Just set /dev/cdc-wdm0 as device. Tested
with E3131 in huawei/ncm mode.

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


Re: [OpenWrt-Devel] [PATCH] tools/e2fsprogs: add a darwin-compat patch

2015-03-28 Thread Felix Fietkau
On 2015-03-17 07:41, Lawrence D'Anna wrote:
> On darwin we need to import stdint to get these integer typedefs.
It works for me on darwin without this patch. What version are you
using, and what does the error look like?

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