[OpenWrt-Devel] [PATCH] buildroot: improve git submodule handling for packages

2016-02-26 Thread Karl Palsson
Move the `--recursive` switch from `git clone` to `git submodule`
so that submodules are cloned for upstream branches where the
PKG_SOURCE_VERSION commit-ish has a different .gitmodules
configuration than the repository default.

This is, for example, required when the master branch for a source
package does not use submodules, but its topic branch for OpenWRT
does.

This changes the buildroot dependency from git-1.6.2 to git 1.7.12.2,
which was released September 2012.

Signed-off-by: Darik Horn 
Signed-off-by: Karl Palsson 
---
 include/download.mk | 5 +++--
 include/prereq-build.mk | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)


Note: this does NOT help with CONFIG_SRC_TREE_OVERRIDE=y!

diff --git a/include/download.mk b/include/download.mk
index 8619734..a118aad 100644
--- a/include/download.mk
+++ b/include/download.mk
@@ -90,8 +90,9 @@ define DownloadMethod/git
cd $(TMP_DIR)/dl && \
rm -rf $(SUBDIR) && \
[ \! -d $(SUBDIR) ] && \
-   git clone $(URL) $(SUBDIR) --recursive && \
-   (cd $(SUBDIR) && git checkout $(VERSION) && git submodule 
update) && \
+   git clone $(URL) $(SUBDIR) && \
+   (cd $(SUBDIR) && git checkout $(VERSION) && \
+   git submodule update --init --recursive) && \
echo "Packing checkout..." && \
rm -rf $(SUBDIR)/.git && \
$(call dl_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
diff --git a/include/prereq-build.mk b/include/prereq-build.mk
index bcb2103..23a5b93 100644
--- a/include/prereq-build.mk
+++ b/include/prereq-build.mk
@@ -154,8 +154,8 @@ $(eval $(call SetupHostCommand,python,Please install Python 
2.x, \
 $(eval $(call SetupHostCommand,svn,Please install the Subversion client, \
svn --version | grep Subversion))
 
-$(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.6.5, \
-   git clone 2>&1 | grep -- --recursive))
+$(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \
+   git submodule update --help 2>&1 | grep -- --recursive))
 
 $(eval $(call SetupHostCommand,file,Please install the 'file' package, \
file --version 2>&1 | grep file))
-- 
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/3] ar71xx: WNR612v2: exclude USB modules from image

2016-02-26 Thread Michal
On Fri, 26 Feb 2016 21:47:42 +0100
Felix Fietkau  wrote:

> On 2016-02-26 21:36, Felix Fietkau wrote:
> > On 2016-02-26 21:18, Michal wrote:  
> >> On Thu, 25 Feb 2016 14:27:56 +0100
> >> Felix Fietkau  wrote:
> >>   
> >>> On 2016-02-21 22:55, Michal wrote:  
> >>> > From: Michal Cieslakiewicz 
> >>> > Date: Sun, 21 Feb 2016 18:17:27 +0100
> >>> > Subject: [PATCH 1/3] ar71xx: WNR612v2: exclude USB modules from
> >>> > image
> >>> > 
> >>> > Netgear WNR612v2 has no USB port yet default system image
> >>> > includes USB kernel modules. This patch fixes that.
> >>> > 
> >>> > Signed-off-by: Michal Cieslakiewicz 
> >>> > ---
> >>> >  target/linux/ar71xx/generic/profiles/netgear.mk | 1 +
> >>> >  1 file changed, 1 insertion(+)
> >>> > 
> >>> > diff --git a/target/linux/ar71xx/generic/profiles/netgear.mk
> >>> > b/target/linux/ar71xx/generic/profiles/netgear.mk index
> >>> > 2796e46..32c692a 100644 ---
> >>> > a/target/linux/ar71xx/generic/profiles/netgear.mk +++
> >>> > b/target/linux/ar71xx/generic/profiles/netgear.mk @@ -54,6
> >>> > +54,7 @@ $(eval $(call Profile,WNR2000V4)) 
> >>> >  define Profile/WNR612V2
> >>> > NAME:=NETGEAR WNR612V2 / On Networks N150
> >>> > +   PACKAGES:= -kmod-usb-core -kmod-usb-ohci -kmod-usb2
> >>> > -kmod-ledtrig-usbdev
> >>> This doesn't make any sense to me. Those modules are not enabled
> >>> in the target default package set, so it shouldn't be necessary
> >>> for the profile to explicitly remove them.
> >>> I don't see how this patch changes anything...
> >>> 
> >>> - Felix  
> >> 
> >> Hello Felix,
> >> 
> >> I disagree, patch works as expected. If you remove PACKAGES line
> >> completely, USB modules gets into image and its size increases
> >> (3407876 vs 3473412, tested on r48780).
> >> 
> >> Anyway, this topic seems concluded because patch mentioned here has
> >> been included in recent trunk :-)  
> > It's not concluded for me. The patch is still wrong, because it
> > papers over a bug instead of fixing it properly.  
> Found the real bug and fixed it in r48807
> Reverted your patch in r48808
> 
> - Felix

Good, then patch described as "[PATCH 6/6] [package] exclude USB modules
from WNR2000v3 image" (apparently appears twice in patchwork:
http://patchwork.ozlabs.org/patch/582069/ and
http://patchwork.ozlabs.org/patch/582071/) that does exactly the same
for WNR2000v3 can also be reverted. I've built r48808 for this
device without it and image size is ok - no USB stuff.

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


Re: [OpenWrt-Devel] Where init scripts are linked to rc.d?

2016-02-26 Thread alzhao
Use /etc/init.d/yourscript enable

It should be enabled by default, as I know.
On Sat, 27 Feb 2016 at 03:33, Jakub Jančo  wrote:

> Hello,
>
> Im adding some custom init script in ImageBuilder throught FILES, but
> these are not linked to /etc/rc.d on first boot.
>
> Where to hook them?
>
> If I make package, will it be linked automatically?
>
> Thanks.
>
> --
> S pozdravom Jakub Janco
> ___
> 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


[OpenWrt-Devel] Exceptions are broken in the uClibc++ - any throw causes memory corruption

2016-02-26 Thread Ivan Koldaev
Hi community!


I believe I have discovered that uClibc++ incorrectly implements C++
exception ABI, allocating not enough memory in the
"__cxxabiv1::__cxa_allocate_exception":

/// code begin ///
retval = malloc (thrown_size + sizeof(__cxa_exception));
/// code end ///


