[OpenWrt-Devel] [PATCH] strongSwan 5.1.1 update for Ticket #14018

2013-11-10 Thread Edy Corak
This patch updates the strongSwan package in Attitude Adjustment 12.09.1
to the Current Release 5.1.1

Ticket: https://dev.openwrt.org/ticket/14018

Signed-off-by: Edy Corak i...@loenshotel.de

Index: patches/300-include-ipsec-user-script.patch
===
--- patches/300-include-ipsec-user-script.patch	(Revision 0)
+++ patches/300-include-ipsec-user-script.patch	(Revision 0)
@@ -0,0 +1,17 @@
+--- a/src/_updown/_updown.in
 b/src/_updown/_updown.in
+@@ -16,11 +16,9 @@
+ # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ # for more details.
+ 
+-# CAUTION:  Installing a new version of strongSwan will install a new
+-# copy of this script, wiping out any custom changes you make.  If
+-# you need changes, make a copy of this under another name, and customize
+-# that, and use the (left/right)updown parameters in ipsec.conf to make
+-# strongSwan use yours instead of this default one.
++# Add your custom ip rules to the /etc/ipsec.user file if you need that functionality.
++
++[ -e /etc/ipsec.user ]  . /etc/ipsec.user $1
+ 
+ # things that this script gets (from ipsec_pluto(8) man page)
+ #
Index: Makefile
===
--- Makefile	(Revision 38701)
+++ Makefile	(Arbeitskopie)
@@ -1,5 +1,5 @@
 # 
-# Copyright (C) 2012 OpenWrt.org
+# Copyright (C) 2012-2013 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=strongswan
-PKG_VERSION:=5.0.0
-PKG_RELEASE:=1
+PKG_VERSION:=5.1.1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://download.strongswan.org/
-PKG_MD5SUM:=c8b861305def7c0abae04f7bbefec212
+PKG_MD5SUM:=e3af3d493d22286be3cd794533a8966a
 
 PKG_MOD_AVAILABLE:= \
 	addrblock \
@@ -36,6 +36,7 @@
 	eap-identity \
 	eap-md5 \
 	eap-mschapv2 \
+	eap-radius \
 	farp \
 	fips-prf \
 	gcm \
@@ -69,11 +70,11 @@
 	smp \
 	socket-default \
 	socket-dynamic \
-	socket-raw \
 	sql \
 	sqlite \
 	stroke \
 	test-vectors \
+	unity \
 	uci \
 	updown \
 	whitelist \
@@ -150,6 +151,7 @@
 	+strongswan-mod-eap-identity \
 	+strongswan-mod-eap-md5 \
 	+strongswan-mod-eap-mschapv2 \
+	+strongswan-mod-eap-radius \
 	+strongswan-mod-farp \
 	+strongswan-mod-fips-prf \
 	+strongswan-mod-gcm \
@@ -185,6 +187,7 @@
 	+strongswan-mod-stroke \
 	+strongswan-mod-test-vectors \
 	+strongswan-mod-uci \
+	+strongswan-mod-unity \
 	+strongswan-mod-updown \
 	+strongswan-mod-whitelist \
 	+strongswan-mod-x509 \
@@ -198,7 +201,7 @@
 define Package/strongswan-full/description
 $(call Package/strongswan/description/Default)
  This meta-package contains dependencies for all of the strongswan plugins
- except kernel-klips, kernel-pfkey, socket-dynamic and socket-raw which are
+ except kernel-klips, kernel-pfkey, socket-dynamic and which are
  ommitted in favor of the kernel-netlink and socket-default plugins.
 endef
 
@@ -343,6 +346,7 @@
 define Package/strongswan/conffiles
 /etc/ipsec.conf
 /etc/ipsec.secrets
+/etc/ipsec.user
 /etc/strongswan.conf
 endef
 
@@ -352,6 +356,8 @@
 	$(INSTALL_DIR) $(1)/usr/lib/ipsec
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/{libstrongswan.so.*,libhydra.so.*} $(1)/usr/lib/ipsec/
 	$(INSTALL_CONF) ./files/ipsec.secrets $(1)/etc/
+	$(INSTALL_DIR) $(1)/etc/init.d
+	$(INSTALL_BIN) ./files/ipsec.init $(1)/etc/init.d/ipsec
 endef
 
 define Package/strongswan-default/install
@@ -378,10 +384,12 @@
 endef
 
 define Package/strongswan-utils/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/pki $(1)/usr/bin/
 	$(INSTALL_DIR) $(1)/usr/sbin
 	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ipsec $(1)/usr/sbin/
 	$(INSTALL_DIR) $(1)/usr/lib/ipsec
-	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ipsec/{openac,pki,scepclient} $(1)/usr/lib/ipsec/
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ipsec/{openac,scepclient} $(1)/usr/lib/ipsec/
 endef
 
 define Plugin/duplicheck/install
@@ -390,6 +398,12 @@
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-duplicheck.so $(1)/usr/lib/ipsec/plugins/
 endef
 
+define Plugin/eap-radius/install
+	$(INSTALL_DIR) $(1)/usr/lib/ipsec/plugins
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/libradius.so.* $(1)/usr/lib/ipsec/
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-eap-radius.so $(1)/usr/lib/ipsec/plugins/
+endef
+
 define Plugin/attr-sql/install
 	$(INSTALL_DIR) $(1)/usr/lib/ipsec
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/pool $(1)/usr/lib/ipsec/
@@ -416,6 +430,8 @@
 	$(INSTALL_DIR) $(1)/usr/lib/ipsec/plugins
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/{_updown,_updown_espmark} $(1)/usr/lib/ipsec/
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-updown.so $(1)/usr/lib/ipsec/plugins/
+	$(INSTALL_DIR) $(1)/etc
+	$(INSTALL_CONF) ./files/ipsec.user $(1)/etc/
 endef
 
 define Plugin/whitelist/install
@@ -451,6 +467,7 @@
 $(eval $(call 

[OpenWrt-Devel] [PATCH] ag71xx: fix ag71xx_probe error path

2013-11-10 Thread Catalin Patulea

Signed-off-by: Catalin Patulea c...@vv.carleton.ca
---
 .../net/ethernet/atheros/ag71xx/ag71xx_main.c  |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c 
b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
index f4d6735..0c2163f 100644
--- 
a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
+++ 
b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
@@ -1197,7 +1197,7 @@ static int ag71xx_probe(struct platform_device *pdev)
err = register_netdev(dev);
if (err) {
dev_err(pdev-dev, unable to register net device\n);
-   goto err_phy_disconnect;
+   goto err_debugfs_exit;
}
 
pr_info(%s: Atheros AG71xx at 0x%08lx, irq %d, mode:%s\n,
@@ -1206,6 +1206,8 @@ static int ag71xx_probe(struct platform_device *pdev)
 
return 0;
 
+err_debugfs_exit:
+   ag71xx_debugfs_exit(ag);
 err_phy_disconnect:
ag71xx_phy_disconnect(ag);
 err_free_desc:
-- 
1.7.9.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] forky hotplug-calls on lowmem-devices

2013-11-10 Thread Felix Fietkau
On 2013-11-10 08:09, Bastian Bittorf wrote:
 * Felix Fietkau n...@openwrt.org [10.11.2013 08:00]:
  hotplug-call: script: /etc/hotplug.d/iface/00-netstate READY: 1194
  hotplug-call: script: /etc/hotplug.d/iface/15-teql START: 1194
  hotplug-call: script: /etc/hotplug.d/iface/15-teql READY: 1194
  hotplug-call: script: /etc/hotplug.d/iface/30-6relay START: 1194
  hotplug-call: script: /etc/hotplug.d/iface/30-6relay READY: 1194
  hotplug-call: script: /etc/hotplug.d/iface/50-olsrd START: 1194
  hotplug-call: script: /etc/hotplug.d/iface/50-olsrd READY: 1194
  hotplug-call: $1 = 'iface' READY: 1194
 What do these numbers mean?
 
 the process-id, so we can see/count forks.
It probably isn't showing the subshell pid initiated by ().

  is it really needed to run in parallel? maybe it can be made configurable
  to run one after another?
 They are called from different processes, so they cannot easily be
 serialized. net is called by hotplug2 (on AA) / procd (on BB). iface is
 called by netifd.
 
 maybe all goes into a queue which procd runs?
I'd like to keep it in netifd, because I want to avoid adding special
cases for things like suppressing redundant events for a single interface.

  are the 'micro-optimizations' and nobody cares or is this ok?
 I'd like to avoid such micro-optimization churn unless you can prove
 that it actually matters.
 
 this is easy:
 for I in $(seq 0 1); do UP=$( sed -ne 's![^0-9].*$!!p' /proc/uptime ); 
 done
 for I in $(seq 0 1); do read UP REST /proc/uptime; UP=${UP%.*}; done
 
 sed-variant:
 real   1m 10.10s
 user   0m 18.52s
 sys0m 48.83s
 
 internal calls:
 real   0m 3.25s   
 user   0m 1.82s  
 sys0m 1.42s  
 
 3 sec vs. 70 sec...
 this was done on a strong board, on a weak board the difference is much 
 bigger.
 This is only _one_ little optimization, and there are a lot of...
For it to matter, I'm more interested in the absolute time saved than
relative differences on a completely unrealistic number of iterations.
In the case you're describing, it's still only saving about 7 ms per
interface-up event, that's not a lot.
By the way, I found an even faster way to deal with that particular
call: https://dev.openwrt.org/changeset/38704 :)

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


Re: [OpenWrt-Devel] [PATCH 0/2] Initial NAND support for WNDR4300

2013-11-10 Thread Stefan Agner
 Weird. For me it was working only at the first boot after flashing the image,
 but any modifications in the fs has been lost after subsequent reboots.
Hm, might be I did not looked at that correctly. Altough, I installed
some packages and I think they were still there after reboot...

Just updated to latest master and flashed the image using Factory Reset
(U-Boot TFTP-Server). The flashing worked fine, but I now get an error
on bootup:
[2.71] UBI: attaching mtd8 to ubi0
[2.79] UBI error: scan_peb: bad image sequence number 248591051
in PEB 63, expected 172450884
[2.80] Erase counter header dump:
[2.81]  magic  0x55424923
[2.81]  version1
[2.81]  ec 1
[2.82]  vid_hdr_offset 2048
[2.82]  data_offset4096
[2.82]  image_seq  248591051
[2.83]  hdr_crc0x98ac164
[2.83] erase counter header hexdump:
[2.83] UBI error: ubi_attach_mtd_dev: failed to attach mtd8,
error -22
[2.84] UBI error: ubi_init: cannot attach mtd8
[2.85] VFS: Cannot open root device (null) or
unknown-block(0,0): error -6

It looks like there's a bug in the new EOF marker support.

I looked into the code, I found this interesting comment just before the
bad image sequence error message:
/*   
 * Make sure that all PEBs have the same image sequence number.  
 * This allows us to detect situations when users flash UBI  
 * images incorrectly, so that the flash has the new UBI image   
 * and leftovers from the old one. This feature was added
 * relatively recently, and the sequence number was always   
 * zero, because old UBI implementations always set it to zero.  
 * For this reasons, we do not panic if some PEBs have zero  
 * sequence number, while other PEBs have non-zero sequence  
 * number.   
 */


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


Re: [OpenWrt-Devel] [PATCH 0/2] Initial NAND support for WNDR4300

2013-11-10 Thread Stefan Agner
Nevermind, the second time it worked:

[2.71] UBI: attaching mtd8 to ubi0
[2.74] UBI: EOF marker found, PEBs from 17 will be erased
[2.74] UBI: scanning is finished
[2.77] gluebi (pid 1): gluebi_resized: got update notification
for unknown UBI device 0 volume 1
[2.78] UBI: volume 1 (rootfs_data) re-sized from 1 to 146 LEBs
[2.79] UBI: attached mtd8 (name ubiroot, size 23 MiB) to ubi0
[2.80] UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976
bytes
[2.81] UBI: min./max. I/O unit sizes: 2048/2048, sub-page size
2048
[2.81] UBI: VID header offset: 2048 (aligned 2048), data offset:
4096
[2.82] UBI: good PEBs: 184, bad PEBs: 0, corrupted PEBs: 0
[2.82] UBI: user volume: 2, internal volumes: 1, max. volumes
count: 128
[2.83] UBI: max/mean erase counter: 1/0, WL threshold: 4096,
image sequence number: 1699075075
[2.84] UBI: available PEBs: 0, total reserved PEBs: 184, PEBs
reserved for bad PEB handling: 20
[2.85] UBI: background thread ubi_bgt0d started, PID 263
[2.86] mtd: device 12 (rootfs) set to be root filesystem
[2.87] VFS: Mounted root (squashfs filesystem) readonly on
device 31:12.

Probably because I made no make clean before building the new image with
those EOF marker?

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


Re: [OpenWrt-Devel] forky hotplug-calls on lowmem-devices

2013-11-10 Thread Bastian Bittorf
* Felix Fietkau n...@openwrt.org [10.11.2013 13:13]:
  3 sec vs. 70 sec...
  this was done on a strong board, on a weak board the difference is much 
  bigger.
  This is only _one_ little optimization, and there are a lot of...
 For it to matter, I'm more interested in the absolute time saved than
 relative differences on a completely unrealistic number of iterations.
 In the case you're describing, it's still only saving about 7 ms per
 interface-up event, that's not a lot.

i digged again trough the script and have some ideas:

1)
every script probes if itself is 'enabled', so in
e.g. /etc/hotplug.d/iface/30-6relay the call is:

/etc/init.d/6relayd enabled || exit 0

can we avoid that? maybe if the daemon is disabled
via '/etc/init.d/6relayd disable', than the hotplug-file
is also hidden? or netifd/procd should not call daemons
which are disabled?

2)
also every script which needs an action has to fork, e.g.
in '/etc/hotplug.d/iface/50-olsrd' we call

/etc/init.d/olsrd restart

maybe we can just source 'rc.common' once in '/sbin/hotplug-call'
and so we can call just 'restart' when we need it?

3)
what happens during bootup (where we can see load ~5...10),
when all interfaces are fired: for every event we have to restart
the whole olsrd-process. i better way would be to 'wait for all
interfaces' in one batch and than call it?

 By the way, I found an even faster way to deal with that particular
 call: https://dev.openwrt.org/changeset/38704 :)

8-)

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


Re: [OpenWrt-Devel] Newbie needs help in building stable for newer hardware

2013-11-10 Thread Florian Effenberger
Hi,

2013/11/10 Weedy weedy2...@gmail.com:

 ehh, I guess needed to add ubus call network reload before ifup.
 That was about it.

thanks for sharing, that indeed helps!

However, there must be some easy method, as I assume 12.09.1 will be
in the same state as 12.09, but with some newer hardware and bugfixes
added, so I wonder how these micro releases are built... :-)

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


Re: [OpenWrt-Devel] forky hotplug-calls on lowmem-devices

