Re: [OpenWrt-Devel] svn revisions and github repository

2016-06-24 Thread Bruno Randolf
On 22/06/16 23:50, Павел Плетенев wrote:
> Hello all!
> Thank you for the great OS!
> I'm trying to build Chaos Calmer from source for BlackSwift board
> (AR9331 dev board). 
> Patches for it can be applied only for revision 49007. I'm trying to
> apply RT_PREEMT patch for openwrt in that embedded system and I wish to
> publish my work somehow. My idea was to fork your github repository at
> needed revision and start hacking on that.
> 
> So at first I tried googling  github repository
> (github.com/openwrt/openwrt ) for
> r49007 without any luck. Then I found official openwrt git repository
> "git.openwrt.org/15.05/openwrt.git
> " and this commit
> .
> I'm using it currently for hacking. That commit hash isn't present in
> github repository. 
> The questions are: How are github repository and the one stated above
> correlate? Are there any docs about this? How can I publish changes made
> in git.openwrt.org  repository?

Hi! I think the do not correlate because they are different imports of
the SVN repository.

BWT: I added support for the BlackSwift to 15.05 in
c08d85662b48fff4ac26cdc00c7b22006248cabd (or SVN r46674).

BTW2: The BlackSwift is not really available any more, is it?

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


Re: [OpenWrt-Devel] Introducing the LEDE project

2016-05-05 Thread Bruno Randolf
On 05/05/16 13:48, Zoltan HERPAI wrote:
> I would not call "all active OpenWrt core developers" have left the
> boat. Take a look at this [1] page - some of them are active, some of
> them are not, but calling an end to the project is an overstatement at
> least. Also, refer to the mail Mike sent out last night.

Well, you are right, I should not make predictions of the future... ;)

But as someone who is following, using, building upon and sometimes
contributing to OpenWRT since ~10 years I can only say that the only
developers who have been visible, reacting and committing stuff have
left. I still wonder why, of course...

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


Re: [OpenWrt-Devel] Introducing the LEDE project

2016-05-05 Thread Bruno Randolf
On 05/05/16 02:02, Kathy Giori wrote:
> On Wed, May 4, 2016 at 5:45 PM, Fernando Frediani  
> wrote:
>> Thanks Daniel. That explains a lot.
>> I imagine if some digging is done it would be possible to find the holders
>> of the critical resources and then re-organize it from scratch within the
>> OpenWrt Project.
>> But as the fork has already happened there is no much point in doing that.

My conclusion is: As all active OpenWRT core developers have left the
boat there must be something going on behind the scenes, which they feel
can not be fixed within OpenWRT. If they don't change their mind, that's
probably the end of OpenWRT, then...

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


Re: [OpenWrt-Devel] Introducing the LEDE project

2016-05-03 Thread Bruno Randolf
On 03/05/16 18:59, Jo-Philipp Wich wrote:
> we'd like to introduce LEDE, a reboot of the OpenWrt community
> ...
> Jo-Philipp Wich,
> John Crispin,
> Daniel Golle, 
> Felix Fietkau,
> Hauke Mehrtens
> John Crispin
> Matthias Schiffer,
> Steven Barth

While a fresh start and a more open process is good move, given this
list of supporters it sounds a bit ridiculous... who is left in the
OpenWRT boat and why not do it as OpenWRT (V2 or whatever)???

Anyhow I am excited to see some important problems in the OpenWRT
community being addressed!

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


[OpenWrt-Devel] netifd hotplug event race condition for monitor interfaces

2016-04-29 Thread Bruno Randolf
Hello,

I have a system where I want to reload a service when a monitor
interface appears. The monitor interface is configured in
/etc/config/wireless as:

config wifi-iface 'monitor'
option device 'radio0'
option ifname 'moni0'
option mode 'monitor'

Unfortunately netifd events for monitor interfaces are not reliable at
boot time. On some slower systems I never get them, on a Raspberry Pi 2
I get them about 50% of the time.

I have been able to debug it down to netifd/system-linux.c
handle_hotplug_msg() where system_if_force_external() is either true or
false, depending whether /sys/class/net/moni0/phy80211 already exists or
not. Interestingly it works well when it does not exist yet: then I get
the following log, the interface gets UP, and the hotplug script which
restarts my service is called:

netifd: Interface 'moni' is enabled
netifd: Network device 'moni0' link is up
netifd: Interface 'moni' has link connectivity
netifd: Interface 'moni' is setting up now
netifd: Interface 'moni' is now up

But when the /sys/ file does already exist, and
system_if_force_external() is true, I get the following log and the
interface stays down:

netifd: radio0 (1144): command failed: Device or resource busy (-16)
netifd: radio0 (1144): ifconfig: SIOCSIFHWADDR: Invalid argument
netifd: Network device 'moni0' link is up
netifd: Interface 'moni' has link connectivity

root@Rpi2:~# ubus call network.interface.moni status
{
"up": false,
"pending": false,
"available": false,
"autostart": true,
"dynamic": false,
"proto": "none",
"device": "moni0",
"data": {

}
}

I guess the problem is that monitor interfaces are created almost
instantly, in comparison to AP, STA and Ad-hoc interfaces which need
some time to set up...?

Any ideas how to fix this are appreciated, I want to do it, but I am
stuck now.

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


Re: [OpenWrt-Devel] 15.05.1 - Chaos Calmer

2016-04-05 Thread Bruno Randolf
On 04/05/2016 02:33 PM, Saverio Proto wrote:
> Thanks Bruno,
> 
> I am sorry I am coming back to OpenWrt after a long break.
> 
> I expected the tag also on the Release repo
> 
> http://git.openwrt.org/?p=15.05/openwrt.git;a=summary
> 
> Here I see only a 15.05 tag. I dont understand the logic. I expect the
> 15.05.1 to be release from the Release-repo ?

Right, it should be tagged there too!
As I'm now only using the other repo I didn't check there.

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


Re: [OpenWrt-Devel] 15.05.1 - Chaos Calmer

2016-04-04 Thread Bruno Randolf
On 04/04/2016 09:34 PM, Saverio Proto wrote:
>> Great! Thanks for your good work!
>> Could you please add a tag for 15.05.1 in the git repo?
> 
> That would be great. I am trying to git bisect a bug and I have no
> idea on top of what commit is 15.05.1 built.

There is a tag for it already:

https://github.com/openwrt/openwrt/tags

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


Re: [OpenWrt-Devel] Git mirror with branches, tags and full history?

2016-03-30 Thread Bruno Randolf
On 03/30/2016 08:32 AM, John Crispin wrote:
> i have just updated https://github.com/openwrt/openwrt

Thanks!

Now, if you could add a tag "v15.05.1" things would be perfect...

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


[OpenWrt-Devel] Git mirror with branches, tags and full history?

2016-03-29 Thread Bruno Randolf
Hello!

What happened to https://github.com/openwrt/openwrt/?

Last commit on 'master' is from Feb 23, on 'chaos_calmer' from Feb 19...

It's a problem for me because I am using this as my main git upstream
and I'd have to rebase (again) to use
git://git.openwrt.org/15.05/openwrt.git or
git://git.openwrt.org/openwrt.git.

As noted before the benefit of having one git repo with all branches is
easier rebasing and merging new releases. I would appreciate if it came
back.

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


Re: [OpenWrt-Devel] 15.05.1 - Chaos Calmer

2016-03-19 Thread Bruno Randolf
On 03/16/2016 12:06 PM, John Crispin wrote:
> The OpenWrt developers are proud to announce the minor fix release of
> OpenWrt Chaos Calmer.
> 
>___ __
>  |   |.-.-.-.|  |  |  |..|  |_
>  |   -   ||  _  |  -__| ||  |  |  ||   _||   _|
>  |___||   __|_|__|__||||__|  ||
>   |__| W I R E L E S S   F R E E D O M
>  -
>  CHAOS CALMER (15.05.1)
>  -

Great! Thanks for your good work!
Could you please add a tag for 15.05.1 in the git repo?

What are the plans for DD? Would be good to know a rough release
schedule to send in updates we'd like to see in DD early enough...

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


Re: [OpenWrt-Devel] Read-only mirror https://github.com/openwrt/openwrt is stuck since 12 days ago

2016-03-15 Thread Bruno Randolf
On 03/07/2016 10:51 AM, John Crispin wrote:
> 
> 
> On 07/03/2016 11:47, Álvaro Fernández Rojas wrote:
>> I just want to add that openwrt-commits list is also affected, since last 
>> commit published there matches the last one in the read-only mirror.
>>
>> Regards,
>> Álvaro.
> 
> i noticed that one aswell, will investigate ... sorry for the
> delay/inconvenience

It is still down:

https://github.com/openwrt/openwrt?
"Updated 21 days ago"...

Would be great to have the git repo synced to svn again.

Thanks,
bruno

>>> El 6 mar 2016, a las 19:33, Hannu Nyman  escribió:
>>>
>>> The read-only mirror for the main Openwrt sources at Github has been stuck 
>>> since 12 days ago.
>>>
>>> https://github.com/openwrt/openwrt
>>>
>>> Both trunk and Chaos Calmer have got new commits since then...
>>>
>>> Apparently the mirror has not returned to automatic updates after the 
>>> network/hardware troubles.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 1/2] wwan: Add support for CDC (Huawei 'HiLink') Modems

2016-03-01 Thread Bruno Randolf
On 03/01/2016 08:43 AM, John Crispin wrote:
> 
> 
> On 26/02/2016 08:50, John Crispin wrote:
>>
>>
>> On 25/02/2016 08:23, John Crispin wrote:
>>>
>>>
>>> On 24/02/2016 09:08, Bruno Randolf wrote:
>>>> On 02/24/2016 06:11 AM, Matti Laakso wrote:
>>>>>> The reason is that I want different types of Modems to work with the
>>>>>> same interface configuration, using 'wwan'. E.g. it's configured like
>>>>>> this (/etc/config/network):
>>>>>>
>>>>>> config interface 'umts'
>>>>>> option proto wwan
>>>>>> option apn internet.eplus.de
>>>>>> option metric 4
>>>>>>
>>>>>> And it will work with PPP, QMI, MBIM, HiLink or whatever modem supported
>>>>>> by "wwan" (which are hopefully more and more)... Doesn't that make
>>>>>> sense? It would help the user who doesn't want to guess wether QMI works
>>>>>> better than PPP for a specific modem and which serial port to use, etc...
>>>>>>
>>>>>
>>>>> That's a good goal, but I think it's confusing for the user when apn and
>>>>> pin options don't work with HiLink modems but do work with all other
>>>>> modems handled by wwan.
>>>>
>>>> Well, you can see it the other way round: they are not needed for HiLink
>>>> modems and it will "just work"... :)
>>>>
>>>> bruno
>>>>
>>>
>>> i have to say i agree most with bruno but i need to think about this a
>>> bit and i'll test it with the 2 hilinks i have here. i believe that
>>> having the wwan proto handle most of the options is desirable as it will
>>> not only unify the code path but also the config path which at the end
>>> will increase usability.
>>>
>>> John
>>>
>>
>> Hi,
>>
>> this only works if the sim card has no pin set. correct ? i tried it and
>> without logging into the webui and adding my pin/apn/ ... there it wont
>> go online
>>
>>  John
> 
> i have spent ages thinking about this. the main problem is that the unit
> wont go online unless we previously set the apn/pin, ... in the webui.
> although having a unified wwan proto is great and we should have hilink
> support in it, i fear that this will be rather ambiguous to users as
> they set the pin in uci and then it wont get applied. so i have heavy
> heartedly decided to NAK this. i wish i had more time so we could hack
> up a tiny tool to set the webui setting from uci. although that is
> really would be an ugly hack.
> 
> sorry but i hope that the explanation makes sense.

Well, it makes sense only when you need to set APN and PIN. But this
seems to depend on the Provider and SIM card settings.

I know two cases where this is not necessary: "eplus.de" and
"vodafone.es" (PIN lock was disabled manually before in the vodafone.es
case).

Anyhow, this is maybe not a generic enough situation to merit adding
this to OpenWRT...

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


Re: [OpenWrt-Devel] [PATCH 1/2] wwan: Add support for CDC (Huawei 'HiLink') Modems

2016-02-24 Thread Bruno Randolf
On 02/24/2016 06:11 AM, Matti Laakso wrote:
>> The reason is that I want different types of Modems to work with the
>> same interface configuration, using 'wwan'. E.g. it's configured like
>> this (/etc/config/network):
>>
>> config interface 'umts'
>> option proto wwan
>> option apn internet.eplus.de
>> option metric 4
>>
>> And it will work with PPP, QMI, MBIM, HiLink or whatever modem supported
>> by "wwan" (which are hopefully more and more)... Doesn't that make
>> sense? It would help the user who doesn't want to guess wether QMI works
>> better than PPP for a specific modem and which serial port to use, etc...
>>
> 
> That's a good goal, but I think it's confusing for the user when apn and
> pin options don't work with HiLink modems but do work with all other
> modems handled by wwan.

Well, you can see it the other way round: they are not needed for HiLink
modems and it will "just work"... :)

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


Re: [OpenWrt-Devel] [PATCH 1/2] wwan: Add support for CDC (Huawei 'HiLink') Modems

2016-02-23 Thread Bruno Randolf
On 02/23/2016 07:54 AM, John Crispin wrote:
> On 23/02/2016 08:47, Torbjorn Jansson wrote:
>> FYI the hilink modem i have (E3372) only works if you visit one of the
>> pages on the usb sticks built in web server.
>> if you don't visit this page the stick never connects.
>>
>> i have not yet found a good solution to this problem.

We have only been testing with E303 and we had one of them, which got
plugged into a Windows machine. After that it didn't want to autoconnect
any more, until we did a "restore factory defaults" or "reset" on it's
web server. After that it worked fine again.

> that is what i thought. i had the idea that we could build a http client
> to do this but that is a really ugly hack.

Well, HiLink is a pretty ugly design in any case. E.g. you will run into
problems when you want to use 192.168.8.0/24 yourself on another
interface. Problem is that some have these sticks and want to use them.

If really necessary, this "hilink protocol" could be the place to add
these ugly hacks...

> however reading that 3 people talk to the stick in a different manner
> makes me wonder if there is more than 1 type of hilink modem ?

Thats certainly possible, allthough I'd be interested if the "reset" as
described above helps. And we all do DHCP or use an IP from the
192.168.8.0/24 range, no?

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


Re: [OpenWrt-Devel] [PATCH 1/2] wwan: Add support for CDC (Huawei 'HiLink') Modems

2016-02-23 Thread Bruno Randolf
On 02/23/2016 07:11 AM, Matti Laakso wrote:
>> Huawei HiLink ("h" model names) modems just provide a CDC Ethernet
>> interface
>> where we have to run DHCP to get an IP address (usually in the
>> 192.168.8.0
>> range). While this may be bad design in general it's sometimes
>> necessary to
>> support these modems.
>>
>> This adds autodetection and handling of these to wwan.
>>
>> Tested with Huawei E3030h-1.
> 
> Why do you need an extra protocol for these? They work just fine with
> the regular DHCP protocol.

Hi, sorry I saw this so late... (cc: please).

The reason is that I want different types of Modems to work with the
same interface configuration, using 'wwan'. E.g. it's configured like
this (/etc/config/network):

config interface 'umts'
option protowwan
option apn  internet.eplus.de
option metric   4

And it will work with PPP, QMI, MBIM, HiLink or whatever modem supported
by "wwan" (which are hopefully more and more)... Doesn't that make
sense? It would help the user who doesn't want to guess wether QMI works
better than PPP for a specific modem and which serial port to use, etc...

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


[OpenWrt-Devel] [PATCH 2/2] QMI/NCM/MBIM/DirectIP: Support defaultroute, peerdns, metric

2016-02-18 Thread Bruno Randolf
Add support for options 'defaultroute', 'peerdns' and 'metric' to QMI, NCM,
MBIM and DirectIP dynamic dhcp interfaces. Same as for other network
interfaces, these options should be respected.

This includes the changes from http://patchwork.ozlabs.org/patch/581065/

Signed-off-by: Jakub Janco <kub...@gmail.com>
Signed-off-by: Bruno Randolf <b...@einfach.org>
---
 package/network/utils/comgt/Makefile   |  2 +-
 package/network/utils/comgt/files/directip.sh  | 13 --
 package/network/utils/comgt/files/ncm.sh   | 13 --
 .../utils/umbim/files/lib/netifd/proto/mbim.sh | 13 --
 .../utils/uqmi/files/lib/netifd/proto/qmi.sh   | 29 --
 5 files changed, 55 insertions(+), 15 deletions(-)

diff --git a/package/network/utils/comgt/Makefile 
b/package/network/utils/comgt/Makefile
index ac19aad..29bd62c 100644
--- a/package/network/utils/comgt/Makefile
+++ b/package/network/utils/comgt/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=comgt
 PKG_VERSION:=0.32
-PKG_RELEASE:=27
+PKG_RELEASE:=28
 
 PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tgz
 PKG_SOURCE_URL:=@SF/comgt