uClibc++ allocates "thrown_size + sizeof(__cxa_exception)" while stdlibc++
allocates "thrown_size += sizeof (__cxa_refcounted_exception);" since
2009-01-07 (https://gcc.gnu.org/bugzilla/attachment.cgi?id=17047) .
The "__cxa_refcounted_exception" is wrapper around "__cxa_exception" and
thus bigger than "__cxa_exception" alone.
That causes memory corruption (buffer overflow) inside
"__cxxabiv1::__cxa_throw" which is implemented by GCC's libsupc++:

/// code begin (gcc-5.2.0/libstdc++-v3/libsupc++/eh_throw.cc:69) ///
__cxa_refcounted_exception *header
  = __get_refcounted_exception_header_from_obj (obj);
header->referenceCount = 1;
/// code end ///


In the code above, the "header->referenceCount = 1" writes in memory
preceding region allocated for both thrown exception object and exception
structure.
The "obj" is pointer to memory allocated by
"__cxxabiv1::__cxa_allocate_exception", the
"__get_refcounted_exception_header_from_obj (obj)" is defined as:

/// code begin ///
static inline __cxa_refcounted_exception *
__get_refcounted_exception_header_from_obj (void *ptr)
{
  return reinterpret_cast<__cxa_refcounted_exception *>(ptr) - 1;
}
/// code end ///


Thus GCC's libsupc++ expects enough memory allocated preceding exception
object to keep structure "__cxa_refcounted_exception", but uClibc++
allocates only "sizeof(__cxa_exception)" bytes before exception object.

When binary is compiled for OpenWRT's musl libc standard library, the
program crashes with SIGSEGV in the "free" call from
"__cxxabiv1::__cxa_free_exception" because musl is very sensitive for
memory corruption (musl's malloc stores meta-information about memory
region in 8 bytes right before memory chunk itself).
When compiled against glibc, the segmentation fault does not happen
immediately in the "__cxxabiv1::__cxa_free_exception", but memory
corruptions still should take place, yielding undefined behavior.


I would like someone experienced with OpenWRT, musl and uClibc++ to review
and verify my discoveries, because there is chance that I miss some magic
compile flag that makes OpenWRT to build binaries with other implementation
of "__cxxabiv1::__cxa_throw" or I miss something else.
This bug seems to exist for many years (since 2009), so I wonder why no one
noticed that try-catch corrupts memory and it completely does not work for
musl-based builds. My quick research shown that most of the OpenWRT
packages do not use C++ exceptions at all, that is probably why. Also musl
libc which makes this issue very visible, was adopted just recently, so
perhaps not much time passed yet.


For your convenience, I have created OpenWRT package and feed for this test
case:
package: https://github.com/CoolSpot/openwrt-test/throw-catch-sigsegv
feed: https://github.com/CoolSpot/openwrt-test-packages

### Installing the feed
cd ~/Documents/openwrt
echo "src-git openwrttest
https://github.com/coolspot/openwrt-test-packages.git; >> ./feeds.conf
./scripts/feeds update openwrttest
./scripts/feeds install -a -p openwrttest

### Building the package
make menuconfig
# In the menuconfig select the package Test/sub-test/throw-catch-sigsegv to
be built
make package/throw-catch-sigsegv/install
# Copy the package on the device (or VM)
scp
./bin/malta/packages/openwrttest/throw-catch-sigsegv_2016-02-25_malta_mips.ipk
qemu:/tmp/
# on the device (or VM)
root@OpenWrt:~# opkg install
/tmp/throw-catch-sigsegv_2016-02-25_malta_mips.ipk

I am using following setup for reproducing:
OpenWRT commit 4885087731e4ee9ac9823bd5cf3e777eecfd33d9 (Tue Feb 23
14:40:40 2016 +)
uClibc++ compiled with DODEBUG="y" (CONFIG_DEBUG does not affect uClibc++).
qemu-mips version 2.3.0 (Debian 1:2.3+dfsg-5ubuntu9.1)

OpenWRT diffconfig:
CONFIG_TARGET_malta=y
CONFIG_TARGET_malta_be=y
CONFIG_TARGET_malta_be_Default=y
CONFIG_DEBUG=y
CONFIG_KERNEL_PERF_EVENTS=y
CONFIG_KERNEL_PROC_PAGE_MONITOR=y
CONFIG_KERNEL_PROFILING=y
CONFIG_KERNEL_SLABINFO=y
CONFIG_KERNEL_SLUB_DEBUG=y
CONFIG_KERNEL_SLUB_DEBUG_ON=y
CONFIG_NO_STRIP=y
CONFIG_OPENSSL_WITH_EC=y
CONFIG_PACKAGE_ar=y
CONFIG_PACKAGE_binutils=y
CONFIG_PACKAGE_block-mount=y
CONFIG_PACKAGE_ethtool=y
CONFIG_PACKAGE_gdbserver=y
CONFIG_PACKAGE_kmod-crypto-hash=y
CONFIG_PACKAGE_kmod-fs-ext4=y
CONFIG_PACKAGE_kmod-lib-crc16=y
CONFIG_PACKAGE_libbfd=y
CONFIG_PACKAGE_libcap=y
CONFIG_PACKAGE_libncurses=y
CONFIG_PACKAGE_libnl=y
CONFIG_PACKAGE_libnl-core=y
CONFIG_PACKAGE_libnl-genl=y
CONFIG_PACKAGE_libnl-nf=y
CONFIG_PACKAGE_libnl-route=y
CONFIG_PACKAGE_libopcodes=y
CONFIG_PACKAGE_libopenssl=y
CONFIG_PACKAGE_libpcap=y
CONFIG_PACKAGE_libpcre=y
CONFIG_PACKAGE_libpthread=y
CONFIG_PACKAGE_librt=y
CONFIG_PACKAGE_objdump=y
CONFIG_PACKAGE_screen=y
CONFIG_PACKAGE_strace=y
CONFIG_PACKAGE_throw-catch-sigsegv=y

Re: [OpenWrt-Devel] Setting uci defaults in trunk

2016-02-26 Thread Karl Palsson
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Felix Fietkau  wrote:
> - Interfaces using dhcp are usually considered 'wan' instead of 'lan',
> LAN should have a predictable IP address.
> If you believe that that any of the above changes are
> necessary, please provide compelling reasons for it. Otherwise
> we'd prefer to keep device configurations more consistent with
> each other.

I've had similar "problems" and the reason to choose lan instead
of wan was that wan was firewalled by default. Naming the
_single_ ethernet port as "lan" avoided this, and seemed simpler
than calling it wan and making sure the firewall rules were also
changed/disabled. It would be nice if it was easier to use the
board defaults infrastructure for devices like this with only a
single ethernet port, that are often used as client devices,
often with a wifi AP, rather than the traditional ethernet AP,
wifi disabled.

Cheers,
Karl P

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJW0MYkAAoJEBmotQ/U1cr2QDoP/jzToOGndaOqVy1OolipV9Gj
lvYHnO2MsdYuEklYdtzTCK3ZLPaGOG+T/jJY0twHnmqGMtC48/dj3udkh7KElMhi
892w+QEBaRnBOKqHlTiTc3qrQHm8f82qMRblmNjPQF9g3PywtDJhabR0g8cJKgcD
sfuROq9mhz1f4ouPuusrKSJ4qZ7DrvbsNrJECJZNeg/rKMi1bv7Ip2Xe4FJa/9Br
52hliM51Er4n6gdSP+lpVverFLfkRk9RfWOe6gT4P7EVEUsnlnYPrYdW54+sKtCJ
L5j8a5NpuBlxSE6+iLDwrrP6ntZp1ozmaqZhxdjtQCSBqOTS3BN2zNLtqQEt0LFo
ERZ/PQeLwPdfCfBevORIavgNTfg48+BG29cZ+x18uP1HaSST+V7Sp/2+jWuVkJ+6
xZryK38S6i45c8/LFMK2zPUKccTqwm0xBMaM67WmU6DNDjJJAhxQb+5xh9TC9pZo
LmiH6bXiw3ReQeVGzUXG5oeW/4U3CU+dhIpdC32HB4PKsOIZQz9UPHPMDOlRSh0K
CeOsLeJviwm/40Z3Yhm9KUT41gAsjll2nS+9/VI0ibbZx6nK1tdnqw+bld4hCyDm
wUpLiMlQxl1KBIBRhZci7KzOUM+oHJXZ6EYyhNp6hQrZhXCDiREuELPiHvG1Y3rH
XHHfg6F+VxYoYZDaQfnC
=8xkL
-END PGP SIGNATURE-
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 1/3] ar71xx: WNR612v2: exclude USB modules from image

2016-02-26 Thread Felix Fietkau
On 2016-02-26 21:36, Felix Fietkau wrote:
> On 2016-02-26 21:18, Michal wrote:
>> On Thu, 25 Feb 2016 14:27:56 +0100
>> Felix Fietkau  wrote:
>> 
>>> On 2016-02-21 22:55, Michal wrote:
>>> > From: Michal Cieslakiewicz 
>>> > Date: Sun, 21 Feb 2016 18:17:27 +0100
>>> > Subject: [PATCH 1/3] ar71xx: WNR612v2: exclude USB modules from
>>> > image
>>> > 
>>> > Netgear WNR612v2 has no USB port yet default system image
>>> > includes USB kernel modules. This patch fixes that.
>>> > 
>>> > Signed-off-by: Michal Cieslakiewicz 
>>> > ---
>>> >  target/linux/ar71xx/generic/profiles/netgear.mk | 1 +
>>> >  1 file changed, 1 insertion(+)
>>> > 
>>> > diff --git a/target/linux/ar71xx/generic/profiles/netgear.mk
>>> > b/target/linux/ar71xx/generic/profiles/netgear.mk index
>>> > 2796e46..32c692a 100644 ---
>>> > a/target/linux/ar71xx/generic/profiles/netgear.mk +++
>>> > b/target/linux/ar71xx/generic/profiles/netgear.mk @@ -54,6 +54,7 @@
>>> > $(eval $(call Profile,WNR2000V4)) 
>>> >  define Profile/WNR612V2
>>> >   NAME:=NETGEAR WNR612V2 / On Networks N150
>>> > + PACKAGES:= -kmod-usb-core -kmod-usb-ohci -kmod-usb2
>>> > -kmod-ledtrig-usbdev  
>>> This doesn't make any sense to me. Those modules are not enabled in
>>> the target default package set, so it shouldn't be necessary for the
>>> profile to explicitly remove them.
>>> I don't see how this patch changes anything...
>>> 
>>> - Felix
>> 
>> Hello Felix,
>> 
>> I disagree, patch works as expected. If you remove PACKAGES line
>> completely, USB modules gets into image and its size increases (3407876
>> vs 3473412, tested on r48780).
>> 
>> Anyway, this topic seems concluded because patch mentioned here has
>> been included in recent trunk :-)
> It's not concluded for me. The patch is still wrong, because it papers
> over a bug instead of fixing it properly.
Found the real bug and fixed it in r48807
Reverted your patch in r48808

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


Re: [OpenWrt-Devel] [PATCH 1/3] ar71xx: WNR612v2: exclude USB modules from image

2016-02-26 Thread Felix Fietkau
On 2016-02-26 21:18, Michal wrote:
> On Thu, 25 Feb 2016 14:27:56 +0100
> Felix Fietkau  wrote:
> 
>> On 2016-02-21 22:55, Michal wrote:
>> > From: Michal Cieslakiewicz 
>> > Date: Sun, 21 Feb 2016 18:17:27 +0100
>> > Subject: [PATCH 1/3] ar71xx: WNR612v2: exclude USB modules from
>> > image
>> > 
>> > Netgear WNR612v2 has no USB port yet default system image
>> > includes USB kernel modules. This patch fixes that.
>> > 
>> > Signed-off-by: Michal Cieslakiewicz 
>> > ---
>> >  target/linux/ar71xx/generic/profiles/netgear.mk | 1 +
>> >  1 file changed, 1 insertion(+)
>> > 
>> > diff --git a/target/linux/ar71xx/generic/profiles/netgear.mk
>> > b/target/linux/ar71xx/generic/profiles/netgear.mk index
>> > 2796e46..32c692a 100644 ---
>> > a/target/linux/ar71xx/generic/profiles/netgear.mk +++
>> > b/target/linux/ar71xx/generic/profiles/netgear.mk @@ -54,6 +54,7 @@
>> > $(eval $(call Profile,WNR2000V4)) 
>> >  define Profile/WNR612V2
>> >NAME:=NETGEAR WNR612V2 / On Networks N150
>> > +  PACKAGES:= -kmod-usb-core -kmod-usb-ohci -kmod-usb2
>> > -kmod-ledtrig-usbdev  
>> This doesn't make any sense to me. Those modules are not enabled in
>> the target default package set, so it shouldn't be necessary for the
>> profile to explicitly remove them.
>> I don't see how this patch changes anything...
>> 
>> - Felix
> 
> Hello Felix,
> 
> I disagree, patch works as expected. If you remove PACKAGES line
> completely, USB modules gets into image and its size increases (3407876
> vs 3473412, tested on r48780).
> 
> Anyway, this topic seems concluded because patch mentioned here has
> been included in recent trunk :-)
It's not concluded for me. The patch is still wrong, because it papers
over a bug instead of fixing it properly.

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


Re: [OpenWrt-Devel] [PATCH 1/3] ar71xx: WNR612v2: exclude USB modules from image

2016-02-26 Thread Michal
On Thu, 25 Feb 2016 14:27:56 +0100
Felix Fietkau  wrote:

> On 2016-02-21 22:55, Michal wrote:
> > From: Michal Cieslakiewicz 
> > Date: Sun, 21 Feb 2016 18:17:27 +0100
> > Subject: [PATCH 1/3] ar71xx: WNR612v2: exclude USB modules from
> > image
> > 
> > Netgear WNR612v2 has no USB port yet default system image
> > includes USB kernel modules. This patch fixes that.
> > 
> > Signed-off-by: Michal Cieslakiewicz 
> > ---
> >  target/linux/ar71xx/generic/profiles/netgear.mk | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/target/linux/ar71xx/generic/profiles/netgear.mk
> > b/target/linux/ar71xx/generic/profiles/netgear.mk index
> > 2796e46..32c692a 100644 ---
> > a/target/linux/ar71xx/generic/profiles/netgear.mk +++
> > b/target/linux/ar71xx/generic/profiles/netgear.mk @@ -54,6 +54,7 @@
> > $(eval $(call Profile,WNR2000V4)) 
> >  define Profile/WNR612V2
> > NAME:=NETGEAR WNR612V2 / On Networks N150
> > +   PACKAGES:= -kmod-usb-core -kmod-usb-ohci -kmod-usb2
> > -kmod-ledtrig-usbdev  
> This doesn't make any sense to me. Those modules are not enabled in
> the target default package set, so it shouldn't be necessary for the
> profile to explicitly remove them.
> I don't see how this patch changes anything...
> 
> - Felix