2013-11-10 Thread Bastian Bittorf
* Felix Fietkau n...@openwrt.org [10.11.2013 13:13]:
 For it to matter, I'm more interested in the absolute time saved than
 relative differences on a completely unrealistic number of iterations.
 In the case you're describing, it's still only saving about 7 ms per
 interface-up event, that's not a lot.

i did some more debugging and it seems, that during bootup
'/sbin/hotplug' is called ~290 times:

http://intercity-vpn.de/files/openwrt/hotplug-calls-debug-r38651.txt

also during bootup there are calls for wifi down?:
HOTPLUG_TYPE=net ACTION=remove INTERFACE=wlan0
HOTPLUG_TYPE=net ACTION=remove INTERFACE=wlan1

are all the calls to HOTPLUG_TYPE=tty intended?

it doesnt seem very efficient...

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


Re: [OpenWrt-Devel] forky hotplug-calls on lowmem-devices

2013-11-10 Thread Felix Fietkau
On 2013-11-10 13:41, Bastian Bittorf wrote:
 * Felix Fietkau n...@openwrt.org [10.11.2013 13:13]:
  3 sec vs. 70 sec...
  this was done on a strong board, on a weak board the difference is much 
  bigger.
  This is only _one_ little optimization, and there are a lot of...
 For it to matter, I'm more interested in the absolute time saved than
 relative differences on a completely unrealistic number of iterations.
 In the case you're describing, it's still only saving about 7 ms per
 interface-up event, that's not a lot.
 
 i digged again trough the script and have some ideas:
 
 1)
 every script probes if itself is 'enabled', so in
 e.g. /etc/hotplug.d/iface/30-6relay the call is:
 
 /etc/init.d/6relayd enabled || exit 0
 
 can we avoid that? maybe if the daemon is disabled
 via '/etc/init.d/6relayd disable', than the hotplug-file
 is also hidden? or netifd/procd should not call daemons
 which are disabled?
We don't have many of those, and there aren't that many calls to
/etc/hotplug.d/iface.

 2)
 also every script which needs an action has to fork, e.g.
 in '/etc/hotplug.d/iface/50-olsrd' we call
 
 /etc/init.d/olsrd restart
 
 maybe we can just source 'rc.common' once in '/sbin/hotplug-call'
 and so we can call just 'restart' when we need it?
I'm not sure it's worth it. The other email you just sent is a lot more
useful wrt. potential for optimization.

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


Re: [OpenWrt-Devel] forky hotplug-calls on lowmem-devices

2013-11-10 Thread Felix Fietkau
On 2013-11-10 14:25, Bastian Bittorf wrote:
 * Felix Fietkau n...@openwrt.org [10.11.2013 13:13]:
 For it to matter, I'm more interested in the absolute time saved than
 relative differences on a completely unrealistic number of iterations.
 In the case you're describing, it's still only saving about 7 ms per
 interface-up event, that's not a lot.
 
 i did some more debugging and it seems, that during bootup
 '/sbin/hotplug' is called ~290 times:
 
 http://intercity-vpn.de/files/openwrt/hotplug-calls-debug-r38651.txt
 
 also during bootup there are calls for wifi down?:
 HOTPLUG_TYPE=net ACTION=remove INTERFACE=wlan0
 HOTPLUG_TYPE=net ACTION=remove INTERFACE=wlan1
 
 are all the calls to HOTPLUG_TYPE=tty intended?
 
 it doesnt seem very efficient...
Now that's something worth optimizing. According to a simple grep, the
part that uses the tty events is comgt (for 3g device hotplugging).
We can probably fix this inefficiency by using a more specific rule in
procd's hotplug json-script to replace the generic tty hotplug calls.
We could then also make it check if the /etc/hotplug.d/$SUBSYSTEM
directory exists before issuing a call to /sbin/hotplug-call.

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


Re: [OpenWrt-Devel] forky hotplug-calls on lowmem-devices

2013-11-10 Thread Felix Fietkau
On 2013-11-10 14:30, Felix Fietkau wrote:
 On 2013-11-10 14:25, Bastian Bittorf wrote:
 * Felix Fietkau n...@openwrt.org [10.11.2013 13:13]:
 For it to matter, I'm more interested in the absolute time saved than
 relative differences on a completely unrealistic number of iterations.
 In the case you're describing, it's still only saving about 7 ms per
 interface-up event, that's not a lot.
 
 i did some more debugging and it seems, that during bootup
 '/sbin/hotplug' is called ~290 times:
 
 http://intercity-vpn.de/files/openwrt/hotplug-calls-debug-r38651.txt
 
 also during bootup there are calls for wifi down?:
 HOTPLUG_TYPE=net ACTION=remove INTERFACE=wlan0
 HOTPLUG_TYPE=net ACTION=remove INTERFACE=wlan1
 
 are all the calls to HOTPLUG_TYPE=tty intended?
 
 it doesnt seem very efficient...
 Now that's something worth optimizing. According to a simple grep, the
 part that uses the tty events is comgt (for 3g device hotplugging).
 We can probably fix this inefficiency by using a more specific rule in
 procd's hotplug json-script to replace the generic tty hotplug calls.
 We could then also make it check if the /etc/hotplug.d/$SUBSYSTEM
 directory exists before issuing a call to /sbin/hotplug-call.
You could try this patch to see if it makes a difference wrt. boot time:

---
--- a/package/system/procd/files/hotplug.json
+++ b/package/system/procd/files/hotplug.json
@@ -69,8 +69,14 @@
[ exec, /etc/rc.button/%BUTTON% ]
],
[ if,
-   [ eq, SUBSYSTEM,
-   [ net, input, usb, ieee1394, block, atm, 
zaptel, tty, button ]
+   [ or,
+   [ eq, SUBSYSTEM,
+   [ net, input, usb, ieee1394, block, 
atm, zaptel, button ],
+   ],
+   [ and,
+   [ eq, SUBSYSTEM, tty ],
+   [ regex, DEVNAME, ^ttyUSB ],
+   ]
],
[ exec, /sbin/hotplug-call, %SUBSYSTEM% ]
],
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] forky hotplug-calls on lowmem-devices

2013-11-10 Thread Bastian Bittorf
* Felix Fietkau n...@openwrt.org [10.11.2013 15:22]:
 We could then also make it check if the /etc/hotplug.d/$SUBSYSTEM
 directory exists before issuing a call to /sbin/hotplug-call.

this sounds good. so in /sbin/hotplug-call there is
everytime the check

[ \! -z $1 -a -d /etc/hotplug.d/$1 ]  {
...
}

which can be removed afterwards.
also there is a call which looks strange to me:

for script in $(ls /etc/hotplug.d/$1/* 2-); do (
[ -f $script ]  . $script
); done

i propose this simpler look:

for FILE in /etc/hotplug.d/$1/*; do (
command . $FILE
); done

because we know, that the directory exists
and there is no need to fork ls and there
is no need to check for a file if we use 'command'
(a builtin). FILE should be used uppercase, because
this is a global var (just cosmetic).

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


Re: [OpenWrt-Devel] forky hotplug-calls on lowmem-devices

2013-11-10 Thread Felix Fietkau
On 2013-11-10 16:02, Bastian Bittorf wrote:
 * Felix Fietkau n...@openwrt.org [10.11.2013 15:22]:
 We could then also make it check if the /etc/hotplug.d/$SUBSYSTEM
 directory exists before issuing a call to /sbin/hotplug-call.
 
 this sounds good. so in /sbin/hotplug-call there is
 everytime the check
 
 [ \! -z $1 -a -d /etc/hotplug.d/$1 ]  {
   ...
 }
 
 which can be removed afterwards.
 also there is a call which looks strange to me:
 
 for script in $(ls /etc/hotplug.d/$1/* 2-); do (
   [ -f $script ]  . $script
 ); done
 
 i propose this simpler look:
 
 for FILE in /etc/hotplug.d/$1/*; do (
   command . $FILE
 ); done
 
 because we know, that the directory exists
 and there is no need to fork ls and there
 is no need to check for a file if we use 'command'
 (a builtin). FILE should be used uppercase, because
 this is a global var (just cosmetic).
We may know that the directory exists, but that doesn't mean that there
are files in there.

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


Re: [OpenWrt-Devel] forky hotplug-calls on lowmem-devices

2013-11-10 Thread Bastian Bittorf
* Felix Fietkau n...@openwrt.org [10.11.2013 15:22]:
 You could try this patch to see if it makes a difference wrt. boot time:
 
 ---
 --- a/package/system/procd/files/hotplug.json
 +++ b/package/system/procd/files/hotplug.json
 @@ -69,8 +69,14 @@
   [ exec, /etc/rc.button/%BUTTON% ]
   ],
   [ if,
 - [ eq, SUBSYSTEM,
 - [ net, input, usb, ieee1394, block, atm, 
 zaptel, tty, button ]
 + [ or,
 + [ eq, SUBSYSTEM,
 + [ net, input, usb, ieee1394, block, 
 atm, zaptel, button ],
 + ],
 + [ and,
 + [ eq, SUBSYSTEM, tty ],
 + [ regex, DEVNAME, ^ttyUSB ],
 + ]
   ],
   [ exec, /sbin/hotplug-call, %SUBSYSTEM% ]
   ],


this works fine here, so just include:
http://intercity-vpn.de/files/openwrt/hotplug-calls-debug-r38651-patched.txt 

before: 289 calls to /sbin/hotplug-call, now: 32
(model: TP-LINK TL-WDR4900 v1)

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


Re: [OpenWrt-Devel] forky hotplug-calls on lowmem-devices

2013-11-10 Thread Bastian Bittorf
* Felix Fietkau n...@openwrt.org [10.11.2013 16:13]:
  for FILE in /etc/hotplug.d/$1/*; do (
  command . $FILE
  ); done
  
  because we know, that the directory exists
  and there is no need to fork ls and there
  is no need to check for a file if we use 'command'
  (a builtin). FILE should be used uppercase, because
  this is a global var (just cosmetic).
 We may know that the directory exists, but that doesn't mean that there
 are files in there.

if there are no files, than the call is e.g.:

command . /etc/hotplug.d/iface/*

(which throws an error, but does not hurt). the call

test -f $file  . $file

is racy anyway. just use 'command' than, it tests for
existence itself 8-)

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


Re: [OpenWrt-Devel] forky hotplug-calls on lowmem-devices

2013-11-10 Thread Felix Fietkau
On 2013-11-10 16:16, Bastian Bittorf wrote:
 * Felix Fietkau n...@openwrt.org [10.11.2013 16:13]:
  for FILE in /etc/hotplug.d/$1/*; do (
 command . $FILE
  ); done
  
  because we know, that the directory exists
  and there is no need to fork ls and there
  is no need to check for a file if we use 'command'
  (a builtin). FILE should be used uppercase, because
  this is a global var (just cosmetic).
 We may know that the directory exists, but that doesn't mean that there
 are files in there.
 
 if there are no files, than the call is e.g.:
 
 command . /etc/hotplug.d/iface/*
 
 (which throws an error, but does not hurt). the call
I'd prefer preventing unnecessary logspam.

 test -f $file  . $file
 
 is racy anyway. just use 'command' than, it tests for
 existence itself 8-)
How is it racy? /etc/hotplug.d/* doesn't usually change at run time.

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


Re: [OpenWrt-Devel] forky hotplug-calls on lowmem-devices

2013-11-10 Thread Bastian Bittorf
* Felix Fietkau n...@openwrt.org [10.11.2013 16:24]:
  if there are no files, than the call is e.g.:
  
  command . /etc/hotplug.d/iface/*
  
  (which throws an error, but does not hurt). the call
 I'd prefer preventing unnecessary logspam.
 
  test -f $file  . $file
  
  is racy anyway. just use 'command' than, it tests for
  existence itself 8-)
 How is it racy? /etc/hotplug.d/* doesn't usually change at run time.

normally not, the intentention was more to
simplify and dont test 2 times. what about:

for FILE in /etc/hotplug.d/iface/*; do (
. $FILE 2/dev/null
); done

also: why is this needed?: export HOTPLUG_TYPE=$1
because we source everything, we dont need an export, just
an: HOTPLUG_TYPE=$1

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


Re: [OpenWrt-Devel] forky hotplug-calls on lowmem-devices

2013-11-10 Thread Bastian Bittorf
* Felix Fietkau n...@openwrt.org [10.11.2013 14:36]:
  also every script which needs an action has to fork, e.g.
  in '/etc/hotplug.d/iface/50-olsrd' we call
  
  /etc/init.d/olsrd restart
  
  maybe we can just source 'rc.common' once in '/sbin/hotplug-call'
  and so we can call just 'restart' when we need it?
 I'm not sure it's worth it. The other email you just sent is a lot more
 useful wrt. potential for optimization.

i changed the call in the olsrd-hotplug script to

. /etc/rc.common /etc/init.d/olsrd restart
instead of
/etc/init.d/olsrd restart

is this ok, or is the wrong somehow? it seems to work.

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


[OpenWrt-Devel] [PATCH] ar71xx: wndr4300: set official mac addresses

2013-11-10 Thread Stefan Agner
Get the factory assigned mac addresses stored in the caldata partition
and asign them to lan, wan and radio1.

Signed-off-by: Stefan Agner ste...@agner.ch
---
 package/base-files/files/lib/functions/uci-defaults.sh | 9
+
 target/linux/ar71xx/base-files/etc/uci-defaults/02_network | 6 ++
 2 files changed, 15 insertions(+)

diff --git a/package/base-files/files/lib/functions/uci-defaults.sh
b/package/base-files/files/lib/functions/uci-defaults.sh
index bf6fe1e..061c871 100644
--- a/package/base-files/files/lib/functions/uci-defaults.sh
+++ b/package/base-files/files/lib/functions/uci-defaults.sh
@@ -210,6 +210,15 @@ set network.$ifname.macaddr='$mac'
 EOF
 }
 
+ucidef_set_wireless_macaddr() {
+   local ifname=$1
+   local mac=$2
+
+   uci batch EOF
+set wireless.$ifname.macaddr='$mac'
+EOF
+}
+
 ucidef_add_switch() {
local name=$1
local reset=$2
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index bdf37ee..ebb0c55 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -211,6 +211,12 @@ wndr4300)
ucidef_add_switch switch0 1 1
ucidef_add_switch_vlan switch0 1 0t 1 2 3 4
ucidef_add_switch_vlan switch0 2 0t 5
+   mac_lan=$(mtd_get_mac_binary caldata 0)
+   [ -n $mac_lan ]  ucidef_set_interface_macaddr lan $mac_lan
+   mac_wan=$(mtd_get_mac_binary caldata 6)
+   [ -n $mac_wan ]  ucidef_set_interface_macaddr wan $mac_wan
+   mac_wlan5g=$(mtd_get_mac_binary caldata 12)
+   [ -n $mac_wlan5g ]  ucidef_set_wireless_macaddr radio1
$mac_wlan5g
;;
 
 all0305 |\
-- 
1.8.4.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] atheros: /etc/diag.sh for FON2201

2013-11-10 Thread Daniel Gimpelevich
In Backfire, the power LED worked normally on the Fonera+, but in
Barrier Breaker, it's unused. I can't seem to find a way to
differentiate among hardware in the atheros target, so I'm submitting a
FIXME patch to be further patched with info from other devices.

Signed-off-by: Daniel Gimpelevich dan...@gimpelevich.san-francisco.ca.us
--- /dev/null   2013-11-09 12:36:28.330833697 -0800
+++ b/target/linux/atheros/base-files/etc/diag.sh   2013-11-10 
07:34:45.372612754 -0800
@@ -0,0 +1,27 @@
+#!/bin/sh
+# Copyright (C) 2013 OpenWrt.org
+
+. /lib/functions/leds.sh
+
+set_state() {
+   status_led=gpio4
+
+   [ -d /sys/class/leds/gpio4/ ] 
+   [ -d /sys/class/leds/gpio7/ ]  {
+
+   case $1 in
+   preinit)
+   led_timer gpio7 200 200
+   status_led_off
+   ;;
+   failsafe)
+   status_led_blink_failsafe
+   led_off gpio7
+   ;;
+   done)
+   status_led_on
+   led_off gpio7
+   ;;
+   esac
+   }
+}
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] [1/3] ar71xx: Add kernel support for the WR842N/ND v2

2013-11-10 Thread Martijn Zilverschoon
Patch to add kernel support for the TP-LINK WR842N/ND v2

Signed-off-by: Martijn Zilverschoon thefriedzom...@gmail.com
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v8.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v8.c
index 6d2654b..064a33f 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v8.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v8.c
@@ -180,6 +180,28 @@ static void __init tl_wr841n_v8_setup(void)
 MIPS_MACHINE(ATH79_MACH_TL_WR841N_V8, TL-WR841N-v8, TP-LINK TL-WR841N/ND v8,
 	 tl_wr841n_v8_setup);
 
+
+static void __init tl_wr842n_v2_setup(void)
+{
+	tl_ap123_setup();
+
+	ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr841n_v8_leds_gpio) - 1,
+ tl_wr841n_v8_leds_gpio);
+
+	ath79_register_gpio_keys_polled(1, TL_WR841NV8_KEYS_POLL_INTERVAL,
+	ARRAY_SIZE(tl_wr841n_v8_gpio_keys),
+	tl_wr841n_v8_gpio_keys);
+
+	gpio_request_one(TL_MR3420V2_GPIO_USB_POWER,
+			 GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+			 USB power);
+
+	ath79_register_usb();
+}
+
+MIPS_MACHINE(ATH79_MACH_TL_WR842N_V2, TL-WR842N-v2, TP-LINK TL-WR842N/ND v2,
+	 tl_wr842n_v2_setup);
+
 static void __init tl_mr3420v2_setup(void)
 {
 	tl_ap123_setup();
diff --git a/target/linux/ar71xx/patches-3.10/634-MIPS-ath79-add-TL-WR842N-v2-support.patch b/target/linux/ar71xx/patches-3.10/634-MIPS-ath79-add-TL-WR842N-v2-support.patch
new file mode 100644
index 000..f0f06cf
--- /dev/null
+++ b/target/linux/ar71xx/patches-3.10/634-MIPS-ath79-add-TL-WR842N-v2-support.patch
@@ -0,0 +1,12 @@
+Index: linux-3.10.18/arch/mips/ath79/machtypes.h
+===
+--- linux-3.10.18.orig/arch/mips/ath79/machtypes.h	2013-11-10 15:33:58.068025153 +0100
 linux-3.10.18/arch/mips/ath79/machtypes.h	2013-11-10 15:36:03.012088462 +0100
+@@ -113,6 +113,7 @@
+ 	ATH79_MACH_TL_WR841N_V1,	/* TP-LINK TL-WR841N v1 */
+ 	ATH79_MACH_TL_WR841N_V7,	/* TP-LINK TL-WR841N/ND v7 */
+ 	ATH79_MACH_TL_WR841N_V8,	/* TP-LINK TL-WR841N/ND v8 */
++	ATH79_MACH_TL_WR842N_V2,	/* TP-LINK TL-WR842N/ND v2 */
+ 	ATH79_MACH_TL_WR941ND,		/* TP-LINK TL-WR941ND */
+ 	ATH79_MACH_UBNT_AIRROUTER,	/* Ubiquiti AirRouter */
+ 	ATH79_MACH_UBNT_BULLET_M,	/* Ubiquiti Bullet M */
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] [2/3] ar71xx: add profile for the WR842N/ND v2