diff --git a/package/network/utils/comgt/files/directip.sh 
b/package/network/utils/comgt/files/directip.sh
index d828052..c94585c 100644
--- a/package/network/utils/comgt/files/directip.sh
+++ b/package/network/utils/comgt/files/directip.sh
@@ -15,14 +15,17 @@ proto_directip_init_config() {
proto_config_add_string "auth"
proto_config_add_string "username"
proto_config_add_string "password"
+   proto_config_add_boolean "defaultroute"
+   proto_config_add_boolean "peerdns"
+   proto_config_add_int "metric"
 }
 
 proto_directip_setup() {
local interface="$1"
local chat devpath devname
 
-   local device apn pincode ifname auth username password
-   json_get_vars device apn pincode auth username password
+   local device apn pincode ifname auth username password defaultroute 
peerdns metric
+   json_get_vars device apn pincode auth username password defaultroute 
peerdns metric
 
[ -n "$ctl_device" ] && device=$ctl_device
 
@@ -80,6 +83,9 @@ proto_directip_setup() {
json_add_string name "${interface}_4"
json_add_string ifname "@$interface"
json_add_string proto "dhcp"
+   [ -n "$defaultroute" ] && json_add_boolean defaultroute "$defaultroute"
+   [ -n "$peerdns" ] && json_add_boolean peerdns "$peerdns"
+   [ -n "$metric" ] && json_add_int metric "$metric"
ubus call network add_dynamic "$(json_dump)"
 
json_init
@@ -87,6 +93,9 @@ proto_directip_setup() {
json_add_string ifname "@$interface"
json_add_string proto "dhcpv6"
json_add_string extendprefix 1
+   [ -n "$defaultroute" ] && json_add_boolean defaultroute "$defaultroute"
+   [ -n "$peerdns" ] && json_add_boolean peerdns "$peerdns"
+   [ -n "$metric" ] && json_add_int metric "$metric"
ubus call network add_dynamic "$(json_dump)"
 
return 0
diff --git a/package/network/utils/comgt/files/ncm.sh 
b/package/network/utils/comgt/files/ncm.sh
index 571cfaa..5c5be0c 100644
--- a/package/network/utils/comgt/files/ncm.sh
+++ b/package/network/utils/comgt/files/ncm.sh
@@ -19,6 +19,9 @@ proto_ncm_init_config() {
proto_config_add_string mode
proto_config_add_string pdptype
proto_config_add_boolean ipv6
+   proto_config_add_boolean defaultroute
+   proto_config_add_boolean peerdns
+   proto_config_add_int metric
 }
 
 proto_ncm_setup() {
@@ -26,8 +29,8 @@ proto_ncm_setup() {
 
local manufacturer initialize setmode connect ifname devname devpath
 
-   local device apn auth username password pincode delay mode pdptype ipv6
-   json_get_vars device apn auth username password pincode delay mode 
pdptype ipv6
+   local device apn auth username password pincode delay mode pdptype ipv6 
defaultroute peerdns metric
+   json_get_vars device apn auth username password pincode delay mode 
pdptype ipv6 defaultroute peerdns metric

if [ "$ipv6" = 0 ]; then
ipv6=""
@@ -141,6 +144,9 @@ proto_ncm_setup() {
json_add_string name "${interface}_4"
json_add_string ifname "@$interface"
json_add_string proto "dhcp"
+   [ -n "$defaultroute" ] && json_add_boolean defaultroute "$defaultroute"
+   [ -n "$peerdns" ] && json_add_boolean peerdns "$peerdns"
+   [ -n "$metric" ] && json_add_int metric "$me

[OpenWrt-Devel] [PATCH 1/2] wwan: Add support for CDC (Huawei 'HiLink') Modems

2016-02-18 Thread Bruno Randolf
Huawei HiLink ("h" model names) modems just provide a CDC Ethernet interface
where we have to run DHCP to get an IP address (usually in the 192.168.8.0
range). While this may be bad design in general it's sometimes necessary to
support these modems.

This adds autodetection and handling of these to wwan.

Tested with Huawei E3030h-1.

Signed-off-by: Bruno Randolf <b...@einfach.org>
---
 package/network/utils/wwan/Makefile|  3 +-
 package/network/utils/wwan/files/hilink.sh | 56 ++
 package/network/utils/wwan/files/wwan.sh   |  9 -
 3 files changed, 66 insertions(+), 2 deletions(-)
 create mode 100644 package/network/utils/wwan/files/hilink.sh

diff --git a/package/network/utils/wwan/Makefile 
b/package/network/utils/wwan/Makefile
index 8d388dc..1917d1c 100644
--- a/package/network/utils/wwan/Makefile
+++ b/package/network/utils/wwan/Makefile
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=wwan
 PKG_VERSION:=2014-07-17
-PKG_RELEASE=1
+PKG_RELEASE=3
 
 PKG_LICENSE:=GPL-2.0
 PKG_LICENSE_FILES:=
@@ -24,6 +24,7 @@ endef
 define Package/wwan/install
$(INSTALL_DIR) $(1)/lib/netifd/proto/
$(CP) ./files/wwan.sh $(1)/lib/netifd/proto/
+   $(CP) ./files/hilink.sh $(1)/lib/netifd/proto/
$(INSTALL_DIR) $(1)/etc/hotplug.d/usb
$(INSTALL_BIN) ./files/wwan.usb $(1)/etc/hotplug.d/usb/00_wwan.sh
$(INSTALL_DIR) $(1)/etc/hotplug.d/usbmisc
diff --git a/package/network/utils/wwan/files/hilink.sh 
b/package/network/utils/wwan/files/hilink.sh
new file mode 100644
index 000..229e1a4
--- /dev/null
+++ b/package/network/utils/wwan/files/hilink.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+[ -n "$INCLUDE_ONLY" ] || {
+   . /lib/functions.sh
+   . ../netifd-proto.sh
+   init_proto "$@"
+}
+
+proto_hilink_init_config() {
+   available=1
+   no_device=1
+   proto_config_add_boolean defaultroute
+   proto_config_add_boolean peerdns
+   proto_config_add_int metric
+}
+
+proto_hilink_setup() {
+   local interface="$1"
+   local ifname="$ctl_device"
+   local defaultroute peerdns metric
+
+   json_get_vars defaultroute peerdns metric
+
+   [ -n "$ifname" ] || {
+   proto_notify_error "$interface" NO_IFNAME
+   proto_set_available "$interface" 0
+   return 1
+   }
+
+   logger -p daemon.info -t "hilink[$$]" "Starting DHCP on $ifname"
+   proto_init_update "$ifname" 1
+   proto_send_update "$interface"
+
+   json_init
+   json_add_string name "${interface}_4"
+   json_add_string ifname "@$interface"
+   json_add_string proto "dhcp"
+   [ -n "$defaultroute" ] && json_add_boolean defaultroute "$defaultroute"
+   [ -n "$peerdns" ] && json_add_boolean peerdns "$peerdns"
+   [ -n "$metric" ] && json_add_int metric "$metric"
+   json_close_object
+   ubus call network add_dynamic "$(json_dump)"
+
+   return 0
+}
+
+proto_hilink_teardown() {
+   local interface="$1"
+
+   proto_init_update "*" 0
+   proto_send_update "$interface"
+}
+
+[ -n "$INCLUDE_ONLY" ] || {
+   add_protocol hilink
+}
diff --git a/package/network/utils/wwan/files/wwan.sh 
b/package/network/utils/wwan/files/wwan.sh
index 6b33600..3d80aba 100755
--- a/package/network/utils/wwan/files/wwan.sh
+++ b/package/network/utils/wwan/files/wwan.sh
@@ -14,12 +14,14 @@ proto_qmi_setup() { echo "wwan[$$] qmi proto is missing"; }
 proto_ncm_setup() { echo "wwan[$$] ncm proto is missing"; }
 proto_3g_setup() { echo "wwan[$$] 3g proto is missing"; }
 proto_directip_setup() { echo "wwan[$$] directip proto is missing"; }
+proto_hilink_setup() { echo "wwan[$$] hilink proto is missing"; }
 
 [ -f ./mbim.sh ] && . ./mbim.sh
 [ -f ./ncm.sh ] && . ./ncm.sh
 [ -f ./qmi.sh ] && . ./qmi.sh
 [ -f ./3g.sh ] && { . ./ppp.sh; . ./3g.sh; }
 [ -f ./directip.sh ] && . ./directip.sh
+[ -f ./hilink.sh ] && . ./hilink.sh
 
 proto_wwan_init_config() {
available=1
@@ -66,7 +68,7 @@ proto_wwan_setup() {
}
}
 
-   [ -z "$ctl_device" ] && for net in $(ls /sys/class/net/ | grep wwan); do
+   [ -z "$ctl_device" ] && for net in $(ls /sys/class/net/ | grep -E 
"wwan|eth"); do
[ -z "$ctl_device" ] || continue
driver=$(grep DRIVER /sys/class/net/$net/device/uevent | cut 
-d= -f2)
case "$driver" in
@@ -76,6 +78,9 @@ proto_wwan_setup() {
sierra_net|*cdc_ncm)
ctl_device=/dev/$(cd /sys/class/net/$net/; 

Re: [OpenWrt-Devel] [PATCH 2/2] Add support for 'metric' to QMI, NCM, MBIM and DirectIP

2016-02-18 Thread Bruno Randolf
On 02/18/2016 04:43 PM, John Crispin wrote:
> ideally this gets handled generically, which wont be easy as these are
> all virtual interfaces. maybe if we just add the code in a generic place
> rather than duplicate it lots of times.

Ideally - yes... but where?

Also I don't understand why these have to be virtual interfaces.
Wouldn't it be possible to attach the dhcp client to the normal
interface, just as it is done for ethernet or wifi interfaces?

That would simplify other things as I have been trying to mention in my
mail titled: "QMI/NCM/MBIM interfaces netifd ifup event too early"
https://www.mail-archive.com/openwrt-devel@lists.openwrt.org/msg37608.html

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


Re: [OpenWrt-Devel] [PATCH 2/2] Add support for 'metric' to QMI, NCM, MBIM and DirectIP

2016-02-18 Thread Bruno Randolf
On 02/18/2016 02:00 PM, Jakub Jančo wrote:
> You should add all important options to networking:
> metric
> defaultroute
> peerdns
> These are important for remote management and dns resolving.
> 
> You can see my not yet applied patch http://patchwork.ozlabs.org/patch/581065/
> It works for me.

Hi Jakub,

You are right and I will soon send a v2 of the patch which includes your
changes. Thanks,

bruno

> --
> S pozdravom Jakub Janco
> 
> 
> On Wed, Feb 17, 2016 at 7:21 PM, Bruno Randolf <b...@einfach.org> wrote:
>> Same as for other network interfaces, the option 'metric' should be 
>> respected.
>>
>> (Unfortunately I could not test these changes, since I don't have these 
>> modems
>> and QMI is broken on trunk for me... But the same method is used in the
>> "HiLink" script I just added before.)
>>
>> Signed-off-by: Bruno Randolf <b...@einfach.org>
>> ---
>>  package/network/utils/comgt/files/directip.sh  |  7 +--
>>  package/network/utils/comgt/files/ncm.sh   |  7 +--
>>  package/network/utils/umbim/files/lib/netifd/proto/mbim.sh |  7 +--
>>  package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh   | 11 +++
>>  4 files changed, 22 insertions(+), 10 deletions(-)
>>
>> diff --git a/package/network/utils/comgt/files/directip.sh 
>> b/package/network/utils/comgt/files/directip.sh
>> index d828052..048b647 100644
>> --- a/package/network/utils/comgt/files/directip.sh
>> +++ b/package/network/utils/comgt/files/directip.sh
>> @@ -15,14 +15,15 @@ proto_directip_init_config() {
>> proto_config_add_string "auth"
>> proto_config_add_string "username"
>> proto_config_add_string "password"
>> +   proto_config_add_string "metric"
>>  }
>>
>>  proto_directip_setup() {
>> local interface="$1"
>> local chat devpath devname
>>
>> -   local device apn pincode ifname auth username password
>> -   json_get_vars device apn pincode auth username password
>> +   local device apn pincode ifname auth username password metric
>> +   json_get_vars device apn pincode auth username password metric
>>
>> [ -n "$ctl_device" ] && device=$ctl_device
>>
>> @@ -80,6 +81,7 @@ proto_directip_setup() {
>> json_add_string name "${interface}_4"
>> json_add_string ifname "@$interface"
>> json_add_string proto "dhcp"
>> +   json_add_int metric $metric
>> ubus call network add_dynamic "$(json_dump)"
>>
>> json_init
>> @@ -87,6 +89,7 @@ proto_directip_setup() {
>> json_add_string ifname "@$interface"
>> json_add_string proto "dhcpv6"
>> json_add_string extendprefix 1
>> +   json_add_int metric $metric
>> ubus call network add_dynamic "$(json_dump)"
>>
>> return 0
>> diff --git a/package/network/utils/comgt/files/ncm.sh 
>> b/package/network/utils/comgt/files/ncm.sh
>> index 571cfaa..39bdaaf 100644
>> --- a/package/network/utils/comgt/files/ncm.sh
>> +++ b/package/network/utils/comgt/files/ncm.sh
>> @@ -19,6 +19,7 @@ proto_ncm_init_config() {
>> proto_config_add_string mode
>> proto_config_add_string pdptype
>> proto_config_add_boolean ipv6
>> +   proto_config_add_string metric
>>  }
>>
>>  proto_ncm_setup() {
>> @@ -26,8 +27,8 @@ proto_ncm_setup() {
>>
>> local manufacturer initialize setmode connect ifname devname devpath
>>
>> -   local device apn auth username password pincode delay mode pdptype 
>> ipv6
>> -   json_get_vars device apn auth username password pincode delay mode 
>> pdptype ipv6
>> +   local device apn auth username password pincode delay mode pdptype 
>> ipv6 metric
>> +   json_get_vars device apn auth username password pincode delay mode 
>> pdptype ipv6 metric
>>
>> if [ "$ipv6" = 0 ]; then
>> ipv6=""
>> @@ -141,6 +142,7 @@ proto_ncm_setup() {
>> json_add_string name "${interface}_4"
>> json_add_string ifname "@$interface"
>> json_add_string proto "dhcp"
>> +   json_add_int metric $metric
>> ubus call network add_dynamic "$(json_dump)"
>>
>> [ -n "$ipv6" ] && {
>> @@ -149,6 +151,7 @@ pro

[OpenWrt-Devel] [PATCH 2/2] Add support for 'metric' to QMI, NCM, MBIM and DirectIP

2016-02-17 Thread Bruno Randolf
Same as for other network interfaces, the option 'metric' should be respected.

(Unfortunately I could not test these changes, since I don't have these modems
and QMI is broken on trunk for me... But the same method is used in the
"HiLink" script I just added before.)

Signed-off-by: Bruno Randolf <b...@einfach.org>
---
 package/network/utils/comgt/files/directip.sh  |  7 +--
 package/network/utils/comgt/files/ncm.sh   |  7 +--
 package/network/utils/umbim/files/lib/netifd/proto/mbim.sh |  7 +--
 package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh   | 11 +++
 4 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/package/network/utils/comgt/files/directip.sh 
b/package/network/utils/comgt/files/directip.sh
index d828052..048b647 100644
--- a/package/network/utils/comgt/files/directip.sh
+++ b/package/network/utils/comgt/files/directip.sh
@@ -15,14 +15,15 @@ proto_directip_init_config() {
proto_config_add_string "auth"
proto_config_add_string "username"
proto_config_add_string "password"
+   proto_config_add_string "metric"
 }
 
 proto_directip_setup() {
local interface="$1"
local chat devpath devname
 
-   local device apn pincode ifname auth username password
-   json_get_vars device apn pincode auth username password
+   local device apn pincode ifname auth username password metric
+   json_get_vars device apn pincode auth username password metric
 
[ -n "$ctl_device" ] && device=$ctl_device
 
@@ -80,6 +81,7 @@ proto_directip_setup() {
json_add_string name "${interface}_4"
json_add_string ifname "@$interface"
json_add_string proto "dhcp"
+   json_add_int metric $metric
ubus call network add_dynamic "$(json_dump)"
 
json_init
@@ -87,6 +89,7 @@ proto_directip_setup() {
json_add_string ifname "@$interface"
json_add_string proto "dhcpv6"
json_add_string extendprefix 1
+   json_add_int metric $metric
ubus call network add_dynamic "$(json_dump)"
 
return 0
diff --git a/package/network/utils/comgt/files/ncm.sh 
b/package/network/utils/comgt/files/ncm.sh
index 571cfaa..39bdaaf 100644
--- a/package/network/utils/comgt/files/ncm.sh
+++ b/package/network/utils/comgt/files/ncm.sh
@@ -19,6 +19,7 @@ proto_ncm_init_config() {
proto_config_add_string mode
proto_config_add_string pdptype
proto_config_add_boolean ipv6
+   proto_config_add_string metric
 }
 
 proto_ncm_setup() {
@@ -26,8 +27,8 @@ proto_ncm_setup() {
 
local manufacturer initialize setmode connect ifname devname devpath
 
-   local device apn auth username password pincode delay mode pdptype ipv6
-   json_get_vars device apn auth username password pincode delay mode 
pdptype ipv6
+   local device apn auth username password pincode delay mode pdptype ipv6 
metric
+   json_get_vars device apn auth username password pincode delay mode 
pdptype ipv6 metric

if [ "$ipv6" = 0 ]; then
ipv6=""
@@ -141,6 +142,7 @@ proto_ncm_setup() {
json_add_string name "${interface}_4"
json_add_string ifname "@$interface"
json_add_string proto "dhcp"
+   json_add_int metric $metric
ubus call network add_dynamic "$(json_dump)"
 
[ -n "$ipv6" ] && {
@@ -149,6 +151,7 @@ proto_ncm_setup() {
json_add_string ifname "@$interface"
json_add_string proto "dhcpv6"
json_add_string extendprefix 1
+   json_add_int metric $metric
ubus call network add_dynamic "$(json_dump)"
}
 }
diff --git a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh 
b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh
index f8b2c06..ab62ed6 100755
--- a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh
+++ b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh
@@ -17,6 +17,7 @@ proto_mbim_init_config() {
proto_config_add_string auth
proto_config_add_string username
proto_config_add_string password
+   proto_config_add_string metric
 }
 
 _proto_mbim_setup() {
@@ -24,8 +25,8 @@ _proto_mbim_setup() {
local tid=2
local ret
 
-   local device apn pincode delay
-   json_get_vars device apn pincode delay auth username password
+   local device apn pincode delay metric
+   json_get_vars device apn pincode delay auth username password metric
 
[ -n "$ctl_device" ] && device=$ctl_device
 
@@ -130,6 +131,7 @@ _proto_mbim_setup() {
json_add_string name "${interface}_4"
json_add_string ifname &q

[OpenWrt-Devel] [PATCH 1/2] wwan: Add support for CDC (Huawei 'HiLink') Modems

2016-02-17 Thread Bruno Randolf
Huawei HiLink ("h" model names) modems just provide a CDC Ethernet interface
where we have to run DHCP to get an IP address (usually in the 192.168.8.0
range). While this may be bad design in general it's sometimes necessary to
support these modems.

This adds autodetection and handling of these to wwan.

Tested with Huawei E3030h-1.

Signed-off-by: Bruno Randolf <b...@einfach.org>
---
 package/network/utils/wwan/Makefile|  3 +-
 package/network/utils/wwan/files/hilink.sh | 52 ++
 package/network/utils/wwan/files/wwan.sh   |  9 +-
 3 files changed, 62 insertions(+), 2 deletions(-)
 create mode 100644 package/network/utils/wwan/files/hilink.sh

diff --git a/package/network/utils/wwan/Makefile 
b/package/network/utils/wwan/Makefile
index 8d388dc..02028a9 100644
--- a/package/network/utils/wwan/Makefile
+++ b/package/network/utils/wwan/Makefile
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=wwan
 PKG_VERSION:=2014-07-17
-PKG_RELEASE=1
+PKG_RELEASE=2
 
 PKG_LICENSE:=GPL-2.0
 PKG_LICENSE_FILES:=
@@ -24,6 +24,7 @@ endef
 define Package/wwan/install
$(INSTALL_DIR) $(1)/lib/netifd/proto/
$(CP) ./files/wwan.sh $(1)/lib/netifd/proto/
+   $(CP) ./files/hilink.sh $(1)/lib/netifd/proto/
$(INSTALL_DIR) $(1)/etc/hotplug.d/usb
$(INSTALL_BIN) ./files/wwan.usb $(1)/etc/hotplug.d/usb/00_wwan.sh
$(INSTALL_DIR) $(1)/etc/hotplug.d/usbmisc
diff --git a/package/network/utils/wwan/files/hilink.sh 
b/package/network/utils/wwan/files/hilink.sh
new file mode 100644
index 000..ed8de6d
--- /dev/null
+++ b/package/network/utils/wwan/files/hilink.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+[ -n "$INCLUDE_ONLY" ] || {
+   . /lib/functions.sh
+   . ../netifd-proto.sh
+   init_proto "$@"
+}
+
+proto_hilink_init_config() {
+   available=1
+   no_device=1
+   proto_config_add_string metric
+}
+
+proto_hilink_setup() {
+   local interface="$1"
+   local ifname="$ctl_device"
+   local metric
+
+   json_get_vars metric
+
+   [ -n "$ifname" ] || {
+   proto_notify_error "$interface" NO_IFNAME
+   proto_set_available "$interface" 0
+   return 1
+   }
+
+   logger -p daemon.info -t "hilink[$$]" "Starting DHCP on $ifname"
+   proto_init_update "$ifname" 1
+   proto_send_update "$interface"
+
+   json_init
+   json_add_string name "${interface}_4"
+   json_add_string ifname "@$interface"
+   json_add_string proto "dhcp"
+   json_add_int metric $metric
+   json_close_object
+   ubus call network add_dynamic "$(json_dump)"
+
+   return 0
+}
+
+proto_hilink_teardown() {
+   local interface="$1"
+
+   proto_init_update "*" 0
+   proto_send_update "$interface"
+}
+
+[ -n "$INCLUDE_ONLY" ] || {
+   add_protocol hilink
+}
diff --git a/package/network/utils/wwan/files/wwan.sh 
b/package/network/utils/wwan/files/wwan.sh
index 6b33600..3d80aba 100755
--- a/package/network/utils/wwan/files/wwan.sh
+++ b/package/network/utils/wwan/files/wwan.sh
@@ -14,12 +14,14 @@ proto_qmi_setup() { echo "wwan[$$] qmi proto is missing"; }
 proto_ncm_setup() { echo "wwan[$$] ncm proto is missing"; }
 proto_3g_setup() { echo "wwan[$$] 3g proto is missing"; }
 proto_directip_setup() { echo "wwan[$$] directip proto is missing"; }
+proto_hilink_setup() { echo "wwan[$$] hilink proto is missing"; }
 
 [ -f ./mbim.sh ] && . ./mbim.sh
 [ -f ./ncm.sh ] && . ./ncm.sh
 [ -f ./qmi.sh ] && . ./qmi.sh
 [ -f ./3g.sh ] && { . ./ppp.sh; . ./3g.sh; }
 [ -f ./directip.sh ] && . ./directip.sh
+[ -f ./hilink.sh ] && . ./hilink.sh
 
 proto_wwan_init_config() {
available=1
@@ -66,7 +68,7 @@ proto_wwan_setup() {
}
}
 
-   [ -z "$ctl_device" ] && for net in $(ls /sys/class/net/ | grep wwan); do
+   [ -z "$ctl_device" ] && for net in $(ls /sys/class/net/ | grep -E 
"wwan|eth"); do
[ -z "$ctl_device" ] || continue
driver=$(grep DRIVER /sys/class/net/$net/device/uevent | cut 
-d= -f2)
case "$driver" in
@@ -76,6 +78,9 @@ proto_wwan_setup() {
sierra_net|*cdc_ncm)
ctl_device=/dev/$(cd /sys/class/net/$net/; find 
../../../ -name ttyUSB* |xargs basename | head -n1)
;;
+   cdc_ether)
+   ctl_device=$net
+   ;;
*) continue;;
esac
echo "wwan[$$]" "Using proto:$proto device:$ctl_device 
iface:$net desc:$desc"
@@ -98,6 +103,7 @@ proto_wwan_setup() {
   

[OpenWrt-Devel] QMI/NCM/MBIM interfaces netifd ifup event too early

2016-02-10 Thread Bruno Randolf
Hi!

I have a situation where I have to react to "ifup" events in OpenWRT,
and I believe that QMI/NCM/MBIM interfaces are sending the "ifup" event
too early, which is before they got an IP address. That is due to the
use of "sub-interfaces" for DHCP IPv4 and DHCP IPv6, as seen in the
/lib/netifd/proto/[ncm|qmi|mbim].sh scripts:

echo "Starting DHCP"
proto_init_update "$ifname" 1
proto_send_update "$interface"

json_init
json_add_string name "${interface}_4"
json_add_string ifname "@$interface"
json_add_string proto "dhcp"
json_close_object
ubus call network add_dynamic "$(json_dump)"

json_init
json_add_string name "${interface}_6"
json_add_string ifname "@$interface"
json_add_string proto "dhcpv6"
json_close_object
ubus call network add_dynamic "$(json_dump)"

Here the "main" interface is marked "up" before the sub-interfaces
"xyz_4" or "xyz_6" are added or got an IP address.

Normally, a WAN, WLAN or a 3G (PPP) interface is only "up" after it got
an IP and when we can start sending data thru it. Also I can not always
trigger on the "xyz_4" interface because in the 3G/PPP case the IP is
directly assigned to "xyz" and no "xyz_4" exists...

Is there any way in netifd that we could avoid the use of the
sub-interfaces here (other interfaces also may have DHCP and DHCPv6 IP
assignement without sub-interface, IMHO), or that the main interface
will only be "up" when at least one of the sub-interfaces is up?

Any pointers welcome, I'm ready to "mess" with the code as well... :)

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


Re: [OpenWrt-Devel] [PATCH] rtl8xxxu: Add new driver for Realtek WiFi USB devices

2015-11-26 Thread Bruno Randolf
On 11/26/2015 04:04 PM, W. Michael Petullo wrote:
>> This new driver supports RTL8723AU, RTL8188CU, RTL8188RU, RTL8191CU, and
>> RTL8192CU and is taken from:
>> https://git.kernel.org/cgit/linux/kernel/git/jes/linux.git/log/?h=rtl8723au-mac80211
> 
> Has there been any progress getting this merged?

Yes, AFAIK rtl8xxxu has been merged into the next 4.4 kernel.

No idea if OpenWRT plans to update mac80211/backports to a newer version
any time soon, but that would be the most straightforward way to get
this driver into OpenWRT.

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


Re: [OpenWrt-Devel] watchping

2015-11-26 Thread Bruno Randolf
Hi All,

Just FYI, finally I have been able to "liberate" my attempt at it into
GPL code and the 'pingcheck' recently got merged into OpenWRT packages:
https://github.com/br101/pingcheck

Greetings,
bruno


On 07/06/2015 07:54 PM, Bruno Randolf wrote:
> Hi Juliusz and all,
> 
> Exporting a route to a routing protocol was just one example of what
> could be done based on the fact that internet connectivity is available
> on an interface. There are other uses one could imagine:
>  - Activate a backup interface, say a 3G connection
>  - Announce a default GW or not (routing proto or DHCP).
>  - Check for firmware upgrades on a public server
>  - Start or reconfigure a service
> 
> Second, a default route is not enough: what counts is wether inernet
> connectivity is available thru that route. Sometimes a router announces
> a default route but is not connected itself, or problems exist
> "upstream". In that sense it's probably like your "babel-pinger" but
> more generic.
> 
> The mwan3 package seems do do a similar thing in a script. Do you think
> it could profit from a C-based ubus service? Would it make sense?
> 
> bruno
> 
> 
> 
> On 07/03/2015 09:19 PM, Juliusz Chroboczek wrote:
>> Hi Bruno,
>>
>>> Sometimes it's necessary to re-configure an OpenWRT system based on the
>>> fact wether Internet connectivity is available on a certain interface.
>> [...]
>>> One example where this is useful is: When Internet is available, we
>>> configure BATMAN to act as a gateway 'server', if not as a gateway
>>> 'client'.
>>
>> I think that a solution that relies on distribution scripts is inherently
>> brittle.  The routing daemon should be able to detect the current
>> configuration, in a distribution-independent manner, and automatically
>> adapt to the current situation.  This is what happens with babeld -- it is
>> able to automatically redistribute a kernel route (typically the default
>> route, but not necessarily) into the routing protocol.
>>
>> I know of three ways of automatically obtaining a default route, in
>> descending order of preference:
>>
>>   - if the other end of the Internet connection speaks RIP, RIPng or OSPF,
>> we run Quagga on the gateway and redistribute into Babel;
>>
>>   - if DHCPv4 is reliable (it usually is), then we simply redistribute the
>> DHCP-provided route into the routing protocol;
>>
>>   - if DHCPv4 is unreliable, we use the "babel-pinger" utility which
>> pings a remote host and installs a route depending on its availability.
>>
>> Additionally, there is some very promising but still experimental work to
>> provide a fully general and highly integrated solution in the "hnetd-full"
>> package.
>>
>> -- Juliusz
>> ___
>> openwrt-devel mailing list
>> openwrt-devel@lists.openwrt.org
>> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>>
> 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] CC: brcm2708: Add sysupgrade support for Raspberry Pi

2015-11-13 Thread Bruno Randolf
Also create .gz images if configured to do so.

This is equivalent, but different to what we have in trunk, as the image
creation has been rewritten there.

Signed-off-by: Bruno Randolf <b...@einfach.org>
---
 .../brcm2708/base-files/lib/preinit/79_move_config | 18 ++
 .../linux/brcm2708/base-files/lib/upgrade/platform.sh  | 17 +
 target/linux/brcm2708/image/Makefile   |  3 +++
 3 files changed, 38 insertions(+)
 create mode 100644 target/linux/brcm2708/base-files/lib/preinit/79_move_config
 create mode 100644 target/linux/brcm2708/base-files/lib/upgrade/platform.sh

diff --git a/target/linux/brcm2708/base-files/lib/preinit/79_move_config 
b/target/linux/brcm2708/base-files/lib/preinit/79_move_config
new file mode 100644
index 000..7bcea7b
--- /dev/null
+++ b/target/linux/brcm2708/base-files/lib/preinit/79_move_config
@@ -0,0 +1,18 @@
+#!/bin/sh
+# Copyright (C) 2015 OpenWrt.org
+
+BOOTPART=/dev/mmcblk0p1
+
+move_config() {
+   if [ -b $BOOTPART ]; then
+   insmod nls_cp437
+   insmod nls_iso8859-1
+   insmod fat
+   insmod vfat
+   mount -t vfat -o rw,noatime $BOOTPART /mnt
+   [ -f /mnt/sysupgrade.tgz ] && mv -f /mnt/sysupgrade.tgz /
+   umount /mnt
+   fi
+}
+
+boot_hook_add preinit_mount_root move_config
diff --git a/target/linux/brcm2708/base-files/lib/upgrade/platform.sh 
b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh
new file mode 100644
index 000..3e1ee00
--- /dev/null
+++ b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,17 @@
+platform_check_image() {
+   # i know no way to verify the image
+   return 0;
+}
+
+platform_do_upgrade() {
+   sync
+   get_image "$1" | dd of=/dev/mmcblk0 bs=2M conv=fsync
+   sleep 1
+}
+
+platform_copy_config() {
+   mount -t vfat -o rw,noatime /dev/mmcblk0p1 /mnt
+   cp -af "$CONF_TAR" /mnt/
+   sync
+   umount /mnt
+}
diff --git a/target/linux/brcm2708/image/Makefile 
b/target/linux/brcm2708/image/Makefile
index e70bdd0..633ed88 100644
--- a/target/linux/brcm2708/image/Makefile
+++ b/target/linux/brcm2708/image/Makefile
@@ -28,6 +28,9 @@ define Image/Build/RaspberryPi
mcopy -i $(KDIR)/boot.img $(KDIR)/Image ::kernel.img  # Copy OpenWrt 
built kernel
./gen_rpi_sdcard_img.sh $(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1).img 
$(KDIR)/boot.img $(KDIR)/root.$(1) \
$(CONFIG_BRCM2708_SD_BOOT_PARTSIZE) 
$(CONFIG_TARGET_ROOTFS_PARTSIZE)
+  ifneq ($(CONFIG_TARGET_IMAGES_GZIP),)
+   gzip -9n -c $(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1).img > 
$(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1).img.gz
+  endif
 endef
 
 define Image/Build
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Git mirror with branches, tags and full history

2015-11-09 Thread Bruno Randolf
On 11/09/2015 09:06 AM, Steven Barth wrote:
> Hey everyone,
> 
> I took the time last week to create a full-history git-mirror with
> branches, author mapping and release tags. It is currently on github,
> but it will probably end up on git.openwrt.org in the end.
> 
> Note: Do NOT send us pull requests to this repository, they will be
> ignored. Send patches to this mailing-list instead.
> 
> Now finally the mirror is at: https://github.com/openwrt/openwrt
> Since the authors are mapped, it is NOT compatible with the current
> git-mirror.
> 
> Let us know what you think.

Looks neat!

For me the real benefit will show later, when I'll have to rebase to the
next release.

Thanks a lot! :)

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


[OpenWrt-Devel] [PATCH] mac80211: Package firmware for rtl8291cu separately

2015-10-23 Thread Bruno Randolf
Hi, I forgot this patch before. Again I think this is not for trunk inclusion
as the driver will hit mac80211 eventually. But in general it could be good to
package firmware separately to allow for different drivers to use the same
firmware.

---
 package/kernel/mac80211/Makefile | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
index f332cbd..45456cd 100644
--- a/package/kernel/mac80211/Makefile
+++ b/package/kernel/mac80211/Makefile
@@ -1534,12 +1534,18 @@ endef
 define KernelPackage/rtl8192cu
   $(call KernelPackage/mac80211/Default)
   TITLE:=Realtek RTL8192CU/RTL8188CU support
-  DEPENDS+= +kmod-rtlwifi-usb +kmod-rtl8192c-common
+  DEPENDS+= +kmod-rtlwifi-usb +kmod-rtl8192c-common +rtl8192cu-firmware
   FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192cu/rtl8192cu.ko
   AUTOLOAD:=$(call AutoProbe,rtl8192cu)
 endef
 
-define KernelPackage/rtl8192cu/install
+define Package/rtl8192cu-firmware
+  SECTION:=firmware
+  CATEGORY:=Firmware
+  TITLE:=Realtek RTL8192CU/RTL8188CU firmware
+endef
+
+define Package/rtl8192cu-firmware/install
$(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
$(INSTALL_DATA) 
$(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw.bin 
$(1)/lib/firmware/rtlwifi
$(INSTALL_DATA) 
$(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_A.bin 
$(1)/lib/firmware/rtlwifi
@@ -2178,6 +2184,7 @@ $(eval $(call KernelPackage,rtl8192ce))
 $(eval $(call KernelPackage,rtl8192se))
 $(eval $(call KernelPackage,rtl8192de))
 $(eval $(call KernelPackage,rtl8192cu))
+$(eval $(call BuildPackage,rtl8192cu-firmware))
 $(eval $(call KernelPackage,wlcore))
 $(eval $(call KernelPackage,wl12xx))
 $(eval $(call KernelPackage,wl18xx))
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Networking on Raspberry Pi Model B

2015-10-22 Thread Bruno Randolf
On 10/22/2015 05:53 PM, W. Michael Petullo wrote:
> I have installed OpenWrt (trunk, as of around October 17) on a Raspberry
> Pi Model B. The network adapter is an Edimax 802.11b/g/n Nano USB Adapter.
> Unfortunately, the network stack of the device is failing after a
> number of minutes. At this point, for example, pinging and other network
> communication begins to fail.
> 
> The same device is reliable when running Pidora.
> 
> I am going to continue to troubleshoot, but wanted to see if any other
> developers where having trouble with OpenWrt on the Raspberry Pi. Has
> anyone else seen similar symptoms?

Yes, it's a problem of the rtl8192cu driver. There is a new driver for
that chipset in the making, its name is rtl8xxxu and it can currently be
found here:

https://git.kernel.org/cgit/linux/kernel/git/jes/linux.git/log/?h=rtl8723au-mac80211

So far it only supports STA and monitor mode but it's pretty stable and
does not suffer from these outages.

I recently created a OpenWRT package for it which I will post to this
mailing-list soon, but it only works on OpenWRT trunk so far.

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


Re: [OpenWrt-Devel] SVN to GIT transition

2015-10-13 Thread Bruno Randolf
On 10/12/2015 10:53 PM, Felix Fietkau wrote:
>> git describe
>>
>> r-35387-g83c5a41
>>
>> If you prefer, cut the last part and get "r-35387".
>>
>> Looks familiar? Now you even have real linear numbering in each branch,
>> without the gaps you get when committing to different branches in SVN +
>> the unique hash. Need to look up the commit? Use the hash (g83c5a41).
>>
>> Of course "r" is just an example to show the familiarity with SVN
>> revisions, you could choose whatever seems fit, for example at this
>> moment it would make sense to tag the moment when 15.05 was branched off
>> from trunk as "dd", then you'd get "dd-number-hash" in trunk and
>> "15.05-66-g66620f5" in the 15.05 branch (you actually do, just need to
>> use "git describe --tags" because the tag was not created with -a).
>
> That looks quite interesting. The issue I see with that is if somebody
> adds a local commit on top and builds the tree, the number behind 'r' is
> misleading and the hash is useless.

Right, I see, the ambiguous numbering with local commits may be a weak
point. But then, if you don't find the hash in the OpenWRT git, you also
know that it's not a clean copy of trunk and that's also valuable
information. People should report bugs from clean trunk, not containing
random, unknown, additional commits.

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


Re: [OpenWrt-Devel] SVN to GIT transition

2015-10-13 Thread Bruno Randolf
On 10/13/2015 09:08 PM, David Lang wrote:
> On Tue, 13 Oct 2015, Roman Yeryomin wrote:
> 
>>>
>>> Would it be possible to track the revision number in an automated way
>>> even
>>> in a git repo?  So store the r number, and automatically increment on
>>> commits.  Not sure if that's an option, but it seems like it might
>>> address
>>> the problem.
>>>
>>
>> If a user is smart enough to commit something locally then he knows
>> what he is doing and is smart enough to report the changes he made.
>> It's so simple.
> 
> I think the concern is that someone may do this and then make the
> resulting images available to others to install.

One way to avoid the ambiguity of the r-number would be to use
"git describe origin/master" then even if the local master branch has
commits, you'd get the "upstream" revision number. But, I think it's
more important to know that there have been local changes.

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


Re: [OpenWrt-Devel] SVN to GIT transition

2015-10-12 Thread Bruno Randolf
On 10/12/2015 01:43 PM, Felix Fietkau wrote:
> When using tags as a starting point (via git describe), somebody has to
> create those tags, which is cumbersome (and would mean adding lots of
> useless ones).

What's cumbersome? And why would you have to create useless tags?

I would actually take this argument on the reverse and say it's good,
because it forces you to tag revisions which should be tagged (like
"15.05-rc1", "15.05").

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


Re: [OpenWrt-Devel] SVN to GIT transition

2015-10-12 Thread Bruno Randolf
On 10/11/2015 01:48 PM, John Crispin wrote:
> although i see the point, out of tree fork have never been relevant to
> any core decision makings

I understand that this is not the main concern for core OpenWRT
developers, but on the other hand you must be aware that there exist
several of these "forks" which carry project or vendor specific changes,
stuff that can't be made OpenWRT trunk compatible, or not yet, or only
in parts, etc... and making it easier for these "forks" to merge OpenWRT
releases also makes it easier to merge project specific improvements
back to OpenWRT trunk. Otherwise these "forks" stay real forks, which
branch off at some revision and never merge again. That's why I think it
would be good for OpenWRT to allow easier merging in all directions.

Apart from that of course, the OpenWRT core developers are a pretty
small team, and a centralized model may fit them well, especially if
they don't want to include more people in the process. The decision is
up to the core developers.

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


[OpenWrt-Devel] [PATCH] libnl: Install include files into libnl3

2015-10-01 Thread Bruno Randolf
Install header files into same location as pkgconfig/libnl-3.0.pc says:
  Cflags: -I${includedir}/libnl3

Signed-off-by: Bruno Randolf <b...@einfach.org>
---
 package/libs/libnl/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/libs/libnl/Makefile b/package/libs/libnl/Makefile
index 857bbe2..241e9a7 100644
--- a/package/libs/libnl/Makefile
+++ b/package/libs/libnl/Makefile
@@ -85,8 +85,8 @@ define Build/Compile
 endef
 
 define Build/InstallDev
-   $(INSTALL_DIR) $(1)/usr/include/libnl $(1)/usr/lib/pkgconfig
-   $(CP) $(PKG_INSTALL_DIR)/usr/include/libnl3/* $(1)/usr/include/libnl/
+   $(INSTALL_DIR) $(1)/usr/include/libnl3 $(1)/usr/lib/pkgconfig
+   $(CP) $(PKG_INSTALL_DIR)/usr/include/libnl3/* $(1)/usr/include/libnl3/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig
 
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Project specific settings

2015-09-16 Thread Bruno Randolf
Hi Christoph,

On 09/15/2015 07:32 PM, Rüdiger, Christoph wrote:
> Our build tree is full of custom patches to different packages,
> mainly in the openwrt/package directory. This makes it close to
> impossible to update the repository to a new OpenWrt version without
> producing a good bunch of merge conflicts.

I have go thru this pain every time I do a major upgrade between OpenWRT
releases, but AFAIK there is no real solution, except keeping your diffs
minimal...

You can override packages from openwrt/packages with a package from your
own feeds with the "./scripts/feeds install -f" option (see commit I
quote below), but as openwrt/packages are considered essential packages
and are usually tightly integrated into the whole system, in general
you'd have to update/merge your own overriding package anyhow, so in
practice you might as well change openwrt/packages directly...

Usually, and when done regularly, "git merge upstream-15.05/master"
works, but sometimes it creates merge errors. In this case it can help
to do merge like this, to favour upstream, but keep your own additions:

  git merge -s recursive -X theirs upstream-15.05/master

Followed by thorough diffing to upstream-15.05/master and your own
branch to make sure you keep all necessary changes from both branches.

Anyone who knows a better way, please let us know...

bruno

---
commit 80710b0f2796c0573e78d200ec185e3d8d7db0c8
Author: blogic 
Date:   Mon Feb 9 12:09:23 2015 +

build: allow openwrt.git packages to be replaced by feeds

Currently, replacing a package available in openwrt.git requires
modifications in openwrt.git, or requires duplicating the package in a
feed but with a different name, which causes all kind of problems
related to dependencies (all packages selecting it would have to be
modified accordingly to select the new package).

With this change, if a package with the same name is present both in
feeds/ and package/ folders, the one in feeds/ can override the one
in package/, both in the menuconfig and during the build, by passing the
"-f" option to "./scripts/feeds install"

This mechanism is particularly useful for vendor tree, or in general for
application which needs to replace one particular package which exists
within openwrt.git by a custom/newer version.

Signed-off-by: Mathieu Olivari 
---
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Chaos Calmer 15.05

2015-09-14 Thread Bruno Randolf
On 09/11/2015 09:56 AM, Rafał Miłecki wrote:
> On 11 September 2015 at 10:54, Steven Barth  wrote:
>> The OpenWrt developers are proud to announce the final release of OpenWrt 
>> Chaos Calmer.
> 
> Before someone asks, it's
> r46767
> 483dac821788b457d349233e770329186a0aa860
> ramips: fix devicetree corruption with some boot loaders if the caches
> are not ready at boot

Could someone please tag this in the git repository?

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


[OpenWrt-Devel] [PATCH] CC: ar71xx: Add support for Black Swift

2015-08-10 Thread Bruno Randolf
Add support for the Black Swift board:
http://www.black-swift.com/

Took relevant parts and slightly adapted from:
https://github.com/blackswift/openwrt/blob/master/bsb.patch

Signed-off-by: Bruno Randolf b...@einfach.org
---
 target/linux/ar71xx/base-files/etc/diag.sh |  3 +
 .../ar71xx/base-files/etc/uci-defaults/01_leds |  4 ++
 .../ar71xx/base-files/etc/uci-defaults/02_network  |  7 ++
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |  3 +
 .../ar71xx/base-files/lib/upgrade/platform.sh  |  1 +
 target/linux/ar71xx/config-3.18|  1 +
 .../linux/ar71xx/files/arch/mips/ath79/mach-bsb.c  | 83 ++
 .../ar71xx/generic/profiles/smartelectronics.mk| 17 +
 target/linux/ar71xx/image/Makefile |  8 +++
 .../906-MIPS-ath79-add-blackswift.patch| 45 
 10 files changed, 172 insertions(+)
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-bsb.c
 create mode 100644 target/linux/ar71xx/generic/profiles/smartelectronics.mk
 create mode 100644 
target/linux/ar71xx/patches-3.18/906-MIPS-ath79-add-blackswift.patch

diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
b/target/linux/ar71xx/base-files/etc/diag.sh
index d6c7ec9..ece7098 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -38,6 +38,9 @@ get_status_led() {
aw-nr580)
status_led=aw-nr580:green:ready
;;
+   bsb)
+   status_led=bsb:red:sys
+   ;;
bullet-m | rocket-m | rocket-m-xw | nano-m | nanostation-m | 
nanostation-m-xw | loco-m-xw)
status_led=ubnt:green:link4
;;
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 ae45503..d628f1a 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -46,6 +46,10 @@ ap113)
ucidef_set_led_usbdev usb USB ap113:green:usb 1-1
;;
 
+bsb)
+   ucidef_set_led_default sys SYS bsb:red:sys 1
+   ;;
+
 bullet-m | \
 nanostation-m | \
 rocket-m | \
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 d577fc6..7e26886 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -64,6 +64,13 @@ tl-wdr4900-v2)
ucidef_add_switch_vlan switch0 2 1 6
;;
 
+bsb)
+   ucidef_set_interfaces_lan_wan eth1 eth0
+   ucidef_add_switch switch0 1 1
+   ucidef_add_switch_vlan switch0 1 0 1 3
+   ucidef_set_interface_wlan
+   ;;
+
 cpe510)
ucidef_set_interfaces_lan_wan eth0.1 eth0.2
ucidef_add_switch switch0 1 1
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 4c10ab2..cacf362 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -664,6 +664,9 @@ ar71xx_board_detect() {
*SMART-300)
name=smart-300
;;
+   Smart Electronics Black Swift board*)
+   name=bsb
+   ;;
*TEW-632BRP)
name=tew-632brp
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index f3dd61b..e5376ef 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -260,6 +260,7 @@ platform_check_image() {
return 1
;;
 
+   bsb | \
dir-825-b1 | \
tew-673gru)
dir825b_check_image $1  return 0
diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18
index 4f52332..d661aa7 100644
--- a/target/linux/ar71xx/config-3.18
+++ b/target/linux/ar71xx/config-3.18
@@ -43,6 +43,7 @@ CONFIG_ATH79_MACH_AW_NR580=y
 CONFIG_ATH79_MACH_ANTMINER_S1=y
 CONFIG_ATH79_MACH_ANTMINER_S3=y
 CONFIG_ATH79_MACH_BHU_BXU2000N2_A=y
+CONFIG_ATH79_MACH_BSB=y
 CONFIG_ATH79_MACH_CAP4200AG=y
 CONFIG_ATH79_MACH_CARAMBOLA2=y
 CONFIG_ATH79_MACH_CPE510=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-bsb.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-bsb.c
new file mode 100644
index 000..9f9be02
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-bsb.c
@@ -0,0 +1,83 @@
+/*
+ *  Smart Electronics Black Swift board support
+ *
+ *  Copyright (C) 2014 Dmitriy Zherebkov d...@black-swift.com
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#include asm/mach-ath79/ath79.h
+#include asm/mach-ath79/ar71xx_regs.h
+#include

[OpenWrt-Devel] [PATCH] ar71xx: Add support for Black Swift

2015-08-10 Thread Bruno Randolf
Add support for the Black Swift board:
http://www.black-swift.com/

Took relevant parts and slightly adapted from:
https://github.com/blackswift/openwrt/blob/master/bsb.patch

Signed-off-by: Bruno Randolf b...@einfach.org
---
 target/linux/ar71xx/base-files/etc/diag.sh |  3 +
 .../ar71xx/base-files/etc/uci-defaults/01_leds |  4 ++
 .../ar71xx/base-files/etc/uci-defaults/02_network  |  7 ++
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |  3 +
 .../ar71xx/base-files/lib/upgrade/platform.sh  |  1 +
 target/linux/ar71xx/config-4.1 |  1 +
 .../linux/ar71xx/files/arch/mips/ath79/mach-bsb.c  | 83 ++
 .../ar71xx/generic/profiles/smartelectronics.mk| 17 +
 target/linux/ar71xx/image/Makefile |  8 +++
 .../814-MIPS-ath79-add-blackswift.patch| 45 
 10 files changed, 172 insertions(+)
 mode change 100755 = 100644 
target/linux/ar71xx/base-files/etc/uci-defaults/02_network
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-bsb.c
 create mode 100644 target/linux/ar71xx/generic/profiles/smartelectronics.mk
 create mode 100644 
target/linux/ar71xx/patches-4.1/814-MIPS-ath79-add-blackswift.patch

diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
b/target/linux/ar71xx/base-files/etc/diag.sh
index 561c5da..abb3f62 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -41,6 +41,9 @@ get_status_led() {
aw-nr580)
status_led=aw-nr580:green:ready
;;
+   bsb)
+   status_led=bsb:red:sys
+   ;;
bullet-m | rocket-m | rocket-m-xw | nano-m | nanostation-m | 
nanostation-m-xw | loco-m-xw)
status_led=ubnt:green:link4
;;
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 2aced37..392be3a 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -55,6 +55,10 @@ ap147-010)
ucidef_set_led_wlan wlan2g WLAN 2.4 GHz ap147:green:wlan-2g 
phy0tpt
;;
 
+bsb)
+   ucidef_set_led_default sys SYS bsb:red:sys 1
+   ;;
+
 bullet-m | \
 nanostation-m | \
 rocket-m | \
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network 
b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
old mode 100755
new mode 100644
index 2893e62..acaf03f
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -72,6 +72,13 @@ tl-wdr4900-v2)
ucidef_add_switch_vlan switch0 2 1 6
;;
 
+bsb)
+   ucidef_set_interfaces_lan_wan eth1 eth0
+   ucidef_add_switch switch0 1 1
+   ucidef_add_switch_vlan switch0 1 0 1 3
+   ucidef_set_interface_wlan
+   ;;
+
 cpe510)
ucidef_set_interfaces_lan_wan eth0.1 eth0.2
ucidef_add_switch switch0 1 1
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 256bd10..359a5a6 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -676,6 +676,9 @@ ar71xx_board_detect() {
*SMART-300)
name=smart-300
;;
+   Smart Electronics Black Swift board*)
+   name=bsb
+   ;;
*TEW-632BRP)
name=tew-632brp
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 76d8c5b..fb9add6 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -263,6 +263,7 @@ platform_check_image() {
return 1
;;
 
+   bsb | \
dir-825-b1 | \
tew-673gru)
dir825b_check_image $1  return 0
diff --git a/target/linux/ar71xx/config-4.1 b/target/linux/ar71xx/config-4.1
index 1e31a01..1951cbb 100644
--- a/target/linux/ar71xx/config-4.1
+++ b/target/linux/ar71xx/config-4.1
@@ -47,6 +47,7 @@ CONFIG_ATH79_MACH_AP96=y
 CONFIG_ATH79_MACH_ARCHER_C7=y
 CONFIG_ATH79_MACH_AW_NR580=y
 CONFIG_ATH79_MACH_BHU_BXU2000N2_A=y
+CONFIG_ATH79_MACH_BSB=y
 CONFIG_ATH79_MACH_CAP4200AG=y
 CONFIG_ATH79_MACH_CARAMBOLA2=y
 CONFIG_ATH79_MACH_CPE510=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-bsb.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-bsb.c
new file mode 100644
index 000..9f9be02
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-bsb.c
@@ -0,0 +1,83 @@
+/*
+ *  Smart Electronics Black Swift board support
+ *
+ *  Copyright (C) 2014 Dmitriy Zherebkov d...@black-swift.com
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published

Re: [OpenWrt-Devel] [PATCH 1/2] CC: brcm2708: Add sysupgrade for Rasperry Pi

2015-07-24 Thread Bruno Randolf
On 07/24/2015 08:12 AM, John Crispin wrote:
 On 17/07/2015 19:18, Bruno Randolf wrote:
 diff --git a/target/linux/brcm2708/Makefile b/target/linux/brcm2708/Makefile
 index 30f6e1d..37ff204 100644
 --- a/target/linux/brcm2708/Makefile
 +++ b/target/linux/brcm2708/Makefile
 @@ -19,7 +19,8 @@ SUBTARGETS:=bcm2708 bcm2709
  KERNEL_PATCHVER:=3.18
  
  include $(INCLUDE_DIR)/target.mk
 -DEFAULT_PACKAGES += brcm2708-gpu-fw kmod-usb-hid kmod-sound-core 
 kmod-sound-arm-bcm2835
 +DEFAULT_PACKAGES += brcm2708-gpu-fw kmod-usb-hid kmod-sound-core 
 kmod-sound-arm-bcm2835 \
 +kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1
  
  define Target/Description
  Build firmware image for Broadcom BCM2708/BCM2709 SoC devices.
 
 these changes are unrelated to sysupgrade. please split the patch up

Hi John,

This is necessary for sysupgrade, since it stores the sysupgrade.tgz in
the FAT32 boot partition.

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


[OpenWrt-Devel] [PATCH] CC: brcm2708: Add gzip image compression

2015-07-18 Thread Bruno Randolf
Signed-off-by: Bruno Randolf b...@einfach.org
---
 target/linux/brcm2708/image/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/target/linux/brcm2708/image/Makefile 
b/target/linux/brcm2708/image/Makefile
index e70bdd0..633ed88 100644
--- a/target/linux/brcm2708/image/Makefile
+++ b/target/linux/brcm2708/image/Makefile
@@ -28,6 +28,9 @@ define Image/Build/RaspberryPi
mcopy -i $(KDIR)/boot.img $(KDIR)/Image ::kernel.img  # Copy OpenWrt 
built kernel
./gen_rpi_sdcard_img.sh $(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1).img 
$(KDIR)/boot.img $(KDIR)/root.$(1) \
$(CONFIG_BRCM2708_SD_BOOT_PARTSIZE) 
$(CONFIG_TARGET_ROOTFS_PARTSIZE)
+  ifneq ($(CONFIG_TARGET_IMAGES_GZIP),)
+   gzip -9n -c $(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1).img  
$(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1).img.gz
+  endif
 endef
 
 define Image/Build
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/2] CC: brcm2708: Add sysupgrade for Rasperry Pi

2015-07-17 Thread Bruno Randolf
The upgrade procedure works similar to the x86 platforms: The configuration
files (sysupgrade.tgz) are saved in the boot partition and moved to the
standard place in a preinit script. Since the boot partition is FAT32 we need
the vfat modules and dependencies.

Signed-off-by: Bruno Randolf b...@einfach.org
---
 target/linux/brcm2708/Makefile |  3 ++-
 .../brcm2708/base-files/lib/preinit/79_move_config | 18 ++
 .../linux/brcm2708/base-files/lib/upgrade/platform.sh  | 17 +
 3 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/brcm2708/base-files/lib/preinit/79_move_config
 create mode 100644 target/linux/brcm2708/base-files/lib/upgrade/platform.sh

diff --git a/target/linux/brcm2708/Makefile b/target/linux/brcm2708/Makefile
index 30f6e1d..37ff204 100644
--- a/target/linux/brcm2708/Makefile
+++ b/target/linux/brcm2708/Makefile
@@ -19,7 +19,8 @@ SUBTARGETS:=bcm2708 bcm2709
 KERNEL_PATCHVER:=3.18
 
 include $(INCLUDE_DIR)/target.mk
-DEFAULT_PACKAGES += brcm2708-gpu-fw kmod-usb-hid kmod-sound-core 
kmod-sound-arm-bcm2835
+DEFAULT_PACKAGES += brcm2708-gpu-fw kmod-usb-hid kmod-sound-core 
kmod-sound-arm-bcm2835 \
+   kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1
 
 define Target/Description
Build firmware image for Broadcom BCM2708/BCM2709 SoC devices.
diff --git a/target/linux/brcm2708/base-files/lib/preinit/79_move_config 
b/target/linux/brcm2708/base-files/lib/preinit/79_move_config
new file mode 100644
index 000..7bcea7b
--- /dev/null
+++ b/target/linux/brcm2708/base-files/lib/preinit/79_move_config
@@ -0,0 +1,18 @@
+#!/bin/sh
+# Copyright (C) 2015 OpenWrt.org
+
+BOOTPART=/dev/mmcblk0p1
+
+move_config() {
+   if [ -b $BOOTPART ]; then
+   insmod nls_cp437
+   insmod nls_iso8859-1
+   insmod fat
+   insmod vfat
+   mount -t vfat -o rw,noatime $BOOTPART /mnt
+   [ -f /mnt/sysupgrade.tgz ]  mv -f /mnt/sysupgrade.tgz /
+   umount /mnt
+   fi
+}
+
+boot_hook_add preinit_mount_root move_config
diff --git a/target/linux/brcm2708/base-files/lib/upgrade/platform.sh 
b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh
new file mode 100644
index 000..3e1ee00
--- /dev/null
+++ b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,17 @@
+platform_check_image() {
+   # i know no way to verify the image
+   return 0;
+}
+
+platform_do_upgrade() {
+   sync
+   get_image $1 | dd of=/dev/mmcblk0 bs=2M conv=fsync
+   sleep 1
+}
+
+platform_copy_config() {
+   mount -t vfat -o rw,noatime /dev/mmcblk0p1 /mnt
+   cp -af $CONF_TAR /mnt/
+   sync
+   umount /mnt
+}
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/2] CC: brcm2708: Add gzip image compression

2015-07-17 Thread Bruno Randolf
Signed-off-by: Bruno Randolf b...@einfach.org
---
 target/linux/brcm2708/image/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/target/linux/brcm2708/image/Makefile 
b/target/linux/brcm2708/image/Makefile
index e70bdd0..90d54bb 100644
--- a/target/linux/brcm2708/image/Makefile
+++ b/target/linux/brcm2708/image/Makefile
@@ -28,6 +28,9 @@ define Image/Build/RaspberryPi
mcopy -i $(KDIR)/boot.img $(KDIR)/Image ::kernel.img  # Copy OpenWrt 
built kernel
./gen_rpi_sdcard_img.sh $(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1).img 
$(KDIR)/boot.img $(KDIR)/root.$(1) \
$(CONFIG_BRCM2708_SD_BOOT_PARTSIZE) 
$(CONFIG_TARGET_ROOTFS_PARTSIZE)
+  ifneq ($(CONFIG_TARGET_IMAGES_GZIP),)
+   gzip -9n -k -f $(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1).img
+  endif
 endef
 
 define Image/Build
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Why STA wifi interface shutsdown AP interface?

2015-07-15 Thread Bruno Randolf
On 07/15/2015 12:08 PM, valent.turko...@gmail.com wrote:
 On 15 July 2015 at 12:37, Yaroslav Syrytsia m...@ys.lc wrote:
 Hi,

 It is a known issue, some descriptions you can find there - 
 http://vonger.cn/?p=1778
 I guess it is not depend on a driver or hw.
 
 Yaroslav thanks man you saved me lots of headache! :)
 
From reading blog post you linked this seams to be more a feature than
 bug. Other vendors like Mikrotik for example made their wifi stack so
 that virtual wifi interfaces act more like real interfaces and
 aren't linked.
 
 I actually consider this behaviour as a bug. Why not have 6 different
 virtual wifi interfaces each separate from others? 

Because there is only one pysical hardware and the hardware can only be
tuned to one channel. The STA interface needs to look for the channel
the AP is on and as long as the channel is not determined we can not
start an AP.

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


Re: [OpenWrt-Devel] [PATCH] base-files: Add preinit option to disable config restore

2015-07-14 Thread Bruno Randolf
Hi Felix,

On 07/14/2015 10:09 AM, Felix Fietkau wrote:
 Unless I'm missing something, this seems like a rarely needed special
 case to me. How about simply adding a custom preinit file to your
 firmware through files/ instead?
 Since the preinit script runs boot_run_hook preinit_mount_root just
 before the config restore, you should be able to add your code in the
 right place and use it to delete or move sysupgrade.tgz.

Yes, you are right, this is a simpler way. Forget my patch then.

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


Re: [OpenWrt-Devel] Build errors when activating the Device Tree flag for Raspberry Pi

2015-07-14 Thread Bruno Randolf
On 07/14/2015 12:43 PM, Jernej Izak wrote:
 ifneq (y,)
 
 bash: -c: line 0: syntax error near unexpected token `y,'
 
 bash: -c: line 0: `ifneq (y,)'

That looks like being caused by my brcm2708: Implement sysupgrade
(commit 49f8801514837980bd80dd3fa1c24e82897d2e5c)... I tested it but
blogic committed a slightly different version which seems to be broken.
I'm checking it now...

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


Re: [OpenWrt-Devel] Build errors when activating the Device Tree flag for Raspberry Pi

2015-07-14 Thread Bruno Randolf
On 07/14/2015 04:07 PM, John Crispin wrote:
 its not about blaming but about figuring out what went wrong.

Right, same here :)

 i will be
 on the laptop that i used for merging in abotu an hour and will see int
 he logs which commands i called and which patch i applied exactly

It's commit ad8e7742b637c36c4f5c32d1d2e8df1f2b32a31b brcm2708: add DT
support which changed the image generation process. After that my patch
seemed to apply but the logic changed. Today I can't work on this any
more, but the easiest way would be to remove the GZIP stuff for now and
add it back later.

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


Re: [OpenWrt-Devel] Build errors when activating the Device Tree flag for Raspberry Pi

2015-07-14 Thread Bruno Randolf
On 07/14/2015 03:34 PM, John Crispin wrote:
 
 
 On 14/07/2015 14:41, Bruno Randolf wrote:
 On 07/14/2015 12:43 PM, Jernej Izak wrote:
 ifneq (y,)

 bash: -c: line 0: syntax error near unexpected token `y,'

 bash: -c: line 0: `ifneq (y,)'

 That looks like being caused by my brcm2708: Implement sysupgrade
 (commit 49f8801514837980bd80dd3fa1c24e82897d2e5c)... I tested it but
 blogic committed a slightly different version which seems to be broken.
 I'm checking it now...

 bruno
 
 i used the version in patchwork, was that not the one to use ?

Yes. I'm not blaming you and I'm not exactly sure what happened, but I
think the image generation process has been changed in the mean time.
E.g. my patch (and the one in patchwork
http://patchwork.ozlabs.org/patch/494584/) had the mcopy lines before
./gen_rpi_sdcard_img.sh and the one you applied has them in a different
target. Also now the image is generated in
target-arm_cortex-a7+vfp_musl-1.1.10_eabi/linux-brcm2708_bcm2709/tmp/
and before directly in bin/brcm2708/...

Something must have changed in the way the target is evaluated so that
ifneq is interpreted as a shell command. And also there are other
places now where the .gz ending would have to be handled.

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


[OpenWrt-Devel] [PATCH] base-files: Add preinit option to disable config restore

2015-07-13 Thread Bruno Randolf
Sometimes it's desirable to be sure that config files from a new firmware image
overwrite the config files from the previously running firmware and we can not
always expect the user to use 'sysupgrade -n'. In this case the option
TARGET_PREINIT_CONFIG_RESTORE can be set to 'n'.

This is more useful with a custom uci-default scripts which can selectively
migrate config options, since the the old configuration still exists during the
first boot in /sysupgrade.tgz until /etc/init.d/done is called.

Signed-off-by: Bruno Randolf b...@einfach.org
---
 package/base-files/Makefile| 3 ++-
 package/base-files/files/etc/preinit   | 1 +
 package/base-files/files/lib/preinit/80_mount_root | 2 +-
 package/base-files/image-config.in | 7 +++
 4 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index a5f15fa..94a6f26 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
 include $(INCLUDE_DIR)/version.mk
 
 PKG_NAME:=base-files
-PKG_RELEASE:=157
+PKG_RELEASE:=158
 
 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
 PKG_BUILD_DEPENDS:=opkg/host usign/host
@@ -79,6 +79,7 @@ define ImageConfigOptions
echo 'pi_broadcast=$(if 
$(CONFIG_TARGET_PREINIT_BROADCAST),$(CONFIG_TARGET_PREINIT_BROADCAST),192.168.1.255)'
 $(1)/lib/preinit/00_preinit.conf
echo 'pi_preinit_net_messages=$(CONFIG_TARGET_PREINIT_SHOW_NETMSG)' 
$(1)/lib/preinit/00_preinit.conf
echo 
'pi_preinit_no_failsafe_netmsg=$(CONFIG_TARGET_PREINIT_SUPPRESS_FAILSAFE_NETMSG)'
 $(1)/lib/preinit/00_preinit.conf
+   echo 'pi_config_restore=$(CONFIG_TARGET_PREINIT_CONFIG_RESTORE)' 
$(1)/lib/preinit/00_preinit.conf
 endef
 endif
 
diff --git a/package/base-files/files/etc/preinit 
b/package/base-files/files/etc/preinit
index 9cc8a9a..c0b3168 100755
--- a/package/base-files/files/etc/preinit
+++ b/package/base-files/files/etc/preinit
@@ -20,6 +20,7 @@ fs_failsafe_wait_timeout=2
 
 pi_suppress_stderr=y
 pi_init_suppress_stderr=y
+pi_config_restore=y
 pi_init_path=/bin:/sbin:/usr/bin:/usr/sbin
 pi_init_cmd=/sbin/init
 
diff --git a/package/base-files/files/lib/preinit/80_mount_root 
b/package/base-files/files/lib/preinit/80_mount_root
index f3fe788..770c845 100644
--- a/package/base-files/files/lib/preinit/80_mount_root
+++ b/package/base-files/files/lib/preinit/80_mount_root
@@ -5,7 +5,7 @@
 do_mount_root() {
mount_root
boot_run_hook preinit_mount_root
-   [ -f /sysupgrade.tgz ]  {
+   [ $pi_config_restore = y ]  [ -f /sysupgrade.tgz ]  {
echo - config restore -
cd /
tar xzf /sysupgrade.tgz
diff --git a/package/base-files/image-config.in 
b/package/base-files/image-config.in
index fd0ead6..832bf43 100644
--- a/package/base-files/image-config.in
+++ b/package/base-files/image-config.in
@@ -86,6 +86,13 @@ config TARGET_PREINIT_BROADCAST
Broadcast address to which to send preinit network messages, as
as failsafe messages
 
+config TARGET_PREINIT_CONFIG_RESTORE
+   bool
+   prompt Restore configuration from sysupgrade if PREINITOPT
+   default y
+   help
+   Restore configuration from previous firmware when doing
+   sysupgrade. Normally this should be 'y'.
 
 menuconfig INITOPT
bool Init configuration options if IMAGEOPT
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] brcm2708: Implement sysupgrade

2015-07-13 Thread Bruno Randolf
Implement sysupgrade for Raspberry Pi, similar to the way it is done on x86:
The config files are saved in the boot partition and moved to where they are
normally expected in preinit.

Also add optional gzip compression for the SD card image, since this can save
a lot of space (76M vs 6M), also similar to x86.

Signed-off-by: Bruno Randolf b...@einfach.org
---
 target/linux/brcm2708/Makefile |  2 +-
 .../brcm2708/base-files/lib/preinit/79_move_config | 18 ++
 .../linux/brcm2708/base-files/lib/upgrade/platform.sh  | 17 +
 target/linux/brcm2708/image/Makefile   |  3 +++
 4 files changed, 39 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/brcm2708/base-files/lib/preinit/79_move_config
 create mode 100644 target/linux/brcm2708/base-files/lib/upgrade/platform.sh

diff --git a/target/linux/brcm2708/Makefile b/target/linux/brcm2708/Makefile
index 30f6e1d..015aa9c 100644
--- a/target/linux/brcm2708/Makefile
+++ b/target/linux/brcm2708/Makefile
@@ -19,7 +19,7 @@ SUBTARGETS:=bcm2708 bcm2709
 KERNEL_PATCHVER:=3.18
 
 include $(INCLUDE_DIR)/target.mk
-DEFAULT_PACKAGES += brcm2708-gpu-fw kmod-usb-hid kmod-sound-core 
kmod-sound-arm-bcm2835
+DEFAULT_PACKAGES += brcm2708-gpu-fw kmod-usb-hid kmod-sound-core 
kmod-sound-arm-bcm2835 kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1
 
 define Target/Description
Build firmware image for Broadcom BCM2708/BCM2709 SoC devices.
diff --git a/target/linux/brcm2708/base-files/lib/preinit/79_move_config 
b/target/linux/brcm2708/base-files/lib/preinit/79_move_config
new file mode 100644
index 000..7bcea7b
--- /dev/null
+++ b/target/linux/brcm2708/base-files/lib/preinit/79_move_config
@@ -0,0 +1,18 @@
+#!/bin/sh
+# Copyright (C) 2015 OpenWrt.org
+
+BOOTPART=/dev/mmcblk0p1
+
+move_config() {
+   if [ -b $BOOTPART ]; then
+   insmod nls_cp437
+   insmod nls_iso8859-1
+   insmod fat
+   insmod vfat
+   mount -t vfat -o rw,noatime $BOOTPART /mnt
+   [ -f /mnt/sysupgrade.tgz ]  mv -f /mnt/sysupgrade.tgz /
+   umount /mnt
+   fi
+}
+
+boot_hook_add preinit_mount_root move_config
diff --git a/target/linux/brcm2708/base-files/lib/upgrade/platform.sh 
b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh
new file mode 100644
index 000..3e1ee00
--- /dev/null
+++ b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,17 @@
+platform_check_image() {
+   # i know no way to verify the image
+   return 0;
+}
+
+platform_do_upgrade() {
+   sync
+   get_image $1 | dd of=/dev/mmcblk0 bs=2M conv=fsync
+   sleep 1
+}
+
+platform_copy_config() {
+   mount -t vfat -o rw,noatime /dev/mmcblk0p1 /mnt
+   cp -af $CONF_TAR /mnt/
+   sync
+   umount /mnt
+}
diff --git a/target/linux/brcm2708/image/Makefile 
b/target/linux/brcm2708/image/Makefile
index e70bdd0..0dd7b7d 100644
--- a/target/linux/brcm2708/image/Makefile
+++ b/target/linux/brcm2708/image/Makefile
@@ -28,6 +28,9 @@ define Image/Build/RaspberryPi
mcopy -i $(KDIR)/boot.img $(KDIR)/Image ::kernel.img  # Copy OpenWrt 
built kernel
./gen_rpi_sdcard_img.sh $(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1).img 
$(KDIR)/boot.img $(KDIR)/root.$(1) \
$(CONFIG_BRCM2708_SD_BOOT_PARTSIZE) 
$(CONFIG_TARGET_ROOTFS_PARTSIZE)
+  ifneq ($(CONFIG_TARGET_IMAGES_GZIP),)
+   gzip -k -f9 $(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1).img
+  endif
 endef
 
 define Image/Build
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Raspberry Pi 2 sysupgrade

2015-07-10 Thread Bruno Randolf
On 07/09/2015 06:44 AM, John Crispin wrote:
 I have the below change to add rudimentary support for sysupgrade on the
 Raspberry Pi. I looked at the way platform_copy_config() is implemented
 for x86 and tried to do the same, but I get the following error on mount:

 mount: mounting /dev/mmcblk0p2 on /mnt failed: Device or resource busy
 
 in that case its either still flushing the cache or has not been
 properly unmounted i think. you could try adding the partprobe tool to
 force a rescan of the table but i am not sure this is the problem here

You are right. I tried 'partprobe -s /dev/mmcblk0' and it shows the
partitions correctly but mount still fails.

I also tried 'sync' before trying to mount to flush the cache with no
effect.

So the suspect is that it has not been properly unmounted. So I tried to
'unmount -f /dev/mmcblk0p2' but that fails with umount: can't forcibly
umount /dev/mmcblk0p2: Invalid argument

Here are the mounts at that time:

rootfs on / type rootfs (rw)
proc on /proc type proc (rw,noatime)
sysfs on /sys type sysfs (rw,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
tmpfs on /dev type tmpfs (rw,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
tmpfs on / type tmpfs (rw,nosuid,nodev,noatime)

rootfs on / type rootfs (rw) should be the RAM rootfs, no?
How and were to unmount / correctly?

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


[OpenWrt-Devel] Raspberry Pi 2 sysupgrade

2015-07-08 Thread Bruno Randolf
Hi!

I have the below change to add rudimentary support for sysupgrade on the
Raspberry Pi. I looked at the way platform_copy_config() is implemented
for x86 and tried to do the same, but I get the following error on mount:

mount: mounting /dev/mmcblk0p2 on /mnt failed: Device or resource busy

I believe I'd need some way to re-read the partition table after the dd
command. How does it work on x86? Any ideas?

Also would it be OK to gzip the sdcard image to save space? It
compresses from 76M to 11M.

Below is the diff, but this is not a properly formatted patch, yet.

bruno

diff --git a/target/linux/brcm2708/base-files/lib/upgrade/platform.sh
b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh
new file mode 100644
index 000..95ade38
--- /dev/null
+++ b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,19 @@
+platform_check_image() {
+   # i know no way to verify the image
+   return 0;
+}
+
+platform_do_upgrade() {
+   sync
+   get_image $1 | dd of=/dev/mmcblk0 bs=2M conv=fsync
+   sleep 1
+}
+
+## mount does not work. I think I'd need to re-read the partition table!
+#platform_copy_config() {
+#  echo *** platform_copy_config called  /dev/console
+#  mount -t ext4 -o rw,noatime /dev/mmcblk0p2 /mnt
+#  cp -af $CONF_TAR /mnt/
+#  umount /mnt
+#  echo *** platform_copy_config done  /dev/console
+#}
diff --git a/target/linux/brcm2708/image/Makefile
b/target/linux/brcm2708/image/Makefile
index e70bdd0..095cf0d 100644
--- a/target/linux/brcm2708/image/Makefile
+++ b/target/linux/brcm2708/image/Makefile
@@ -28,6 +28,7 @@ define Image/Build/RaspberryPi
mcopy -i $(KDIR)/boot.img $(KDIR)/Image ::kernel.img  # Copy
OpenWrt built kernel
./gen_rpi_sdcard_img.sh
$(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1).img $(KDIR)/boot.img
$(KDIR)/root.$(1) \
$(CONFIG_BRCM2708_SD_BOOT_PARTSIZE)
$(CONFIG_TARGET_ROOTFS_PARTSIZE)
+   gzip -k -f $(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1).img
 endef

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


[OpenWrt-Devel] watchping

2015-07-03 Thread Bruno Randolf
Hi,

Sometimes it's necessary to re-configure an OpenWRT system based on the
fact wether Internet connectivity is available on a certain interface.
That the 'wan' interface is up, does not necessarily mean that Internet
is available (an upstream device or router may be down or configured
wrongly), so we want to check if we can actually get a ping reply.

One example where this is useful is: When Internet is available, we
configure BATMAN to act as a gateway 'server', if not as a gateway 'client'.

Another example could be, wether to activate a 3G data connection as
fallback for Ethernet WAN or not.

So far I have been using 'watchping' from the 'libre-mesh' project [1],
but it is plaqued by concurrency issues and other problems, so I am
considering to write a little C program which uses 'ubus' to directly
listen to 'netifd' ifup/down events, does the 'pings' and which could
expose the results (Internet available or not) via ubus as well.

I am writing here to ask wether someone has done this already, or if
there are any other concerns or opinions. Please let me know!

Greetings,
bruno

[1]
https://github.com/libre-mesh/lime-packages/tree/develop/packages/watchping
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] can netifd automatically restart a service?

2015-06-11 Thread Bruno Randolf
On 06/11/2015 07:32 AM, Nikos Mavrogiannopoulos wrote:
 In issue 574 [0] there is a big discussion of the behavior of
 transmission in openwrt. To summarize it:
 * By default when transmission downloads, it may crash the router due to
 high memory consumption and OOB. That crash may lead to reboot or not.
 * To avoid that, some memory limitations can be set (such as disabling
 overcommit), and then transmission will exit, but the router would be
 functional.
 
 I think the 2nd is quite a reasonable approach as it is more important
 to keep the router up and running than transmission (or any other
 individual service). However, a way to reduce the impact would be for
 netifd to restart transmission if crashed. Can that be done already, or
 inittab is the only option?

procd can do that. E.g. a sample init.d/service file:

#!/bin/sh /etc/rc.common

START=99

USE_PROCD=1
PROG=/usr/sbin/yourprog
CONFFILE=/etc/your.conf

start_service() {
procd_open_instance
procd_set_param command $PROG
procd_set_param file $CONFFILE
procd_set_param respawn
procd_close_instance
}

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


Re: [OpenWrt-Devel] [PATCH] base-files: add /etc/profile.d support

2015-06-10 Thread Bruno Randolf
On 06/10/2015 07:46 PM, Bastian Bittorf wrote:
 * Yousong Zhou yszhou4t...@gmail.com [10.06.2015 20:38]:
 distributions. This allows packages to install their own scripts into
 /etc/profile.d/.

 IMO, OpenWrt is not like most of other Linux distributions.  So what are
 those other packages that need this and the current specific use cases?
 
 I agree, that OpenWrt differs - and i have a usecase:
 
 1)
 we like to have special helpers like
 
 alias n='wget -qO - http://127.0.0.1:2006/neighbours'
 (for OLSRd)
 
 and we source/include a special 'metascript' which
 makes adminstration much easier. for now we patch /etc/profile
 but having it in profile.d is more clean and: it is automatically
 removed if package XY is also removed...

Right.

Also something more simple: I'd like to have ll='ls -la' on my systems
and OpenWRT based mini-distributions. Right now I have to change
package/base-files/etc/profile or override /etc/profile completely from
the files/ folder. In this case it's not too complicated, but its not
maintainable very well.

Another maybe more interesting example is the Java VM jamvm. It
depends on classpath which is quite big and one of my systems has to
be installed on the SD card. Because the libraries are on /mnt/sd/ I
need export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mnt/sd/usr/lib/classpath
for jamvm to work properly. That could go into a system and
distribution specific package which puts it into /etc/profile.d/...
which is much cleaner than overriding /etc/profile or -worse- messing
with /etc/profile in a postinst script...

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


[OpenWrt-Devel] [PATCH/RFC] bluez: Add bluez-daemon package

2015-05-29 Thread Bruno Randolf
Move bluetoothd and related programs and files from bluez-utils into
bluez-daemon package. The main motivation for this is to remove the dependency
to DBus from bluez-utils. The utilities like hcitool are useful without it.

Also add kmod-bluetooth dependency to bluez-utils, as the utils don't make much
sense without bluetooth support in the kernel.

Signed-off-by: Bruno Randolf b...@einfach.org
---
Please let me know, if this is OK, I'll send a pull request
---
 utils/bluez/Makefile | 39 +--
 1 file changed, 33 insertions(+), 6 deletions(-)

diff --git a/utils/bluez/Makefile b/utils/bluez/Makefile
index 4865698..ebc1646 100644
--- a/utils/bluez/Makefile
+++ b/utils/bluez/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=bluez
 PKG_VERSION:=5.30
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=http://www.kernel.org/pub/linux/bluetooth/
@@ -47,7 +47,7 @@ $(call Package/bluez/Default)
   SECTION:=libs
   CATEGORY:=Libraries
   TITLE+= library
-  DEPENDS:=+libpthread
+  DEPENDS:=+libpthread +kmod-bluetooth
 endef
 
 define Package/bluez-utils
@@ -55,10 +55,18 @@ $(call Package/bluez/Default)
   SECTION:=utils
   CATEGORY:=Utilities
   TITLE+= utilities
-  DEPENDS:=+bluez-libs +libpthread +librt +dbus +glib2 +libical +libncurses 
+libreadline $(INTL_DEPENDS) $(ICONV_DEPENDS)
+  DEPENDS:=+bluez-libs +libpthread +librt +glib2 +libncurses +libreadline 
$(INTL_DEPENDS) $(ICONV_DEPENDS)
 endef
 
-define Package/bluez-utils/conffiles
+define Package/bluez-daemon
+$(call Package/bluez/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE+= daemon
+  DEPENDS:=+bluez-libs +bluez-utils +dbus +libical $(INTL_DEPENDS) 
$(ICONV_DEPENDS)
+endef
+
+define Package/bluez-daemon/conffiles
 /etc/bluetooth/main.conf
 /etc/bluetooth/network.conf
 /etc/bluetooth/input.conf
@@ -109,10 +117,28 @@ endef
 
 define Package/bluez-utils/install
$(INSTALL_DIR) $(1)/usr/bin
-   $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
+   $(CP) $(PKG_INSTALL_DIR)/usr/bin/bccmd $(1)/usr/bin/
+   $(CP) $(PKG_INSTALL_DIR)/usr/bin/bluemoon $(1)/usr/bin/
+   $(CP) $(PKG_INSTALL_DIR)/usr/bin/btmon $(1)/usr/bin/
+   $(CP) $(PKG_INSTALL_DIR)/usr/bin/ciptool $(1)/usr/bin/
+   $(CP) $(PKG_INSTALL_DIR)/usr/bin/hciattach $(1)/usr/bin/
+   $(CP) $(PKG_INSTALL_DIR)/usr/bin/hciconfig $(1)/usr/bin/
+   $(CP) $(PKG_INSTALL_DIR)/usr/bin/hcidump $(1)/usr/bin/
+   $(CP) $(PKG_INSTALL_DIR)/usr/bin/hcitool $(1)/usr/bin/
+   $(CP) $(PKG_INSTALL_DIR)/usr/bin/hex2hcd $(1)/usr/bin/
+   $(CP) $(PKG_INSTALL_DIR)/usr/bin/l2ping $(1)/usr/bin/
+   $(CP) $(PKG_INSTALL_DIR)/usr/bin/l2test $(1)/usr/bin/
+   $(CP) $(PKG_INSTALL_DIR)/usr/bin/rctest $(1)/usr/bin/
+   $(CP) $(PKG_INSTALL_DIR)/usr/bin/rfcomm $(1)/usr/bin/
+   $(CP) $(PKG_INSTALL_DIR)/usr/bin/sdptool $(1)/usr/bin/
+   $(INSTALL_BIN) $(PKG_BUILD_DIR)/attrib/gatttool $(1)/usr/bin/
+endef
+
+define Package/bluez-daemon/install
+   $(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/usr/lib/bluetooth/bluetoothd $(1)/usr/bin/
+   $(CP) $(PKG_INSTALL_DIR)/usr/bin/bluetoothctl $(1)/usr/bin/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/bluetooth/obexd $(1)/usr/bin/
-   $(INSTALL_BIN) $(PKG_BUILD_DIR)/attrib/gatttool $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DATA) ./files/bluetooth.config $(1)/etc/config/bluetooth
$(INSTALL_DIR) $(1)/etc/dbus-1/system.d/
@@ -129,3 +155,4 @@ endef
 $(eval $(call BuildPackage,bluez-examples))
 $(eval $(call BuildPackage,bluez-libs))
 $(eval $(call BuildPackage,bluez-utils))
+$(eval $(call BuildPackage,bluez-daemon))
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] kernel: bluetooth: Add dependency to kmod-crypto-ecb

2015-05-29 Thread Bruno Randolf
Add dependency of kmod-crypto-ecb to kmod-bluetooth to avoid the kernel warning
Bluetooth: Unable to create crypto context.

Signed-off-by: Bruno Randolf b...@einfach.org
---
 package/kernel/linux/modules/other.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/kernel/linux/modules/other.mk 
b/package/kernel/linux/modules/other.mk
index 082c74a..955c140 100644
--- a/package/kernel/linux/modules/other.mk
+++ b/package/kernel/linux/modules/other.mk
@@ -28,7 +28,7 @@ $(eval $(call KernelPackage,6lowpan))
 define KernelPackage/bluetooth
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Bluetooth support
-  DEPENDS:=@USB_SUPPORT +kmod-usb-core +kmod-crypto-hash +kmod-lib-crc16 
+kmod-hid
+  DEPENDS:=@USB_SUPPORT +kmod-usb-core +kmod-crypto-hash +kmod-crypto-ecb 
+kmod-lib-crc16 +kmod-hid
   KCONFIG:= \
CONFIG_BLUEZ \
CONFIG_BLUEZ_L2CAP \
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] ath9k_htc: Target is unresponsive

2015-05-25 Thread Bruno Randolf
On 05/25/2015 03:38 PM, Luca Olivetti wrote:
 This is the message I get when I plug  a tp-link tl-wn722n (which is
 working fine both in an ubuntu desktop and on a mageia laptop):
 
 
 [  547.804000] usb 1-1: new high-speed USB device number 5 using ifxusb_hcd
 [  548.02] usb 1-1: ath9k_htc: Firmware htc_9271.fw requested
 [  549.296000] usb 1-1: ath9k_htc: Transferred FW: htc_9271.fw, size: 50980
 [  550.304000] ath9k_htc 1-1:1.0: ath9k_htc: Target is unresponsive
 [  550.308000] ath9k_htc: Failed to initialize the device
 
 
 Just to exclude a problem with the usb port, I tried with an rt73 based
 stick I have and it works fine.
 I have a different firmware on my desktop system, I tried it but the
 result is the same.
 
 This is with openwrt trunk on an astoria arv7518pw (lantiq xway)

Maybe a problem with the USB power supply. Can you try with a powered
USB hub?

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


Re: [OpenWrt-Devel] dnsmasq and --dhcp-relay option ?

2015-04-24 Thread Bruno Randolf
On 04/24/2015 02:26 PM, openwrt-de...@couprie.net wrote:
 The diff is for /etc/init.d/dnsmasq
 
 This diff works for me, it puts the following change in
 /var/etc/dnsmasq.conf
 
 dhcp-relay=192.168.200.1,10.255.255.225
 
 What do i need to change to submit it as a patch ?

Look at https://dev.openwrt.org/wiki/SubmittingPatches

In short:

 - Base your patch on openwrt trunk, git or svn version.

 - Create the patch from the top directory or via git diff so it
includes the full path.

 - Add a Signed-off-by line

 - Send with [PATCH] as subject prefix

 - Be careful that your email program does not line-wrap or otherwise
modify the patch. Best to use git send-email directly...

Hope that helps,
bruno


 Comments are welome :-)
 
 Perry
 
 On 24-04-15 13:21, Kevin Darbyshire-Bryant wrote:
 On 24/04/2015 11:17, Perry Couprie wrote:
 And something like this ?

 --- dnsmasq.orig2015-04-24 12:14:51.453093251 +0200
 +++ dnsmasq2015-04-24 12:15:15.121092827 +0200
 @@ -416,6 +416,10 @@
  xappend
 --dhcp-range=$networkid,$START,$END,$NETMASK,$leasetime${options:+
 $options}
  
  dhcp_option_add $cfg $networkid
 +
 +config_get relay $cfg relay
 +network_get_ipaddr interface_ip $networkid
 +xappend --dhcp-relay=$interface_ip,$relay
  }
  
  dhcp_option_add() {

 Perry

 That syntax won't work in /etc/dnsmasq.conf - it only understands
 dnsmasq options, not .init/uci script options which would then be
 passed to dnsmasq by /var/etc/dnsmasq.conf.  If you were talking about
 extending uci so that it understood additional dnsmasq options then
 I'm afraid you're beyond my level of knowledge.  Stuff that uci
 doesn't know about and is relatively static I've put into
 /etc/dnsmasq.conf manually as /var/etc/dnsmasq.conf references
 /etc/dnsmasq.conf for just such user customisation purposes.

 I hope that helps.

 Kevin



 On 24-04-15 07:48, Kevin Darbyshire-Bryant wrote:
 Hi Perry,

 The /etc/dnsmasq.conf file is outside of uci control,  so it doesn't
 get rebuilt at process start/stop and gets preserved across
 reboots/upgrades.  It's an ideal place for tweaks and options that
 the uci interface is not yet aware.  I use it all the time.  Edit
 with your favourite text editor.

 Kevin


 -- 
 Cheers,

 ke...@darbyshire-bryant.me.uk mailto:ke...@darbyshire-bryant.me.uk


 On 24 Apr 2015, at 00:10, Perry Couprie pe...@couprie.net
 mailto:pe...@couprie.net wrote:

 Can this be done by using uci commands ?

 Perry

 On 23-04-15 23:20, Kevin Darbyshire-Bryant wrote:
 On 23/04/2015 21:55, openwrt-de...@couprie.net wrote:
 Hi,

 I need the dnsmasq --dhcp-relay option, how do i add this option
 to the dnsmasq script ?

 Perry

 You could edit '/etc/dnsmasq.conf' and add your option/s directly
 to it.  Does that achieve your aim?

 Kevin


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



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


Re: [OpenWrt-Devel] Designated Driver

2015-04-07 Thread Bruno Randolf
+1

On 04/07/2015 08:47 PM, Hartmut Knaack wrote:
 That Doodle poll turned out to be spamed/trolled, and everyone could even
 change or delete other votes. Since this was just communicated over this
 mailing list, and subscribers are at least basically verified, why not have a
 good old fashioned poll?
 
 Give your +1 answer on this mail if you prefer Designated Driver.
 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] netifd loosing control over monitor interface?

2015-04-01 Thread Bruno Randolf
Hello All,

As I roughly outlined before in another thread (synchronous network
reload/restart), I am trying to re-configure several dependent network
interfaces thru ubus/netifd on BB.

I have one physical wireless device and 3 virtual interfaces:
 - moni (moni0)
 - mesh (mesh0)
 - ap (ap0)

On top of mesh0 there is batman-adv with its bat0 interface and
depending on wether a internet connection is available or not (I use
watchping) it is either configured as bat_cl (GW client, DHCP) or
bat_gw (GW, static IP).

Now, when I want to change the channel of the radio, all these
interfaces need to be re-configured.

Since I started to use the ubus C API I am able to control the async
network reload most of the time - I listen to ubus network ifup events
and issue a ubus call network reload both thru the C API. When my
monitor interface is up again I can continue, and the next step in the
program is to get it's HW address thru ioctl SIOCGIFHWADDR.

Now, after a lot of fine-tuning (add force_link to moni and assign it a
static IP 0.0.0.0 - yes, it makes a difference), that works most of the
time, say 98%, but sometimes it happens that the monitor interface is
lost, and no ifup event for it ever comes... I believe the problem
actually happens at ifdown:

Here is the output of the ubus events in this case:

Reloading network and waiting for moni...
{ network.interface: {action:ifdown,interface:mesh} }
{ network.interface: {action:ifdown,interface:bat_gw} }
{ network.interface: {action:ifdown,interface:moni} }
{ network.interface: {action:ifup,interface:bat_gw} }
{ network.interface: {action:ifup,interface:mesh} }

Normally moni comes up before mesh and bat_gw.

ifconfig still shows the moni0 interface, which is why I believe the
ifdown did not succeed:

moni0 Link encap:UNSPEC  HWaddr
AC-86-74-07-71-62-00-44-00-00-00-00-00-00-00-00
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:22 errors:0 dropped:0 overruns:0 frame:0
  TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:1000
  RX bytes:2925 (2.8 KiB)  TX bytes:0 (0.0 B)

But it's not know (available: false) to netifd any more:

root@OpenWrt:~# ubus call network.interface.moni status
{
up: false,
pending: false,
available: false,
autostart: true,
proto: static,
device: moni0,
data: {

}
}

It also does not show up in ubus call network.device status and any
attempt to re-configure it fails, e.g.:

root@OpenWrt:~# ubus call network.interface.moni up
root@OpenWrt:~# ubus call network.interface.moni status
{
up: false,
pending: false,
available: false,
autostart: true,
proto: static,
device: moni0,
data: {

},
errors: [
{
subsystem: interface,
code: NO_DEVICE
}
]
}

And even a ubus call network restart does not fix the problem. I have
to resort to reboot the system :(

Attached you there is more syslog (with comments) of this case, and my
network and wireless config files.

Thanks for any comments or ideas. Is there anything I could do to get
more debugging output of netifd?

bruno


config wifi-device 'radio0'
option type 'mac80211'
option hwmode '11g'
option path 'platform/ar933x_wmac'
option htmode 'HT20'
option disabled '0'
option channel '9'

config wifi-iface 'mesh'
option device 'radio0'
option ifname 'mesh0'
option network 'mesh'
option mode 'adhoc'
option ssid 'mesh'
option bssid '02:CA:FE:CA:CA:40'
option mcast_rate '18000'
option encryption 'none'
option disabled '0'

config wifi-iface 'monitor'
option device 'radio0'
option ifname 'moni0'
option mode 'monitor'

config wifi-iface 'ap'
option device 'radio0'
option ifname 'ap0'
option mode 'ap'
option ssid 'XXX'
option encryption 'psk2'
option key 'XXX'
option macfilter 'allow'


config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'

config interface 'lan'
option ifname 'eth0'
option force_link '1'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'

config interface 'wan'
option ifname 'eth1'
option proto 'dhcp'
option metric '2'

config interface 'mesh'
option mtu '1532'
option proto 'batadv'
option mesh 'bat0'

config interface 'bat_cl'
option ifname 'bat0'
option proto 'dhcp'
option metric '1'
option auto '0'

config interface 'bat_gw'
option ifname 'bat0'
option proto 'static'
option mtu '1500'
option ipaddr '10.0.0.1'
 

Re: [OpenWrt-Devel] synchronous network reload/restart

2015-03-31 Thread Bruno Randolf
Hi,

It seems netifd itself and batman-adv also has a similar problem. See
the lines below:

./batadv.sh: eval: line 1: can't create
/sys/class/net/mesh0/batman_adv/mesh_iface: nonexistent directory

Tue Mar 31 09:38:01 2015 daemon.notice netifd: radio0 (6033): ifconfig:
SIOCSIFHWADDR: Invalid argument

This only happens sometimes, not always... More log:

Tue Mar 31 09:38:00 2015 daemon.info confsync[5896]: Interface moni is up
Tue Mar 31 09:38:00 2015 daemon.notice netifd: Interface 'moni' is now up
Tue Mar 31 09:38:00 2015 daemon.notice netifd: mesh (5931): ./batadv.sh:
eval: line 1: can't create /sys/class/net/mesh0/batman_adv/mesh_iface:
nonexistent directory
Tue Mar 31 09:38:00 2015 daemon.notice netifd: Network device 'moni0'
link is down
Tue Mar 31 09:38:00 2015 daemon.notice netifd: Interface 'moni' has link
connectivity loss
Tue Mar 31 09:38:00 2015 daemon.notice netifd: Interface 'moni' is now down
Tue Mar 31 09:38:00 2015 daemon.err confsync[5896]: MAC addr ioctl failed
Tue Mar 31 09:38:00 2015 daemon.notice netifd: Interface 'moni' is disabled
Tue Mar 31 09:38:00 2015 daemon.notice netifd: Interface 'moni' is enabled
Tue Mar 31 09:38:00 2015 daemon.notice netifd: Interface 'moni' is disabled
Tue Mar 31 09:38:01 2015 daemon.notice netifd: Interface 'moni' is enabled
Tue Mar 31 09:38:01 2015 daemon.notice netifd: Network device 'moni0'
link is up
Tue Mar 31 09:38:01 2015 daemon.notice netifd: Interface 'moni' has link
connectivity
Tue Mar 31 09:38:01 2015 daemon.notice netifd: Interface 'moni' is
setting up now
Tue Mar 31 09:38:01 2015 daemon.notice netifd: Interface 'moni' is now up
Tue Mar 31 09:38:01 2015 daemon.notice netifd: radio0 (6033): ifconfig:
SIOCSIFHWADDR: Invalid argument

bruno

On 03/30/2015 11:56 PM, Bruno Randolf wrote:
 On 03/30/2015 11:26 AM, Zefir Kurtisi wrote:
 On 03/26/2015 06:54 PM, Jo-Philipp Wich wrote:
 Hi.

 Is there any way to synchronously (blocking) reload or restart the
 network configuration?

 ubus call network reload (or restart) returns immediately, and the
 re-configuration happens asynchronously in the background. I'd like the
 command to block or otherwise wait until the reconfiguration is
 complete. Any way to achieve this?

 No.

 ~ Jow

 Potential 'workarounds'

 1) if you need to wait for your AP
 use e.g. 'ubus -t 30 wait_for hostapd.wlan0'
 to wait for it up to 30 secs to show up

 2) to synchronize PROCD startup-scripts
 add a service_started() method in your scripts that does busy-polling for
 procd/netifd to bring up services. This blocks subsequent init-scripts from 
 being
 executed before your current script is done.


 Some kind of dependency tracking within procd would help for sure (e.g. 
 'start
 this service only after services x+y are running'), but given how services 
 are
 handled as independent instances now, this would add lots of complexity to 
 modules
 that must not fail.
 
 Thanks for these workarounds, they do not help me, but may be useful for
 someone else in the future.
 
 I am dealing with the problem of re-configuration of multiple dependent
 virtual interfaces: an ad-hoc interface, a monitor interface, an AP and
 a BATMAN-ADV bat0 interface all on one wireless device. Also I have a
 service which depends on the monitor interface, and needs to be
 restarted when that devices gets re-created.
 
 So far got some results by making the necessary ubus calls equivalent of
 ubus call network reload via the C interface, and waiting for the ubus
 events also thru the C API, but sometimes it seems I get a ifup ({
 network.interface: {action:ifup,interface:moni} }) event
 before the device is really available, because directly after that,
 getting the MAC address by SIOCGIFHWADDR ioctl fails...
 
 Any ideas?
 
 bruno
 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] synchronous network reload/restart

2015-03-30 Thread Bruno Randolf
On 03/30/2015 11:26 AM, Zefir Kurtisi wrote:
 On 03/26/2015 06:54 PM, Jo-Philipp Wich wrote:
 Hi.

 Is there any way to synchronously (blocking) reload or restart the
 network configuration?

 ubus call network reload (or restart) returns immediately, and the
 re-configuration happens asynchronously in the background. I'd like the
 command to block or otherwise wait until the reconfiguration is
 complete. Any way to achieve this?

 No.

 ~ Jow
 
 Potential 'workarounds'
 
 1) if you need to wait for your AP
 use e.g. 'ubus -t 30 wait_for hostapd.wlan0'
 to wait for it up to 30 secs to show up
 
 2) to synchronize PROCD startup-scripts
 add a service_started() method in your scripts that does busy-polling for
 procd/netifd to bring up services. This blocks subsequent init-scripts from 
 being
 executed before your current script is done.
 
 
 Some kind of dependency tracking within procd would help for sure (e.g. 'start
 this service only after services x+y are running'), but given how services are
 handled as independent instances now, this would add lots of complexity to 
 modules
 that must not fail.

Thanks for these workarounds, they do not help me, but may be useful for
someone else in the future.

I am dealing with the problem of re-configuration of multiple dependent
virtual interfaces: an ad-hoc interface, a monitor interface, an AP and
a BATMAN-ADV bat0 interface all on one wireless device. Also I have a
service which depends on the monitor interface, and needs to be
restarted when that devices gets re-created.

So far got some results by making the necessary ubus calls equivalent of
ubus call network reload via the C interface, and waiting for the ubus
events also thru the C API, but sometimes it seems I get a ifup ({
network.interface: {action:ifup,interface:moni} }) event
before the device is really available, because directly after that,
getting the MAC address by SIOCGIFHWADDR ioctl fails...

Any ideas?

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


[OpenWrt-Devel] synchronous network reload/restart

2015-03-26 Thread Bruno Randolf
Hello,

Is there any way to synchronously (blocking) reload or restart the
network configuration?

ubus call network reload (or restart) returns immediately, and the
re-configuration happens asynchronously in the background. I'd like the
command to block or otherwise wait until the reconfiguration is
complete. Any way to achieve this?

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


Re: [OpenWrt-Devel] ar71xx update to v3.18

2015-02-16 Thread Bruno Randolf
Hi!

Tested on OM2P and TP-Link WDR3600, looks good: boots, nothing obviously
broken, wifi works, eth works, but I have not ran it more than 10
minutes each.

Greetings,
bruno

On 02/15/2015 07:49 PM, John Crispin wrote:
 Hi,
 
 i just pushed the v3.18 support for ar71xx. i have tested this on
 carambola2, unifi and wndr4300. the default is still at 3.14. please
 start testing on more hardware.
 
 to do so you need to set the kernel to 3.18 in
 target/linux/ar71xx/Makefile as the default is still at 3.14.
 
 902-unaligned_access_hacks.patch was rebased, however there might be new
 places in the stack that need the hack applied. testing for this is also
 welcome.
 
   John
 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] au1xxx v3.18

2015-02-09 Thread Bruno Randolf
Hi John,

Something's wrong with the serial, but I was able to login via Ethernet.

I did not verify PCI yet, as I only have a PCI adapter on the cubes
which are in use.

Serial log below:

bruno

On 02/09/2015 12:26 PM, John Crispin wrote:
 Hi Bruno, (or anyone else that has the hw at hand)
 
 i pushed the v3.18 support. could you test it please and let me know if
 it is working ? you need to set 3.18 in the Makefile, it is still at 3.14.

[0.00] Linux version 3.18.6 (br1@shiva) (gcc version 4.8.3
(OpenWrt/Linaro GCC 4.8-2014.04 r44360) ) #1 Mon Feb 9 20:19:34 WET 2015
[0.00] bootconsole [early0] enabled
[0.00] CPU0 revision is: 01030202 (Au1500)
[0.00] 4G Systems MTX-1 Board
[0.00] Determined physical RAM map:
[0.00]  memory: 0400 @  (usable)
[0.00] Initrd not found or empty - disabling initrd
[0.00] Zone ranges:
[0.00]   Normal   [mem 0x-0x03ff]
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x-0x03ff]
[0.00] Initmem setup node 0 [mem 0x-0x03ff]
[0.00] Primary instruction cache 16kB, VIPT, 4-way, linesize 32
bytes.
[0.00] Primary data cache 16kB, 4-way, VIPT, no aliases,
linesize 32 bytes
[0.00] Built 1 zonelists in Zone order, mobility grouping on.
Total pages: 16256
[0.00] Kernel command line: root=/dev/mtdblock/0
console=ttyS0,115200 root=/dev/mtdblock0 rootfstype=squashfs,jffs2
[0.00] PID hash table entries: 256 (order: -2, 1024 bytes)
[0.00] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[0.00] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[0.00] Memory: 60556K/65536K available (2412K kernel code, 95K
rwdata, 476K rodata, 144K init, 195K bss, 4980K reserved)
[0.00] NR_IRQS:128
[0.00] Alchemy clocksource installed
[0.004000] Calibrating delay loop... 395.26 BogoMIPS (lpj=790528)
[0.04] pid_max: default: 32768 minimum: 301
[0.044000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[0.048000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096
bytes)
[0.056000] NET: Registered protocol family 16
[0.06] Alchemy clocktree installed
[0.064000] Alchemy DMA initialized
[0.068000] alchemy-pci alchemy-pci.0: PCI controller at 32 MHz
[0.10] PCI host bridge to bus :00
[0.104000] pci_bus :00: root bus resource [mem
0x4000-0x4fff]
[0.108000] pci_bus :00: root bus resource [io  0x1000-0x]
[0.112000] pci_bus :00: No busn resource found for root bus,
will use [bus 00-ff]
[0.116000] Switched to clocksource alchemy-counter1
[0.124000] NET: Registered protocol family 2
[0.128000] TCP established hash table entries: 1024 (order: 0, 4096
bytes)
[0.136000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[0.144000] TCP: Hash tables configured (established 1024 bind 1024)
[0.152000] TCP: reno registered
[0.156000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[0.16] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[0.168000] NET: Registered protocol family 1
[0.176000] futex hash table entries: 256 (order: -1, 3072 bytes)
[0.188000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[0.192000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME)
(CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[0.216000] msgmni has been set to 118
[0.224000] io scheduler noop registered
[0.228000] io scheduler deadline registered (default)
[0.232000] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[0.24] console [ttyS0] disabled
[0.244000] serial8250.8: ttyS0 at MMIO 0x1110 (irq = 8,
base_baud = 18187500) is a 16550A
���


With 14.07 the last part looks like this:

[0.18] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[0.192000] serial8250.8: ttyS0 at MMIO 0x1110 (irq = 8) is a 16550A
[0.20] console [ttyS0] enabled, bootconsole disabled
[0.20] console [ttyS0] enabled, bootconsole disabled
[0.216000] serial8250.8: ttyS1 at MMIO 0x1140 (irq = 11) is a 16550A
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] [ar71xx] Add support for MERCURY MAC1200R

2015-01-11 Thread Bruno Randolf
On 01/11/2015 09:25 PM, Gioacchino Mazzurco wrote:
 The device has two radios:
  - 802.11abgn AR9344 SoC, ath9k, working OK
  - 802.11ac QCA988x, ath10k, working in AP and STA modes

Interesting device. Can you post more specs, or add to the TOH wiki?

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


[OpenWrt-Devel] Dual Wifi for OpenWRT

2015-01-10 Thread Bruno Randolf
Hello!

Does anyone know a hardware platform with 2 or more wifi interfaces
which can both be used in the 2.4 GHz band?

I just went thru the table of hardware looking for boards which have
more than one wifi. Unfortunately all of the consumer APs tagged with
2WNIC seem to have 1 wifi for 2.4GHz and one for 5GHz. The few other
boards which can support more than one wifi (RouterBoard, Complex,
Gateworks) are miniPCI or mPCIe based and look like developer boards
meaning one has to get the board, cards, casing separately and assemble
it manually...

Is there really no readily availabe HW with more than one wifi? I'm
puzzled...

Thanks for any pointers...
bruno
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Dual Wifi for OpenWRT

2015-01-10 Thread Bruno Randolf
On 01/10/2015 08:38 PM, David Lang wrote:
 I would not expect to find consumer hardware that had two radios on the
 2.4GHz band, the problems that you would run into trying to keep the
 output of one radio from deafening the other (if not outright popping
 the receiver amps) would be significant (to say the least). It could be
 done, but it would take antenna setups that you just don't see mass
 produced to even get started.

Right, that is a good explanation why no consumer HW with this feature
exists.

 Even the enterprise grade hardware that has multiple radios tends to
 have problems with this. It takes having very directional antennas to
 try and keep as much of the signal away from the other radio to even start.

Hmm... Yes antenna placement is important and difficult, but I know
setups where this works quite well. E.g. using RouterStation Pro with 3
MiniPCI cards (ath5k/ath9k).

 What is it that you are trying to accomplish?

For one part I'm trying to find alternatives to that RouterStationPro
board which is EOL.

But in the current case I actually want to have one or more radios in
monitor mode (running horst, switching thru channels) and another one
for connectivity (mesh). In this case the interference problems you
mention don't exist, but I admit that this is not a very usual
use-case... ;)

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


Re: [OpenWrt-Devel] [PATCH] au1000: distinguish different models and set correct MAC-address

2014-12-11 Thread Bruno Randolf
Hi Bastian,

There is a syntax error in the /etc/uci-defaults/02_network script, but
even when I fix that, the MAC address is not set. What is
ucidef_set_interface_macaddr supposed to do?

Some more comments below:

On 12/10/2014 09:26 PM, Bastian Bittorf wrote:
 The target au1000 has at least 2 different models, the
 'InternetBox' and the 'MeshCube' which look very similar
 from the kernel point of view but are totally different
 devices which base on the same design. Populating /tmp/sysinfo
 now. The 1st one has an issue which leads to a random
 mac-address after each boot which is corrected now via
 reading the bootloader-env. The real fix would be
 converting to DTS, this is only a workaround now.
 Signed-off-by: Bastian Bittorf bitt...@bluebottle.com
 ---
  .../au1000/base-files/etc/uci-defaults/02_network  |   17 ++
  target/linux/au1000/base-files/lib/au1000.sh   |   59 
 
  2 files changed, 76 insertions(+)
  create mode 100755 target/linux/au1000/base-files/etc/uci-defaults/02_network
  create mode 100644 target/linux/au1000/base-files/lib/au1000.sh
 
 diff --git a/target/linux/au1000/base-files/etc/uci-defaults/02_network 
 b/target/linux/au1000/base-files/etc/uci-defaults/02_network
 new file mode 100755
 index 000..80bfb73
 --- /dev/null
 +++ b/target/linux/au1000/base-files/etc/uci-defaults/02_network
 @@ -0,0 +1,17 @@
 +#!/bin/sh
 +
 +. /lib/au1000.sh
 +. /lib/functions/system.sh
 +. /lib/functions/uci-defaults.sh
 +MAC=
 +
 +case $(au1000_board_name) in
 + 'internetbox')
 + MAC=$( au1000_yamonenv_getvar 'ethaddr' )
 + MAC=$( macaddr_canonicalize $MAC )
 +
 + [ -n $MAC ]  ucidef_set_interface_macaddr lan $MAC

/etc/uci-defaults/02_network: line 13: syntax error: unterminated quoted
string - around $MAC

 + ;;
 +esac
 +
 +[ -z $MAC ] || uci commit network
 diff --git a/target/linux/au1000/base-files/lib/au1000.sh 
 b/target/linux/au1000/base-files/lib/au1000.sh
 new file mode 100644
 index 000..556598d
 --- /dev/null
 +++ b/target/linux/au1000/base-files/lib/au1000.sh
 @@ -0,0 +1,59 @@
 +#!/bin/sh
 +
 +au1000_yamonenv_getvar()
 +{
 + local varname=$1
 + local partition
 +
 + . /lib/functions.sh
 +
 + partition=$( find_mtd_part 'yamon env' )
 + YAMONENVFILE=$partition yamonenv $varname

That part also works on the Cube with JFFS2. I get the MAC address
correctly.

 +au1000_detect()
 +{
 + local line board_name model
 +
 + while read line; do
 + case $line in
 + 'system type'*)
 + break
 + ;;
 + esac
 + done '/proc/cpuinfo'
 +
 + case $line in
 + *' MTX-1')
 + # both models appear nearly similar: the 'InternetBox' 
 has
 + # the same design but shrinked to 1 PCB and only 1 x 
 miniPCI
 + # for WiFi/ath5k and 1 x miniPCI for CardBus/UMTS, they 
 differ
 + # in BogoMIPS but there are old MeshCubes with 330 Mhz 
 instead
 + # of 400 MHz and no Cube has 'imei' (for UMTS) set in 
 bootloader-env
 +
 + if [ -n $( au1000_yamonenv_getvar 'imei' ) ]; then
 + board_name='internetbox'
 + model='T-Mobile InternetBox TMD SB1-S'
 + else
 + board_name='meshcube'
 + model='4G Systems AccessCube/MeshCube'
 + fi
 + ;;
 + *)
 + board_name='unknown'
 + model='unknown'

That case statement looks pointless, but it makes sense to easily extend
the Models. For example there is one more au1000 based board I know of,
the XXS1500 from mycable.de

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


Re: [OpenWrt-Devel] au1000 - 3.14 tested needed

2014-12-10 Thread Bruno Randolf
Hi Bastian,

Sorry for the delay.

On 12/08/2014 08:01 PM, Bastian Bittorf wrote:
 what is strange: the ethernet-mac is always changing
 after each reboot. not sure if this was also the case
 with 3.10 - bruno can you see this too?

Yes, I can confirm this.
I just checked: The same happens on 14.07 with kernel 3.10.49 so we
haven't noticed this problem since a while...

 what is also strange: 'yamonenv' is installed, but simply
 does not work. i never used it before, so i'am not sure
 if it was ever working...

yanmonenv works over here (tested on 14.07 and trunk):

root@OpenWrt:/# yamonenv -a
memsize=0x0400
prompt=YAMON
start=go 0xbfd0 root=/dev/mtdblock/0
modetty0=115200,n,8,1,none
modetty1=115200,n,8,1,none
bootserport=tty0
ethaddr=00.0e.56.00.00.f7
ipaddr=192.168.1.1
subnetmask=255.255.255.0
gateway=0.0.0.0
bootprot=tftp
bootserver=192.168.1.9
bootfile=vmlinux-mtx.srec
MAC=0
cubeID=247
tftp=load /vmlinux.srec; go . root=/dev/mtdblock/0
flash=go 0xbfd0 root=/dev/mtdblock/0
startwaittime=30
load=
lo=load /vmlinux.srec

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


Re: [OpenWrt-Devel] au1000 - 3.14 tested needed

2014-12-10 Thread Bruno Randolf
On 12/10/2014 11:30 AM, Bastian Bittorf wrote:
 so, does this mean we have not applied DTS to this target?

Very likely.

I don't remember how we got the MAC addr set before DT.

 what is also strange: 'yamonenv' is installed, but simply
 does not work. i never used it before, so i'am not sure
 if it was ever working...

 yanmonenv works over here (tested on 14.07 and trunk):
 
 strange - i have only a 'T-Mobile InternetBox TMD SB1-S' here.
 Do you have a real cube? I'am rebuilding now and will check again
 why 'yamonenv' does not output anything here. partitions look like:

For me yamonenv works on both the cube and the internet box. Maybe
your YAMON environment is messed up and has a bad checksum? Not sure,
would need to check the code of yamonenv, but I don't have the time to
do that right now.

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


Re: [OpenWrt-Devel] au1000 - 3.14 tested needed

2014-12-02 Thread Bruno Randolf
Hi John,

Thanks!

I just tested it: up  running, PCI got detected, Wifi works, looking
good... :)

root@OpenWrt:/# uname -a
Linux OpenWrt 3.14.25 #1 Mon Dec 1 20:42:17 WET 2014 mips GNU/Linux

bruno

On 12/01/2014 04:55 PM, John Crispin wrote:
 Hi,
 
 i pushed 3.14 support for au1000. i have no hw for testing so this is
 only compile tested and hence i left 3.10 as default. can someone test
 3.14 so we can set it as default please.
 
   John
 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] OM2P firmware upgrade with LuCI

2014-11-28 Thread Bruno Randolf
Hi!

I just noted that there is an issue with the firmware upgrade via LuCI
on the OM2P. The image validity check fails, because the following
script in system.lua fails:

local function image_supported()
-- XXX: yay...
return ( 0 == os.execute(
. /lib/functions.sh;  ..
include /lib/upgrade;  ..
platform_check_image %q /dev/null
% image_tmp
) )
end

Calling platform_check_image directly fails due to the way
target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh is written
(break), but I believe the better way would be to use sysupgrade -T
anyhow - it works if I change the code like this:

local function image_supported()
return ( 0 == os.execute(
sysupgrade -T %q /dev/null
% image_tmp
) )
end

Any chance to get this into LuCI or should /lib/upgrade/openmesh.sh be
rewritten to be compatible with the (yay) LuCI way?

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


Re: [OpenWrt-Devel] Problems with ffmpeg and alsa-lib

2014-10-14 Thread Bruno Randolf
On 10/13/2014 10:48 PM, Ted Hess wrote:
 2 - Building alsa-lib has no dependency on the host system's audio
 setup. The problem you are seeing is indeed a problem with your build
 environment, and what tools you have installed. More information is
 needed about our build system and target config before I can help you.

I'm building on Ubuntu 14.04, for ar71xx and au1000 targets. The problem
happens in OpenWRT 14.07 and trunk.

It looks like the host gcc gets called with the target CFLAGS, see the
config.log below. Tell me if there is anything else you need to know.

bruno


build_dir/target-mips_34kc_uClibc-0.9.33.2/alsa-lib-1.0.28/config.log
-

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by alsa-lib configure 1.0.28, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ./configure --target=mips-openwrt-linux --host=mips-openwrt-linux
--build=x86_64-linux-gnu --program-prefix= --program-suffix=
--prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
--libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share
--localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls
--disable-python --disable-debug --without-debug --with-float=soft
--with-versioned=no

## - ##
## Platform. ##
## - ##

hostname = shiva
uname -m = x86_64
uname -r = 3.13.0-37-generic
uname -s = Linux
uname -v = #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014

/usr/bin/uname -p = unknown
/bin/uname -X = unknown

/bin/arch  = unknown
/usr/bin/arch -k   = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo  = unknown
/bin/machine   = unknown
/usr/bin/oslevel   = unknown
/bin/universe  = unknown

PATH:
/home/br1/dev/openwrt/trunk/openwrt/staging_dir/target-mips_34kc_uClibc-0.9.33.2/host/bin
PATH:
/home/br1/dev/openwrt/trunk/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin
PATH: /home/br1/dev/openwrt/trunk/openwrt/staging_dir/host/bin
PATH:
/home/br1/dev/openwrt/trunk/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin
PATH: /home/br1/dev/openwrt/trunk/openwrt/staging_dir/host/bin
PATH:
/home/br1/dev/openwrt/trunk/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin
PATH: /home/br1/dev/openwrt/trunk/openwrt/staging_dir/host/bin
PATH: /home/br1/bin
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/games
PATH: /usr/local/games


## --- ##
## Core tests. ##
## --- ##

configure:2281: loading site script
/home/br1/dev/openwrt/trunk/openwrt/include/site/mips-openwrt-linux-uclibc
| #!/bin/sh
|
| . $TOPDIR/include/site/mips-linux
| . $TOPDIR/include/site/linux-uclibc
|
configure:2414: checking build system type
configure:2428: result: x86_64-pc-linux-gnu
configure:2448: checking host system type
configure:2461: result: mips-openwrt-linux-gnu
configure:2497: checking for a BSD-compatible install
configure:2565: result: /usr/bin/install -c
configure:2576: checking whether build environment is sane
configure:2626: result: yes
configure:2675: checking for mips-openwrt-linux-strip
configure:2702: result: mips-openwrt-linux-uclibc-strip
configure:2767: checking for a thread-safe mkdir -p
configure:2806: result: /bin/mkdir -p
configure:2819: checking for gawk
configure:2835: found /usr/bin/gawk
configure:2846: result: gawk
configure:2857: checking whether make sets $(MAKE)
configure:2879: result: yes
configure:2970: checking whether to enable maintainer-specific portions
of Makefiles
configure:2979: result: yes
configure:3005: checking whether make supports nested variables
configure:3022: result: yes
configure:3039: checking for cross-compiler
configure:3048: result: gcc
configure:3063: checking for mips-openwrt-linux-gcc
configure:3090: result: gcc
configure:3359: checking for C compiler version
configure:3368: gcc --version 5
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:3379: $? = 0
configure:3368: gcc -v 5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib
--enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes

[OpenWrt-Devel] ffmpeg on au1500 --disable-mips32r2

2014-10-13 Thread Bruno Randolf
Hello again,

ffmpeg tries to automatically enable optimizations for the MIPS
platform, but for au1500 it automatically enables mips32r2, which this
CPU does not support.

For now, I could fix the problem by adding --disable-mips32r2 to
FFMPEG_CONFIGURE, but again, this is probably not the correct solution
for all platforms. How should it be done right?

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


[OpenWrt-Devel] luci-app-minidlna disables minidlna?

2014-07-21 Thread Bruno Randolf
Hi Garbor,

In luci-app-mindlna we find the following in
/etc/uci-defaults/luci-minidlna:

3   /etc/init.d/minidlna enabled  {
4   /etc/init.d/minidlna stop
5   /etc/init.d/minidlna disable
6   }

Which disables MiniDLNA startup and is a quite unexpected side-effect of
installing a web-interface plugin, don't you think? Any reason for
this? Can this be removed?

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


Re: [OpenWrt-Devel] Sysupgrade to Barrier Breaker on au1000 (MTX-1)

2014-07-21 Thread Bruno Randolf
On 07/18/2014 06:25 PM, John Crispin wrote:
 4) we make a script that we call after the build on the server that
 repackages the images
 
 how about that ?

Hmmm, I think it should not be done on the server, but as part of the
OpenWRT build - also if I compile locally I would like to get a
sysupgrade image to upgrade from AA to BB... Relying on server scripts
would exclude this possibility, and also make more awkward to maintain
your build server scripts (special cases for rare platforms).

It would be possible to create a special image for upgrade from AA,
something like
openwrt-au1000-au1500-jffs2-128k-sysupgrade-from-12.09.bin, but I
think it's simpler to just add a symlink to the tar.gz in all cases,
like this:

diff --git a/target/linux/au1000/image/Makefile
b/target/linux/au1000/image/Makefile
index 63c0b03..060f87a 100644
--- a/target/linux/au1000/image/Makefile
+++ b/target/linux/au1000/image/Makefile
@@ -63,8 +63,11 @@ define Image/Build
$(CP) $(KDIR)/kernel.flash.srec
$(BIN_DIR)/$(IMG_PREFIX)-vmlinux-flash.srec
$(CP) $(KDIR)/kernel.ram.srec
$(BIN_DIR)/$(IMG_PREFIX)-vmlinux-ram.srec
$(CP) $(BIN_DIR)/$(IMG_PREFIX)-$(1).fs
$(TMP_DIR)/$(IMG_PREFIX)-root.fs
+   # link for backwards compatibility with Attitude Adjustment
+   ln -sfn $(TMP_DIR)/$(IMG_PREFIX)-root.fs
$(TMP_DIR)/$(IMG_PREFIX)-jffs2-128k.fs
tar -C $(BIN_DIR) -cvzf
$(BIN_DIR)/$(IMG_PREFIX)-$(1)-sysupgrade.bin \
-   $(IMG_PREFIX)-vmlinux.bin -C $(TMP_DIR)
$(IMG_PREFIX)-root.fs
+   $(IMG_PREFIX)-vmlinux.bin -C $(TMP_DIR)
$(IMG_PREFIX)-root.fs \
+   $(IMG_PREFIX)-jffs2-128k.fs
 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
$(call Image/Build/Initramfs)
 endif

What do you think? If you agree I will post this as a properly formatted
patch.

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


Re: [OpenWrt-Devel] Sysupgrade to Barrier Breaker on au1000 (MTX-1)

2014-07-21 Thread Bruno Randolf
On 07/21/2014 12:28 PM, Bruno Randolf wrote:
 It would be possible to create a special image for upgrade from AA,
 something like
 openwrt-au1000-au1500-jffs2-128k-sysupgrade-from-12.09.bin, but I
 think it's simpler to just add a symlink to the tar.gz in all cases,

The symlink approach does not work, as dd does not recognize the symlink
and the rootfs is broken afterwards. So IMHO the best solution is to
create a special sysupgrade image for upgrade from 12.09, like
openwrt-au1000-au1500-jffs2-128k-sysupgrade-from-12.09.bin...

diff --git a/target/linux/au1000/image/Makefile
b/target/linux/au1000/image/Makefile
index 63c0b03..56f613b 100644
--- a/target/linux/au1000/image/Makefile
+++ b/target/linux/au1000/image/Makefile
@@ -65,6 +65,10 @@ define Image/Build
$(CP) $(BIN_DIR)/$(IMG_PREFIX)-$(1).fs
$(TMP_DIR)/$(IMG_PREFIX)-root.fs
tar -C $(BIN_DIR) -cvzf
$(BIN_DIR)/$(IMG_PREFIX)-$(1)-sysupgrade.bin \
$(IMG_PREFIX)-vmlinux.bin -C $(TMP_DIR)
$(IMG_PREFIX)-root.fs
+   # backwards compatible image for upgrade from Attitude
Adjustment (12.09)
+   $(CP) $(BIN_DIR)/$(IMG_PREFIX)-$(1).fs
$(TMP_DIR)/$(IMG_PREFIX)-jffs2-128k.fs
+   tar -C $(BIN_DIR) -cvzf
$(BIN_DIR)/$(IMG_PREFIX)-$(1)-sysupgrade-from-12.09.bin \
+   $(IMG_PREFIX)-vmlinux.bin -C $(TMP_DIR)
$(IMG_PREFIX)-jffs2-128k.fs
 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
$(call Image/Build/Initramfs)
 endif

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


Re: [OpenWrt-Devel] Sysupgrade to Barrier Breaker on au1000 (MTX-1)

2014-07-21 Thread Bruno Randolf
On 07/21/2014 02:22 PM, John Crispin wrote:
 i will merge a patch post the rc2 fork that will generate old and new
 images int he release branch while not doing so in the dev trunk. i
 really dont want any workarounds in trunk
 
 how about that ?

Sounds OK to me. Anyhow there are not so many au1000 users out there and
I guess we can expect them to follow the major OpenWRT releases...

bruno

   John
 
 On 21/07/2014 15:20, Bruno Randolf wrote:
 On 07/21/2014 12:28 PM, Bruno Randolf wrote:
 It would be possible to create a special image for upgrade from 
 AA, something like 
 openwrt-au1000-au1500-jffs2-128k-sysupgrade-from-12.09.bin, but
 I think it's simpler to just add a symlink to the tar.gz in all
 cases,

 The symlink approach does not work, as dd does not recognize the 
 symlink and the rootfs is broken afterwards. So IMHO the best 
 solution is to create a special sysupgrade image for upgrade from 
 12.09, like 
 openwrt-au1000-au1500-jffs2-128k-sysupgrade-from-12.09.bin...

 diff --git a/target/linux/au1000/image/Makefile 
 b/target/linux/au1000/image/Makefile index 63c0b03..56f613b 100644 
 --- a/target/linux/au1000/image/Makefile +++ 
 b/target/linux/au1000/image/Makefile @@ -65,6 +65,10 @@ define 
 Image/Build $(CP) $(BIN_DIR)/$(IMG_PREFIX)-$(1).fs 
 $(TMP_DIR)/$(IMG_PREFIX)-root.fs tar -C $(BIN_DIR) -cvzf 
 $(BIN_DIR)/$(IMG_PREFIX)-$(1)-sysupgrade.bin \ 
 $(IMG_PREFIX)-vmlinux.bin -C $(TMP_DIR) $(IMG_PREFIX)-root.fs + # 
 backwards compatible image for upgrade from Attitude Adjustment 
 (12.09) +   $(CP) $(BIN_DIR)/$(IMG_PREFIX)-$(1).fs 
 $(TMP_DIR)/$(IMG_PREFIX)-jffs2-128k.fs +   tar -C $(BIN_DIR) 
 -cvzf $(BIN_DIR)/$(IMG_PREFIX)-$(1)-sysupgrade-from-12.09.bin \ + 
 $(IMG_PREFIX)-vmlinux.bin -C $(TMP_DIR)
 $(IMG_PREFIX)-jffs2-128k.fs ifeq
 ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) $(call Image/Build/Initramfs)
 endif

 bruno

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


Re: [OpenWrt-Devel] Sysupgrade to Barrier Breaker on au1000 (MTX-1)

2014-07-17 Thread Bruno Randolf
Hi John and all,

On 07/17/2014 08:14 AM, John Crispin wrote:
 au1000 was not updated for BB and as you see there is some work missing.
 
 feel free to send a patch to fix the sysupgrade issue. Once that is
 done and if you volunteert to maintain au1000 for BB, then we culd add
 it to the list of targets that we build for rc2

I volunteer to maintain au1000. The only devices I have are MTX-1
though, but I believe there are not many other au1000 boards out in the
wild anyways.

I don't know how to fix the sysupgrade issue. Basically the name used in
AA was wrong (ROOTFS_IMG=openwrt-au1000-au1500-jffs2-128k.fs) and this
has been chnaged to something more generic in BB
(ROOTFS_IMG=openwrt-au1000-au1500-root.fs). sysupgrade from BB to BB
works OK, but the problem is upgrade from AA to BB, where the ROOTFS_IMG
names in the tar do not match.

The only solutions I can think of are, none of which I find really good:

1) Keep on using the old (wrong) name for all image types
2) Provide a symlink with the old name for upgrade from AA to BB
3) Add backwards compatibility code to /lib/upgrade/platform.sh

Any other ideas?

What are the other things that are missing for au1000 in BB?

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


[OpenWrt-Devel] Barrier Breaker on au1000 (MTX-1)

2014-07-15 Thread Bruno Randolf
Hello,

I needed to update the kernel version to 3.10.44 to compile Barrier
Breaker for au1000 (MTX-1):

diff --git a/target/linux/au1000/Makefile b/target/linux/au1000/Makefile

index 2f9c24d..5fb4a43 100644

--- a/target/linux/au1000/Makefile
+++ b/target/linux/au1000/Makefile
@@ -13,7 +13,7 @@ FEATURES:=squashfs usb pci
 SUBTARGETS=au1500 au1550
 MAINTAINER:=Florian Fainelli flor...@openwrt.org

-LINUX_VERSION:=3.6.11
+LINUX_VERSION:=3.10.44

 include $(INCLUDE_DIR)/target.mk
 DEFAULT_PACKAGES += wpad-mini yamonenv

With this change everything works fine, apart from that the htmode
option was empty for ath5k devices, but that's a different story.

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


[OpenWrt-Devel] Sysupgrade to Barrier Breaker on au1000 (MTX-1)

2014-07-15 Thread Bruno Randolf
Another problem I noted when upgrading from AA to BB on MTX-1:

# sysupgrade -n /tmp/openwrt-au1000-au1500-jffs2-128k-sysupgrade.bin
tar: openwrt-au1000-au1500-jffs2-128k.fs: not found in archive
Invalid image contents
Image check 'platform_check_image' failed.

I needed to change in /lib/upgrade/platform.sh:
ROOTFS_IMG=openwrt-au1000-au1500-root.fs

In AA the ROOTFS image was called differently, the name in BB makes more
sense, but how could we provide a good upgrade path from AA to BB?

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


Re: [OpenWrt-Devel] [PATCH][packages]firewall3: optimize by loading conntrack modules on demand

2013-11-04 Thread Bruno Randolf
Hi!

Auto-loading only the required modules definetly helps a lot for low CPU
power systems like the Soekris net48xx.

We have seen a difference in sirq (Soft IRQ) load of 80% with conntrack
modules versus 12% without any iptables modules when the system is hit
with 50Mbps UDP traffic on the ethernet. Or with iperf UDP it's 30Mbps
vs 36Mbps (all modues/no conntrack modules), but here the iperf process
itself takes a lot of CPU time.

So, for small systems which do not use a firewall or which have a
firewall configuration without conntrack it would be really good to load
the modules on demand...

bruno






On 11/04/2013 10:27 AM, Takayuki Kaiso wrote:
 Thanks for the suggestions for each line, I failed to care for port
 forwarding (redirect) case.
 
 1. autoload issues
 I basically agree to the simple way you said, only load them when
 needed for the first time.
 then, continuous running system, with low cpu power, dynamically change
 firewall configuration
 will not be helped, but I hope it should be rare.
 
 2. regarding the redundant lines of state-enable_conntrack = true,
 yes it looks redundant, but masquerade requires conntrack as its
 prerequisite, doesn't it ?
 so I think we need to enables the flag in both cases.
 
 thanks a lot.
 Takayuki Kaiso
 Hi,

 in general I do consider this idea but I do not agree with the
 implementation in your patch.

 In particular I think that the firewall init script is the wrong place
 to unload kmods, actually I think a random service should never unload
 kmods, at most only load them when needed for the first time.

 We can certainly change the netfilter kmod packages to not autoload on
 boot anymore, then insmod the required ones from fw3 (similar to how
 iptables did it).

 Furthermore the module dependencies should be calculated in the C code
 directly, I do not like parsing the firewall config for a 2nd time in
 shell, just to determine needed modules.

 A couple of additional comments are inline below.

 On 01.11.2013 06:35, Takayuki Kaiso wrote:
 Now all the firewall modules are loaded at boot time regardless of
 the user's firewall configuration.
 Then, performance overhead is so high for low cpu power boards (Ex.
 soekris net4826 with 266MHz)
 by this approach and should be better to load modules on demand
 base.$B!!(B

 This patch allow us to unload unnecessary modules especially for
 conntrack related ones. $B!!(B
 It can decrease the overhead for the config which does not enable
 NAT, for instance.

 Signed-off-by: Takayuki Kaiso tka...@thinktube.com

 ---
 package/firewall/files/firewall.init | 44 +
 .../patches/010-remove-unnecessary-chain.patch | 101
 +
 2 files changed, 145 insertions(+)

 diff --git a/package/firewall/files/firewall.init
 b/package/firewall/files/firewall.init
 index 64e3a8c..6eda74f 100755
 --- a/package/firewall/files/firewall.init
 +++ b/package/firewall/files/firewall.init
 @@ -2,24 +2,68 @@

 START=19

 +CONNTRACK_ZONES=
 +CONNTRACK_MODS=nf_nat_irc nf_conntrack_irc nf_nat_ftp
 nf_conntrack_ftp ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4
 nf_defrag_ipv4
 +xt_conntrack
 There are more than just those, e.g. in the conntrack-extra packages, a
 more generic solution is needed here.

 +CONNTRACK_MODS_REVERSE=
 +
 +fw_zone_check_conntrack() {
 + config_get name $1 name
 + config_get_bool masq $1 masq 0
 + config_get_bool conntrack $1 conntrack 0
 + [ $conntrack = 1 -o $masq = 1 ]  append CONNTRACK_ZONES
 $name
 Port forwards imply conntracking on a zone as well, this is not covered
 here.

 +}
 +
 +load_conntrack_modules() {
 + for i in $CONNTRACK_MODS; do
 + CONNTRACK_MODS_REVERSE=$i $CONNTRACK_MODS_REVERSE
 + done
 + for i in $CONNTRACK_MODS_REVERSE; do
 + insmod $i 2/dev/null;
 + done
 +}
 +
 +unload_conntrack_modules() {
 + for i in $CONNTRACK_MODS; do
 + rmmod $i 2/dev/null;
 + done
 +}
 +
 +update_firewall_modules() {
 + config_load firewall
 + config_foreach fw_zone_check_conntrack zone
 + if [ -n $CONNTRACK_ZONES ]; then
 + echo loading conntrack modules
 + load_conntrack_modules
 + else
 + echo Unloading conntrack modules
 + unload_conntrack_modules
 + fi
 +}
 +
 boot() {
 # Be silent on boot, firewall might be started by hotplug already,
 # so don't complain in syslog.
 fw3 -q start
 + update_firewall_modules
 Shouldn't that be done before starting the firewall?
 }

 start() {
 fw3 start
 + update_firewall_modules
 Dito.
 }

 stop() {
 fw3 flush
 + update_firewall_modules
 After a flush, the complete firewall is empty, one could argue that the
 principle of least surprise is violated here by *loading* kmods under
 certain circumstances.
 }

 restart() {
 fw3 restart
 + update_firewall_modules
 }

 reload() {
 fw3 reload
 + update_firewall_modules
 Reload does not clear the entire ruleset, it simply rebuilds internal
 chains. There is a high probability of live rules still relying on
 conntrack modules.
 }
 diff --git
 a/package/firewall/patches/010-remove-unnecessary-chain.patch
 

Re: [OpenWrt-Devel] [PATCH] [platform/au1000/sysupgrade] fix sysupgrade when changing rootfs from jffs2 to squashfs and visa versa

2013-10-30 Thread Bruno Randolf
On 10/30/2013 07:24 AM, Bastian Bittorf wrote:
 [platform/au1000/sysupgrade] fix sysupgrade when changing rootfs from jffs2 
 to squashfs and visa versa
 
 till now only jffs2 was possible and sysupgrade refuses to change fs-type,
 because of bad/invalid content in sysupgrade-file. manually overriding
 works, so i made this patch. upgrade tested from r36088 to r38570.
 (jffs2 to squashfs).
 
 Signed-off-by: Bastian Bittorf bitt...@bluebottle.com
 ---
  .../au1000/base-files/lib/upgrade/platform.sh  |   25 +--
  1 files changed, 17 insertions(+), 8 deletions(-)
 
 diff --git a/target/linux/au1000/base-files/lib/upgrade/platform.sh 
 b/target/linux/au1000/base-files/lib/upgrade/platform.sh
 index 85ab213..e2c8687 100644
 --- a/target/linux/au1000/base-files/lib/upgrade/platform.sh
 +++ b/target/linux/au1000/base-files/lib/upgrade/platform.sh
 @@ -1,19 +1,28 @@
  KERNEL_IMG=openwrt-au1000-au1500-vmlinux.bin
 -ROOTFS_IMG=openwrt-au1000-au1500-jffs2-128k.fs
 +ROOTFS_IMG_JFFS2=openwrt-au1000-au1500-jffs2-128k.fs
 +ROOTFS_IMG_SQASH=openwrt-au1000-au1500-squashfs.fs

I don't know how other platforms handle this, but couldn't the rootfs
image inside the [jffs2|squashfs]-sysupgrade.bin always have the same name?

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


Re: [OpenWrt-Devel] [PATCH 3/6] pptpd: Add uci configuration for PPTPD.

2013-10-17 Thread Bruno Randolf

On 10/15/2013 02:45 PM, Jo-Philipp Wich wrote:

comments inline.


Hi, Thanks, will address the issues and resend.

bruno


On 11.10.2013 12:30, Bruno Randolf wrote:

Signed-off-by: Bruno Randolf b...@einfach.org
---
  net/pptpd/Makefile|  3 +++
  net/pptpd/files/pptpd.init| 40 ++--
  net/pptpd/files/pptpd.uciconf |  8 
  3 files changed, 49 insertions(+), 2 deletions(-)
  create mode 100644 net/pptpd/files/pptpd.uciconf

diff --git a/net/pptpd/Makefile b/net/pptpd/Makefile
index e79e0a7..0a2f642 100644
--- a/net/pptpd/Makefile
+++ b/net/pptpd/Makefile
@@ -41,6 +41,7 @@ MAKE_FLAGS += \
  define Package/pptpd/conffiles
  /etc/pptpd.conf
  /etc/ppp/options.pptpd
+/etc/config/pptpd
  endef

  define Package/pptpd/install
@@ -58,6 +59,8 @@ define Package/pptpd/install
$(INSTALL_BIN) ./files/pptpd.init $(1)/etc/init.d/pptpd
$(INSTALL_DIR) $(1)/etc/ppp
$(INSTALL_DATA) ./files/options.pptpd $(1)/etc/ppp/
+   $(INSTALL_DIR) $(1)/etc/config
+   $(INSTALL_DATA) ./files/pptpd.uciconf $(1)/etc/config/pptpd


Per convention, shipped uci configs are called program.config in files/.


  endef

  $(eval $(call BuildPackage,pptpd))
diff --git a/net/pptpd/files/pptpd.init b/net/pptpd/files/pptpd.init
index a74973c..79c0ab6 100644
--- a/net/pptpd/files/pptpd.init
+++ b/net/pptpd/files/pptpd.init
@@ -6,14 +6,50 @@ BIN=pptpd
  DEFAULT=/etc/default/$BIN
  RUN_D=/var/run
  PID_F=$RUN_D/$BIN.pid
+CONFIG=/tmp/pptpd.conf


For consistency, native configs autogenerated from uci should go into
the /var/etc directory.


+CHAP_SECRETS=/etc/ppp/chap-secrets


This should reside in /var/etc or /var/run, if pptp cannot be isntructed
to look for this file there it should be symlinked there.



-start() {
+setup_user() {
+   local section=$1
+
+   config_get user $section user
+   config_get passwd $section passwd
+   [ -n $user ] || return 0
+   [ -n $passwd ] || return 0
+
+   echo $user pptp-server $passwd *  $CHAP_SECRETS


This file will grow indefinitely with each system start.


+}
+
+setup_config() {
+   local section=$1
+
+   config_get enabled $section enabled
+   [ $enabled -eq 0 ]  return 1
+
+   cp /etc/pptpd.conf $CONFIG
+
+   config_get localip $section localip
+   config_get remoteip $section remoteip
+   [ -n $localip ]  echo localip  $localip  $CONFIG
+   [ -n $remoteip ]  echo remoteip  $remoteip  $CONFIG
+   return 0
+}
+
+start_pptpd() {
[ -f $DEFAULT ]  . $DEFAULT
mkdir -p $RUN_D
for m in arc4 sha1 slhc crc-ccitt ppp_generic ppp_async ppp_mppe_mppc; 
do
insmod $m /dev/null 21
done
-   $BIN $OPTIONS
+   $BIN $OPTIONS -c $CONFIG


This should use service wrappers.


+}
+
+start() {
+   config_load pptpd
+   setup_config pptpd || return
+   [ -e $CHAP_SECRETS ]  rm -f $CHAP_SECRETS
+   config_foreach setup_user key
+   start_pptpd
  }

  stop() {
diff --git a/net/pptpd/files/pptpd.uciconf b/net/pptpd/files/pptpd.uciconf
new file mode 100644
index 000..66cf0be
--- /dev/null
+++ b/net/pptpd/files/pptpd.uciconf
@@ -0,0 +1,8 @@
+config service 'pptpd'
+   option 'enabled' '0'
+   option 'localip' '192.168.0.1'
+   option 'remoteip' '192.168.0.20-30'
+
+config 'key'


Wouldn't be a section name like config login better suited?


+   option 'user' 'youruser'
+   option 'passwd' 'yourpass'


For consistency with existing configs it is better to write out the
option names, means username and password instead of user and
passwd.


~ Jow



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


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


Re: [OpenWrt-Devel] [PATCH 6/6] isc-dhcp: dhcrelay: Add RFC3527 link selection sub-option

2013-10-17 Thread Bruno Randolf

On 10/15/2013 02:52 PM, Jo-Philipp Wich wrote:

+++ b/net/isc-dhcp/patches/100-relay-rfc3527-link-selection.patch


Can you elaborate on the origin of this patch? Was it written by you?


Yes, this patch was written by me, and I have sent it for inclusion to 
the upstream ISC dhcp-hackers mailinglist but unfortunately without 
any feedback yet.


As explained in the RFC (http://tools.ietf.org/html/rfc3527) and 
mentioned in my commit message, this (RFC3537) link selection sub-option 
is a way to tell the DHCP server how to reach the relay agent, and at 
the same time select the IP address range from another subnet. This is 
necessary when both are on different subnets and the DHCP server does 
not know how to reach the relay agent just based on the DCHP subnet. In 
our case this happens in a mesh network.


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


[OpenWrt-Devel] [PATCH 0/3] trunk packages resend

2013-10-17 Thread Bruno Randolf
Hi!

Here I resend the PPTPD and dhcrelay patches for trunk packages. I tried to
address all issues jow has mentioned before.

Bruno Randolf (3):
  pptpd: Add uci configuration for PPTPD.
  isc-dhcp: dhcrelay: Add more UCI options
  isc-dhcp: dhcrelay: Add RFC3527 link selection sub-option

 net/isc-dhcp/Makefile  |   8 ++
 net/isc-dhcp/files/dhcrelay4.init  |  43 +++--
 net/isc-dhcp/files/etc/config/dhcrelay |  27 --
 .../patches/100-relay-rfc3527-link-selection.patch | 100 +
 net/pptpd/Makefile |   5 +-
 net/pptpd/files/pptpd.config   |   8 ++
 net/pptpd/files/pptpd.init |  46 --
 7 files changed, 220 insertions(+), 17 deletions(-)
 create mode 100644 net/isc-dhcp/patches/100-relay-rfc3527-link-selection.patch
 create mode 100644 net/pptpd/files/pptpd.config

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


[OpenWrt-Devel] [PATCH 2/3] isc-dhcp: dhcrelay: Add more UCI options

2013-10-17 Thread Bruno Randolf
Add more options to dhcrelay UCI and init script:

- enabled
- interfaces: Listen interfaces
- relay_mode: What to do about packets that already have a relay option

Also mark /etc/config/dhcrelay as conffile

Signed-off-by: Bruno Randolf b...@einfach.org
---
 net/isc-dhcp/Makefile  |  8 
 net/isc-dhcp/files/dhcrelay4.init  | 36 --
 net/isc-dhcp/files/etc/config/dhcrelay | 24 ++-
 3 files changed, 57 insertions(+), 11 deletions(-)

diff --git a/net/isc-dhcp/Makefile b/net/isc-dhcp/Makefile
index aa27aca..5e5471f 100644
--- a/net/isc-dhcp/Makefile
+++ b/net/isc-dhcp/Makefile
@@ -55,11 +55,19 @@ $(call Package/isc-dhcp-relay-ipv6/description)
  This package is compiled with IPv4 support only.
 endef
 
+define Package/isc-dhcp-relay-ipv4/conffiles
+/etc/config/dhcrelay
+endef
+
 define Package/isc-dhcp-relay-ipv6/description
 $(call Package/isc-dhcp-relay/description)
  This package is compiled with IPv4 and IPv6 support.
 endef
 
+define Package/isc-dhcp-relay-ipv6/conffiles
+/etc/config/dhcrelay
+endef
+
 define Package/isc-dhcp-client-ipv4
   $(call Package/isc-dhcp/Default)
   TITLE+= client (without IPv6)
diff --git a/net/isc-dhcp/files/dhcrelay4.init 
b/net/isc-dhcp/files/dhcrelay4.init
index 70905cf..e1e6871 100644
--- a/net/isc-dhcp/files/dhcrelay4.init
+++ b/net/isc-dhcp/files/dhcrelay4.init
@@ -8,15 +8,39 @@ SERVICE_PID_FILE=/var/run/dhcrelay4.pid
 SERVICE_USE_PID=1
 
 start() {
-local relay_dhcpserver
+   . /lib/functions/network.sh
+   config_load dhcrelay
+   local args=
 
-config_load dhcrelay
-config_get relay_dhcpserver ipv4 dhcpserver
+   local enabled
+   config_get_bool enabled ipv4 enabled 0
+   [ $enabled -eq 0 ]  return 0
 
-service_start /usr/sbin/dhcrelay -4 -q \
--pf $SERVICE_PID_FILE $relay_dhcpserver
+   # listen interfaces
+   local interfaces
+   local ifname
+   config_get interfaces ipv4 interfaces
+   for net in $interfaces; do
+   if network_get_device ifname $net; then
+   append args -i $ifname
+   fi
+   done
+
+   # relay mode
+   local relay_mode
+   config_get relay_mode ipv4 relay_mode
+   [ -n $relay_mode ]  append args -m $relay_mode
+
+   # dhcp server address
+   local server
+   config_get server ipv4 dhcpserver
+   [ -n $server ] || return 0
+   append args $server
+
+   service_start /usr/sbin/dhcrelay -4 -q \
+   -pf $SERVICE_PID_FILE $args
 }
 
 stop() {
-service_stop /usr/sbin/dhcrelay
+   service_stop /usr/sbin/dhcrelay
 }
diff --git a/net/isc-dhcp/files/etc/config/dhcrelay 
b/net/isc-dhcp/files/etc/config/dhcrelay
index 5fde239..1b89782 100644
--- a/net/isc-dhcp/files/etc/config/dhcrelay
+++ b/net/isc-dhcp/files/etc/config/dhcrelay
@@ -1,10 +1,24 @@
 
 config dhcrelay ipv4
-option dhcpserver '192.0.2.10'
+   option 'enabled' '0'
+
+   # IP address of the server
+   option 'dhcpserver' '192.0.2.10'
+
+   # network interfaces to listen on (e.g. lan or wan)
+   option 'interfaces' ''
+
+   # What to do about packets that already have a relay option:
+   # 'append': Forward and append our own relay option
+   # 'replace': Forward, but replace theirs with ours (default)
+   # 'forward': Forward without changes
+   # 'discard': Don't forward
+   option 'relay_mode' ''
+
 
 config dhcrelay ipv6
-#option dhcpserver '2001:db8:1::1'
-option upper 'eth1'
-list lower 'eth0.2'
-list lower 'eth0.3'
+#  option dhcpserver '2001:db8:1::1'
+   option upper 'eth1'
+   list lower 'eth0.2'
+   list lower 'eth0.3'
 
-- 
1.8.1.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/3] pptpd: Add uci configuration for PPTPD.

2013-10-17 Thread Bruno Randolf
Signed-off-by: Bruno Randolf b...@einfach.org
---
 net/pptpd/Makefile   |  5 -
 net/pptpd/files/pptpd.config |  8 
 net/pptpd/files/pptpd.init   | 46 +++-
 3 files changed, 53 insertions(+), 6 deletions(-)
 create mode 100644 net/pptpd/files/pptpd.config

diff --git a/net/pptpd/Makefile b/net/pptpd/Makefile
index e79e0a7..318ed11 100644
--- a/net/pptpd/Makefile
+++ b/net/pptpd/Makefile
@@ -22,7 +22,7 @@ include $(INCLUDE_DIR)/package.mk
 define Package/pptpd
   SECTION:=net
   CATEGORY:=Network
-  DEPENDS:=+kmod-ppp +kmod-gre +ppp
+  DEPENDS:=+kmod-ppp +kmod-gre +kmod-mppe +ppp
   TITLE:=PopTop pptp server
   URL:=http://www.poptop.org/
   SUBMENU:=VPN
@@ -41,6 +41,7 @@ MAKE_FLAGS += \
 define Package/pptpd/conffiles
 /etc/pptpd.conf
 /etc/ppp/options.pptpd
+/etc/config/pptpd
 endef
 
 define Package/pptpd/install
@@ -58,6 +59,8 @@ define Package/pptpd/install
$(INSTALL_BIN) ./files/pptpd.init $(1)/etc/init.d/pptpd
$(INSTALL_DIR) $(1)/etc/ppp
$(INSTALL_DATA) ./files/options.pptpd $(1)/etc/ppp/
+   $(INSTALL_DIR) $(1)/etc/config
+   $(INSTALL_DATA) ./files/pptpd.config $(1)/etc/config/pptpd
 endef
 
 $(eval $(call BuildPackage,pptpd))
diff --git a/net/pptpd/files/pptpd.config b/net/pptpd/files/pptpd.config
new file mode 100644
index 000..b2d5df5
--- /dev/null
+++ b/net/pptpd/files/pptpd.config
@@ -0,0 +1,8 @@
+config service 'pptpd'
+   option 'enabled' '0'
+   option 'localip' '192.168.0.1'
+   option 'remoteip' '192.168.0.20-30'
+
+config 'login'
+   option 'username' 'youruser'
+   option 'password' 'yourpass'
diff --git a/net/pptpd/files/pptpd.init b/net/pptpd/files/pptpd.init
index a74973c..b1381b2 100644
--- a/net/pptpd/files/pptpd.init
+++ b/net/pptpd/files/pptpd.init
@@ -2,20 +2,56 @@
 # Copyright (C) 2006 OpenWrt.org
 
 START=60
-BIN=pptpd
+BIN=/usr/sbin/pptpd
 DEFAULT=/etc/default/$BIN
 RUN_D=/var/run
 PID_F=$RUN_D/$BIN.pid
+CONFIG=/var/etc/pptpd.conf
+CHAP_SECRETS=/var/etc/chap-secrets
 
-start() {
+setup_login() {
+   local section=$1
+
+   config_get username $section username
+   config_get password $section password
+   [ -n $username ] || return 0
+   [ -n $password ] || return 0
+
+   echo $username pptp-server $password *  $CHAP_SECRETS
+}
+
+setup_config() {
+   local section=$1
+
+   config_get enabled $section enabled
+   [ $enabled -eq 0 ]  return 1
+
+   cp /etc/pptpd.conf $CONFIG
+
+   config_get localip $section localip
+   config_get remoteip $section remoteip
+   [ -n $localip ]  echo localip  $localip  $CONFIG
+   [ -n $remoteip ]  echo remoteip  $remoteip  $CONFIG
+   return 0
+}
+
+start_pptpd() {
[ -f $DEFAULT ]  . $DEFAULT
mkdir -p $RUN_D
-   for m in arc4 sha1 slhc crc-ccitt ppp_generic ppp_async ppp_mppe_mppc; 
do
+   for m in arc4 sha1_generic slhc crc-ccitt ppp_generic ppp_async 
ppp_mppe; do
insmod $m /dev/null 21
done
-   $BIN $OPTIONS
+   ln -sfn $CHAP_SECRETS /etc/ppp/chap-secrets
+   service_start $BIN $OPTIONS -c $CONFIG
+}
+
+start() {
+   config_load pptpd
+   setup_config pptpd || return
+   config_foreach setup_login login
+   start_pptpd
 }
 
 stop() {
-   [ -f $PID_F ]  kill $(cat $PID_F)
+   service_stop $BIN
 }
-- 
1.8.1.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 3/3] isc-dhcp: dhcrelay: Add RFC3527 link selection sub-option

2013-10-17 Thread Bruno Randolf
RFC3527 link selection sub-option is used to select the uplink interface of
dhcrelay in cases where the DHCP server does not know how to reach the dhcrelay
based on the DHCP range. This can happen in weird network configurations like
Mesh networks.

Signed-off-by: Bruno Randolf b...@einfach.org
---
 net/isc-dhcp/files/dhcrelay4.init  |   7 ++
 net/isc-dhcp/files/etc/config/dhcrelay |   3 +
 .../patches/100-relay-rfc3527-link-selection.patch | 100 +
 3 files changed, 110 insertions(+)
 create mode 100644 net/isc-dhcp/patches/100-relay-rfc3527-link-selection.patch

diff --git a/net/isc-dhcp/files/dhcrelay4.init 
b/net/isc-dhcp/files/dhcrelay4.init
index e1e6871..9af0f84 100644
--- a/net/isc-dhcp/files/dhcrelay4.init
+++ b/net/isc-dhcp/files/dhcrelay4.init
@@ -26,6 +26,13 @@ start() {
fi
done
 
+   # link selection sub-option (RFC3527)
+   local link_selection
+   config_get link_selection ipv4 link_selection
+   if network_get_device ifname $link_selection; then
+   append args -l $ifname
+   fi
+
# relay mode
local relay_mode
config_get relay_mode ipv4 relay_mode
diff --git a/net/isc-dhcp/files/etc/config/dhcrelay 
b/net/isc-dhcp/files/etc/config/dhcrelay
index 1b89782..b3b53b5 100644
--- a/net/isc-dhcp/files/etc/config/dhcrelay
+++ b/net/isc-dhcp/files/etc/config/dhcrelay
@@ -15,6 +15,9 @@ config dhcrelay ipv4
# 'discard': Don't forward
option 'relay_mode' ''
 
+   # enable RFC3527 link selection sub-option and use the IP address of
+   # the specified network interface as uplink IP address (e.g. wan)
+   option 'link_selection' ''
 
 config dhcrelay ipv6
 #  option dhcpserver '2001:db8:1::1'
diff --git a/net/isc-dhcp/patches/100-relay-rfc3527-link-selection.patch 
b/net/isc-dhcp/patches/100-relay-rfc3527-link-selection.patch
new file mode 100644
index 000..1f593ee
--- /dev/null
+++ b/net/isc-dhcp/patches/100-relay-rfc3527-link-selection.patch
@@ -0,0 +1,100 @@
+--- a/relay/dhcrelay.c
 b/relay/dhcrelay.c
+@@ -65,6 +65,7 @@ int server_packets_relayed = 0;  /* Packe
+ int client_packet_errors = 0; /* Errors sending packets to clients. */
+ 
+ int add_agent_options = 0;/* If nonzero, add relay agent options. */
++int add_rfc3527_suboption = 0;/* If nonzero, add RFC3527 link 
selection sub-option. */
+ 
+ int agent_option_errors = 0;/* Number of packets forwarded without
+  agent options because there was no room. */
+@@ -104,6 +105,8 @@ struct server_list {
+   struct sockaddr_in to;
+ } *servers;
+ 
++struct interface_info *uplink;
++
+ #ifdef DHCPv6
+ struct stream_list {
+   struct stream_list *next;
+@@ -144,6 +147,7 @@ static const char url[] =
+  [-pf pid-file] [--no-pid]\n\
+  [-m append|replace|forward|discard]\n \
+  [-i interface0 [ ... -i interfaceN]\n \
++ [-l interface]\n \
+  server0 [ ... serverN]\n\n \
+dhcrelay -6   [-d] [-q] [-I] [-c hops] [-p port]\n \
+  [-pf pid-file] [--no-pid]\n\
+@@ -157,6 +161,7 @@ static const char url[] =
+ [-pf pid-file] [--no-pid]\n\
+ [-m append|replace|forward|discard]\n \
+ [-i interface0 [ ... -i interfaceN]\n \
++[-l interface]\n \
+ server0 [ ... serverN]\n\n
+ #endif
+ 
+@@ -314,6 +319,20 @@ main(int argc, char **argv) {
+   agent_relay_mode = discard;
+   } else
+   usage();
++  } else if (!strcmp (argv [i], -l)) {
++  add_agent_options = 1;
++  add_rfc3527_suboption = 1;
++  if (++i == argc)
++  usage();
++
++  status = interface_allocate(uplink, MDL);
++  if (status != ISC_R_SUCCESS)
++  log_fatal(%s: interface_allocate: %s,
++argv[i],
++isc_result_totext(status));
++  strcpy(uplink-name, argv[i]);
++  interface_snorf(uplink, INTERFACE_REQUESTED);
++  //interface_dereference(uplink, MDL);
+   } else if (!strcmp(argv[i], -D)) {
+ #ifdef DHCPv6
+   if (local_family_set  (local_family == AF_INET6)) {
+@@ -685,12 +704,17 @@ do_relay4(struct interface_info *ip, str
+  ip-addresses[0])))
+   return;
+ 
++  /* RFC3527: Replace giaddr address by uplink address. The original
++   * giaddr will be used in the link selection sub-option */
++  if (add_rfc3527_suboption)
++  packet-giaddr = uplink-addresses[0];
++
+   /* If giaddr is not already

Re: [OpenWrt-Devel] [PATCH 4/7] pptpd: Add uci configuration for PPTPD.

2013-10-11 Thread Bruno Randolf

On 10/11/2013 01:24 AM, Yousong Zhou wrote:

To make `enabled 0` a working option, it should be something like

 setup_config pptpd  start_pptpd


Thanks, will fix and resend the patch for trunk.

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


[OpenWrt-Devel] [PATCH 0/6] Patches for trunk packages

2013-10-11 Thread Bruno Randolf
Similar to my previous series for AA, now rebased to trunk...

Bruno Randolf (6):
  libgphoto2 depends on libusb-compat, not libusb-1.0
  ddns-scripts: add init script
  pptpd: Add uci configuration for PPTPD.
  pptpd: remove IP in options.pptp
  isc-dhcp: dhcrelay: Add more UCI options
  isc-dhcp: dhcrelay: Add RFC3527 link selection sub-option

 libs/libgphoto2/Makefile   |   2 +-
 net/ddns-scripts/Makefile  |   2 +
 net/ddns-scripts/files/etc/init.d/ddns |  12 +++
 net/isc-dhcp/Makefile  |   8 ++
 net/isc-dhcp/files/dhcrelay4.init  |  47 --
 net/isc-dhcp/files/etc/config/dhcrelay |  27 --
 .../patches/100-relay-rfc3527-link-selection.patch | 100 +
 net/pptpd/Makefile |   3 +
 net/pptpd/files/options.pptpd  |   1 -
 net/pptpd/files/pptpd.init |  40 -
 net/pptpd/files/pptpd.uciconf  |   8 ++
 11 files changed, 235 insertions(+), 15 deletions(-)
 create mode 100644 net/ddns-scripts/files/etc/init.d/ddns
 create mode 100644 net/isc-dhcp/patches/100-relay-rfc3527-link-selection.patch
 create mode 100644 net/pptpd/files/pptpd.uciconf

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


[OpenWrt-Devel] [PATCH 2/6] ddns-scripts: add init script

2013-10-11 Thread Bruno Randolf
Signed-off-by: Bruno Randolf b...@einfach.org
---
 net/ddns-scripts/Makefile  |  2 ++
 net/ddns-scripts/files/etc/init.d/ddns | 12 
 2 files changed, 14 insertions(+)
 create mode 100644 net/ddns-scripts/files/etc/init.d/ddns

diff --git a/net/ddns-scripts/Makefile b/net/ddns-scripts/Makefile
index 651c623..0e9f0f3 100644
--- a/net/ddns-scripts/Makefile
+++ b/net/ddns-scripts/Makefile
@@ -37,6 +37,8 @@ endef
 define Package/ddns-scripts/install
$(INSTALL_DIR) $(1)
$(CP) ./files/* $(1)/
+   $(INSTALL_DIR) $(1)/etc/init.d
+   $(INSTALL_BIN) ./files/etc/init.d/ddns $(1)/etc/init.d/
 endef
 
 $(eval $(call BuildPackage,ddns-scripts))
diff --git a/net/ddns-scripts/files/etc/init.d/ddns 
b/net/ddns-scripts/files/etc/init.d/ddns
new file mode 100644
index 000..3171d5a
--- /dev/null
+++ b/net/ddns-scripts/files/etc/init.d/ddns
@@ -0,0 +1,12 @@
+#!/bin/sh /etc/rc.common
+START=95
+
+start() {
+   . /usr/lib/ddns/dynamic_dns_functions.sh
+   start_daemon_for_all_ddns_sections
+}
+
+stop() {
+   killall -9 dynamic_dns_updater.sh
+}
+
-- 
1.8.1.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 3/6] pptpd: Add uci configuration for PPTPD.

2013-10-11 Thread Bruno Randolf
Signed-off-by: Bruno Randolf b...@einfach.org
---
 net/pptpd/Makefile|  3 +++
 net/pptpd/files/pptpd.init| 40 ++--
 net/pptpd/files/pptpd.uciconf |  8 
 3 files changed, 49 insertions(+), 2 deletions(-)
 create mode 100644 net/pptpd/files/pptpd.uciconf

diff --git a/net/pptpd/Makefile b/net/pptpd/Makefile
index e79e0a7..0a2f642 100644
--- a/net/pptpd/Makefile
+++ b/net/pptpd/Makefile
@@ -41,6 +41,7 @@ MAKE_FLAGS += \
 define Package/pptpd/conffiles
 /etc/pptpd.conf
 /etc/ppp/options.pptpd
+/etc/config/pptpd
 endef
 
 define Package/pptpd/install
@@ -58,6 +59,8 @@ define Package/pptpd/install
$(INSTALL_BIN) ./files/pptpd.init $(1)/etc/init.d/pptpd
$(INSTALL_DIR) $(1)/etc/ppp
$(INSTALL_DATA) ./files/options.pptpd $(1)/etc/ppp/
+   $(INSTALL_DIR) $(1)/etc/config
+   $(INSTALL_DATA) ./files/pptpd.uciconf $(1)/etc/config/pptpd
 endef
 
 $(eval $(call BuildPackage,pptpd))
diff --git a/net/pptpd/files/pptpd.init b/net/pptpd/files/pptpd.init
index a74973c..79c0ab6 100644
--- a/net/pptpd/files/pptpd.init
+++ b/net/pptpd/files/pptpd.init
@@ -6,14 +6,50 @@ BIN=pptpd
 DEFAULT=/etc/default/$BIN
 RUN_D=/var/run
 PID_F=$RUN_D/$BIN.pid
+CONFIG=/tmp/pptpd.conf
+CHAP_SECRETS=/etc/ppp/chap-secrets
 
-start() {
+setup_user() {
+   local section=$1
+
+   config_get user $section user
+   config_get passwd $section passwd
+   [ -n $user ] || return 0
+   [ -n $passwd ] || return 0
+
+   echo $user pptp-server $passwd *  $CHAP_SECRETS
+}
+
+setup_config() {
+   local section=$1
+
+   config_get enabled $section enabled
+   [ $enabled -eq 0 ]  return 1
+
+   cp /etc/pptpd.conf $CONFIG
+
+   config_get localip $section localip
+   config_get remoteip $section remoteip
+   [ -n $localip ]  echo localip  $localip  $CONFIG
+   [ -n $remoteip ]  echo remoteip  $remoteip  $CONFIG
+   return 0
+}
+
+start_pptpd() {
[ -f $DEFAULT ]  . $DEFAULT
mkdir -p $RUN_D
for m in arc4 sha1 slhc crc-ccitt ppp_generic ppp_async ppp_mppe_mppc; 
do
insmod $m /dev/null 21
done
-   $BIN $OPTIONS
+   $BIN $OPTIONS -c $CONFIG
+}
+
+start() {
+   config_load pptpd
+   setup_config pptpd || return
+   [ -e $CHAP_SECRETS ]  rm -f $CHAP_SECRETS
+   config_foreach setup_user key
+   start_pptpd
 }
 
 stop() {
diff --git a/net/pptpd/files/pptpd.uciconf b/net/pptpd/files/pptpd.uciconf
new file mode 100644
index 000..66cf0be
--- /dev/null
+++ b/net/pptpd/files/pptpd.uciconf
@@ -0,0 +1,8 @@
+config service 'pptpd'
+   option 'enabled' '0'
+   option 'localip' '192.168.0.1'
+   option 'remoteip' '192.168.0.20-30'
+
+config 'key'
+   option 'user' 'youruser'
+   option 'passwd' 'yourpass'
-- 
1.8.1.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 4/6] pptpd: remove IP in options.pptp

2013-10-11 Thread Bruno Randolf
ppp has obsoleted this option (as of v2.4.3-7) according to
http://wiki.openwrt.org/doc/howto/vpn.server.pptpd

Signed-off-by: Bruno Randolf b...@einfach.org
---
 net/pptpd/files/options.pptpd | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/pptpd/files/options.pptpd b/net/pptpd/files/options.pptpd
index 5dd2daf..f73eeea 100644
--- a/net/pptpd/files/options.pptpd
+++ b/net/pptpd/files/options.pptpd
@@ -1,6 +1,5 @@
 #debug
 #logfile /tmp/pptp-server.log
-172.16.1.1:
 auth
 name pptp-server
 lcp-echo-failure 3
-- 
1.8.1.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/6] libgphoto2 depends on libusb-compat, not libusb-1.0

2013-10-11 Thread Bruno Randolf
Signed-off-by: Bruno Randolf b...@einfach.org
---
 libs/libgphoto2/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libs/libgphoto2/Makefile b/libs/libgphoto2/Makefile
index cc45ece..bf4f55f 100644
--- a/libs/libgphoto2/Makefile
+++ b/libs/libgphoto2/Makefile
@@ -37,7 +37,7 @@ endef
 
 define Package/libgphoto2-drivers
   $(call Package/libgphoto2/Default)
-  DEPENDS:=libgphoto2 +libusb-1.0 +libgd
+  DEPENDS:=libgphoto2 +libusb-compat +libgd
   TITLE:=Gphoto2 drivers for various cameras
 endef
 
-- 
1.8.1.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 5/6] isc-dhcp: dhcrelay: Add more UCI options

2013-10-11 Thread Bruno Randolf
Add more options to dhcrelay UCI and init script:

- enabled
- interfaces: Listen interfaces
- relay_mode: What to do about packets that already have a relay option

Also mark /etc/config/dhcrelay as conffile

Signed-off-by: Bruno Randolf b...@einfach.org
---
 net/isc-dhcp/Makefile  |  8 +++
 net/isc-dhcp/files/dhcrelay4.init  | 39 --
 net/isc-dhcp/files/etc/config/dhcrelay | 24 -
 3 files changed, 60 insertions(+), 11 deletions(-)

diff --git a/net/isc-dhcp/Makefile b/net/isc-dhcp/Makefile
index aa27aca..5e5471f 100644
--- a/net/isc-dhcp/Makefile
+++ b/net/isc-dhcp/Makefile
@@ -55,11 +55,19 @@ $(call Package/isc-dhcp-relay-ipv6/description)
  This package is compiled with IPv4 support only.
 endef
 
+define Package/isc-dhcp-relay-ipv4/conffiles
+/etc/config/dhcrelay
+endef
+
 define Package/isc-dhcp-relay-ipv6/description
 $(call Package/isc-dhcp-relay/description)
  This package is compiled with IPv4 and IPv6 support.
 endef
 
+define Package/isc-dhcp-relay-ipv6/conffiles
+/etc/config/dhcrelay
+endef
+
 define Package/isc-dhcp-client-ipv4
   $(call Package/isc-dhcp/Default)
   TITLE+= client (without IPv6)
diff --git a/net/isc-dhcp/files/dhcrelay4.init 
b/net/isc-dhcp/files/dhcrelay4.init
index 70905cf..0f87b37 100644
--- a/net/isc-dhcp/files/dhcrelay4.init
+++ b/net/isc-dhcp/files/dhcrelay4.init
@@ -8,15 +8,42 @@ SERVICE_PID_FILE=/var/run/dhcrelay4.pid
 SERVICE_USE_PID=1
 
 start() {
-local relay_dhcpserver
+   include /lib/network
+   scan_interfaces
+   config_load dhcrelay
 
-config_load dhcrelay
-config_get relay_dhcpserver ipv4 dhcpserver
+   local args=
 
-service_start /usr/sbin/dhcrelay -4 -q \
--pf $SERVICE_PID_FILE $relay_dhcpserver
+   local enabled
+   config_get_bool enabled ipv4 enabled 0
+   [ $enabled -eq 0 ]  return 0
+
+   # listen interfaces
+   local interfaces
+   config_get interfaces ipv4 interfaces
+   if [ -n $interfaces ]; then
+   for net in $interfaces; do
+   local ifname
+   config_get ifname $net ifname
+   [ -n $ifname ]  append args -i $ifname
+   done
+   fi
+
+   # relay mode
+   local relay_mode
+   config_get relay_mode ipv4 relay_mode
+   [ -n $relay_mode ]  append args -m $relay_mode
+
+   # dhcp server address
+   local server
+   config_get server ipv4 dhcpserver
+   [ -n $server ] || return 0
+   append args $server
+
+   service_start /usr/sbin/dhcrelay -4 -q \
+   -pf $SERVICE_PID_FILE $args
 }
 
 stop() {
-service_stop /usr/sbin/dhcrelay
+   service_stop /usr/sbin/dhcrelay
 }
diff --git a/net/isc-dhcp/files/etc/config/dhcrelay 
b/net/isc-dhcp/files/etc/config/dhcrelay
index 5fde239..1b89782 100644
--- a/net/isc-dhcp/files/etc/config/dhcrelay
+++ b/net/isc-dhcp/files/etc/config/dhcrelay
@@ -1,10 +1,24 @@
 
 config dhcrelay ipv4
-option dhcpserver '192.0.2.10'
+   option 'enabled' '0'
+
+   # IP address of the server
+   option 'dhcpserver' '192.0.2.10'
+
+   # network interfaces to listen on (e.g. lan or wan)
+   option 'interfaces' ''
+
+   # What to do about packets that already have a relay option:
+   # 'append': Forward and append our own relay option
+   # 'replace': Forward, but replace theirs with ours (default)
+   # 'forward': Forward without changes
+   # 'discard': Don't forward
+   option 'relay_mode' ''
+
 
 config dhcrelay ipv6
-#option dhcpserver '2001:db8:1::1'
-option upper 'eth1'
-list lower 'eth0.2'
-list lower 'eth0.3'
+#  option dhcpserver '2001:db8:1::1'
+   option upper 'eth1'
+   list lower 'eth0.2'
+   list lower 'eth0.3'
 
-- 
1.8.1.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 6/6] isc-dhcp: dhcrelay: Add RFC3527 link selection sub-option

2013-10-11 Thread Bruno Randolf
RFC3527 link selection sub-option is used to select the uplink interface of
dhcrelay in cases where the DHCP server does not know how to reach the dhcrelay
based on the DHCP range. This can happen in weird network configurations like
Mesh networks.

Signed-off-by: Bruno Randolf b...@einfach.org
---
 net/isc-dhcp/files/dhcrelay4.init  |   8 ++
 net/isc-dhcp/files/etc/config/dhcrelay |   3 +
 .../patches/100-relay-rfc3527-link-selection.patch | 100 +
 3 files changed, 111 insertions(+)
 create mode 100644 net/isc-dhcp/patches/100-relay-rfc3527-link-selection.patch

diff --git a/net/isc-dhcp/files/dhcrelay4.init 
b/net/isc-dhcp/files/dhcrelay4.init
index 0f87b37..d03722f 100644
--- a/net/isc-dhcp/files/dhcrelay4.init
+++ b/net/isc-dhcp/files/dhcrelay4.init
@@ -29,6 +29,14 @@ start() {
done
fi
 
+   # link selection sub-option (RFC3527)
+   local link_selection
+   config_get link_selection ipv4 link_selection
+   if [ -n $link_selection ]; then
+   config_get ifname $link_selection ifname
+   append args -l $ifname
+   fi
+
# relay mode
local relay_mode
config_get relay_mode ipv4 relay_mode
diff --git a/net/isc-dhcp/files/etc/config/dhcrelay 
b/net/isc-dhcp/files/etc/config/dhcrelay
index 1b89782..b3b53b5 100644
--- a/net/isc-dhcp/files/etc/config/dhcrelay
+++ b/net/isc-dhcp/files/etc/config/dhcrelay
@@ -15,6 +15,9 @@ config dhcrelay ipv4
# 'discard': Don't forward
option 'relay_mode' ''
 
+   # enable RFC3527 link selection sub-option and use the IP address of
+   # the specified network interface as uplink IP address (e.g. wan)
+   option 'link_selection' ''
 
 config dhcrelay ipv6
 #  option dhcpserver '2001:db8:1::1'
diff --git a/net/isc-dhcp/patches/100-relay-rfc3527-link-selection.patch 
b/net/isc-dhcp/patches/100-relay-rfc3527-link-selection.patch
new file mode 100644
index 000..1f593ee
--- /dev/null
+++ b/net/isc-dhcp/patches/100-relay-rfc3527-link-selection.patch
@@ -0,0 +1,100 @@
+--- a/relay/dhcrelay.c
 b/relay/dhcrelay.c
+@@ -65,6 +65,7 @@ int server_packets_relayed = 0;  /* Packe
+ int client_packet_errors = 0; /* Errors sending packets to clients. */
+ 
+ int add_agent_options = 0;/* If nonzero, add relay agent options. */
++int add_rfc3527_suboption = 0;/* If nonzero, add RFC3527 link 
selection sub-option. */
+ 
+ int agent_option_errors = 0;/* Number of packets forwarded without
+  agent options because there was no room. */
+@@ -104,6 +105,8 @@ struct server_list {
+   struct sockaddr_in to;
+ } *servers;
+ 
++struct interface_info *uplink;
++
+ #ifdef DHCPv6
+ struct stream_list {
+   struct stream_list *next;
+@@ -144,6 +147,7 @@ static const char url[] =
+  [-pf pid-file] [--no-pid]\n\
+  [-m append|replace|forward|discard]\n \
+  [-i interface0 [ ... -i interfaceN]\n \
++ [-l interface]\n \
+  server0 [ ... serverN]\n\n \
+dhcrelay -6   [-d] [-q] [-I] [-c hops] [-p port]\n \
+  [-pf pid-file] [--no-pid]\n\
+@@ -157,6 +161,7 @@ static const char url[] =
+ [-pf pid-file] [--no-pid]\n\
+ [-m append|replace|forward|discard]\n \
+ [-i interface0 [ ... -i interfaceN]\n \
++[-l interface]\n \
+ server0 [ ... serverN]\n\n
+ #endif
+ 
+@@ -314,6 +319,20 @@ main(int argc, char **argv) {
+   agent_relay_mode = discard;
+   } else
+   usage();
++  } else if (!strcmp (argv [i], -l)) {
++  add_agent_options = 1;
++  add_rfc3527_suboption = 1;
++  if (++i == argc)
++  usage();
++
++  status = interface_allocate(uplink, MDL);
++  if (status != ISC_R_SUCCESS)
++  log_fatal(%s: interface_allocate: %s,
++argv[i],
++isc_result_totext(status));
++  strcpy(uplink-name, argv[i]);
++  interface_snorf(uplink, INTERFACE_REQUESTED);
++  //interface_dereference(uplink, MDL);
+   } else if (!strcmp(argv[i], -D)) {
+ #ifdef DHCPv6
+   if (local_family_set  (local_family == AF_INET6)) {
+@@ -685,12 +704,17 @@ do_relay4(struct interface_info *ip, str
+  ip-addresses[0])))
+   return;
+ 
++  /* RFC3527: Replace giaddr address by uplink address. The original
++   * giaddr will be used in the link selection sub-option */
++  if (add_rfc3527_suboption)
++  packet-giaddr = uplink-addresses[0

Re: [OpenWrt-Devel] [PATCH 01/10] cron: improve init script

2013-10-11 Thread Bruno Randolf

On 10/11/2013 01:35 AM, Yousong Zhou wrote:

Hi,

On 10 October 2013 19:02, Bruno Randolf b...@einfach.org wrote:

Add PATH in case it is missing (e.g. when executing the script from
ssh, like ssh IP /etc/init.d/cron restart).

Signed-off-by: Bruno Randolf b...@einfach.org
---
  package/busybox/files/cron | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/package/busybox/files/cron b/package/busybox/files/cron
index 465b1ab..79b0a46 100755
--- a/package/busybox/files/cron
+++ b/package/busybox/files/cron
@@ -5,6 +5,8 @@ START=50

  SERVICE_USE_PID=1

+PATH=/usr/sbin/:$PATH


Not sure here. Even `PATH` is needed, it should be `export PATH=xxx`
to make it visible to child processes.


It did fix problems with invocation via ssh at some point, this is very 
rare and it looks like it's not necessary for trunk any more, so feel 
free to ignore it.


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


Re: [OpenWrt-Devel] [OpenWrt-Users] unknown network field 'beacon_int and wpa_supplicant

2013-10-10 Thread Bruno Randolf

Hi, This is a patch against AA which fixes it for us:

wpa_supplicant: fix beacon_int configuration option

wpa_supplicant expects beacon_int instead of beacon_interval in its 
config file.


diff --git a/package/hostapd/files/wpa_supplicant.sh 
b/package/hostapd/files/wpa_supplicant.sh

index 0b5e1d3..bd86801 100644
--- a/package/hostapd/files/wpa_supplicant.sh
+++ b/package/hostapd/files/wpa_supplicant.sh
@@ -119,13 +119,13 @@ wpa_supplicant_setup_vif() {
;;
esac

-   local fixed_freq bssid1 beacon_interval brates mrate
+   local fixed_freq bssid1 beacon_int brates mrate
config_get ifname $vif ifname
config_get bridge $vif bridge
config_get ssid $vif ssid
config_get bssid $vif bssid
bssid1=${bssid:+bssid=$bssid}
-   beacon_interval=${beacon_int:+beacon_interval=$beacon_int}
+   beacon_int=${beacon_int:+beacon_int=$beacon_int}

local br brval brsub brstr
[ -n $basic_rate_list ]  {
@@ -163,7 +163,7 @@ network={
$proto
$freq
${fixed:+fixed_freq=1}
-   $beacon_interval
+   $beacon_int
$brates
$mrate
$ht_str

On 10/10/2013 12:17 AM, Ben West wrote:

I believe this problem appeared on or about r36682, which coincides with
a hostapd update to AA.  This suggests a regression in hostapd w/r/t/ to
beacon interval code.

I can confirm the same problem happens when attempting to specify
beacon_int on a single psk2-encrypted adhoc interface, not just with
multi-VAPs as with the original poster.  My test was on an Engenius
EOC-1650, atheros platform, running Attitude Adjustment r38347 that I
compiled.

The error quoted below goes away when I comment out the beacon_int
line in /etc/config/wireless.  Likewise, this wireless config, with the
beacon_int line, works just fine under Attitude Adjustment r36669,
before the hostapd update.

root@OpenWRT:~# wifi restart
command failed: Device or resource busy (-16)
Successfully initialized wpa_supplicant
Line 12: unknown network field 'beacon_interval'.
Line 33: failed to parse network block.
Failed to read or parse configuration '/var/run/wpa_supplicant-wlan0.conf'.
enable_mac80211(radio0): Failed to set up wpa_supplicant for interface wlan0

root@OpenWRT:~# cat /etc/config/wireless
config wifi-device  radio0
 option type mac80211
 option channel  4
 option hwmode   11g
 option macaddr  00:02:6F:XX:XX:XX
 option beacon_int   337
 option diversity 0
 option disabled 0

config wifi-iface
 option network 'mesh'
 option mode 'adhoc'
 option device 'radio0'
 option ssid 'MyMesh'
 option bssid '02:CA:FF:EE:BA:BF'
 option hidden '0'
 option encryption 'psk2'
 option key 'blahblahblahblahblah'

root@OpenWRT:~# cat /var/run/wpa_supplicant-wlan0.conf
ctrl_interface=/var/run/wpa_supplicant-wlan0
ap_scan=2
network={
 mode=1
 scan_ssid=0
 ssid=MyMesh
 bssid=02:CA:FF:EE:BA:BF
 key_mgmt=WPA-PSK
 proto=RSN
 frequency=2427
 fixed_freq=1
 beacon_interval=337

 psk=blahblahblahblahblah

}

root@OpenWRT:~# cat /etc/openwrt_release
DISTRIB_ID=MyCustomWRT
DISTRIB_RELEASE=CustomV2.1
DISTRIB_REVISION=r38347
DISTRIB_CODENAME=pre-release
DISTRIB_TARGET=atheros/generic
DISTRIB_DESCRIPTION=My Custom Release

On Fri, Jun 28, 2013 at 9:07 PM, cmsv c...@wirelesspt.net
mailto:c...@wirelesspt.net wrote:

Info:
http://wiki.openwrt.org/doc/uci/wireless#wpa.enterprise.access.point


configuration:

/etc/config# cat wireless

config wifi-device 'radio0'
 option type 'mac80211'
 option phy 'phy0'
 option hwmode '11ng'
 option noscan '1'
 option disabled '0'
 option diversity '0'
 option rxantenna '2'
 option txantenna '2'
 option txpower '20'
 option beacon_int '1000'
 option distance '2000'
 list ht_capab 'RX-HT40-SGI'
 list ht_capab 'TX-STBC'
 list ht_capab 'RX-STBC1'
 list ht_capab 'DSSS_CCK-40'
 option channel '1'
 option country 'PT'
 option htmode 'HT20'
 option beacon_int '1000'

config wifi-iface
 option device 'radio0'
 option ifname 'wlan0'
 option network 'lan'
 option mode 'ap'
 option ssid 'test.net http://test.net'
 option hidden '0'
 option encryption 'none'


config wifi-iface
 option device 'radio0'
 option ifname 'adhoc0'
 option network 'mesh'
 option mode 'adhoc'
 option bssid '02:16:e8:6a:0b:1e'
 option ssid 'mesh.test'
 option hidden '0'
 option macfilter 'allow'
 option encryption 'psk2'
 option key '1234567890'

Problem:

wifi down
wifi up
command failed: Device or 

[OpenWrt-Devel] [PATCH 01/10] cron: improve init script

2013-10-10 Thread Bruno Randolf
Add PATH in case it is missing (e.g. when executing the script from
ssh, like ssh IP /etc/init.d/cron restart).

Signed-off-by: Bruno Randolf b...@einfach.org
---
 package/busybox/files/cron | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/package/busybox/files/cron b/package/busybox/files/cron
index 465b1ab..79b0a46 100755
--- a/package/busybox/files/cron
+++ b/package/busybox/files/cron
@@ -5,6 +5,8 @@ START=50
 
 SERVICE_USE_PID=1
 
+PATH=/usr/sbin/:$PATH
+
 start () {
loglevel=$(uci_get system.@system[0].cronloglevel)
[ -z $(ls /etc/crontabs/) ]  exit 1
-- 
1.8.1.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


  1   2   >