Hello Felix,

I disagree, patch works as expected. If you remove PACKAGES line
completely, USB modules gets into image and its size increases (3407876
vs 3473412, tested on r48780).

Anyway, this topic seems concluded because patch mentioned here has
been included in recent trunk :-)

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


[OpenWrt-Devel] [PATCH] ramips: EX2700: remove unused kernel modules

2016-02-26 Thread Joseph C. Lehner
Remove the kmod-mt76 and kmod-rt2800-pci packages from the EX2700
profile to free up around 100 KiB of space on the root filesystem.

This patch applies to both trunk and Chaos Calmer.

Signed-off-by: Joseph C. Lehner 

---

diff --git a/target/linux/ramips/mt7620/profiles/netgear.mk
b/target/linux/ramips/mt7620/profiles/netgear.mk
index d1b073a..9631537 100644
--- a/target/linux/ramips/mt7620/profiles/netgear.mk
+++ b/target/linux/ramips/mt7620/profiles/netgear.mk
@@ -7,7 +7,8 @@

 define Profile/EX2700
NAME:=Netgear EX2700
-   PACKAGES:=-kmod-usb-core -kmod-usb2 -kmod-usb-ohci -kmod-ledtrig-usbdev
+   PACKAGES:=-kmod-usb-core -kmod-usb2 -kmod-usb-ohci -kmod-ledtrig-usbdev 
\
+   -kmod-mt76 -kmod-rt2800-pci
 endef

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


[OpenWrt-Devel] Where init scripts are linked to rc.d?

2016-02-26 Thread Jakub Jančo
Hello,

Im adding some custom init script in ImageBuilder throught FILES, but
these are not linked to /etc/rc.d on first boot.

Where to hook them?

If I make package, will it be linked automatically?

Thanks.

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


[OpenWrt-Devel] [PATCH v2] ar71xx: Add OOLITE to the Gainstrong profile, removed standalone profile.

2016-02-26 Thread Stijn Segers
This patch moves the OOLITE profile code into the overarching Gainstrong
profile and deletes the old single profile file.

Signed-off by: Stijn Segers 

---
 target/linux/ar71xx/generic/profiles/gainstrong.mk | 11 +++
 target/linux/ar71xx/generic/profiles/oolite.mk | 18 --
 2 files changed, 11 insertions(+), 18 deletions(-)
 delete mode 100644 target/linux/ar71xx/generic/profiles/oolite.mk

diff --git a/target/linux/ar71xx/generic/profiles/gainstrong.mk 
b/target/linux/ar71xx/generic/profiles/gainstrong.mk
index a82529d..8f41539 100644
--- a/target/linux/ar71xx/generic/profiles/gainstrong.mk
+++ b/target/linux/ar71xx/generic/profiles/gainstrong.mk
@@ -15,3 +15,14 @@ define Profile/MINIBOXV1/Description
Package set optimized for the Gainstrong MiniBox V1.0
 endef
 $(eval $(call Profile,MINIBOXV1))
+
+define Profile/OOLITE
+   NAME:=Gainstrong OOLITE
+   PACKAGES:=kmod-usb-core kmod-usb2  kmod-ledtrig-usbdev
+endef
+
+
+define Profile/OOLITE/Description
+   Package set optimized for the Gainstrong OOLITE.
+endef
+$(eval $(call Profile,OOLITE))
diff --git a/target/linux/ar71xx/generic/profiles/oolite.mk 
b/target/linux/ar71xx/generic/profiles/oolite.mk
deleted file mode 100644
index 448f08d..000
--- a/target/linux/ar71xx/generic/profiles/oolite.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Copyright (C) 2009 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/OOLITE
-   NAME:=OOLITE
-   PACKAGES:=kmod-usb-core kmod-usb2  kmod-ledtrig-usbdev
-endef
-
-
-define Profile/OOLITE/Description
-   Package set optimized for the OOLITE.
-endef
-$(eval $(call Profile,OOLITE))
-
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Setting uci defaults in trunk

2016-02-26 Thread micke . prag

2016-02-26 17:20 skrev Felix Fietkau:


On 2016-02-26 15:54, micke.prag@telldus.sewrote:


2016-02-26 15:35 skrev Felix Fietkau:


On 2016-02-26 15:27, micke.prag@telldus.sewrote:


Hi I have a board config for a device that I am about to commit to
OpenWRT. I am rebasing my work against trunk but some things have
changed since I made the config. My code was written against 
r46120

but somethings doesn't work on r48800. My question is how I should
update my code to "proper OpenWRT standard"? First, network. The
board has only one network port (it is not a router). This should
be configured using DHCP. The board also has Wifi and should be
configured as a client but disabled as default. In -r46120 I put
this in /etc/uci-defaults/02_network: ucidef_set_interface_raw
"lan" "eth0" "dhcp" ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
uci batch 

Re: [OpenWrt-Devel] Setting uci defaults in trunk

2016-02-26 Thread Felix Fietkau
On 2016-02-26 15:54, micke.p...@telldus.se wrote:
> 2016-02-26 15:35 skrev Felix Fietkau:
> 
>> On 2016-02-26 15:27, micke.prag@telldus.sewrote:
>>
>>> Hi I have a board config for a device that I am about to commit to
>>> OpenWRT. I am rebasing my work against trunk but some things have
>>> changed since I made the config. My code was written against r46120 
>>> but
>>> somethings doesn't work on r48800. My question is how I should 
>>> update
>>> my code to "proper OpenWRT standard"? First, network. The board has
>>> only one network port (it is not a router). This should be 
>>> configured
>>> using DHCP. The board also has Wifi and should be configured as a
>>> client but disabled as default. In -r46120 I put this in
>>> /etc/uci-defaults/02_network: ucidef_set_interface_raw "lan" "eth0"
>>> "dhcp" ucidef_set_interface_raw "wlan" "wlan0" "dhcp" uci batch 
>>> <>> set network.lan.hostname='TellStick-ZNet-Lite' set
>>> wireless.radio0.disabled=0 set 
>>> wireless.@wifi-iface[0].network='wlan'
>>> set wireless.@wifi-iface[0].mode='sta' set
>>> wireless.@wifi-iface[0].encryption=psk2 EOF uci commit wireless In
>>> r48800 this file seems to have been replaced by 
>>> /etc/board.d/02_network
>>> instead. Unfortunately "raw" uci commands does not work since its
>>> generating /etc/board.json instead? Am I correct? If I do this then
>>> "dhcp" is ignored and the interface is set to static anyway:
>>> ucidef_set_interface_lan "eth0" "dhcp" How to convert the wireless 
>>> and
>>> the hostname I have no idea? Next is led. I had this in
>>> /etc/uci-defaults/02_network: ucidef_set_led_netdev "lan_act" 
>>> "LANACT"
>>> "tellstick:green:lan" "eth0" ucidef_set_led_netdev "lan_link" 
>>> "LANLINK"
>>> "tellstick:orange:lan" "eth0" uci set system.led_lan_act.mode='tx 
>>> rx'
>>> uci set system.led_lan_link.mode='link' The first two lines work in
>>> r48800 but how do I convert the last two lines? How do I set the 
>>> mode?
>>
>> To change the defaults, you shouldn't just modify the existing files.
>> You can simply create a new file in /etc/uci-defaults which runs your
>> uci batch command as usual. It will run after /etc/board.d has been
>> processed and the default config has been generated, so you should be
>> able to override any parameter you want.
> 
> The file /etc/uci-defaults/02_network was (re)moved in r47534. Is it 
> really the right way to go to reintroduce this file again?
> My thougs was that this should be implemented in /etc/board.json 
> instead, maybe I was wrong?
> 
> Please note that my goal is to have the board config sent upstream, not 
> only for my local build.
Ah, ok. I misread your intentions because of the kinds of changes you
were proposing. Some of the things you mentioned don't make sense as
board specific defaults in my opinion:
- We don't change the default host name for specific boards.
- We don't enable wireless by default or change its mode
- Interfaces using dhcp are usually considered 'wan' instead of 'lan',
LAN should have a predictable IP address.
If you believe that that any of the above changes are necessary, please
provide compelling reasons for it. Otherwise we'd prefer to keep device
configurations more consistent with each other.

As for the LED stuff: I'd suggest extending the API to make it possible
to pass the mode to ucidef_set_led_netdev so that it ends up in
board.json and can be used by /bin/config_generate.

Anything else?

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


Re: [OpenWrt-Devel] Setting uci defaults in trunk

2016-02-26 Thread micke . prag

2016-02-26 15:35 skrev Felix Fietkau:


On 2016-02-26 15:27, micke.prag@telldus.sewrote:


Hi I have a board config for a device that I am about to commit to
OpenWRT. I am rebasing my work against trunk but some things have
changed since I made the config. My code was written against r46120 
but
somethings doesn't work on r48800. My question is how I should 
update

my code to "proper OpenWRT standard"? First, network. The board has
only one network port (it is not a router). This should be 
configured

using DHCP. The board also has Wifi and should be configured as a
client but disabled as default. In -r46120 I put this in
/etc/uci-defaults/02_network: ucidef_set_interface_raw "lan" "eth0"
"dhcp" ucidef_set_interface_raw "wlan" "wlan0" "dhcp" uci batch 
<
set network.lan.hostname='TellStick-ZNet-Lite' set
wireless.radio0.disabled=0 set 
wireless.@wifi-iface[0].network='wlan'

set wireless.@wifi-iface[0].mode='sta' set
wireless.@wifi-iface[0].encryption=psk2 EOF uci commit wireless In
r48800 this file seems to have been replaced by 
/etc/board.d/02_network

instead. Unfortunately "raw" uci commands does not work since its
generating /etc/board.json instead? Am I correct? If I do this then
"dhcp" is ignored and the interface is set to static anyway:
ucidef_set_interface_lan "eth0" "dhcp" How to convert the wireless 
and

the hostname I have no idea? Next is led. I had this in
/etc/uci-defaults/02_network: ucidef_set_led_netdev "lan_act" 
"LANACT"
"tellstick:green:lan" "eth0" ucidef_set_led_netdev "lan_link" 
"LANLINK"
"tellstick:orange:lan" "eth0" uci set system.led_lan_act.mode='tx 
rx'

uci set system.led_lan_link.mode='link' The first two lines work in
r48800 but how do I convert the last two lines? How do I set the 
mode?


To change the defaults, you shouldn't just modify the existing files.
You can simply create a new file in /etc/uci-defaults which runs your
uci batch command as usual. It will run after /etc/board.d has been
processed and the default config has been generated, so you should be
able to override any parameter you want.