2013-11-10 Thread Martijn Zilverschoon
Patch to add the profile for the TP-LINK WR842N/ND v2

Signed-off-by: Martijn Zilverschoon thefriedzom...@gmail.com
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 897aab9..64d2986 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -974,7 +974,7 @@ $(eval $(call SingleProfile,TPLINK,64kraw,TLWR743NV1,tl-wr743nd-v1,TL-WR741ND,tt
 $(eval $(call SingleProfile,TPLINK,64kraw,TLWR841NV3,tl-wr841nd-v3,TL-WR941ND,ttyS0,115200,0x08410003,3,4M))
 $(eval $(call SingleProfile,TPLINK,64kraw,TLWR841NV5,tl-wr841nd-v5,TL-WR741ND,ttyS0,115200,0x08410005,1,4M))
 $(eval $(call SingleProfile,TPLINK,64kraw,TLWR841NV7,tl-wr841nd-v7,TL-WR841N-v7,ttyS0,115200,0x08410007,1,4M))
-$(eval $(call SingleProfile,TPLINK,64kraw,TLWR842,tl-wr842n-v1,TL-MR3420,ttyS0,115200,0x08420001,1,8M))
+$(eval $(call SingleProfile,TPLINK,64kraw,TLWR842V1,tl-wr842n-v1,TL-MR3420,ttyS0,115200,0x08420001,1,8M))
 $(eval $(call SingleProfile,TPLINK,64kraw,TLWR941NV2,tl-wr941nd-v2,TL-WR941ND,ttyS0,115200,0x09410002,2,4M))
 $(eval $(call SingleProfile,TPLINK,64kraw,TLWR941NV3,tl-wr941nd-v3,TL-WR941ND,ttyS0,115200,0x09410002,2,4M))
 $(eval $(call SingleProfile,TPLINK,64kraw,TLWR941NV4,tl-wr941nd-v4,TL-WR741ND,ttyS0,115200,0x09410004,1,4M))
@@ -997,6 +997,7 @@ $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR740NV4,tl-wr740n-v4,TL-WR741N
 $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR741NV4,tl-wr741nd-v4,TL-WR741ND-v4,ttyATH0,115200,0x07410004,1,4Mlzma))
 $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR743NV2,tl-wr743nd-v2,TL-WR741ND-v4,ttyATH0,115200,0x07430002,1,4Mlzma))
 $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR841NV8,tl-wr841n-v8,TL-WR841N-v8,ttyS0,115200,0x08410008,1,4Mlzma))
+$(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR842V2,tl-wr842n-v2,TL-WR842N-v2,ttyS0,115200,0x8420002,1,8Mlzma))
 $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR941NV6,tl-wr941nd-v6,TL-WDR3500,ttyS0,115200,0x09410006,1,4Mlzma))
 $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR1041,tl-wr1041n-v2,TL-WR1041N-v2,ttyS0,115200,0x10410002,1,4Mlzma))
 $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR2543,tl-wr2543-v1,TL-WR2543N,ttyS0,115200,0x25430001,1,8Mlzma,-v 3.13.99))
@@ -1058,6 +1059,7 @@ $(eval $(call MultiProfile,TLWR740,TLWR740NV1 TLWR740NV3 TLWR740NV4))
 $(eval $(call MultiProfile,TLWR741,TLWR741NV1 TLWR741NV2 TLWR741NV4))
 $(eval $(call MultiProfile,TLWR743,TLWR743NV1 TLWR743NV2))
 $(eval $(call MultiProfile,TLWR841,TLWR841NV15 TLWR841NV3 TLWR841NV5 TLWR841NV7 TLWR841NV8))
+$(eval $(call MultiProfile,TLWR842,TLWR842V1 TLWR842V2))
 $(eval $(call MultiProfile,TLWR941,TLWR941NV2 TLWR941NV3 TLWR941NV4 TLWR941NV6))
 $(eval $(call MultiProfile,TLWDR4300,TLWDR3500V1 TLWDR3600V1 TLWDR4300V1 TLWDR4310V1 MW4530RV1))
 $(eval $(call MultiProfile,UBNT,UBNTAIRROUTER UBNTRS UBNTRSPRO UBNTLSSR71 UBNTBULLETM UBNTROCKETM UBNTNANOM UBNTUNIFI UBNTUNIFIOUTDOOR UAPPRO))
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] [3/3] ar71xx: add user space support for the TL-WR842N/ND v2

2013-11-10 Thread Martijn Zilverschoon
Patch to add the user space support for the TL-WR842N/ND v2

Signed-off-by: Martijn Zilverschoon thefriedzom...@gmail.com
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index e304fac..6ee36c1 100755
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -140,6 +140,7 @@ get_status_led() {
 	tl-wr841n-v1 | \
 	tl-wr841n-v7 | \
 	tl-wr841n-v8 | \
+	tl-wr842n-v2 | \
 	tl-wr941nd)
 		status_led=tp-link:green:system
 		;;
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
index 235a475..52fc409 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -219,7 +219,8 @@ tl-wr741nd-v4)
 	ucidef_set_led_wlan wlan WLAN tp-link:green:wlan phy0tpt
 	;;
 
-tl-wr841n-v8)
+tl-wr841n-v8 |\
+tl-wr842n-v2)
 	ucidef_set_led_netdev wan WAN tp-link:green:wan eth0
 	ucidef_set_led_switch lan1 LAN1 tp-link:green:lan1 switch0 0x04
 	ucidef_set_led_switch lan2 LAN2 tp-link:green:lan2 switch0 0x08
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index bdf37ee..94ec141 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -169,6 +169,7 @@ tl-wr941nd)
 
 tl-mr3420-v2 |\
 tl-wr841n-v8 |\
+tl-wr842n-v2 |\
 wnr2000-v3 |\
 wnr2200 |\
 wnr612-v2)
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index e1cedf6..8c84446 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -474,6 +474,9 @@ ar71xx_board_detect() {
 	*TL-WR841N/ND v8)
 		name=tl-wr841n-v8
 		;;
+	*TL-WR842N/ND v2)
+		name=tl-wr842n-v2
+		;;
 	*TL-WR941ND)
 		name=tl-wr941nd
 		;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index ae04a8c..06bdf24 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -202,6 +202,7 @@ platform_check_image() {
 	tl-wr841n-v1 | \
 	tl-wr841n-v7 | \
 	tl-wr841n-v8 | \
+	tl-wr842n-v2 | \
 	tl-wr941nd | \
 	tl-wr1041n-v2 | \
 	tl-wr1043nd | \
	___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] [packages] libsodium: New package

2013-11-10 Thread Moritz Warning
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Add Sodium version 0.4.5 as new package to OpenWrt.

Sodium is cryptographic library based on NaCl and exposes
a very simple, high-level API with a tiny set of functions for
each operation. It improves on many shortcomings of NaCl.

Signed-off-by: Moritz Warning moritzwarning at web.de
- ---
 libs/libsodium/Makefile |   41 +
 1 file changed, 41 insertions(+)
 create mode 100644 libs/libsodium/Makefile

diff --git a/libs/libsodium/Makefile b/libs/libsodium/Makefile
new file mode 100644
index 000..ba952b8
- --- /dev/null
+++ b/libs/libsodium/Makefile
@@ -0,0 +1,41 @@
+#
+# Copyright (C) 2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libsodium
+PKG_VERSION:=0.4.5
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://github.com/jedisct1/libsodium/releases/download/$(PKG_VERSION)
+PKG_MD5SUM:=3a97d2c29ec0133e334036e3f19d0741
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libsodium
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=NaCl-based crypto library
+  URL:=http://github.com/jedisct1/libsodium
+endef
+
+define Build/Configure
+   $(call Build/Configure/Default,--enable-shared=no)
+endef
+
+define Build/InstallDev
+   $(INSTALL_DIR) $(1)/usr/include/sodium
+   $(CP) $(PKG_INSTALL_DIR)/usr/include/sodium.h $(1)/usr/include
+   $(CP) $(PKG_INSTALL_DIR)/usr/include/sodium/*.h $(1)/usr/include/sodium
+   $(INSTALL_DIR) $(1)/usr/lib
+   $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsodium.a $(1)/usr/lib
+endef
+
+$(eval $(call BuildPackage,libsodium))
- -- 
1.7.10.4
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iQEcBAEBAgAGBQJSgATzAAoJECHrh56PP4wplQ0IAN/iHEonqUzCTgsszn8nU7Mx
Hg0uog/7g7ia/hKTq7Y5XU1rt81p60c5VzShiKyv8r5TJLZEVXyMvZVwiQodDpsc
eEYWvS6e557tNAhYgCa4uGm7pmdrO2bq0Av2j6RSzBvG82mCl9osg/Z1DeHQYD3f
Yb1uBuZMmEsczvaeJuCLrv2H7vQy24YZ+X3KiJDF4P98iln4YJBfHSQMzW/GAc+p
FyFSaN9d6mksCZy9hvXs4fHgCdAJEgr7JjCQwlTJtlkY6fw4pll3G26QBBHNazAk
TnzQPWwj/sfURWSxrdnJ+NW3sl66IZoZ81wuVR/3ytXXvo2OHhDGSupATYfDYhQ=
=dvQ7
-END PGP SIGNATURE-
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 4/8] brcm47xx/lzmaloader: add Belkin F7DXXXX support

2013-11-10 Thread Cody P Schafer
F7D3301/F7D7301, F7D3302/F7D7302 and F7D4301 all have replacements for
the TRX magic (HDR0), and all those models also appear to support a
single QA TRX magic. Add all of this to the lzmaloader's trx
recognition code.

Signed-off-by: Cody P Schafer de...@codyps.com
---
 .../brcm47xx/image/lzma-loader/src/decompress.c| 25 --
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/target/linux/brcm47xx/image/lzma-loader/src/decompress.c 
b/target/linux/brcm47xx/image/lzma-loader/src/decompress.c
index 05681b1..56f4500 100644
--- a/target/linux/brcm47xx/image/lzma-loader/src/decompress.c
+++ b/target/linux/brcm47xx/image/lzma-loader/src/decompress.c
@@ -90,6 +90,11 @@ struct trx_header {
 #define EDIMAX_PS_HEADER_MAGIC 0x36315350 /*  PS16  */
 #define EDIMAX_PS_HEADER_LEN   0xc /* 12 bytes long for edimax header */
 
+#define BELKIN_F7D3301_MAGIC   0x20100322 /* a date of some sort */
+#define BELKIN_F7D3302_MAGIC   0x20090928
+#define BELKIN_F7D4302_MAGIC   0x20101006
+#define BELKIN_F7D_QA_MAGIC0x12345678
+
 /* beyound the image end, size not known in advance */
 extern unsigned char workspace[];
 
@@ -121,6 +126,23 @@ static __inline__ unsigned char get_byte(void)
return read_byte(0, buffer, fake), *buffer;
 }
 
+static int has_trx_magic(unsigned char *data)
+{
+   UInt32 magic = ((struct trx_header *)data)-magic;
+
+   switch (magic) {
+   case TRX_MAGIC:
+   case EDIMAX_PS_HEADER_MAGIC:
+   case BELKIN_F7D3301_MAGIC:
+   case BELKIN_F7D3302_MAGIC:
+   case BELKIN_F7D4302_MAGIC:
+   case BELKIN_F7D_QA_MAGIC:
+   return 1;
+   default:
+   return 0;
+   }
+}
+
 /* should be the first function */
 void entry(unsigned long icache_size, unsigned long icache_lsize, 
unsigned long dcache_size, unsigned long dcache_lsize,
@@ -138,8 +160,7 @@ void entry(unsigned long icache_size, unsigned long 
icache_lsize,
 
/* look for trx header, 32-bit data access */
for (data = ((unsigned char *) KSEG1ADDR(BCM4710_FLASH));
-   ((struct trx_header *)data)-magic != TRX_MAGIC 
-   ((struct trx_header *)data)-magic != EDIMAX_PS_HEADER_MAGIC;
+!has_trx_magic(data);
 data += 65536);
 
if (((struct trx_header *)data)-magic == EDIMAX_PS_HEADER_MAGIC)
-- 
1.8.4.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 0/8] Add Belkin F7Dx30x support

2013-11-10 Thread Cody P Schafer
These pathes add (at least) support for the Belkin F7D3302/F7D7302 router
(which I have), and potentially also enable the F7D3301 and F7D4301 routers
(which I don't have and have not tested).


--

Cody P Schafer (8):
  broadcom-diag: add Belkin F7D3302/F7D7302
  linux/brcm47xx : Belkin F7Dx30x board detection
  brcm47xx/image: build Belkin F7D images
  brcm47xx/lzmaloader: add Belkin F7D support
  brcm47xx/mtd-partition: recognize Belkin F7D TRX headers
  brcm47xx: fix netconfig for inverted vlan?ports in nvram
  mtd: recognize belkin trx magic
  brcm47xx/upgrade: add workarounds for Belkin .trx headers

 package/kernel/broadcom-diag/src/diag.c| 31 +--
 package/system/mtd/src/trx.c   | 27 --
 .../linux/brcm47xx/base-files/etc/init.d/netconfig |  6 ++-
 .../brcm47xx/base-files/lib/upgrade/platform.sh| 62 --
 target/linux/brcm47xx/image/Makefile   | 24 +
 .../brcm47xx/image/lzma-loader/src/decompress.c| 25 -
 ...PS-BCM47XX-fix-detection-of-some-boards-2.patch | 37 +
 .../077-MIPS-BCM47XX-mtd-partition-belkin.patch| 42 +++
 8 files changed, 239 insertions(+), 15 deletions(-)
 create mode 100644 
target/linux/brcm47xx/patches-3.10/076-MIPS-BCM47XX-fix-detection-of-some-boards-2.patch
 create mode 100644 
target/linux/brcm47xx/patches-3.10/077-MIPS-BCM47XX-mtd-partition-belkin.patch

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


[OpenWrt-Devel] [PATCH 2/8] linux/brcm47xx : Belkin F7Dx30x board detection

2013-11-10 Thread Cody P Schafer
boardnum is unstable, so allow using NULL to make it unchecked.

A method for differentiating F7D3301 from F7D3302 using nvram is
unknown at this point. Reading the first 32bits of magic from the
linux mtd partition would do the trick, but these 2 are similar
enough that we don't need separate led/button definitions. Not knowing
which one you have is only a usability issue for upgrading the device:
they expect different magic numbers for their trx images.

Signed-off-by: Cody P Schafer de...@codyps.com
---
 ...PS-BCM47XX-fix-detection-of-some-boards-2.patch | 37 ++
 1 file changed, 37 insertions(+)
 create mode 100644 
target/linux/brcm47xx/patches-3.10/076-MIPS-BCM47XX-fix-detection-of-some-boards-2.patch

diff --git 
a/target/linux/brcm47xx/patches-3.10/076-MIPS-BCM47XX-fix-detection-of-some-boards-2.patch
 
b/target/linux/brcm47xx/patches-3.10/076-MIPS-BCM47XX-fix-detection-of-some-boards-2.patch
new file mode 100644
index 000..21eda18
--- /dev/null
+++ 
b/target/linux/brcm47xx/patches-3.10/076-MIPS-BCM47XX-fix-detection-of-some-boards-2.patch
@@ -0,0 +1,37 @@
+Index: linux-3.10.18/arch/mips/bcm47xx/board.c
+===
+--- linux-3.10.18.orig/arch/mips/bcm47xx/board.c
 linux-3.10.18/arch/mips/bcm47xx/board.c
+@@ -180,6 +180,7 @@ struct bcm47xx_board_type_list3 bcm47xx_
+   {{BCM47XX_BOARD_ZTE_H218N, ZTE H218N}, 0x053d, 1234, 0x1305},
+   {{BCM47XX_BOARD_NETGEAR_WNR3500L, Netgear WNR3500L}, 0x04CF, 
3500, 02},
+   {{BCM47XX_BOARD_LINKSYS_WRT54GSV1, Linksys WRT54GS V1}, 0x0101, 
42, 0x10},
++  {{BCM47XX_BOARD_BELKIN_F7D330X, Belkin F7D330X}, 0xa4cf, NULL, 
0x1102 },
+   { {0}, 0},
+ };
+ 
+@@ -270,9 +271,9 @@ static __init const struct bcm47xx_board
+   bcm47xx_nvram_getenv(boardnum, buf2, sizeof(buf2)) = 0 
+   bcm47xx_nvram_getenv(boardrev, buf3, sizeof(buf3)) = 0) {
+   for (e3 = bcm47xx_board_list_board; e3-value1; e3++) {
+-  if (!strcmp(buf1, e3-value1) 
+-  !strcmp(buf2, e3-value2) 
+-  !strcmp(buf3, e3-value3))
++  if ((!e3-value1 || !strcmp(buf1, e3-value1)) 
++  (!e3-value2 || !strcmp(buf2, e3-value2)) 
++  (!e3-value3 || !strcmp(buf3, e3-value3)))
+   return e3-board;
+   }
+   }
+Index: linux-3.10.18/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
+===
+--- linux-3.10.18.orig/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
 linux-3.10.18/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
+@@ -28,6 +28,7 @@ enum bcm47xx_board {
+   BCM47XX_BOARD_ASUS_WLHDD,
+ 
+   BCM47XX_BOARD_BELKIN_F7D4301,
++  BCM47XX_BOARD_BELKIN_F7D330X,
+ 
+   BCM47XX_BOARD_BUFFALO_WBR2_G54,
+   BCM47XX_BOARD_BUFFALO_WHR2_A54G54,
-- 
1.8.4.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/8] broadcom-diag: add Belkin F7D3302/F7D7302

2013-11-10 Thread Cody P Schafer
Signed-off-by: Cody P Schafer de...@codyps.com
---
 package/kernel/broadcom-diag/src/diag.c | 31 ---
 1 file changed, 28 insertions(+), 3 deletions(-)

diff --git a/package/kernel/broadcom-diag/src/diag.c 
b/package/kernel/broadcom-diag/src/diag.c
index e11141e..fccc219 100644
--- a/package/kernel/broadcom-diag/src/diag.c
+++ b/package/kernel/broadcom-diag/src/diag.c
@@ -145,6 +145,7 @@ enum {
 
/* Belkin */
BELKIN_UNKNOWN,
+   BELKIN_F7D330X, /* covers F7D7302,F7D3302,F7D3301, and F7D7301 */
BELKIN_F7D4301,
 
/* Netgear */
@@ -966,6 +967,26 @@ static struct platform_t __initdata platforms[] = {
{ .name = connected,  .gpio = 1  0, .polarity = 
NORMAL },
},
},
+   [BELKIN_F7D330X] = {
+   .name   = Belkin F7D330X,
+   .buttons= {
+   { .name = reset,  .gpio = 1  6 },
+   { .name = wps,.gpio = 1  8 },
+   },
+   .leds   = {
+   /* green */
+   { .name = power,  .gpio = 1  10, .polarity = 
REVERSE },
+   /* orange power */
+   { .name = warn,   .gpio = 1  11, .polarity = 
REVERSE },
+   /* green */
+   { .name = wps,.gpio = 1  12, .polarity = 
REVERSE },
+   /* orange wps */
+   { .name = wlan,   .gpio = 1  13, .polarity = 
REVERSE },
+   { .name = usb0,   .gpio = 1  14, .polarity = 
REVERSE },
+   /* shipped unconnected in the F7D3302 */
+   { .name = usb1,   .gpio = 1  15, .polarity = 
REVERSE },
+   },
+   },
[BELKIN_F7D4301] = {
.name   = Belkin PlayMax F7D4301,
.buttons= {
@@ -973,10 +994,12 @@ static struct platform_t __initdata platforms[] = {
{ .name = wps,.gpio = 1  8 },
},
.leds   = {
-   { .name = power,  .gpio = 1  11, .polarity = 
REVERSE },
+   { .name = power,  .gpio = 1  10, .polarity = 
REVERSE },
+   { .name = warn,   .gpio = 1  11, .polarity = 
REVERSE },
+   { .name = wps,.gpio = 1  12, .polarity = 
REVERSE },
{ .name = wlan,   .gpio = 1  13, .polarity = 
REVERSE },
-   { .name = led0,   .gpio = 1  14, .polarity = 
REVERSE },
-   { .name = led1,   .gpio = 1  15, .polarity = 
REVERSE },
+   { .name = usb0,   .gpio = 1  14, .polarity = 
REVERSE },
+   { .name = usb1,   .gpio = 1  15, .polarity = 
REVERSE },
},
},
/* Netgear */
@@ -1378,6 +1401,8 @@ static struct platform_t __init *platform_detect(void)
return platforms[WLHDD];
case BCM47XX_BOARD_BELKIN_F7D4301:
return platforms[BELKIN_F7D4301];
+   case BCM47XX_BOARD_BELKIN_F7D330X:
+   return platforms[BELKIN_F7D330X];
case BCM47XX_BOARD_BUFFALO_WBR2_G54:
return platforms[WBR2_G54];
case BCM47XX_BOARD_BUFFALO_WHR2_A54G54:
-- 
1.8.4.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 3/8] brcm47xx/image: build Belkin F7DXXXX images

2013-11-10 Thread Cody P Schafer
F7D3302/F7D7302, F7D3301/F7D7301, and F7D4301

Signed-off-by: Cody P Schafer de...@codyps.com
---
 target/linux/brcm47xx/image/Makefile | 24 
 1 file changed, 24 insertions(+)

diff --git a/target/linux/brcm47xx/image/Makefile 
b/target/linux/brcm47xx/image/Makefile
index eca09a8..43403a2 100644
--- a/target/linux/brcm47xx/image/Makefile
+++ b/target/linux/brcm47xx/image/Makefile
@@ -60,6 +60,24 @@ define Image/Build/Edi
$(STAGING_DIR_HOST)/bin/trx2edips $(BIN_DIR)/$(IMG_PREFIX)-$(1).trx 
$(BIN_DIR)/openwrt-$(2)-$(3).bin
 endef
 
+
+# 1: trx input
+# 2: bin output
+# 3: 4 magic bytes
+define Image/Build/Belkin_
+   echo -ne $(3)  $(2).head
+   dd if=$(1) of=/dev/stdout bs=4 skip=1  $(2).tail
+   cat $(2).head $(2).tail  $(2)
+   rm -f $(2).head $(2).tail
+endef
+
+# $(1) : fs type (squashfs)
+# $(2) : device name
+# $(3) : encoded printf string to use in place of the trx's HDR\0
+define Image/Build/Belkin
+   $(call 
Image/Build/Belkin_,$(BIN_DIR)/$(IMG_PREFIX)-$(1).trx,$(BIN_DIR)/openwrt-$(2)-$(patsubst
 jffs2-%,jffs2,$(1)).bin,$(3))
+endef
+
 define Image/Build/Huawei
dd if=/dev/zero of=$(BIN_DIR)/openwrt-$(2)-$(3)-gz.bin bs=92 count=1
echo -ne 'HDR0\x08\x00\x00\x00'  $(BIN_DIR)/openwrt-$(2)-$(3)-gz.bin
@@ -118,10 +136,16 @@ define Image/Build/jffs2-64k
$(call Image/Build/CyberTAN,$(1),e3000_v1,61XN,1.0.3,$(patsubst 
jffs2-%,jffs2,$(1)))
$(call Image/Build/CyberTAN,$(1),e3200_v1,3200,1.0.1,$(patsubst 
jffs2-%,jffs2,$(1)))
$(call Image/Build/CyberTAN,$(1),e4200_v1,4200,1.0.5,$(patsubst 
jffs2-%,jffs2,$(1)))
+
$(call Image/Build/Motorola,$(1),wa840g,2,$(patsubst 
jffs2-%,jffs2,$(1)))
$(call Image/Build/Motorola,$(1),we800g,3,$(patsubst 
jffs2-%,jffs2,$(1)))
$(call Image/Build/Edi,$(1),ps1208mfg,$(patsubst jffs2-%,jffs2,$(1)))
$(call Image/Build/dwl3150,$(1),$(patsubst jffs2-%,jffs2,$(1)))
+
+   $(call Image/Build/Belkin,$(1),f7d-qa,'\x78\x56\x34\x12')
+   $(call Image/Build/Belkin,$(1),f7d3301,'\x22\x03\x10\x20')
+   $(call Image/Build/Belkin,$(1),f7d3302,'\x28\x09\x09\x20')
+   $(call Image/Build/Belkin,$(1),f7d4302,'\x06\x10\x10\x20')
 endef
 
 define Image/Build/squashfs
-- 
1.8.4.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 7/8] mtd: recognize belkin trx magic

2013-11-10 Thread Cody P Schafer
Signed-off-by: Cody P Schafer de...@codyps.com
---
 package/system/mtd/src/trx.c | 27 ---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/package/system/mtd/src/trx.c b/package/system/mtd/src/trx.c
index 65c2440..8d85aaf 100644
--- a/package/system/mtd/src/trx.c
+++ b/package/system/mtd/src/trx.c
@@ -22,6 +22,7 @@
 #include stdio.h
 #include stdlib.h
 #include stddef.h
+#include stdbool.h
 #include unistd.h
 #include fcntl.h
 #include sys/mman.h
@@ -35,6 +36,11 @@
 #include crc32.h
 
 #define TRX_MAGIC   0x30524448  /* HDR0 */
+#define BELKIN_F7D3301_MAGIC   0x20100322 /* a date of some sort */
+#define BELKIN_F7D3302_MAGIC   0x20090928
+#define BELKIN_F7D4302_MAGIC   0x20101006
+#define BELKIN_F7D_QA_MAGIC0x12345678
+
 struct trx_header {
uint32_t magic; /* HDR0 */
uint32_t len;   /* Length of file including header */
@@ -54,6 +60,21 @@ struct trx_header {
 ssize_t pread(int fd, void *buf, size_t count, off_t offset);
 ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
 
+static bool is_trx_magic(uint32_t magic)
+{
+   magic = STORE32_LE(magic);
+   switch (magic) {
+   case TRX_MAGIC:
+   case BELKIN_F7D3301_MAGIC:
+   case BELKIN_F7D3302_MAGIC:
+   case BELKIN_F7D4302_MAGIC:
+   case BELKIN_F7D_QA_MAGIC:
+   return true;
+   default:
+   return false;
+   }
+}
+
 int
 trx_fixup(int fd, const char *name)
 {
@@ -82,7 +103,7 @@ trx_fixup(int fd, const char *name)
}
 
trx = ptr;
-   if (trx-magic != TRX_MAGIC) {
+   if (!is_trx_magic(trx-magic)) {
fprintf(stderr, TRX header not found\n);
goto err;
}
@@ -116,7 +137,7 @@ trx_check(int imagefd, const char *mtd, char *buf, int *len)
return 0;
}
 
-   if (trx-magic != TRX_MAGIC || trx-len  sizeof(struct trx_header)) {
+   if (!is_trx_magic(trx-magic) || trx-len  sizeof(struct trx_header)) {
if (quiet  2) {
fprintf(stderr, Bad trx header\n);
fprintf(stderr, This is not the correct file format; 
refusing to flash.\n
@@ -181,7 +202,7 @@ mtd_fixtrx(const char *mtd, size_t offset)
}
 
trx = (struct trx_header *) (buf + offset);
-   if (trx-magic != STORE32_LE(0x30524448)) {
+   if (!is_trx_magic(trx-magic)) {
fprintf(stderr, No trx magic found\n);
exit(1);
}
-- 
1.8.4.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 8/8] brcm47xx/upgrade: add workarounds for Belkin .trx headers

2013-11-10 Thread Cody P Schafer
Signed-off-by: Cody P Schafer de...@codyps.com
---
 .../brcm47xx/base-files/lib/upgrade/platform.sh| 62 --
 1 file changed, 57 insertions(+), 5 deletions(-)

diff --git a/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh 
b/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh
index 9921cf5..5aad6c0 100644
--- a/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh
@@ -1,14 +1,66 @@
 PART_NAME=linux
 
+get_fw_mtd () {
+   grep \$PART_NAME\  /proc/mtd | cut -d':' -f1
+}
+
+get_current_magic_long () {
+   dd bs=4 count=1 2/dev/null  /dev/$(get_fw_mtd) | hexdump -v -n 4 -e 
'1/1 %02x'
+}
+
 platform_check_image() {
[ $ARGC -gt 1 ]  return 1
 
-   case $(get_magic_word $1) in
-   # .trx files
-   4844) return 0;;
-   *)
-   echo Invalid image type. Please use only .trx files
+   magic=$(get_magic_long $1)
+   # For Belkin support, check on magic in current image.
+   cmagic=$(get_current_magic_long)
+
+   case $cmagic in
+   48445230) # HDR0
+   case $magic in
+   # .trx files
+   48445230) return 0;;
+   *)
+   echo Invalid image type. Please use only .trx 
files
+   return 1
+   ;;
+   esac
+   ;;
+   22031020) # F7D3301
+   if [ $magic = 22031020 ] || [ $magic = 78563412 ]; then
+   return 0
+   else
+   echo Invalid image for this router.
+   echo Either f7d3301 or f7d-qa .bin files required.
+   return 1
+   fi
+   ;;
+   28090920) # F7D3302
+   if [ $magic = 28090920 ] || [ $magic = 78563412 ]; then
+   return 0
+   else
+   echo Invalid image for this router.
+   echo Either f7d3302 or f7d-qa .bin files required.
+   return 1
+   fi
+   ;;
+   06101020) # F7D4302
+   if [ $magic = 06101020 ] || [ $magic = 78563412 ]; then
+   return 0
+   else
+   echo Invalid image for this router.
+   echo Either f7d4302 or f7d-qa .bin files required.
+   return 1
+   fi
+   ;;
+   78563412) # Belkin F7Dx30x QA Firmware
+   if [ $magic = 78563412 ] ; then
+   return 0
+   else
+   echo Potentially invalid image for this router.
+   echo Please use a f7d-qa .bin file (or force)
return 1
+   fi
;;
esac
 }
-- 
1.8.4.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 5/8] brcm47xx/mtd-partition: recognize Belkin F7DXXXX TRX headers

2013-11-10 Thread Cody P Schafer
F7D3301/F7D7301, F7D3302/F7D7302, and F7D4301 replace the HDR0 with a
custom byte sequence (which appears to be a date). Also, they all
appear to support a single QA byte sequence. Add all of these to the
partition detection.

Signed-off-by: Cody P Schafer de...@codyps.com
---
 .../077-MIPS-BCM47XX-mtd-partition-belkin.patch| 42 ++
 1 file changed, 42 insertions(+)
 create mode 100644 
target/linux/brcm47xx/patches-3.10/077-MIPS-BCM47XX-mtd-partition-belkin.patch

diff --git 
a/target/linux/brcm47xx/patches-3.10/077-MIPS-BCM47XX-mtd-partition-belkin.patch
 
b/target/linux/brcm47xx/patches-3.10/077-MIPS-BCM47XX-mtd-partition-belkin.patch
new file mode 100644
index 000..18c3117
--- /dev/null
+++ 
b/target/linux/brcm47xx/patches-3.10/077-MIPS-BCM47XX-mtd-partition-belkin.patch
@@ -0,0 +1,42 @@
+Index: linux-3.10.17/drivers/mtd/bcm47xxpart.c
+===
+--- linux-3.10.17.orig/drivers/mtd/bcm47xxpart.c
 linux-3.10.17/drivers/mtd/bcm47xxpart.c
+@@ -33,7 +33,11 @@
+ #define POT_MAGIC20x504f  /* OP */
+ #define ML_MAGIC1 0x39685a42
+ #define ML_MAGIC2 0x26594131
+-#define TRX_MAGIC 0x30524448
++#define TRX_MAGIC 0x30524448  /* HDR0 */
++#define BELKIN_F7D3301_MAGIC  0x20100322
++#define BELKIN_F7D3302_MAGIC  0x20090928
++#define BELKIN_F7D4302_MAGIC  0x20101006
++#define BELKIN_F7D_QA_MAGIC   0x12345678
+ #define SQSH_MAGIC0x71736873  /* shsq */
+ 
+ struct trx_header {
+@@ -45,6 +48,15 @@ struct trx_header {
+   uint32_t offset[3];
+ } __packed;
+ 
++static bool is_trx_magic(uint32_t magic)
++{
++  return (magic == TRX_MAGIC) ||
++   (magic == BELKIN_F7D_QA_MAGIC) ||
++  (magic == BELKIN_F7D3301_MAGIC) ||
++  (magic == BELKIN_F7D3302_MAGIC) ||
++  (magic == BELKIN_F7D4302_MAGIC);
++}
++
+ static void bcm47xxpart_add_part(struct mtd_partition *part, char *name,
+u64 offset, uint32_t mask_flags)
+ {
+@@ -139,7 +150,7 @@ static int bcm47xxpart_parse(struct mtd_
+   }
+ 
+   /* TRX */
+-  if (buf[0x000 / 4] == TRX_MAGIC) {
++  if (is_trx_magic(buf[0x000 / 4])) {
+   trx = (struct trx_header *)buf;
+ 
+   trx_part = curr_part;
-- 
1.8.4.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] quilt: avoid copying backup files.

2013-11-10 Thread Cody P Schafer
Signed-off-by: Cody P Schafer de...@codyps.com
---
 include/quilt.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/quilt.mk b/include/quilt.mk
index 925b7a7..e256489 100644
--- a/include/quilt.mk
+++ b/include/quilt.mk
@@ -22,7 +22,7 @@ endif
 QUILT_CMD:=quilt --quiltrc=-
 
 define filter_series
-sed -e s,\\\#.*,, $(1) | grep -E \[a-zA-Z0-9\]
+sed -e s,\\\#.*,, $(1) | grep -E \[a-zA-Z0-9\] | grep -v '^.*~'
 endef
 
 define PatchDir/Quilt
@@ -31,7 +31,7 @@ define PatchDir/Quilt
mkdir -p $(1)/patches/$(3); \
cp $(2)/series $(1)/patches/$(3); \
fi
-   @for patch in ( (cd $(2)  if [ -f series ]; then $(call 
filter_series,series); else ls | sort; fi; ) 2/dev/null ); do ( \
+   @for patch in ( (cd $(2)  if [ -f series ]; then $(call 
filter_series,series); else ls | sort | grep -v '^.*~'; fi; ) 2/dev/null 
); do ( \
cp $(2)/patch $(1)/patches/$(3); \
echo $(3)patch  $(1)/patches/series; \
); done
-- 
1.8.4.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 6/8] brcm47xx: fix netconfig for inverted vlan?ports in nvram

2013-11-10 Thread Cody P Schafer
This was observed on the Belkin Share F7D7302.

Signed-off-by: Cody P Schafer de...@codyps.com
---
 target/linux/brcm47xx/base-files/etc/init.d/netconfig | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/target/linux/brcm47xx/base-files/etc/init.d/netconfig 
b/target/linux/brcm47xx/base-files/etc/init.d/netconfig
index 1bf9487..d0ce9d3 100755
--- a/target/linux/brcm47xx/base-files/etc/init.d/netconfig
+++ b/target/linux/brcm47xx/base-files/etc/init.d/netconfig
@@ -93,12 +93,14 @@ start() {
 
END {
if (((nvram[vlan0ports] ~ /^0 1 2 3 8/ )  
(nvram[vlan1ports] ~ /^4 8/  (cpuport == 8))) || \
-   ((nvram[vlan1ports] ~ /^0 1 2 3 8/ )  
(nvram[vlan2ports] ~ /^4 8/  (cpuport == 8 {
+   ((nvram[vlan1ports] ~ /^0 1 2 3 8/ )  
(nvram[vlan2ports] ~ /^4 8/  (cpuport == 8))) || \
+   ((nvram[vlan2ports] ~ /^0 1 2 3 8/ )  
(nvram[vlan1ports] ~ /^4 8/  (cpuport == 8 {
c[vlan1ports] = 0 1 2 3 8t
c[vlan2ports] = 4 8t
}
if (((nvram[vlan0ports] ~ /^0 1 2 3 5/ )  
(nvram[vlan1ports] ~ /^4 5/  (cpuport == 5))) || \
-   ((nvram[vlan1ports] ~ /^0 1 2 3 5/ )  
(nvram[vlan2ports] ~ /^4 5/  (cpuport == 5 {
+   ((nvram[vlan1ports] ~ /^0 1 2 3 5/ )  
(nvram[vlan2ports] ~ /^4 5/  (cpuport == 5))) || \
+   ((nvram[vlan2ports] ~ /^0 1 2 3 5/ )  
(nvram[vlan1ports] ~ /^4 5/  (cpuport == 5 {
c[vlan1ports] = 0 1 2 3 5t
c[vlan2ports] = 4 5t
}
-- 
1.8.4.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] Commandline Hack and Command line marker not found

2013-11-10 Thread Drasko DRASKOVIC
Hi all,
Can somebody explain what is OpenWRT Command Line Hack option in
kernel menuconfig?

Following the instructions here:
https://github.com/8devices/u-boot/issues/3#issuecomment-28056612 I
have disabled CONFIG_IMAGE_CMDLINE_HACK.

Now I am getting error: Command line marker not found!

I have noticed that patch-cmdline is called, and this probokes error
when CONFIG_IMAGE_CMDLINE_HACK is disbled:
/home/drasko/carambola2/staging_dir/host/bin/patch-cmdline
/home/drasko/carambola2/build_dir/target-mips_r2_uClibc-0.9.33.2/linux-ar71xx_generic/tmp/vmlinux-carambola2
board=CARAMBOLA2 console=ttyATH0,115200
mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,2048k(kernel),13888k(rootfs),64k(nvram),64k(art)ro,15936k@0x5(firmware)

Can anybody explain why is this happening and how to fix this?

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


[OpenWrt-Devel] [PATCH 0/18, v2] broadcom-wl: improvements for newer devices

2013-11-10 Thread Nathan Hintz
The goal of this patch set is to provide improved support for newer devices
supported by the proprietary broadcom-wl driver.  This includes some general
cleanup items, bug fixes, and some enhancements.  I've tried to keep the
individual patches small and focused on a single topic.

Testing was limited to devices I have available to me (WRT54GS v1.1 and E3000).

I have not been able to get encrypted WDS working with the existing 
mechanization
in /etc/hotplug.d/net/20-broadcom-wds (nas4not); but I have gotten it to work by
eliminating the use of the hotplug script and setting up the WDS interfaces
directly in /lib/wifi/broadcom.sh (specifying them on the 'nas' command line).
This change is not included in this patch set; but I would clean it up and
submit it, assuming this patch set is accepted (perhaps w/ modifications), if
the WDS experience is still the same for others and there were no fundamental
objections to the approach.

Nathan

---

v2 - Incorporated Jow's comment to rename the interfaces (wl0, wl0-1, wl0-2..., 
and
 wds0-1, wds0-2...).
 Added an error check when attempting to read 'bssmax'.
 The rest are just along for the ride.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 4/18, v2] broadcom-wl: update description for recently added

2013-11-10 Thread Nathan Hintz
Update descriptions for 'phytype' and 'band'.

Signed-off-by: Nathan Hintz nlhi...@hotmail.com
---
 package/kernel/broadcom-wl/src/wlc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/kernel/broadcom-wl/src/wlc.c 
b/package/kernel/broadcom-wl/src/wlc.c
index 7e638e5..7b21ea0 100644
--- a/package/kernel/broadcom-wl/src/wlc.c
+++ b/package/kernel/broadcom-wl/src/wlc.c
@@ -917,7 +917,7 @@ static const struct wlc_call wlc_calls[] = {
.param = INT,
.data.num = (WLC_GET_PHYTYPE  16),
.handler = wlc_ioctl,
-   .desc = PHY Type
+   .desc = PHY Type (read-only)
},
{
.name = nmode,
@@ -945,7 +945,7 @@ static const struct wlc_call wlc_calls[] = {
.param = INT,
.data.num = ((WLC_GET_BAND  16) | WLC_SET_BAND),
.handler = wlc_ioctl,
-   .desc = Band
+   .desc = Band (0=auto, 1=5Ghz, 2=2.4GHz)
},
 };
 #define wlc_calls_size (sizeof(wlc_calls) / sizeof(struct wlc_call))
-- 
1.8.3.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/18, v2] broadcom-wl: change interface names

2013-11-10 Thread Nathan Hintz
'netifd' treats all devices with a . in their name as vlan devices.
Modify the name of virtual/WDS interfaces created by broadcom-wl to use
a - instead of a ., so they will be treated as simple devices
by 'netifd'.

Signed-off-by: Nathan Hintz nlhi...@hotmail.com
---

v2 - Incorporated Jow's comment to rename the interfaces (wl0, wl0-1, wl0-2..., 
and
 wds0-1, wds0-2...).

 .../broadcom-wl/files/etc/hotplug.d/net/20-broadcom_wds   |  2 +-
 package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh |  4 ++--
 package/kernel/broadcom-wl/patches/013-interface-name.patch   | 11 +++
 3 files changed, 14 insertions(+), 3 deletions(-)
 create mode 100644 package/kernel/broadcom-wl/patches/013-interface-name.patch

diff --git a/package/kernel/broadcom-wl/files/etc/hotplug.d/net/20-broadcom_wds 
b/package/kernel/broadcom-wl/files/etc/hotplug.d/net/20-broadcom_wds
index 0a563c2..4e56d21 100644
--- a/package/kernel/broadcom-wl/files/etc/hotplug.d/net/20-broadcom_wds
+++ b/package/kernel/broadcom-wl/files/etc/hotplug.d/net/20-broadcom_wds
@@ -56,6 +56,6 @@ setup_broadcom_wds() {
 
 case $ACTION in
add|register)
-   [ ${INTERFACE%%0.*} = wds ]  setup_broadcom_wds $INTERFACE
+   [ ${INTERFACE%%0-*} = wds ]  setup_broadcom_wds $INTERFACE
;;
 esac
diff --git a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh 
b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
index 4d81bcb..506b077 100644
--- a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
+++ b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
@@ -45,7 +45,7 @@ scan_broadcom() {
 
local _c=
for vif in ${adhoc_if:-$sta_if $ap_if $mon_if}; do
-   config_set $vif ifname ${device}${_c:+.$_c}
+   config_set $vif ifname ${device}${_c:+-$_c}
_c=$((${_c:-0} + 1))
done
config_set $device vifs ${adhoc_if:-$sta_if $ap_if $mon_if}
@@ -102,7 +102,7 @@ disable_broadcom() {
include /lib/network
 
# make sure the interfaces are down and removed from all bridges
-   for dev in $device ${device}.1 ${device}.2 ${device}.3; do
+   for dev in $device ${device}-1 ${device}-2 ${device}-3; do
ifconfig $dev down 2/dev/null /dev/null  {
unbridge $dev
}
diff --git a/package/kernel/broadcom-wl/patches/013-interface-name.patch 
b/package/kernel/broadcom-wl/patches/013-interface-name.patch
new file mode 100644
index 000..3a136de
--- /dev/null
+++ b/package/kernel/broadcom-wl/patches/013-interface-name.patch
@@ -0,0 +1,11 @@
+--- a/driver/wl_linux.c
 b/driver/wl_linux.c
+@@ -1556,7 +1556,7 @@ wl_add_if(wl_info_t *wl, struct wlc_if*
+ 
+   wl_if_setup(wlif-dev);
+ 
+-  sprintf(wlif-dev-name, %s%d.%d, devname, wl-pub-unit, 
wlif-subunit);
++  sprintf(wlif-dev-name, %s%d-%d, devname, wl-pub-unit, 
wlif-subunit);
+   if (remote)
+   bcopy(remote, wlif-remote, ETHER_ADDR_LEN);
+ 
-- 
1.8.3.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 7/18, v2] broadcom-wl: shutdown 'nas' when 'wl' device is disabled

2013-11-10 Thread Nathan Hintz
'nas' must be shutdown independently for each 'wl' device to properly
support devices with multiple radios.  Do the shutdown when the device
is disabled instead of when it is brought up.

Signed-off-by: Nathan Hintz nlhi...@hotmail.com
---

v2 - Incorporated Jow's comment to rename the interfaces (wl0, wl0-1, wl0-2..., 
and
 wds0-1, wds0-2...).

 package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh 
b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
index 80cd9d5..191092a 100644
--- a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
+++ b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
@@ -101,6 +101,9 @@ disable_broadcom() {
(
include /lib/network
 
+   local pid_file=/var/run/nas.$device.pid
+   [ -e $pid_file ]  start-stop-daemon -K -q -s SIGKILL -p 
$pid_file  rm $pid_file
+
# make sure the interfaces are down and removed from all bridges
for dev in $device ${device}-1 ${device}-2 ${device}-3; do
ifconfig $dev down 2/dev/null /dev/null  {
@@ -346,7 +349,6 @@ enable_broadcom() {
}
_c=$(($_c + 1))
done
-   killall -KILL nas - 2-
wlc ifname $device stdin EOF
 $ifdown
 
-- 
1.8.3.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 3/18, v2] broadcom-wl: fix band reporting

2013-11-10 Thread Nathan Hintz
Modify the band reporting for broadcom devices to correctly report
HW capability.  Currently, 802.11na devices report bgn; but should be
reporting an.

Signed-off-by: Nathan Hintz nlhi...@hotmail.com
---
 .../patches/014-fix-band-reporting.patch   | 41 ++
 1 file changed, 41 insertions(+)
 create mode 100644 
package/kernel/broadcom-wl/patches/014-fix-band-reporting.patch

diff --git a/package/kernel/broadcom-wl/patches/014-fix-band-reporting.patch 
b/package/kernel/broadcom-wl/patches/014-fix-band-reporting.patch
new file mode 100644
index 000..f1305a4
--- /dev/null
+++ b/package/kernel/broadcom-wl/patches/014-fix-band-reporting.patch
@@ -0,0 +1,41 @@
+--- a/driver/wl_iw.c
 b/driver/wl_iw.c
+@@ -314,7 +314,7 @@
+ )
+ {
+   int phytype, err;
+-  uint band[3];
++  uint i, band[3], bands;
+   char cap[5];
+ 
+   WL_TRACE((%s: SIOCGIWNAME\n, dev-name));
+@@ -335,16 +335,20 @@
+   break;
+   case WLC_PHY_TYPE_LP:
+   case WLC_PHY_TYPE_G:
+-  if (band[0] = 2)
+-  strcpy(cap, abg);
+-  else
+-  strcpy(cap, bg);
+-  break;
+   case WLC_PHY_TYPE_N:
+-  if (band[0] = 2)
+-  strcpy(cap, abgn);
+-  else
+-  strcpy(cap, bgn);
++  bands = 0;
++  for (i = 1; i = band[0]; i++) {
++  bands |= dtoh32(band[i]);
++  }
++  strcpy(cap, );
++  if (bands  WLC_BAND_5G)
++  strcat(cap, a);
++  if (bands  WLC_BAND_2G)
++  strcat(cap, bg);
++  if (phytype == WLC_PHY_TYPE_N)
++  strcat(cap, n);
++  break;
++  default:
+   break;
+   }
+ done:
-- 
1.8.3.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/18, v2] broadcom-wl: fix compiler warning

2013-11-10 Thread Nathan Hintz
Delete the return value (nvram_exit is declared with a 'void' return).

Signed-off-by: Nathan Hintz nlhi...@hotmail.com
---
 package/kernel/broadcom-wl/patches/100-fix_nvram_two_devices.patch | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/kernel/broadcom-wl/patches/100-fix_nvram_two_devices.patch 
b/package/kernel/broadcom-wl/patches/100-fix_nvram_two_devices.patch
index 5650862..6cf6fae 100644
--- a/package/kernel/broadcom-wl/patches/100-fix_nvram_two_devices.patch
+++ b/package/kernel/broadcom-wl/patches/100-fix_nvram_two_devices.patch
@@ -25,7 +25,7 @@
  
 +  nvram_init_done--;
 +  if (nvram_init_done != 0)
-+  return 0;
++  return;
 +
sih = (si_t *)si;
this = vars;
-- 
1.8.3.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 5/18, v2] broadcom-wl: fix whitespace handling

2013-11-10 Thread Nathan Hintz
Signed-off-by: Nathan Hintz nlhi...@hotmail.com
---
 package/kernel/broadcom-wl/src/wlc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/kernel/broadcom-wl/src/wlc.c 
b/package/kernel/broadcom-wl/src/wlc.c
index 7b21ea0..9f4abc0 100644
--- a/package/kernel/broadcom-wl/src/wlc.c
+++ b/package/kernel/broadcom-wl/src/wlc.c
@@ -1104,14 +1104,14 @@ int main(int argc, char **argv)
if (!*s)
continue;

-   if ((s2 = strchr(buf, ' ')) != NULL)
+   if ((s2 = strchr(s, ' ')) != NULL)
*(s2++) = 0;

while (s2  isspace(*s2))
s2++;

-   if ((call = find_cmd(buf)) == NULL) {
-   fprintf(stderr, Invalid command: %s\n, buf);
+   if ((call = find_cmd(s)) == NULL) {
+   fprintf(stderr, Invalid command: %s\n, s);
ret = -1;
} else
ret = do_command(call, ((call-param  NOARG) ? NULL : 
s2));
-- 
1.8.3.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 10/18, v2] broadcom-wl: eliminate 'invalid command' when setting ssid

2013-11-10 Thread Nathan Hintz
Signed-off-by: Nathan Hintz nlhi...@hotmail.com
---
 package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh 
b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
index 17fa80f..0dd25a3 100644
--- a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
+++ b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
@@ -319,8 +319,7 @@ enable_broadcom() {
local ssid
config_get ssid $vif ssid
append vif_post_up vlan_mode 0 $N
-   append vif_post_up ssid $ssid $N
-   append vif_do_up ssid $ssid $N
+   append vif_pre_up ssid $ssid $N
 
[ $mode = monitor ]  {
append vif_post_up monitor $monitor $N
-- 
1.8.3.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 6/18, v2] broadcom-wl: use a single instance of 'nas' per 'wl' device

2013-11-10 Thread Nathan Hintz
A single instance of 'nas' can support multiple interfaces; there's
no need to run multiple instances.

Signed-off-by: Nathan Hintz nlhi...@hotmail.com
---
 package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh 
b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
index 506b077..80cd9d5 100644
--- a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
+++ b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
@@ -334,13 +334,15 @@ enable_broadcom() {
append if_up set_wifi_up '$vif' '$ifname' ;$N
append if_up start_net '$ifname' '$net_cfg' ;$N
}
-   [ -z $nasopts ] || {
+   [ -z $nas -o -z $nasopts ] || {
eval ${vif}_ssid=\\$ssid\
nas_mode=-A
[ $mode = sta ]  nas_mode=-S
-   [ -z $nas ] || {
-   
nas_cmd=${nas_cmd:+$nas_cmd$N}start-stop-daemon -S -b -p 
/var/run/nas.$ifname.pid -x $nas -- -P /var/run/nas.$ifname.pid -H 34954 -i 
$ifname $nas_mode -m $auth -w $wsec -s \\$${vif}_ssid\ -g 3600 -F $nasopts
+   [ -z $nas_cmd ]  {
+   local pid_file=/var/run/nas.$device.pid
+   nas_cmd=start-stop-daemon -S -b -p $pid_file 
-x $nas -- -P $pid_file -H 34954
}
+   append nas_cmd -i $ifname $nas_mode -m $auth -w $wsec 
-s \\$${vif}_ssid\ -g 3600 -F $nasopts
}
_c=$(($_c + 1))
done
-- 
1.8.3.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 16/18, v2] broadcom-wl: support probe of 'wds' devices

2013-11-10 Thread Nathan Hintz
'nas' requires probe of 'wds' devices to be successful;
so don't fail them.

Signed-off-by: Nathan Hintz nlhi...@hotmail.com
---
 .../patches/015-support-probe-of-wds-interfaces.patch | 11 +++
 1 file changed, 11 insertions(+)
 create mode 100644 
package/kernel/broadcom-wl/patches/015-support-probe-of-wds-interfaces.patch

diff --git 
a/package/kernel/broadcom-wl/patches/015-support-probe-of-wds-interfaces.patch 
b/package/kernel/broadcom-wl/patches/015-support-probe-of-wds-interfaces.patch
new file mode 100644
index 000..f44921a
--- /dev/null
+++ 
b/package/kernel/broadcom-wl/patches/015-support-probe-of-wds-interfaces.patch
@@ -0,0 +1,11 @@
+--- a/shared/wl.c
 b/shared/wl.c
+@@ -27,7 +27,7 @@ wl_probe(char *name)
+ {
+   int ret, val;
+ 
+-  if ((name[0] != 'w') || (name[1] != 'l'))
++  if ((name[0] != 'w') || ((name[1] != 'l')  ((name[1] != 'd') || 
(name[2] != 's'
+   return -1;
+ 
+   /* Check interface */
-- 
1.8.3.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 11/18, v2] broadcom-wl: add support for setting H/W address

2013-11-10 Thread Nathan Hintz
Some devices initialize with a default address (common to all H/W).
The address needs to be changeable so that a unique address can be
assigned to each AP.

Signed-off-by: Nathan Hintz nlhi...@hotmail.com
---

v2 - Incorporated Jow's comment to rename the interfaces (wl0, wl0-1, wl0-2..., 
and
 wds0-1, wds0-2...).

 package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh | 15 +++
 package/kernel/broadcom-wl/src/wlc.c  |  7 +++
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh 
b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
index 0dd25a3..892a415 100644
--- a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
+++ b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
@@ -97,7 +97,6 @@ disable_broadcom() {
local device=$1
set_wifi_down $device
wlc ifname $device down
-   wlc ifname $device bssid `wlc ifname $device default_bssid`
(
include /lib/network
 
@@ -131,7 +130,7 @@ enable_broadcom() {
config_get_bool frameburst $device frameburst
config_get macfilter $device macfilter
config_get maclist $device maclist
-   config_get macaddr $device macaddr
+   config_get macaddr $device macaddr $(wlc ifname $device 
default_bssid)
config_get txpower $device txpower
config_get frag $device frag
config_get rts $device rts
@@ -199,7 +198,7 @@ enable_broadcom() {
 
local _c=0
local nas=$(which nas)
-   local if_up nas_cmd
+   local if_pre_up if_up nas_cmd
local vif vif_pre_up vif_post_up vif_do_up vif_txpower
 
for vif in $vifs; do
@@ -340,7 +339,10 @@ enable_broadcom() {
 
local ifname
config_get ifname $vif ifname
-   #append if_up ifconfig $ifname up ;$N
+   local if_cmd=if_pre_up
+   [ $ifname != ${ifname##${device}-} ]  if_cmd=if_up
+   append $if_cmd macaddr=\$(wlc ifname '$ifname' cur_etheraddr) 
;$N
+   append $if_cmd ifconfig '$ifname' \${macaddr:+hw ether 
\$macaddr} ;$N
 
local net_cfg=$(find_net_config $vif)
[ -z $net_cfg ] || {
@@ -362,6 +364,8 @@ enable_broadcom() {
wlc ifname $device stdin EOF
 $ifdown
 
+${macaddr:+bssid $macaddr}
+${macaddr:+cur_etheraddr $macaddr}
 band ${band:-0}
 ${nmode:+nmode $nmode}
 ${nmode:+${nreqd:+nreqd $nreqd}}
@@ -393,6 +397,9 @@ slottime ${slottime:--1}
 ${frameburst:+frameburst $frameburst}
 
 $vif_pre_up
+EOF
+   eval $if_pre_up
+   wlc ifname $device stdin EOF
 up
 $vif_post_up
 EOF
diff --git a/package/kernel/broadcom-wl/src/wlc.c 
b/package/kernel/broadcom-wl/src/wlc.c
index 9f4abc0..21754a7 100644
--- a/package/kernel/broadcom-wl/src/wlc.c
+++ b/package/kernel/broadcom-wl/src/wlc.c
@@ -892,6 +892,13 @@ static const struct wlc_call wlc_calls[] = {
.desc = BSSID
},
{
+   .name = cur_etheraddr,
+   .param = MAC,
+   .handler = wlc_iovar,
+   .data.str = cur_etheraddr,
+   .desc = Current MAC Address
+   },
+   {
.name = default_bssid,
.param = MAC,
.handler = wlc_iovar,
-- 
1.8.3.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 12/18, v2] broadcom-wl: improve device cleanup

2013-11-10 Thread Nathan Hintz
Move all device cleanup to disable_broadcom.

Signed-off-by: Nathan Hintz nlhi...@hotmail.com
---

v2 - Incorporated Jow's comment to rename the interfaces (wl0, wl0-1, wl0-2..., 
and
 wds0-1, wds0-2...).

 .../kernel/broadcom-wl/files/lib/wifi/broadcom.sh  | 36 +-
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh 
b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
index 892a415..9416f77 100644
--- a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
+++ b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
@@ -50,12 +50,6 @@ scan_broadcom() {
done
config_set $device vifs ${adhoc_if:-$sta_if $ap_if $mon_if}
 
-   ifdown=down
-   for vif in 0 1 2 3; do
-   append ifdown vif $vif $N
-   append ifdown enabled 0 $N
-   done
-
ap=1
infra=1
if [ $_c -gt 1 ]; then
@@ -96,7 +90,6 @@ scan_broadcom() {
 disable_broadcom() {
local device=$1
set_wifi_down $device
-   wlc ifname $device down
(
include /lib/network
 
@@ -104,12 +97,28 @@ disable_broadcom() {
[ -e $pid_file ]  start-stop-daemon -K -q -s SIGKILL -p 
$pid_file  rm $pid_file
 
# make sure the interfaces are down and removed from all bridges
-   local dev
-   for dev in $device ${device}-1 ${device}-2 ${device}-3; do
-   ifconfig $dev down 2/dev/null /dev/null  {
-   unbridge $dev
-   }
+   local dev ifname
+   for dev in /sys/class/net/wds${device##wl}-* 
/sys/class/net/${device}-* /sys/class/net/${device}; do
+   if [ -e $dev ]; then
+   ifname=${dev##/sys/class/net/}
+   ifconfig $ifname down
+   unbridge $ifname
+   fi
+   done
+
+   # make sure all of the devices are disabled in the driver
+   local ifdown=
+   local vif
+   append ifdown down $N
+   append ifdown wds none $N
+   for vif in 3 2 1 0; do
+   append ifdown vif $vif $N
+   append ifdown enabled 0 $N
done
+
+   wlc ifname $device stdin EOF
+$ifdown
+EOF
)
true
 }
@@ -362,8 +371,6 @@ enable_broadcom() {
_c=$(($_c + 1))
done
wlc ifname $device stdin EOF
-$ifdown
-
 ${macaddr:+bssid $macaddr}
 ${macaddr:+cur_etheraddr $macaddr}
 band ${band:-0}
@@ -387,7 +394,6 @@ monitor ${monitor:-0}
 radio ${radio:-1}
 macfilter ${macfilter:-0}
 maclist ${maclist:-none}
-wds none
 ${wds:+wds $wds}
 country ${country:-US}
 ${channel:+channel $channel}
-- 
1.8.3.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 14/18, v2] broadcom-wl: perform additional cleanup on wl module unload

2013-11-10 Thread Nathan Hintz
Signed-off-by: Nathan Hintz nlhi...@hotmail.com
---
 package/kernel/broadcom-wl/patches/007-use-glue-driver.patch  | 8 ++--
 .../kernel/broadcom-wl/patches/008-fix_virtual_interfaces.patch   | 2 +-
 package/kernel/broadcom-wl/patches/012-compat-3.10.patch  | 2 +-
 package/kernel/broadcom-wl/patches/013-interface-name.patch   | 2 +-
 .../kernel/broadcom-wl/patches/110-add_number_to_dev_name.patch   | 2 +-
 5 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/package/kernel/broadcom-wl/patches/007-use-glue-driver.patch 
b/package/kernel/broadcom-wl/patches/007-use-glue-driver.patch
index 2639abc..a30dcc4 100644
--- a/package/kernel/broadcom-wl/patches/007-use-glue-driver.patch
+++ b/package/kernel/broadcom-wl/patches/007-use-glue-driver.patch
@@ -108,18 +108,20 @@
  
  #ifdef CONFIG_PCI
error = pci_register_driver(wl_pci_driver);
-@@ -1082,7 +1053,9 @@ wl_module_init(void)
+@@ -1082,7 +1053,11 @@ wl_module_init(void)
return 0;
  
  error_pci:
 -  ssb_driver_unregister(wl_ssb_driver);
 +#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
 +  wl_glue_unregister();
++  wl_glue_set_attach_callback(NULL);
++  wl_glue_set_remove_callback(NULL);
 +#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
return error;
  }
  
-@@ -1099,9 +1072,9 @@ wl_module_exit(void)
+@@ -1099,9 +1074,11 @@ wl_module_exit(void)
  #ifdef CONFIG_PCI
pci_unregister_driver(wl_pci_driver);
  #endif/* CONFIG_PCI */
@@ -128,6 +130,8 @@
 -#endif/* CONFIG_SSB */
 +#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
 +  wl_glue_unregister();
++  wl_glue_set_attach_callback(NULL);
++  wl_glue_set_remove_callback(NULL);
 +#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
  }
  
diff --git 
a/package/kernel/broadcom-wl/patches/008-fix_virtual_interfaces.patch 
b/package/kernel/broadcom-wl/patches/008-fix_virtual_interfaces.patch
index 6cffa27..3605931 100644
--- a/package/kernel/broadcom-wl/patches/008-fix_virtual_interfaces.patch
+++ b/package/kernel/broadcom-wl/patches/008-fix_virtual_interfaces.patch
@@ -1,6 +1,6 @@
 --- a/driver/wl_linux.c
 +++ b/driver/wl_linux.c
-@@ -1541,6 +1541,8 @@ wl_add_if(wl_info_t *wl, struct wlc_if* 
+@@ -1545,6 +1545,8 @@ wl_add_if(wl_info_t *wl, struct wlc_if* 
return NULL;
}
  
diff --git a/package/kernel/broadcom-wl/patches/012-compat-3.10.patch 
b/package/kernel/broadcom-wl/patches/012-compat-3.10.patch
index 0e0415f..1ab8539 100644
--- a/package/kernel/broadcom-wl/patches/012-compat-3.10.patch
+++ b/package/kernel/broadcom-wl/patches/012-compat-3.10.patch
@@ -36,7 +36,7 @@
  static int
  wl_read_proc(char *buffer, char **start, off_t offset, int length, int *eof, 
void *data)
  {
-@@ -1137,7 +1137,7 @@ wl_free(wl_info_t *wl)
+@@ -1141,7 +1141,7 @@ wl_free(wl_info_t *wl)
  
/* free common resources */
if (wl-wlc) {
diff --git a/package/kernel/broadcom-wl/patches/013-interface-name.patch 
b/package/kernel/broadcom-wl/patches/013-interface-name.patch
index 3a136de..a19e3a9 100644
--- a/package/kernel/broadcom-wl/patches/013-interface-name.patch
+++ b/package/kernel/broadcom-wl/patches/013-interface-name.patch
@@ -1,6 +1,6 @@
 --- a/driver/wl_linux.c
 +++ b/driver/wl_linux.c
-@@ -1556,7 +1556,7 @@ wl_add_if(wl_info_t *wl, struct wlc_if*
+@@ -1560,7 +1560,7 @@ wl_add_if(wl_info_t *wl, struct wlc_if*
  
wl_if_setup(wlif-dev);
  
diff --git 
a/package/kernel/broadcom-wl/patches/110-add_number_to_dev_name.patch 
b/package/kernel/broadcom-wl/patches/110-add_number_to_dev_name.patch
index 13ce727..28917d9 100644
--- a/package/kernel/broadcom-wl/patches/110-add_number_to_dev_name.patch
+++ b/package/kernel/broadcom-wl/patches/110-add_number_to_dev_name.patch
@@ -1,6 +1,6 @@
 --- a/driver/wl_linux.c
 +++ b/driver/wl_linux.c
-@@ -1412,7 +1412,7 @@ wl_alloc_if(wl_info_t *wl, int iftype, u
+@@ -1416,7 +1416,7 @@ wl_alloc_if(wl_info_t *wl, int iftype, u
dev = alloc_etherdev(sizeof(wl_if_t));
wlif = netdev_priv(dev);
bzero(wlif, sizeof(wl_if_t));
-- 
1.8.3.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 9/18, v2] broadcom-wl: clean up variable definitions (broadcom.sh)

2013-11-10 Thread Nathan Hintz
Specify variables as 'local' where appropriate

Signed-off-by: Nathan Hintz nlhi...@hotmail.com
---

v2 - Incorporated Jow's comment to rename the interfaces (wl0, wl0-1, wl0-2..., 
and
 wds0-1, wds0-2...).

 .../kernel/broadcom-wl/files/lib/wifi/broadcom.sh  | 47 +-
 1 file changed, 28 insertions(+), 19 deletions(-)

diff --git a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh 
b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
index 7721b87..17fa80f 100644
--- a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
+++ b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
@@ -2,18 +2,17 @@ append DRIVERS broadcom
 
 scan_broadcom() {
local device=$1
-   local wds
+   local vif vifs wds
local adhoc sta apmode mon disabled
local adhoc_if sta_if ap_if mon_if
-   local _c=0
 
config_get vifs $device vifs
for vif in $vifs; do
config_get_bool disabled $vif disabled 0
[ $disabled -eq 0 ] || continue
 
+   local mode
config_get mode $vif mode
-   _c=$(($_c + 1))
case $mode in
adhoc)
adhoc=1
@@ -28,6 +27,7 @@ scan_broadcom() {
ap_if=${ap_if:+$ap_if }$vif
;;
wds)
+   local addr
config_get addr $vif bssid
[ -z $addr ] || {
addr=$(echo $addr | tr 'A-F' 'a-f')
@@ -105,6 +105,7 @@ disable_broadcom() {
[ -e $pid_file ]  start-stop-daemon -K -q -s SIGKILL -p 
$pid_file  rm $pid_file
 
# make sure the interfaces are down and removed from all bridges
+   local dev
for dev in $device ${device}-1 ${device}-2 ${device}-3; do
ifconfig $dev down 2/dev/null /dev/null  {
unbridge $dev
@@ -116,7 +117,8 @@ disable_broadcom() {
 
 enable_broadcom() {
local device=$1
-   local _c
+   local channel country maxassoc wds vifs distance slottime rxantenna 
txantenna
+   local frameburst macfilter maclist macaddr txpower frag rts hwmode 
htmode
config_get channel $device channel
config_get country $device country
config_get maxassoc $device maxassoc
@@ -135,15 +137,9 @@ enable_broadcom() {
config_get rts $device rts
config_get hwmode $device hwmode
config_get htmode $device htmode
-   local vif_pre_up vif_post_up vif_do_up vif_txpower
local doth=0
local wmm=1
 
-   _c=0
-   nas=$(which nas)
-   nas_cmd=
-   if_up=
-
[ -z $slottime ]  {
[ -n $distance ]  {
# slottime = 9 + (distance / 150) + (distance % 150 ? 1 
: 0)
@@ -201,9 +197,15 @@ enable_broadcom() {
esac
}
 
+   local _c=0
+   local nas=$(which nas)
+   local if_up nas_cmd
+   local vif vif_pre_up vif_post_up vif_do_up vif_txpower
+
for vif in $vifs; do
config_get vif_txpower $vif txpower
 
+   local mode
config_get mode $vif mode
append vif_pre_up vif $_c $N
append vif_post_up vif $_c $N
@@ -213,20 +215,24 @@ enable_broadcom() {
config_get_bool doth $vif doth $doth
 
[ $mode = sta ] || {
+   local hidden isolate
config_get_bool hidden $vif hidden 0
append vif_pre_up closed $hidden $N
config_get_bool isolate $vif isolate 0
append vif_pre_up ap_isolate $isolate $N
}
 
-   wsec_r=0
-   eap_r=0
-   wsec=0
-   auth=0
-   nasopts=
+   local wsec_r=0
+   local eap_r=0
+   local wsec=0
+   local auth=0
+   local nasopts=
+   local enc key rekey
+
config_get enc $vif encryption
case $enc in
*wep*)
+   local def defkey k knr
wsec_r=1
wsec=1
defkey=1
@@ -274,6 +280,7 @@ enable_broadcom() {
nasopts=-k \\$${vif}_key\${rekey:+ -g 
$rekey}
;;
*wpa*)
+   local auth_port auth_secret auth_server
wsec_r=1
eap_r=1
config_get auth_server $vif auth_server
@@ -309,6 +316,7 @@ enable_broadcom() {
append vif_do_up wsec_restrict $wsec_r $N
append vif_do_up eap_restrict $eap_r $N
 
+ 

[OpenWrt-Devel] [PATCH 15/18, v2] broadcom-wl: fix crash when starting multiple virtual interfaces

2013-11-10 Thread Nathan Hintz
When enabling multiple VIFS, the driver sometimes crashes.  The frequency
of the crash increases as more VIFS are enabled.

Signed-off-by: Nathan Hintz nlhi...@hotmail.com
---
 .../patches/008-fix_virtual_interfaces.patch   | 123 -
 .../broadcom-wl/patches/009-fix_compile_3_2.patch  |   4 +-
 .../patches/010-remove_irqf_samble_random.patch|   2 +-
 .../broadcom-wl/patches/012-compat-3.10.patch  |   8 +-
 .../broadcom-wl/patches/013-interface-name.patch   |   2 +-
 .../patches/110-add_number_to_dev_name.patch   |   2 +-
 6 files changed, 131 insertions(+), 10 deletions(-)

diff --git 
a/package/kernel/broadcom-wl/patches/008-fix_virtual_interfaces.patch 
b/package/kernel/broadcom-wl/patches/008-fix_virtual_interfaces.patch
index 3605931..23831df 100644
--- a/package/kernel/broadcom-wl/patches/008-fix_virtual_interfaces.patch
+++ b/package/kernel/broadcom-wl/patches/008-fix_virtual_interfaces.patch
@@ -1,6 +1,117 @@
 --- a/driver/wl_linux.c
 +++ b/driver/wl_linux.c
-@@ -1545,6 +1545,8 @@ wl_add_if(wl_info_t *wl, struct wlc_if* 
+@@ -354,6 +354,7 @@ static int wl_read_proc(char *buffer, ch
+ static int wl_dump(wl_info_t *wl, struct bcmstrbuf *b);
+ #endif /* BCMDBG */
+ struct wl_if *wl_alloc_if(wl_info_t *wl, int iftype, uint unit, struct 
wlc_if* wlc_if);
++static void wl_link_if(wl_info_t *wl, wl_if_t *wlif);
+ static void wl_free_if(wl_info_t *wl, wl_if_t *wlif);
+ 
+ 
+@@ -566,6 +567,9 @@ wl_attach(uint16 vendor, uint16 device,
+   wl-dev = dev;
+   wl_if_setup(dev);
+ 
++  /* add the interface to the interface linked list */
++  wl_link_if(wl, wlif);
++
+   /* map chip registers (47xx: and sprom) */
+   dev-base_addr = regs;
+ 
+@@ -1106,10 +1110,14 @@ wl_free(wl_info_t *wl)
+   free_irq(wl-dev-irq, wl);
+   }
+ 
+-  if (wl-dev) {
+-  wl_free_if(wl, WL_DEV_IF(wl-dev));
+-  wl-dev = NULL;
++  /* free all interfaces */
++  while (wl-if_list) {
++  if ((wl-if_list-dev != wl-dev) || wl-if_list-next == NULL)
++  wl_free_if(wl, wl-if_list);
++  else
++  wl_free_if(wl, wl-if_list-next);
+   }
++  wl-dev = NULL;
+ 
+ #ifdef TOE
+   wl_toe_detach(wl-toei);
+@@ -1355,10 +1363,12 @@ wl_txflowcontrol(wl_info_t *wl, bool sta
+ 
+   ASSERT(prio == ALLPRIO);
+   for (wlif = wl-if_list; wlif != NULL; wlif = wlif-next) {
+-  if (state == ON)
+-  netif_stop_queue(wlif-dev);
+-  else
+-  netif_wake_queue(wlif-dev);
++  if (wlif-dev_registed) {
++  if (state == ON)
++  netif_stop_queue(wlif-dev);
++  else
++  netif_wake_queue(wlif-dev);
++  }
+   }
+ }
+ 
+@@ -1398,7 +1408,6 @@ wl_alloc_if(wl_info_t *wl, int iftype, u
+ {
+   struct net_device *dev;
+   wl_if_t *wlif;
+-  wl_if_t *p;
+ 
+   dev = alloc_etherdev(sizeof(wl_if_t));
+   wlif = netdev_priv(dev);
+@@ -1411,9 +1420,13 @@ wl_alloc_if(wl_info_t *wl, int iftype, u
+   wlif-wlcif = wlcif;
+   wlif-subunit = subunit;
+ 
+-  /* match current flow control state */
+-  if (iftype != WL_IFTYPE_MON  wl-dev  netif_queue_stopped(wl-dev))
+-  netif_stop_queue(dev);
++  return wlif;
++}
++
++static void
++wl_link_if(wl_info_t *wl, wl_if_t *wlif)
++{
++  wl_if_t *p;
+ 
+   /* add the interface to the interface linked list */
+   if (wl-if_list == NULL)
+@@ -1424,7 +1437,6 @@ wl_alloc_if(wl_info_t *wl, int iftype, u
+   p = p-next;
+   p-next = wlif;
+   }
+-  return wlif;
+ }
+ 
+ static void
+@@ -1504,6 +1516,9 @@ _wl_add_if(wl_task_t *task)
+   wl_info_t *wl = wlif-wl;
+   struct net_device *dev = wlif-dev;
+ 
++  /* add the interface to the interface linked list */
++  wl_link_if(wl, wlif);
++
+   if (wlif-type == WL_IFTYPE_WDS)
+   dev-netdev_ops = wl_wds_ops;
+ 
+@@ -1516,6 +1531,14 @@ _wl_add_if(wl_task_t *task)
+   }
+   wlif-dev_registed = TRUE;
+ 
++  /* match current flow control state */
++  if (wl-dev) {
++  if (netif_queue_stopped(wl-dev))
++  netif_stop_queue(dev);
++  else
++  netif_wake_queue(dev);
++  }
++
+ done:
+   MFREE(wl-osh, task, sizeof(wl_task_t));
+   atomic_dec(wl-callbacks);
+@@ -1545,6 +1568,8 @@ wl_add_if(wl_info_t *wl, struct wlc_if*
return NULL;
}
  
@@ -9,3 +120,13 @@
sprintf(wlif-dev-name, %s%d.%d, devname, wl-pub-unit, 
wlif-subunit);
if (remote)
bcopy(remote, wlif-remote, ETHER_ADDR_LEN);
+@@ -2778,6 +2803,9 @@ wl_add_monitor(wl_task_t *task)
+   dev = wlif-dev;
+   wl-monitor = dev;
+ 
++  /* add the interface to the interface linked list */
++  wl_link_if(wl, 

[OpenWrt-Devel] [PATCH 8/18, v2] broadcom-wl: simplify processing of 'hwmode'

2013-11-10 Thread Nathan Hintz
Default gmode to GOnly unless explicitly overwridden.  This corrects
processing for 11ng to specify GOnly for gmode instead of Auto
(which translated to bg).

Signed-off-by: Nathan Hintz nlhi...@hotmail.com
---
 .../kernel/broadcom-wl/files/lib/wifi/broadcom.sh  | 42 +++---
 1 file changed, 22 insertions(+), 20 deletions(-)

diff --git a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh 
b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
index 191092a..7721b87 100644
--- a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
+++ b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
@@ -165,32 +165,34 @@ enable_broadcom() {
;;
esac
 
-   [ ${channel:-0} -ge 1 -a ${channel:-0} -le 14 ]  band=2
-   [ ${channel:-0} -ge 36 ]  band=1
+   local gmode=2 nmode=0 nreqd=
+   case $hwmode in
+   *a) gmode=;;
+   *b) gmode=0;;
+   *bg)gmode=1;;
+   *g) gmode=2;;
+   *gst)   gmode=4;;
+   *lrs)   gmode=5;;
+   *)  nmode=1; nreqd=0;;
+   esac
 
case $hwmode in
-   *na)nmode=1; nreqd=0;;
-   *a) nmode=0;;
-   *ng)gmode=1; nmode=1; nreqd=0;;
-   *n) nmode=1; nreqd=1;;
-   *b) gmode=0; nmode=0;;
-   *bg)gmode=1; nmode=0;;
-   *g) gmode=2; nmode=0;;
-   *gst)   gmode=4; nmode=0;;
-   *lrs)   gmode=5; nmode=0;;
-   *)  case $band in
-   2) gmode=1; nmode=1; nreqd=0;;
-   1) nmode=1; nreqd=0;;
-   *) gmode=1; nmode=1; nreqd=0;;
-   esac
-   ;;
+   n|11n)  nmode=1; nreqd=1;;
+   *n*)nmode=1; nreqd=0;;
esac
 
 # Use 'nmode' for N-Phy only
-   [ $(wlc ifname $device phytype) = 4 ] || nmode=
+   [ $(wlc ifname $device phytype) = 4 ] || nmode=
+
+   local band chanspec
+   [ ${channel:-0} -ge 1 -a ${channel:-0} -le 14 ]  band=2
+   [ ${channel:-0} -ge 36 ]  {
+   band=1
+   gmode=
+   }
 
# Use 'chanspec' instead of 'channel' for 'N' modes (See bcmwifi.h)
-   [ ${nmode:-0} -ne 0 -a -n $band ]  {
+   [ ${nmode:-0} -ne 0 -a -n $band -a -n $channel ]  {
case $htmode in
HT40-)  chanspec=$(printf 0x%x%x%02x $band 0xe 
$(($channel - 2))); channel=;;
HT40+)  chanspec=$(printf 0x%x%x%02x $band 0xd 
$(($channel + 2))); channel=;;
@@ -352,7 +354,7 @@ enable_broadcom() {
wlc ifname $device stdin EOF
 $ifdown
 
-${nmode:+band ${band:-0}}
+band ${band:-0}
 ${nmode:+nmode $nmode}
 ${nmode:+${nreqd:+nreqd $nreqd}}
 ${gmode:+gmode $gmode}
-- 
1.8.3.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 13/18, v2] broadcom-wl: support more virtual interfaces

2013-11-10 Thread Nathan Hintz
Read the number of virtual interfaces to support from the device
capabilities; as some newer devices can support up to 16.

Signed-off-by: Nathan Hintz nlhi...@hotmail.com
---

v2 - Added an error check when attempting to read 'bssmax'.
 
 .../kernel/broadcom-wl/files/lib/wifi/broadcom.sh  | 10 -
 package/kernel/broadcom-wl/src/wlc.c   | 45 ++
 2 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh 
b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
index 9416f77..614db0c 100644
--- a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
+++ b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
@@ -108,12 +108,14 @@ disable_broadcom() {
 
# make sure all of the devices are disabled in the driver
local ifdown=
-   local vif
+   local bssmax=$(wlc ifname $device bssmax)
+   local vif=$((${bssmax:-4} - 1))
append ifdown down $N
append ifdown wds none $N
-   for vif in 3 2 1 0; do
+   while [ $vif -ge 0 ]; do
append ifdown vif $vif $N
append ifdown enabled 0 $N
+   vif=$(($vif - 1))
done
 
wlc ifname $device stdin EOF
@@ -209,8 +211,12 @@ enable_broadcom() {
local nas=$(which nas)
local if_pre_up if_up nas_cmd
local vif vif_pre_up vif_post_up vif_do_up vif_txpower
+   local bssmax=$(wlc ifname $device bssmax)
+   bssmax=${bssmax:-4}
 
for vif in $vifs; do
+   [ $_c -ge $bssmax ]  break
+
config_get vif_txpower $vif txpower
 
local mode
diff --git a/package/kernel/broadcom-wl/src/wlc.c 
b/package/kernel/broadcom-wl/src/wlc.c
index 21754a7..50c40e8 100644
--- a/package/kernel/broadcom-wl/src/wlc.c
+++ b/package/kernel/broadcom-wl/src/wlc.c
@@ -391,6 +391,37 @@ static int wlc_wsec_key(wlc_param param, void *null, void 
*value)
return wl_bssiovar_set(interface, wsec_key, vif, wsec_key, 
sizeof(wsec_key));
 }
 
+static int wlc_cap(wlc_param param, void *data, void *value)
+{
+   char *iov = *((char **) data);
+
+   if (param  GET)
+   return wl_iovar_get(interface, iov, value, BUFSIZE);
+
+   return -1;
+}
+
+static int wlc_bssmax(wlc_param param, void *data, void *value)
+{
+   int *val = (int *) value;
+   char *iov = *((char **) data);
+   int ret = -1;
+
+   if (param  GET) {
+   ret = wl_iovar_get(interface, iov, wlbuf, BUFSIZE);
+   if (!ret) {
+   if (strstr(wlbuf, mbss4))
+   *val = 4;
+   else if (strstr(wlbuf, mbss16))
+   *val = 16;
+   else
+   *val = 1;
+   }
+   }
+
+   return ret;
+}
+
 static inline int cw2ecw(int cw)
 {
int i;  
@@ -954,6 +985,20 @@ static const struct wlc_call wlc_calls[] = {
.handler = wlc_ioctl,
.desc = Band (0=auto, 1=5Ghz, 2=2.4GHz)
},
+   {
+   .name = cap,
+   .param = STRING|NOARG,
+   .handler = wlc_cap,
+   .data.str = cap,
+   .desc = Capabilities
+   },
+   {
+   .name = bssmax,
+   .param = INT|NOARG,
+   .handler = wlc_bssmax,
+   .data.str = cap,
+   .desc = Number of VIF's supported
+   },
 };
 #define wlc_calls_size (sizeof(wlc_calls) / sizeof(struct wlc_call))
 
-- 
1.8.3.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 17/18, v2] broadcom-wl: support 'wds' interfaces on 'wl1' device

2013-11-10 Thread Nathan Hintz
Signed-off-by: Nathan Hintz nlhi...@hotmail.com
---

v2 - Incorporated Jow's comment to rename the interfaces (wl0, wl0-1, wl0-2..., 
and
 wds0-1, wds0-2...).

 package/kernel/broadcom-wl/files/etc/hotplug.d/net/20-broadcom_wds | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/kernel/broadcom-wl/files/etc/hotplug.d/net/20-broadcom_wds 
b/package/kernel/broadcom-wl/files/etc/hotplug.d/net/20-broadcom_wds
index 4e56d21..35c4218 100644
--- a/package/kernel/broadcom-wl/files/etc/hotplug.d/net/20-broadcom_wds
+++ b/package/kernel/broadcom-wl/files/etc/hotplug.d/net/20-broadcom_wds
@@ -56,6 +56,6 @@ setup_broadcom_wds() {
 
 case $ACTION in
add|register)
-   [ ${INTERFACE%%0-*} = wds ]  setup_broadcom_wds $INTERFACE
+   [ ${INTERFACE%%[0-1]-*} = wds ]  setup_broadcom_wds 
$INTERFACE
;;
 esac
-- 
1.8.3.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 18/18, v2] broadcom-wl: version roll

2013-11-10 Thread Nathan Hintz
Signed-off-by: Nathan Hintz nlhi...@hotmail.com
---
 package/kernel/broadcom-wl/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/kernel/broadcom-wl/Makefile 
b/package/kernel/broadcom-wl/Makefile
index 3b4d54c..588ac34 100644
--- a/package/kernel/broadcom-wl/Makefile
+++ b/package/kernel/broadcom-wl/Makefile
@@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=broadcom-wl
 PKG_VERSION:=5.10.56.27.3
-PKG_RELEASE:=6
+PKG_RELEASE:=7
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(ARCH).tar.bz2
 PKG_SOURCE_URL:=http://downloads.openwrt.org/sources
-- 
1.8.3.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ag71xx: fix ag71xx_probe error path

2013-11-10 Thread Gabor Juhos
2013.11.10. 10:42 keltezéssel, Catalin Patulea írta:
 Signed-off-by: Catalin Patulea c...@vv.carleton.ca

Applied.

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