The file /etc/uci-defaults/02_network was (re)moved in r47534. Is it 
really the right way to go to reintroduce this file again?
My thougs was that this should be implemented in /etc/board.json 
instead, maybe I was wrong?


Please note that my goal is to have the board config sent upstream, not 
only for my local build.

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


Re: [OpenWrt-Devel] Setting uci defaults in trunk

2016-02-26 Thread Jo-Philipp Wich
Hi.

> In r48800 this file seems to have been replaced by
> /etc/board.d/02_network instead. Unfortunately "raw" uci commands does
> not work since its generating /etc/board.json instead? Am I correct?
> 
> If I do this then "dhcp" is ignored and the interface is set to static
> anyway:
> ucidef_set_interface_lan "eth0" "dhcp"

This sounds like a bug to me, it is supposed to work. Please post your
used board.d script and the resulting board.json.

> How to convert the wireless and the hostname I have no idea?

You can still use uci-defaults for that.

> Next is led. I had this in /etc/uci-defaults/02_network:
> ucidef_set_led_netdev "lan_act" "LANACT" "tellstick:green:lan" "eth0"
> ucidef_set_led_netdev "lan_link" "LANLINK" "tellstick:orange:lan" "eth0"
> uci set system.led_lan_act.mode='tx rx'
> uci set system.led_lan_link.mode='link'

I added support for passing the mode with
 https://dev.openwrt.org/changeset/48806
so your lines should become:

ucidef_set_led_netdev "lan_act" "LANACT" "tellstick:green:lan" \
"eth0" "tx rx"

ucidef_set_led_netdev "lan_link" "LANLINK" "tellstick:orange:lan" \
"eth0" "link"


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


Re: [OpenWrt-Devel] Setting uci defaults in trunk

2016-02-26 Thread Felix Fietkau
On 2016-02-26 15:27, micke.p...@telldus.se wrote:
> Hi
> 
> I have a board config for a device that I am about to commit to 
> OpenWRT. I am rebasing my work against trunk but some things have 
> changed since I made the config. My code was written against r46120 but 
> somethings doesn't work on r48800.
> 
> My question is how I should update my code to "proper OpenWRT 
> standard"?
> 
> First, network.
> 
> The board has only one network port (it is not a router). This should 
> be configured using DHCP. The board also has Wifi and should be 
> configured as a client but disabled as default.
> 
> In -r46120 I put this in /etc/uci-defaults/02_network:
> ucidef_set_interface_raw "lan" "eth0" "dhcp"
> ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
> uci batch < set network.lan.hostname='TellStick-ZNet-Lite'
> set wireless.radio0.disabled=0
> set wireless.@wifi-iface[0].network='wlan'
> set wireless.@wifi-iface[0].mode='sta'
> set wireless.@wifi-iface[0].encryption=psk2
> EOF
> uci commit wireless
> 
> In r48800 this file seems to have been replaced by 
> /etc/board.d/02_network instead. Unfortunately "raw" uci commands does 
> not work since its generating /etc/board.json instead? Am I correct?
> 
> If I do this then "dhcp" is ignored and the interface is set to static 
> anyway:
> ucidef_set_interface_lan "eth0" "dhcp"
> 
> How to convert the wireless and the hostname I have no idea?
> 
> Next is led. I had this in /etc/uci-defaults/02_network:
> ucidef_set_led_netdev "lan_act" "LANACT" "tellstick:green:lan" "eth0"
> ucidef_set_led_netdev "lan_link" "LANLINK" "tellstick:orange:lan" 
> "eth0"
> uci set system.led_lan_act.mode='tx rx'
> uci set system.led_lan_link.mode='link'
> 
> The first two lines work in r48800 but how do I convert the last two 
> lines? How do I set the mode?
To change the defaults, you shouldn't just modify the existing files.
You can simply create a new file in /etc/uci-defaults which runs your
uci batch command as usual. It will run after /etc/board.d has been
processed and the default config has been generated, so you should be
able to override any parameter you want.

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


[OpenWrt-Devel] Setting uci defaults in trunk

2016-02-26 Thread micke . prag

Hi

I have a board config for a device that I am about to commit to 
OpenWRT. I am rebasing my work against trunk but some things have 
changed since I made the config. My code was written against r46120 but 
somethings doesn't work on r48800.


My question is how I should update my code to "proper OpenWRT 
standard"?


First, network.

The board has only one network port (it is not a router). This should 
be configured using DHCP. The board also has Wifi and should be 
configured as a client but disabled as default.


In -r46120 I put this in /etc/uci-defaults/02_network:
ucidef_set_interface_raw "lan" "eth0" "dhcp"
ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
uci batch 

[OpenWrt-Devel] [PATCH resend] [ubus 1/2] cli: static keyword tweak

2016-02-26 Thread Zhao, Gang
Function ubus_cli_listen() is called only once, and function uloop_run()
and uloop_done() which need struct ubus_event_handler listener are
called within this function, so it's not needed to mark struct
ubus_event_handler listener as static. The same as pointer struct
ubus_context *ctx in main function.

Global struct commands is only used in this file, so it should be marked
static.

Signed-off-by: Zhao, Gang 
---
 cli.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cli.c b/cli.c
index f3a041a..c476f35 100644
--- a/cli.c
+++ b/cli.c
@@ -127,7 +127,7 @@ static int ubus_cli_call(struct ubus_context *ctx, int 
argc, char **argv)
 
 static int ubus_cli_listen(struct ubus_context *ctx, int argc, char **argv)
 {
-   static struct ubus_event_handler listener;
+   struct ubus_event_handler listener;
const char *event;
int ret = 0;
 
@@ -306,7 +306,7 @@ static int usage(const char *prog)
 }
 
 
-struct {
+static struct {
const char *name;
int (*cb)(struct ubus_context *ctx, int argc, char **argv);
 } commands[] = {
@@ -320,7 +320,7 @@ struct {
 int main(int argc, char **argv)
 {
const char *progname, *ubus_socket = NULL;
-   static struct ubus_context *ctx;
+   struct ubus_context *ctx;
char *cmd;
int ret = 0;
int i, ch;
-- 
2.7.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH resend] [ubus 2/2] cli: add timeout support for listen command

2016-02-26 Thread Zhao, Gang
Currently 'ubus listen' command does not respect the timeout parameter,
i.e., whether timeout parameter is provided, 'ubus listen' will always
run infinitely. This patch let 'ubus listen' command support the timeout
parameter. For example, 'ubus listen -t 60' will cause the command to
exit after 60 seconds.

Signed-off-by: Zhao, Gang 
---

If timeout parameter is not provided, listen command will exit after
30 seconds. This is not compatable with previous version, that is,
listen will blcok infinitely if timeout parameter is not
provided. Since it seems no user is using 'ubus listen' command in
openwrt code base, I think this may be acceptable, if not, I can
change the code so listen command will only exit if timeout
parameter is provided.

 cli.c | 25 -
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/cli.c b/cli.c
index c476f35..24b5d22 100644
--- a/cli.c
+++ b/cli.c
@@ -125,15 +125,29 @@ static int ubus_cli_call(struct ubus_context *ctx, int 
argc, char **argv)
return ubus_invoke(ctx, id, argv[1], b.head, receive_call_result_data, 
NULL, timeout * 1000);
 }
 
+struct cli_listen_data {
+   struct uloop_timeout timeout;
+   struct ubus_event_handler ev;
+   bool timed_out;
+};
+
+static void listen_timeout(struct uloop_timeout *timeout)
+{
+   struct cli_listen_data *data = container_of(timeout, struct 
cli_listen_data, timeout);
+   data->timed_out = true;
+   uloop_end();
+}
+
 static int ubus_cli_listen(struct ubus_context *ctx, int argc, char **argv)
 {
-   struct ubus_event_handler listener;
+   struct cli_listen_data data = {
+   .timeout.cb = listen_timeout,
+   .ev.cb = receive_event,
+   .timed_out = false,
+   };
const char *event;
int ret = 0;
 
-   memset(, 0, sizeof(listener));
-   listener.cb = receive_event;
-
if (argc > 0) {
event = argv[0];
} else {
@@ -142,7 +156,7 @@ static int ubus_cli_listen(struct ubus_context *ctx, int 
argc, char **argv)
}
 
do {
-   ret = ubus_register_event_handler(ctx, , event);
+   ret = ubus_register_event_handler(ctx, , event);
if (ret)
break;
 
@@ -163,6 +177,7 @@ static int ubus_cli_listen(struct ubus_context *ctx, int 
argc, char **argv)
 
uloop_init();
ubus_add_uloop(ctx);
+   uloop_timeout_set(, timeout * 1000);
uloop_run();
uloop_done();
 
-- 
2.7.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] dnsmasq: add host-specific lease time option for static hosts

2016-02-26 Thread Hannu Nyman

On 26.2.2016 10:33, John Crispin wrote:

Hi,

this does not apply anymore. mind to rebase and resend it please ?

John



Rebased patch v2 re-sent as https://patchwork.ozlabs.org/patch/588694/
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2] dnsmasq: add host-specific lease time option for static hosts

2016-02-26 Thread Hannu Nyman
Enable setting a host-specific lease time for static hosts.
The new option is called "leasetime" and the format is similar
as for the default lease time: e.g. 12h, 3d, infinite

Default lease time is used for all hosts for which there is
no host-specific definition.

The option is added to /etc/config/dhcp for the selected hosts:
  config host
option name 'Nexus'
option mac 'd8:50:66:55:59:7c'
option ip '192.168.1.245'
option leasetime '2h'

It gets appended to /var/etc/dnsmasq.conf like this:
  dhcp-host=d8:50:66:55:59:7c,192.168.1.245,Nexus,2h

Signed-off-by: Hannu Nyman 
---

As requested, a rebased version of the patch.
Reference to discussion at https://patchwork.ozlabs.org/patch/563051/

I have included this option in my own build for the last 4 years.
(Ever since I tried to submit it via https://dev.openwrt.org/ticket/11227 )

I have also the Luci part ready.

 package/network/services/dnsmasq/Makefile   | 4 ++--
 package/network/services/dnsmasq/files/dnsmasq.init | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/package/network/services/dnsmasq/Makefile 
b/package/network/services/dnsmasq/Makefile
index 89799ee..a5c3740 100644
--- a/package/network/services/dnsmasq/Makefile
+++ b/package/network/services/dnsmasq/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2015 OpenWrt.org
+# Copyright (C) 2006-2016 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dnsmasq
 PKG_VERSION:=2.75
-PKG_RELEASE:=5
+PKG_RELEASE:=6
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq
diff --git a/package/network/services/dnsmasq/files/dnsmasq.init 
b/package/network/services/dnsmasq/files/dnsmasq.init
index 0904503..61ded6a 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -342,7 +342,9 @@ dhcp_host_add() {
config_get_bool broadcast "$cfg" broadcast 0
[ "$broadcast" = "0" ] && broadcast=
 
-   xappend 
"--dhcp-host=$macs${networkid:+,net:$networkid}${broadcast:+,set:needs-broadcast}${tag:+,set:$tag}${ip:+,$ip}${name:+,$name}"
+   config_get leasetime "$cfg" leasetime
+
+   xappend 
"--dhcp-host=$macs${networkid:+,net:$networkid}${broadcast:+,set:needs-broadcast}${tag:+,set:$tag}${ip:+,$ip}${name:+,$name}${leasetime:+,$leasetime}"
 }
 
 dhcp_tag_add() {
-- 
2.5.0
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v3] bcm53xx: add support for Huawei WS880

2016-02-26 Thread Rafał Miłecki
On 2 December 2015 at 21:25, Hauke Mehrtens  wrote:
>> ++
>> ++leds {
>> ++compatible = "gpio-leds";
>> ++
>> ++wlan {
>> ++label = "bcm53xx:white:wlan";
>> ++gpios = < 0 GPIO_ACTIVE_LOW>;
>> ++linux,default-trigger = "default-off";
>> ++};
>> ++
>> ++lan {
>> ++label = "bcm53xx:white:lan";
>> ++gpios = < 1 GPIO_ACTIVE_LOW>;
>> ++linux,default-trigger = "default-on";
>> ++};
>
> When is this lan led activated and when deactivated?

It's statically ON, we don't have any smart trigger for that. It's the
same for all bcm5301x devices.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v3] bcm53xx: add support for Huawei WS880

2016-02-26 Thread Rafał Miłecki
Hi Sergey,

Sorry for this late (!) reply, I totally missed this patch.

On 2 December 2015 at 15:48, Sergey Shatunov  wrote:
> From: Prototik 

It doesn't really matter for our svn repo, but please don't try hiding
your real name.


> Changes since v2:
> LED default state modified

We usually put comments about version changes in a comment block of a
patch. Such comment don't have any real meaning when just browsing
repo history.


> +--- /dev/null
>  b/arch/arm/boot/dts/bcm4708-huawei-ws880.dts
> +@@ -0,0 +1,94 @@
> ++/*
> ++ * Broadcom BCM470X / BCM5301X ARM platform code.
> ++ * DTS for Huawei WS880
> ++ *
> ++ * Copyright (C) 2015 Sergey Shatunov 
> ++ *
> ++ * Licensed under the GNU/GPL. See COPYING for details.
> ++ */
> ++
> ++/dts-v1/;
> ++
> ++#include "bcm4708.dtsi"
> ++#include "bcm5301x-nand-cs0-bch8.dtsi"
> ++
> ++/ {
> ++  compatible = "huawei,ws880", "brcm,bcm4708";
> ++  model = "Huawei WS880 (BCM4708)";
> ++
> ++  chosen {
> ++  bootargs = "console=ttyS0,115200";
> ++  };
> ++
> ++  memory {
> ++  reg = <0x 0x0800>;
> ++  };
> ++
> ++  leds {
> ++  compatible = "gpio-leds";
> ++
> ++  wlan {
> ++  label = "bcm53xx:white:wlan";
> ++  gpios = < 0 GPIO_ACTIVE_LOW>;
> ++  linux,default-trigger = "default-ffn";
> ++  };

Typo: s/ffn/off/


> ++  nand@18028000 {
> ++  nandcs@0 {
> ++  nand-ecc-strength = <4>;
> ++  };
> ++  };

I'm thinking if it would make more sense to just have something like:
bcm5301x-nand-cs0-bch4.dtsi
instead of including bch8 and overwriting strength later.

Hauke: any comments to the? I think you added
bcm5301x-nand-cs0-bch8.dtsi in the first place?


Other than that this patch will need to be rebased for 4.4 kernel due
to my slow reaction :|
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] [ubus 2/2] cli: add timeout support for listen command

2016-02-26 Thread John Crispin
hi

you need to put this information into the description of the patch

a patch normally has this format

---

The patch does ABC to achieve XYZ

Signed-off-by: name 

---

$(The actual patch)






-


please resend both patches in that format.

John





On 26/02/2016 09:33, Zhao, Gang wrote:
> 
> 
> On Fri, Feb 26, 2016 at 2:33 PM, John Crispin  > wrote:
> 
> Description of what the patch does is missing
> 
> 
> Hi, John
> 
> Currently 'ubus listen' command does not respect the timeout parameter,
> i.e., whether timeout parameter is provided, 'ubus listen' will always
> run infinitely, this patch let 'ubus listen' command support the timeout
> parameter, for example, 'ubus listen -t 60' will cause the command to
> exit after 60 seconds.
>  
> The 'ubus wait_for' command already support timeout parameter, so I
> think it may be good to let 'ubus listen' also support timeout.
> 
> 
> John
> 
> On 26/02/2016 03:27, Zhao, Gang wrote:
> > Signed-off-by: Zhao, Gang  >
> > ---
> >  cli.c | 25 -
> >  1 file changed, 20 insertions(+), 5 deletions(-)
> >
> > diff --git a/cli.c b/cli.c
> > index c476f35..24b5d22 100644
> > --- a/cli.c
> > +++ b/cli.c
> > @@ -125,15 +125,29 @@ static int ubus_cli_call(struct ubus_context
> *ctx, int argc, char **argv)
> >   return ubus_invoke(ctx, id, argv[1], b.head,
> receive_call_result_data, NULL, timeout * 1000);
> >  }
> >
> > +struct cli_listen_data {
> > + struct uloop_timeout timeout;
> > + struct ubus_event_handler ev;
> > + bool timed_out;
> > +};
> > +
> > +static void listen_timeout(struct uloop_timeout *timeout)
> > +{
> > + struct cli_listen_data *data = container_of(timeout, struct
> cli_listen_data, timeout);
> > + data->timed_out = true;
> > + uloop_end();
> > +}
> > +
> >  static int ubus_cli_listen(struct ubus_context *ctx, int argc,
> char **argv)
> >  {
> > - struct ubus_event_handler listener;
> > + struct cli_listen_data data = {
> > + .timeout.cb = listen_timeout,
> > + .ev.cb = receive_event,
> > + .timed_out = false,
> > + };
> >   const char *event;
> >   int ret = 0;
> >
> > - memset(, 0, sizeof(listener));
> > - listener.cb = receive_event;
> > -
> >   if (argc > 0) {
> >   event = argv[0];
> >   } else {
> > @@ -142,7 +156,7 @@ static int ubus_cli_listen(struct ubus_context
> *ctx, int argc, char **argv)
> >   }
> >
> >   do {
> > - ret = ubus_register_event_handler(ctx, ,
> event);
> > + ret = ubus_register_event_handler(ctx, , event);
> >   if (ret)
> >   break;
> >
> > @@ -163,6 +177,7 @@ static int ubus_cli_listen(struct ubus_context
> *ctx, int argc, char **argv)
> >
> >   uloop_init();
> >   ubus_add_uloop(ctx);
> > + uloop_timeout_set(, timeout * 1000);
> >   uloop_run();
> >   uloop_done();
> >
> >
> 
> 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] [packages] opkg: Make opkg understand old md5

2016-02-26 Thread Michal Hrusecky
Opkg now uses sha256 by default and expects them. Making it optionally
understand md5s also and detect md5 sum so we can migrate from configuration
that used md5.

Signed-off-by: Michal Hrusecky 
---
 package/system/opkg/Makefile   | 35 +-
 .../system/opkg/patches/230-drop_md5_support.patch | 55 ++
 2 files changed, 69 insertions(+), 21 deletions(-)

diff --git a/package/system/opkg/Makefile b/package/system/opkg/Makefile
index e46c6b3..c09d168 100644
--- a/package/system/opkg/Makefile
+++ b/package/system/opkg/Makefile
@@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/feeds.mk
 PKG_NAME:=opkg
 PKG_REV:=9c97d5ecd795709c8584e972bfdf3aee3a5b846d
 PKG_VERSION:=$(PKG_REV)
-PKG_RELEASE:=10
+PKG_RELEASE:=11
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_VERSION:=$(PKG_REV)
@@ -43,6 +43,7 @@ define Package/opkg/Default
   TITLE:=opkg package manager
   DEPENDS:=+uclient-fetch
   URL:=http://wiki.openmoko.org/wiki/Opkg
+  MENU:=1
 endef
 
 define Package/opkg/Default/description
@@ -55,6 +56,16 @@ define Package/opkg/Default/description
   opkg knows how to install both .ipk and .deb packages.
 endef
 
+define Package/opkg/config
+config OPKG_SUPPORT_MD5
+  bool
+  default n
+  depends on PACKAGE_opkg
+  prompt "Support reading old md5 hashes."
+  help
+   Old opkg used md5s, new uses sha. This options enables understanding 
both while prefering sha.
+endef
+
 define Package/opkg
   $(call Package/opkg/Default)
   VARIANT:=unsigned
@@ -84,6 +95,16 @@ define Package/opkg-smime/description
   This package allows the Package index to be verified with S/MIME.
 endef
 
+define Package/opkg-smime/config
+config OPKG_SMIME_SUPPORT_MD5
+  bool
+  default n
+  depends on PACKAGE_opkg-smime
+  prompt "Support reading old md5 hashes."
+  help
+   Old opkg used md5s, new uses sha. This options enables understanding 
both while prefering sha.
+endef
+
 Package/opkg-smime/conffiles = $(Package/opkg/conffiles)
 
 TARGET_CFLAGS += -ffunction-sections -fdata-sections
@@ -97,11 +118,21 @@ CONFIGURE_ARGS += \
--with-opkglockfile=/var/lock/opkg.lock
 
 ifeq ($(BUILD_VARIANT),smime)
-   CONFIGURE_ARGS += --enable-openssl --disable-usign
+  CONFIGURE_ARGS += --enable-openssl --disable-usign
+  ifeq ($(CONFIG_OPKG_SMIME_SUPPORT_MD5),y)
+CONFIGURE_ARGS += --enable-md5
+  else
+CONFIGURE_ARGS += --disable-md5
+  endif
 else
   ifndef CONFIG_SIGNED_PACKAGES
 CONFIGURE_ARGS += --disable-usign
   endif
+  ifeq ($(CONFIG_OPKG_SUPPORT_MD5),y)
+CONFIGURE_ARGS += --enable-md5
+  else
+CONFIGURE_ARGS += --disable-md5
+  endif
 endif
 
 MAKE_FLAGS = \
diff --git a/package/system/opkg/patches/230-drop_md5_support.patch 
b/package/system/opkg/patches/230-drop_md5_support.patch
index 63671e5..3b28104 100644
--- a/package/system/opkg/patches/230-drop_md5_support.patch
+++ b/package/system/opkg/patches/230-drop_md5_support.patch
@@ -1,6 +1,6 @@
 --- a/libopkg/conffile.c
 +++ b/libopkg/conffile.c
-@@ -36,7 +36,7 @@
+@@ -36,7 +36,7 @@ void conffile_deinit(conffile_t *conffil
  
  int conffile_has_been_modified(conffile_t *conffile)
  {
@@ -9,7 +9,7 @@
  char *filename = conffile->name;
  char *root_filename;
  int ret = 1;
-@@ -48,16 +48,19 @@
+@@ -48,16 +48,23 @@ int conffile_has_been_modified(conffile_
  
  root_filename = root_filename_alloc(filename);
  
@@ -19,7 +19,11 @@
 -opkg_msg(INFO, "Conffile %s:\n\told md5=%s\n\tnew md5=%s\n",
 -  conffile->name, md5sum, conffile->value);
 +#ifdef HAVE_MD5
-+chksum = file_md5sum_alloc(root_filename);
++if(conffile->value && strlen(conffile->value) > 33) {
++chksum = file_sha256sum_alloc(root_filename);
++} else {
++chksum = file_md5sum_alloc(root_filename);
++}
 +#else
 +chksum = file_sha256sum_alloc(root_filename);
 +#endif
@@ -48,7 +52,7 @@
  #include "libbb/libbb.h"
  
  #if defined HAVE_SHA256
-@@ -135,6 +137,7 @@
+@@ -135,6 +137,7 @@ file_mkdir_hier(const char *path, long m
return make_directory(path, mode, FILEUTILS_RECUR);
  }
  
@@ -56,7 +60,7 @@
  char *file_md5sum_alloc(const char *file_name)
  {
  static const int md5sum_bin_len = 16;
-@@ -180,6 +183,7 @@
+@@ -180,6 +183,7 @@ char *file_md5sum_alloc(const char *file
  
  return md5sum_hex;
  }
@@ -66,7 +70,7 @@
  char *file_sha256sum_alloc(const char *file_name)
 --- a/libopkg/opkg_install.c
 +++ b/libopkg/opkg_install.c
-@@ -1082,7 +1082,7 @@
+@@ -1082,7 +1082,7 @@ resolve_conffiles(pkg_t *pkg)
   conffile_list_elt_t *iter;
   conffile_t *cf;
   char *cf_backup;
@@ -75,26 +79,27 @@
  
   if (conf->noaction) return 0;
  
-@@ -1093,7 +1093,11 @@
+@@ -1093,7 +1093,7 @@ resolve_conffiles(pkg_t *pkg)
  
  /* Might need to initialize the md5sum for each conffile */
  if (cf->value == NULL) {
-+#ifdef HAVE_MD5
-  cf->value = file_md5sum_alloc(root_filename);
-+#else
+- cf->value = file_md5sum_alloc(root_filename);
 + 

Re: [OpenWrt-Devel] [PATCH] [ubus 2/2] cli: add timeout support for listen command

2016-02-26 Thread Zhao, Gang
On Fri, Feb 26, 2016 at 2:33 PM, John Crispin  wrote:

> Description of what the patch does is missing
>

Hi, John

Currently 'ubus listen' command does not respect the timeout parameter,
i.e., whether timeout parameter is provided, 'ubus listen' will always run
infinitely, this patch let 'ubus listen' command support the timeout
parameter, for example, 'ubus listen -t 60' will cause the command to exit
after 60 seconds.

The 'ubus wait_for' command already support timeout parameter, so I think
it may be good to let 'ubus listen' also support timeout.


> John
>
> On 26/02/2016 03:27, Zhao, Gang wrote:
> > Signed-off-by: Zhao, Gang 
> > ---
> >  cli.c | 25 -
> >  1 file changed, 20 insertions(+), 5 deletions(-)
> >
> > diff --git a/cli.c b/cli.c
> > index c476f35..24b5d22 100644
> > --- a/cli.c
> > +++ b/cli.c
> > @@ -125,15 +125,29 @@ static int ubus_cli_call(struct ubus_context *ctx,
> int argc, char **argv)
> >   return ubus_invoke(ctx, id, argv[1], b.head,
> receive_call_result_data, NULL, timeout * 1000);
> >  }
> >
> > +struct cli_listen_data {
> > + struct uloop_timeout timeout;
> > + struct ubus_event_handler ev;
> > + bool timed_out;
> > +};
> > +
> > +static void listen_timeout(struct uloop_timeout *timeout)
> > +{
> > + struct cli_listen_data *data = container_of(timeout, struct
> cli_listen_data, timeout);
> > + data->timed_out = true;
> > + uloop_end();
> > +}
> > +
> >  static int ubus_cli_listen(struct ubus_context *ctx, int argc, char
> **argv)
> >  {
> > - struct ubus_event_handler listener;
> > + struct cli_listen_data data = {
> > + .timeout.cb = listen_timeout,
> > + .ev.cb = receive_event,
> > + .timed_out = false,
> > + };
> >   const char *event;
> >   int ret = 0;
> >
> > - memset(, 0, sizeof(listener));
> > - listener.cb = receive_event;
> > -
> >   if (argc > 0) {
> >   event = argv[0];
> >   } else {
> > @@ -142,7 +156,7 @@ static int ubus_cli_listen(struct ubus_context *ctx,
> int argc, char **argv)
> >   }
> >
> >   do {
> > - ret = ubus_register_event_handler(ctx, , event);
> > + ret = ubus_register_event_handler(ctx, , event);
> >   if (ret)
> >   break;
> >
> > @@ -163,6 +177,7 @@ static int ubus_cli_listen(struct ubus_context *ctx,
> int argc, char **argv)
> >
> >   uloop_init();
> >   ubus_add_uloop(ctx);
> > + uloop_timeout_set(, timeout * 1000);
> >   uloop_run();
> >   uloop_done();
> >
> >
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] dnsmasq: add host-specific lease time option for static hosts

2016-02-26 Thread John Crispin
Hi,

this does not apply anymore. mind to rebase and resend it please ?

John

On 05/01/2016 12:48, Hannu Nyman wrote:
> Enable setting a host-specific lease time for static hosts.
> The new option is called "leasetime" and the format is similar
> as for the default lease time: e.g. 12h, 3d, infinite
> 
> Default lease time is used for all hosts for which there is
> no host-specific definition.
> 
> The option is added to /etc/config/dhcp for the selected hosts:
>   config host
> option name 'Nexus'
> option mac 'd8:50:66:55:59:7c'
> option ip '192.168.1.245'
> option leasetime '2h'
> 
> It gets appended to /var/etc/dnsmasq.conf like this:
>   dhcp-host=d8:50:66:55:59:7c,192.168.1.245,Nexus,2h
> 
> Signed-off-by: Hannu Nyman 
> ---
> Reference to discussion at https://patchwork.ozlabs.org/patch/561694/
> 
> I have included this option in my own build for the last 4 years.
> (Ever since I tried to submit it via https://dev.openwrt.org/ticket/11227 )
> 
> I have also the Luci part ready.
> 
> 
>  package/network/services/dnsmasq/Makefile   | 4 ++--
>  package/network/services/dnsmasq/files/dnsmasq.init | 4 +++-
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/package/network/services/dnsmasq/Makefile 
> b/package/network/services/dnsmasq/Makefile
> index cddde5c..530d33d 100644
> --- a/package/network/services/dnsmasq/Makefile
> +++ b/package/network/services/dnsmasq/Makefile
> @@ -1,5 +1,5 @@
>  #
> -# Copyright (C) 2006-2015 OpenWrt.org
> +# Copyright (C) 2006-2016 OpenWrt.org
>  #
>  # This is free software, licensed under the GNU General Public License v2.
>  # See /LICENSE for more information.
> @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=dnsmasq
>  PKG_VERSION:=2.75
> -PKG_RELEASE:=2
> +PKG_RELEASE:=3
>  
>  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
>  PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq
> diff --git a/package/network/services/dnsmasq/files/dnsmasq.init 
> b/package/network/services/dnsmasq/files/dnsmasq.init
> index 3ef2b3d..f89bd8c 100644
> --- a/package/network/services/dnsmasq/files/dnsmasq.init
> +++ b/package/network/services/dnsmasq/files/dnsmasq.init
> @@ -334,7 +334,9 @@ dhcp_host_add() {
>   config_get_bool broadcast "$cfg" broadcast 0
>   [ "$broadcast" = "0" ] && broadcast=
>  
> - xappend 
> "--dhcp-host=$macs${networkid:+,net:$networkid}${broadcast:+,set:needs-broadcast}${tag:+,set:$tag}${ip:+,$ip}${name:+,$name}"
> + config_get leasetime "$cfg" leasetime
> +
> + xappend 
> "--dhcp-host=$macs${networkid:+,net:$networkid}${broadcast:+,set:needs-broadcast}${tag:+,set:$tag}${ip:+,$ip}${name:+,$name}${leasetime:+,$leasetime}"
>  }
>  
>  dhcp_tag_add() {
> 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] [ubus 1/2] cli: static keyword tweak

2016-02-26 Thread Zhao, Gang
On Fri, Feb 26, 2016 at 2:33 PM, John Crispin  wrote:

> Description of what the patch does is missing
>
> John
>
> On 26/02/2016 03:27, Zhao, Gang wrote:
> > Signed-off-by: Zhao, Gang 
> > ---
> >  cli.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/cli.c b/cli.c
> > index f3a041a..c476f35 100644
> > --- a/cli.c
> > +++ b/cli.c
> > @@ -127,7 +127,7 @@ static int ubus_cli_call(struct ubus_context *ctx,
> int argc, char **argv)
> >
> >  static int ubus_cli_listen(struct ubus_context *ctx, int argc, char
> **argv)
> >  {
> > - static struct ubus_event_handler listener;
> > + struct ubus_event_handler listener;
>

 Function ubus_cli_listen is called only once, and function uloop_run and
uloop_doen is called within this function, so I think it's not needed to
mark
struct ubus_event_handler listener static.

>   const char *event;
> >   int ret = 0;
> >
> > @@ -306,7 +306,7 @@ static int usage(const char *prog)
> >  }
> >
> >
> > -struct {
> > +static struct {
>
>   const char *name;
> >   int (*cb)(struct ubus_context *ctx, int argc, char **argv);
> >  } commands[] = {
>

Global struct commands is only used in this file, so it should be marked
static.


> > @@ -320,7 +320,7 @@ struct {
> >  int main(int argc, char **argv)
> >  {
> >   const char *progname, *ubus_socket = NULL;
> > - static struct ubus_context *ctx;
> > + struct ubus_context *ctx;
>

I think this struct is not needed to be marked static, since it's in the
main function.


> >   char *cmd;
> >   int ret = 0;
> >   int i, ch;
> >
> ___
> 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 v2] lantiq, xrx200-net: add devicetree aliases support for port->mac mapping

2016-02-26 Thread John Crispin


On 22/12/2015 10:36, Martin Schiller wrote:
>>> And there are also situations, where you even can't do it in
>> > hardware:
>>> > > when you use the xrx200 in Gigabit mode, you can use mac 0,1,2,4,5.
>>> > > mac/port 3 is dead in this case.
>>> > >
>>> > > But you can't tell an enduser/customer that there is a port 2 and a
>> > port 4
>>> > > but no port 3.
>> >
>> > sure but solving this in the driver by using a virtual port abstraction
>> > is imho not good.
>> >
>> > i'll see if i can think of a better solution for this issue
> As this is a board specific issue, I thought solving this in the
> devicetree would be a nice way.
> 
> But any better solution would be welcome.
> 

can you use swconfig,port to solve this ? and it not, maybe extend the
swconfig code to also have a swconfig,portname option ?

that would be a far more generic solution.

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


Re: [OpenWrt-Devel] [PATCH] [packages] opkg: Make opkg understand old md5

2016-02-26 Thread John Crispin

[...]

>>>  
>>> +define Package/opkg-smime/config
>>> +config OPKG_SMIME_SUPPORT_MD5
>>> +  bool
>>> +  default n
>>> +  depends on PACKAGE_opkg-smime
>>> +  prompt "Support reading old md5 hashes."
>>> +  help
>>> +   Old opkg used md5s, new uses sha. This options enables understanding 
>>> both while prefering sha.
>>> +endef
>>
>> why add a new build variant ?
> 
> There are two opkg variants - one named opkg and one named opkg-smime. I added
> same option to both as maybe someone might want to enable backward
> compatibility in just one of them. For example to save some space or because 
> he
> is more afraid of MD5 in one of the situations.
> 

erm yes ... i missed the /config part ;)


>>> +
>>>  Package/opkg-smime/conffiles = $(Package/opkg/conffiles)
>>>  
>>>  TARGET_CFLAGS += -ffunction-sections -fdata-sections
>>> @@ -98,10 +119,20 @@ CONFIGURE_ARGS += \
>>>  
>>>  ifeq ($(BUILD_VARIANT),smime)
>>> CONFIGURE_ARGS += --enable-openssl --disable-usign
>>> +  ifeq ($(CONFIG_OPKG_SMIME_SUPPORT_MD5),y)
>>> +   CONFIGURE_ARGS += --enable-md5
>>> +  else
>>> +   CONFIGURE_ARGS += --disable-md5
>>> +  endif
>>
>> might want to put this into its own block, set a variable and then reuse
>> that var here and below ...
>>
>>>  else
>>>ifndef CONFIG_SIGNED_PACKAGES
>>>  CONFIGURE_ARGS += --disable-usign
>>>endif
>>> +  ifeq ($(CONFIG_OPKG_SUPPORT_MD5),y)
>>> +   CONFIGURE_ARGS += --enable-md5
>>> +  else
>>> +   CONFIGURE_ARGS += --disable-md5
>>> +  endif
>>
>> to avoid duplication here
> 
> Yep, was thinking about it, but given that there are two variants of the same
> package and options might affect either of them, couldn't figure out better 
> way
> how to do it. Except maybe rewriting opkg-smime as an compile time option of
> opkg instead of different subpackage, but that seemed like different and too
> big change.


ok, make sense i guess. can you change the indentation to be the same as
the rest of the code please ?

> 
>>>  endif
>>>  
>>>  MAKE_FLAGS = \
>>> diff --git a/package/system/opkg/patches/230-drop_md5_support.patch 
>>> b/package/system/opkg/patches/230-drop_md5_support.patch
>>> index 63671e5..07673db 100644
>>> --- a/package/system/opkg/patches/230-drop_md5_support.patch
>>> +++ b/package/system/opkg/patches/230-drop_md5_support.patch
>>> @@ -1,6 +1,6 @@
>>>  --- a/libopkg/conffile.c
>>>  +++ b/libopkg/conffile.c
>>> -@@ -36,7 +36,7 @@
>>> +@@ -36,7 +36,7 @@ void conffile_deinit(conffile_t *conffil
>>>   
>>>   int conffile_has_been_modified(conffile_t *conffile)
>>>   {
>>> @@ -9,7 +9,7 @@
>>>   char *filename = conffile->name;
>>>   char *root_filename;
>>>   int ret = 1;
>>> -@@ -48,16 +48,19 @@
>>> +@@ -48,16 +48,23 @@ int conffile_has_been_modified(conffile_
>>>   
>>>   root_filename = root_filename_alloc(filename);
>>>   
>>> @@ -19,7 +19,11 @@
>>>  -opkg_msg(INFO, "Conffile %s:\n\told md5=%s\n\tnew md5=%s\n",
>>>  -  conffile->name, md5sum, conffile->value);
>>>  +#ifdef HAVE_MD5
>>> -+chksum = file_md5sum_alloc(root_filename);
>>> ++if(conffile->value && strlen(conffile->value) > 33) {
>>
>> is there no better way than checking for the length ?
> 
> Don't know about any other way. Hashes don't have signature as far as I know
> but they should have pretty constant length. Or I could compute both sums and
> try if at least one of them matches, but this seemed more straight forward.

its fine, was just wondering

> 
>>> ++chksum = file_sha256sum_alloc(root_filename);
>>> ++} else {
>>> ++chksum = file_md5sum_alloc(root_filename);
>>> ++}
>>>  +#else
>>>  +chksum = file_sha256sum_alloc(root_filename);
>>>  +#endif
>>> @@ -48,7 +52,7 @@
>>>   #include "libbb/libbb.h"
>>>   
>>>   #if defined HAVE_SHA256
>>> -@@ -135,6 +137,7 @@
>>> +@@ -135,6 +137,7 @@ file_mkdir_hier(const char *path, long m
>>> return make_directory(path, mode, FILEUTILS_RECUR);
>>>   }
>>>   
>>> @@ -56,7 +60,7 @@
>>>   char *file_md5sum_alloc(const char *file_name)
>>>   {
>>>   static const int md5sum_bin_len = 16;
>>> -@@ -180,6 +183,7 @@
>>> +@@ -180,6 +183,7 @@ char *file_md5sum_alloc(const char *file
>>>   
>>>   return md5sum_hex;
>>>   }
>>> @@ -66,7 +70,7 @@
>>>   char *file_sha256sum_alloc(const char *file_name)
>>>  --- a/libopkg/opkg_install.c
>>>  +++ b/libopkg/opkg_install.c
>>> -@@ -1082,7 +1082,7 @@
>>> +@@ -1082,7 +1082,7 @@ resolve_conffiles(pkg_t *pkg)
>>>conffile_list_elt_t *iter;
>>>conffile_t *cf;
>>>char *cf_backup;
>>> @@ -75,11 +79,11 @@
>>>   
>>>if (conf->noaction) return 0;
>>>   
>>> -@@ -1093,7 +1093,11 @@
>>> +@@ -1093,7 +1093,11 @@ resolve_conffiles(pkg_t *pkg)
>>>   
>>>   /* Might need to initialize the md5sum for each conffile */
>>>   if (cf->value == NULL) {
>>> -+#ifdef HAVE_MD5
>>> ++#ifdef PREFER_MD5
>>
>> why is this change needed ? and does PREFER_MD5 actually exit ?
> 
> It does not exist :-) Thought 

Re: [OpenWrt-Devel] [PATCH] [packages] opkg: Make opkg understand old md5

2016-02-26 Thread Michal Hrusecky
John Crispin -  8:40 26.02.16 wrote:
> Hi,
> 
> few comments inline
> 
> On 25/02/2016 13:39, Michal Hrusecky wrote:
> > Opkg now uses sha256 by default and expects them. Making it optionally
> > understand md5s also and detect md5 sum so we can migrate from configuration
> > that used md5.
> > 
> > Signed-off-by: Michal Hrusecky 
> > ---
> >  package/system/opkg/Makefile   | 33 +-
> >  .../system/opkg/patches/230-drop_md5_support.patch | 52 
> > +++---
> >  2 files changed, 68 insertions(+), 17 deletions(-)
> > 
> > diff --git a/package/system/opkg/Makefile b/package/system/opkg/Makefile
> > index e46c6b3..9b2aca1 100644
> > --- a/package/system/opkg/Makefile
> > +++ b/package/system/opkg/Makefile
> > @@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/feeds.mk
> >  PKG_NAME:=opkg
> >  PKG_REV:=9c97d5ecd795709c8584e972bfdf3aee3a5b846d
> >  PKG_VERSION:=$(PKG_REV)
> > -PKG_RELEASE:=10
> > +PKG_RELEASE:=11
> >  
> >  PKG_SOURCE_PROTO:=git
> >  PKG_SOURCE_VERSION:=$(PKG_REV)
> > @@ -43,6 +43,7 @@ define Package/opkg/Default
> >TITLE:=opkg package manager
> >DEPENDS:=+uclient-fetch
> >URL:=http://wiki.openmoko.org/wiki/Opkg
> > +  MENU:=1
> >  endef
> >  
> >  define Package/opkg/Default/description
> > @@ -55,6 +56,16 @@ define Package/opkg/Default/description
> >opkg knows how to install both .ipk and .deb packages.
> >  endef
> >  
> > +define Package/opkg/config
> > +config OPKG_SUPPORT_MD5
> > +  bool
> > +  default n
> > +  depends on PACKAGE_opkg
> > +  prompt "Support reading old md5 hashes."
> > +  help
> > +   Old opkg used md5s, new uses sha. This options enables understanding 
> > both while prefering sha.
> > +endef
> > +
> >  define Package/opkg
> >$(call Package/opkg/Default)
> >VARIANT:=unsigned
> > @@ -84,6 +95,16 @@ define Package/opkg-smime/description
> >This package allows the Package index to be verified with S/MIME.
> >  endef
> >  
> > +define Package/opkg-smime/config
> > +config OPKG_SMIME_SUPPORT_MD5
> > +  bool
> > +  default n
> > +  depends on PACKAGE_opkg-smime
> > +  prompt "Support reading old md5 hashes."
> > +  help
> > +   Old opkg used md5s, new uses sha. This options enables understanding 
> > both while prefering sha.
> > +endef
> 
> why add a new build variant ?

There are two opkg variants - one named opkg and one named opkg-smime. I added
same option to both as maybe someone might want to enable backward
compatibility in just one of them. For example to save some space or because he
is more afraid of MD5 in one of the situations.

> > +
> >  Package/opkg-smime/conffiles = $(Package/opkg/conffiles)
> >  
> >  TARGET_CFLAGS += -ffunction-sections -fdata-sections
> > @@ -98,10 +119,20 @@ CONFIGURE_ARGS += \
> >  
> >  ifeq ($(BUILD_VARIANT),smime)
> > CONFIGURE_ARGS += --enable-openssl --disable-usign
> > +  ifeq ($(CONFIG_OPKG_SMIME_SUPPORT_MD5),y)
> > +   CONFIGURE_ARGS += --enable-md5
> > +  else
> > +   CONFIGURE_ARGS += --disable-md5
> > +  endif
> 
> might want to put this into its own block, set a variable and then reuse
> that var here and below ...
> 
> >  else
> >ifndef CONFIG_SIGNED_PACKAGES
> >  CONFIGURE_ARGS += --disable-usign
> >endif
> > +  ifeq ($(CONFIG_OPKG_SUPPORT_MD5),y)
> > +   CONFIGURE_ARGS += --enable-md5
> > +  else
> > +   CONFIGURE_ARGS += --disable-md5
> > +  endif
> 
> to avoid duplication here

Yep, was thinking about it, but given that there are two variants of the same
package and options might affect either of them, couldn't figure out better way
how to do it. Except maybe rewriting opkg-smime as an compile time option of
opkg instead of different subpackage, but that seemed like different and too
big change.

> >  endif
> >  
> >  MAKE_FLAGS = \
> > diff --git a/package/system/opkg/patches/230-drop_md5_support.patch 
> > b/package/system/opkg/patches/230-drop_md5_support.patch
> > index 63671e5..07673db 100644
> > --- a/package/system/opkg/patches/230-drop_md5_support.patch
> > +++ b/package/system/opkg/patches/230-drop_md5_support.patch
> > @@ -1,6 +1,6 @@
> >  --- a/libopkg/conffile.c
> >  +++ b/libopkg/conffile.c
> > -@@ -36,7 +36,7 @@
> > +@@ -36,7 +36,7 @@ void conffile_deinit(conffile_t *conffil
> >   
> >   int conffile_has_been_modified(conffile_t *conffile)
> >   {
> > @@ -9,7 +9,7 @@
> >   char *filename = conffile->name;
> >   char *root_filename;
> >   int ret = 1;
> > -@@ -48,16 +48,19 @@
> > +@@ -48,16 +48,23 @@ int conffile_has_been_modified(conffile_
> >   
> >   root_filename = root_filename_alloc(filename);
> >   
> > @@ -19,7 +19,11 @@
> >  -opkg_msg(INFO, "Conffile %s:\n\told md5=%s\n\tnew md5=%s\n",
> >  -  conffile->name, md5sum, conffile->value);
> >  +#ifdef HAVE_MD5
> > -+chksum = file_md5sum_alloc(root_filename);
> > ++if(conffile->value && strlen(conffile->value) > 33) {
> 
> is there no better way than checking for the length ?

Don't 

Re: [OpenWrt-Devel] [PATCH v2] [CC] ar71xx: backport support for TP-LINK TL-WR1043ND v3

2016-02-26 Thread John Crispin
Hi,

i cant merge this without a correct patch for trunk.

John

On 08/02/2016 15:27, Sven Roederer wrote:
> The hardware of the v3 is identical to the v2.
> 
> - adding support for WR1043v3
> - resending this patch after fixing the original from 
> https://lists.openwrt.org/pipermail/openwrt-devel/2016-February/039488.html
> - adds support via old-style-definition. So less code is changed and there is 
> less potential to break other projects.
> - based on 
> https://github.com/freifunk-gluon/gluon/blob/master/patches/openwrt/0037-ar71xx-add-support-for-TP-Link-TL-WR1043ND-v3.patch
> - also update Kconfig for this board
> 
> Signed-off-by: Sven Roederer 
> ---
>  target/linux/ar71xx/image/Makefile | 3 
> ++-
>  target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/target/linux/ar71xx/image/Makefile 
> b/target/linux/ar71xx/image/Makefile
> index 4336697..61e62cd 100644
> --- a/target/linux/ar71xx/image/Makefile
> +++ b/target/linux/ar71xx/image/Makefile
> @@ -2007,6 +2007,7 @@ $(eval $(call 
> SingleProfile,TPLINK,64kraw,TLWR941NV4,tl-wr941nd-v4,TL-WR741ND,tt
>  $(eval $(call 
> SingleProfile,TPLINK,64kraw,TLWR1043V1,tl-wr1043nd-v1,TL-WR1043ND,ttyS0,115200,0x10430001,1,8M))
>  
>  $(eval $(call 
> SingleProfile,TPLINK-LZMA,64kraw,TLWR1043V2,tl-wr1043nd-v2,TL-WR1043ND-v2,ttyS0,115200,0x10430002,1,8M))
> +$(eval $(call 
> SingleProfile,TPLINK-LZMA,64kraw,TLWR1043V3,tl-wr1043nd-v3,TL-WR1043ND-v2,ttyS0,115200,0x10430003,1,8M))
>  $(eval $(call 
> SingleProfile,TPLINK-LZMA,64kraw,TLWR2543,tl-wr2543-v1,TL-WR2543N,ttyS0,115200,0x25430001,1,8Mlzma,-v
>  3.13.99))
>  
>  $(eval $(call 
> SingleProfile,TPLINK-SAFELOADER,64kraw,CPE510,cpe210-220-510-520,CPE510,ttyS0,115200,$$(cpe510_mtdlayout),CPE510))
> @@ -2071,7 +2072,7 @@ $(eval $(call MultiProfile,TLWR743,TLWR743NV1))
>  $(eval $(call MultiProfile,TLWR841,TLWR841NV15 TLWR841NV3 TLWR841NV5 
> TLWR841NV7))
>  $(eval $(call MultiProfile,TLWR842,TLWR842V1))
>  $(eval $(call MultiProfile,TLWR941,TLWR941NV2 TLWR941NV3 TLWR941NV4))
> -$(eval $(call MultiProfile,TLWR1043,TLWR1043V1 TLWR1043V2))
> +$(eval $(call MultiProfile,TLWR1043,TLWR1043V1 TLWR1043V2 TLWR1043V3))
>  $(eval $(call MultiProfile,TLWDR4300,TLWDR3500V1 TLWDR3600V1 TLWDR4300V1 
> TLWDR4300V1IL TLWDR4310V1 MW4530RV1))
>  $(eval $(call MultiProfile,TUBE2H,TUBE2H8M TUBE2H16M))
>  $(eval $(call MultiProfile,UBNT,UBNTAIRROUTER UBNTRS UBNTRSPRO UBNTLSSR71 
> UBNTBULLETM UBNTROCKETM UBNTROCKETMXW UBNTNANOM UBNTNANOMXW UBNTLOCOXW 
> UBNTUNIFI UBNTUNIFIOUTDOOR UBNTUNIFIOUTDOORPLUS UAPPRO UBNTAIRGW))
> diff --git 
> a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch 
> b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
> index 2fa041b..ca1b194 100644
> --- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
> +++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
> @@ -1268,7 +1268,7 @@
>  +select ATH79_DEV_WMAC
>  +
>  +config ATH79_MACH_TL_WR1043ND_V2
> -+bool "TP-LINK TL-WR1043ND v2 support"
> ++bool "TP-LINK TL-WR1043ND v2/v3 support"
>  +select SOC_QCA955X
>  +select ATH79_DEV_ETH
>  +select ATH79_DEV_GPIO_BUTTONS
> 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] comgt: NCM protocol now propagate defaultroute, peerdns, metric to dynamic ifaces

2016-02-26 Thread John Crispin
Hi,

can you change this and put the functionality in a more generic place so
that it works for all virtual interfaces ? felix explained in the hilink
thread that bruno started where he thinks this should go.

John

On 09/02/2016 21:38, Jakub Janco wrote:
> NCM protocol now propagate defaultroute, peerdns, metric to its dynamic dhcp 
> ifaces to maintain options defined in /etc/config/network.
> 
> Signed-off-by: Jakub Janco 
> ---
>  package/network/utils/comgt/files/ncm.sh | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/package/network/utils/comgt/files/ncm.sh 
> b/package/network/utils/comgt/files/ncm.sh
> index 571cfaa..0157f26 100644
> --- a/package/network/utils/comgt/files/ncm.sh
> +++ b/package/network/utils/comgt/files/ncm.sh
> @@ -26,8 +26,8 @@ proto_ncm_setup() {
>  
>   local manufacturer initialize setmode connect ifname devname devpath
>  
> - local device apn auth username password pincode delay mode pdptype ipv6
> - json_get_vars device apn auth username password pincode delay mode 
> pdptype ipv6
> + local device apn auth username password pincode delay mode pdptype ipv6 
> defaultroute peerdns metric
> + json_get_vars device apn auth username password pincode delay mode 
> pdptype ipv6 defaultroute peerdns metric
>   
>   if [ "$ipv6" = 0 ]; then
>   ipv6=""
> @@ -141,6 +141,9 @@ proto_ncm_setup() {
>   json_add_string name "${interface}_4"
>   json_add_string ifname "@$interface"
>   json_add_string proto "dhcp"
> + [ -n "$defaultroute" ] && json_add_boolean defaultroute "$defaultroute"
> + [ -n "$peerdns" ] && json_add_boolean peerdns "$peerdns"
> + [ -n "$metric" ] && json_add_int metric "$metric"
>   ubus call network add_dynamic "$(json_dump)"
>  
>   [ -n "$ipv6" ] && {
> @@ -148,6 +151,9 @@ proto_ncm_setup() {
>   json_add_string name "${interface}_6"
>   json_add_string ifname "@$interface"
>   json_add_string proto "dhcpv6"
> + [ -n "$defaultroute" ] && json_add_boolean defaultroute 
> "$defaultroute"
> + [ -n "$peerdns" ] && json_add_boolean peerdns "$peerdns"
> + [ -n "$metric" ] && json_add_int metric "$metric"
>   json_add_string extendprefix 1
>   ubus call network add_dynamic "$(json_dump)"
>   }
> 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel