Re: [OpenWrt-Devel] [PATCH 1/1] alix2: add UCI files for network and wireless

2011-06-05 Thread John Crispin
On 05/06/11 07:47, Philip Prindeville wrote:
 On 6/4/11 6:29 PM, Jonas Gorski wrote:
 On 5 June 2011 00:36, Philip Prindeville
 philipp_s...@redfish-solutions.com wrote:
 The alix2 boards include a miniPCI slot; this is typically used for Wifi 
 cards. Preconfigure wifi.

 The alix2 boards also contain 2 or 3 Ethernet ports. Provision the first 
 two as a bridge.


 Ugh... I have several objections to this, but I just saw the goes
 target has the same ones already present.

 First of all, you would achieve the same by directly putting uci
 config files into alix2/base-files/etc/config/ (like the olpc target
 has).

 Secondly:

 +set wireless.wlan0.type=mac80211

 what if I want to use madwifi?

 +set wireless.wlan0.hwmode=11g

 So I'm not allowed to use 11n?

 +set wireless.wlan0.country=US

 What if I'm not in US?

 +set wireless.@wifi-iface[-1].ssid=typhoon

 What's wrong with Openwrt, the default everywhere else? ;)

 +set wireless.@wifi-iface[-1].key=passphrase

 Ugh, vulnerable to a dictionary attack ...

 +set wireless.@wifi-iface[-1].hidden=0

 This is afaik needless, as 0/false is the default when the key is not 
 present.

 What if I have an alix2 with 2 mini PCI slots and two wifi cards? Then
 my second one won't be visible.

 Also why is wifi /enabled/ by default with a weak password? Security
 wise this is A Bad Idea.

 The network part looks a-okay configuration wise, but I don't like the
 generation at firstboot. Also I'm not sure what happens if I change
 the default network config in menuconfig when building my own image.
 Dynamically setting the network configuration might be acceptable if
 there e.g. would be a check on how many eths are present and then
 assigning the eths to wan and lan.


 Jonas
 
 
 I was going by the example of one of the other platforms, I forget which. 
 Maybe
 target/linux/atheros/base-files/etc/uci-defaults/network ...
 
 I can change the Wifi to be off, and change the SSID. The reason I put values 
 was as placekeepers, so that someone getting into /etc/config/wifi would be 
 able to see what they needed to change by hand.
 
 I'm not sure there are any Alix's currently in production with 2 miniPCI 
 slots, or if there ever have been.
 
 I also decided to do it as a series of mods applied to the standard 
 configuration, so that if the main canned config changed, I wouldn't have 
 to modify the platform configs as well. They would just layer their changes 
 atop the main configuration as deltas.
 
 -Philip
 
 
 
 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/mailman/listinfo/openwrt-devel

wifi should always be of, 11d neutral and use OpenWrt as a ssid. also
there should be no default password/passphrase of any kind

also the wireless config normally gets generated on boot using wifi detect

John


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


Re: [OpenWrt-Devel] [PATCH 1/1] alix2: add UCI files for network and wireless

2011-06-05 Thread John Crispin

 I was going by the example of one of the other platforms, I forget which. 
 Maybe
 target/linux/atheros/base-files/etc/uci-defaults/network ...

Hi,

does not look like atheros. which one was it ? we need to fix that aswell

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


Re: [OpenWrt-Devel] [PATCH 1/1] alix2: add UCI files for network and wireless

2011-06-05 Thread Roberto Riggio

Il 05/06/2011 07:47, Philip Prindeville ha scritto:


I'm not sure there are any Alix's currently in production with 2 miniPCI slots, 
or if there ever have been.
I do have several alix2 boards with 2 minipci slots (both equipped with 
two wifi cards). and

2 ethernet ports.

--

Roberto Riggio, Ph.D.
CREATE-NET
Network  Security Solutions for Pervasive Computing Systems (iNSPIRE)
Senior Researcher
Via alla Cascata 56/D - 38123 Povo Trento (Italy)
e-mail: roberto.rig...@create-net.org
Tel: (+39) 0461 408400 - interno/extension 708
Fax: (+39) 0461 421157
www.create-net.org/~rriggio


The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited according to
the Italian Law 196/2003 of the Legislature. If you received this in
error, please contact the sender and delete the material from any
computer.

Le informazioni contenute in questo messaggio di posta elettronica e nei
file allegati sono da considerarsi strettamente riservate. Il loro
utilizzo e' consentito esclusivamente al destinatario del messaggio, per
le finalita' indicate nel messaggio stesso. Qualora riceveste questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla cancellazione del
messaggio stesso dal Vostro sistema. Trattenere il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo,
od utilizzarlo per finalita' diverse, costituisce comportamento
contrario ai principi dettati dal D. Lgs. 196/2003.

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


Re: [OpenWrt-Devel] [RFC/RFT] generic: Remove IPv6 depependency of bridge in 2.6.38+

2011-06-05 Thread Jonas Gorski
On 4 June 2011 15:39, Florian Fainelli flor...@openwrt.org wrote:
 Hello Jonas,

 On Saturday 14 May 2011 16:54:56 Jonas Gorski wrote:
 Since 2.6.38 the bridge module has a dependency to IPv6 if IPv6 is
 enabled. Since the IPv6 module isn't exactly lightweight and bridge also
 only needs a single function from IPv6, it's rather easy to create a
 common lib module with a RCU pointer to the actual implementation, if
 the IPv6 module is loaded (although slightly hackish).

 The codepath seems to be only taken when using IPv6, so there should be
 no negative side effects when IPv6 isn't loaded. I did not measure how
 big the performance impact is.

 Signed-off-by: Jonas Gorski jonas.gorski+open...@gmail.com

 The patch looks good at first sight, can you post it on netdev to gather some
 opinions from the Linux networking stack developpers?

I can try. My top most reason why I didn't do it yet is that the code
is currently quite hackish (it's more like trying to treat the symptom
than the cause) and I didn't find a clean solution yet (not really
knowing the whole net subsystem doesn't help there either ;-).

Also I still didn't check for any negative performance impacts yet
(there is definitely one, but I don't know if the code paths are
called seldom enough for it to be neglectible).


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


[OpenWrt-Devel] [OFF-TOPIC] Unix networking programming

2011-06-05 Thread scolfield
Hi all,

I know that there are many good programmers and with nice knowledge of
networks computers.
But there are peoples that need/want to improve your knowledge and practice
of Unix networks
programming.

I just only know if you could to indicates a nice books of unix programming,
networks and/or Linux.
I have some books about that, but I like to acquire new books to study. I'm
motivated to learn
more and more about network programming in Linux environment.

With yours experiences about it, I like some hints about which books could I
acquire to study and
to practice programming. Which books you recommends?

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


Re: [OpenWrt-Devel] [OFF-TOPIC] Unix networking programming

2011-06-05 Thread Roback, Joe
Anything by W. Richard Stevens, especially UNIX Network Programming, Volume 1, 
Second Edition: Networking APIs: Sockets and XTI

http://www.kohala.com/start/unpv12e.html

Regards,
Joe


On Jun 5, 2011, at 7:00 AM, scolfield wrote:

 Hi all,
 
 I know that there are many good programmers and with nice knowledge of 
 networks computers.
 But there are peoples that need/want to improve your knowledge and practice 
 of Unix networks 
 programming. 
 
 I just only know if you could to indicates a nice books of unix programming, 
 networks and/or Linux. 
 I have some books about that, but I like to acquire new books to study. I'm 
 motivated to learn
 more and more about network programming in Linux environment.
 
 With yours experiences about it, I like some hints about which books could I 
 acquire to study and
 to practice programming. Which books you recommends?
 
 Thanks,
 scolfield.
 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/mailman/listinfo/openwrt-devel

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


Re: [OpenWrt-Devel] [OFF-TOPIC] Unix networking programming

2011-06-05 Thread scolfield
Hi Roback,

Very nice!
Thank you for your suggestion.

--
scolfield

On Sun, Jun 5, 2011 at 10:30, Roback, Joe openwrt-de...@roback.cc wrote:

 Anything by W. Richard Stevens, especially UNIX Network Programming,
 Volume 1, Second Edition: Networking APIs: Sockets and XTI

 http://www.kohala.com/start/unpv12e.html

 Regards,
 Joe


 On Jun 5, 2011, at 7:00 AM, scolfield wrote:

  Hi all,
 
  I know that there are many good programmers and with nice knowledge of
 networks computers.
  But there are peoples that need/want to improve your knowledge and
 practice of Unix networks
  programming.
 
  I just only know if you could to indicates a nice books of unix
 programming, networks and/or Linux.
  I have some books about that, but I like to acquire new books to study.
 I'm motivated to learn
  more and more about network programming in Linux environment.
 
  With yours experiences about it, I like some hints about which books
 could I acquire to study and
  to practice programming. Which books you recommends?
 
  Thanks,
  scolfield.
  ___
  openwrt-devel mailing list
  openwrt-devel@lists.openwrt.org
  https://lists.openwrt.org/mailman/listinfo/openwrt-devel

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

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


Re: [OpenWrt-Devel] [OFF-TOPIC] Unix networking programming

2011-06-05 Thread John Crispin
Hi,

i can recommend beej -- http://beej.us/guide/

blogic


On 05/06/11 17:12, scolfield wrote:
 Hi Roback,
 
 Very nice!
 Thank you for your suggestion.
 
 --
 scolfield
 
 On Sun, Jun 5, 2011 at 10:30, Roback, Joe openwrt-de...@roback.cc wrote:
 
 Anything by W. Richard Stevens, especially UNIX Network Programming,
 Volume 1, Second Edition: Networking APIs: Sockets and XTI

 http://www.kohala.com/start/unpv12e.html

 Regards,
 Joe


 On Jun 5, 2011, at 7:00 AM, scolfield wrote:

 Hi all,

 I know that there are many good programmers and with nice knowledge of
 networks computers.
 But there are peoples that need/want to improve your knowledge and
 practice of Unix networks
 programming.

 I just only know if you could to indicates a nice books of unix
 programming, networks and/or Linux.
 I have some books about that, but I like to acquire new books to study.
 I'm motivated to learn
 more and more about network programming in Linux environment.

 With yours experiences about it, I like some hints about which books
 could I acquire to study and
 to practice programming. Which books you recommends?

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

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

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

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


[OpenWrt-Devel] Current trunk bricks WRT160NL's

2011-06-05 Thread Tim Fletcher
Just a heads up that I have bricked 2 WRT160NL's today upgrading them,
I'm awaiting a usb - serial convertor to diagnose them.

Not looking for help just now (thou by all means feel free) just want to
warn other people that something bad happened.

The breakage is in the last week I would say, should I be opening trac
tickets now or do you need more info?

By bricked I mean just a flashing power led, no answer on 192.168.1.1 to
ping or tftp upload.

-- 
Tim Fletcher t...@night-shade.org.uk

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


Re: [OpenWrt-Devel] [OFF-TOPIC] Unix networking programming

2011-06-05 Thread scolfield
Hi Crispin,

Thanks for your recommendation.
This guides are very nice.

--
scolfield

On Sun, Jun 5, 2011 at 12:38, John Crispin j...@phrozen.org wrote:

 Hi,

 i can recommend beej -- http://beej.us/guide/

 blogic


 On 05/06/11 17:12, scolfield wrote:
  Hi Roback,
 
  Very nice!
  Thank you for your suggestion.
 
  --
  scolfield
 
  On Sun, Jun 5, 2011 at 10:30, Roback, Joe openwrt-de...@roback.cc
 wrote:
 
  Anything by W. Richard Stevens, especially UNIX Network Programming,
  Volume 1, Second Edition: Networking APIs: Sockets and XTI
 
  http://www.kohala.com/start/unpv12e.html
 
  Regards,
  Joe
 
 
  On Jun 5, 2011, at 7:00 AM, scolfield wrote:
 
  Hi all,
 
  I know that there are many good programmers and with nice knowledge of
  networks computers.
  But there are peoples that need/want to improve your knowledge and
  practice of Unix networks
  programming.
 
  I just only know if you could to indicates a nice books of unix
  programming, networks and/or Linux.
  I have some books about that, but I like to acquire new books to study.
  I'm motivated to learn
  more and more about network programming in Linux environment.
 
  With yours experiences about it, I like some hints about which books
  could I acquire to study and
  to practice programming. Which books you recommends?
 
  Thanks,
  scolfield.
  ___
  openwrt-devel mailing list
  openwrt-devel@lists.openwrt.org
  https://lists.openwrt.org/mailman/listinfo/openwrt-devel
 
  ___
  openwrt-devel mailing list
  openwrt-devel@lists.openwrt.org
  https://lists.openwrt.org/mailman/listinfo/openwrt-devel
 
 
 
 
  ___
  openwrt-devel mailing list
  openwrt-devel@lists.openwrt.org
  https://lists.openwrt.org/mailman/listinfo/openwrt-devel

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

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


Re: [OpenWrt-Devel] Current trunk bricks WRT160NL's

2011-06-05 Thread Jonas Gorski
On 5 June 2011 18:32, Tim Fletcher t...@night-shade.org.uk wrote:
 Just a heads up that I have bricked 2 WRT160NL's today upgrading them,
 I'm awaiting a usb - serial convertor to diagnose them.

 Not looking for help just now (thou by all means feel free) just want to
 warn other people that something bad happened.

 The breakage is in the last week I would say, should I be opening trac
 tickets now or do you need more info?

 By bricked I mean just a flashing power led, no answer on 192.168.1.1 to
 ping or tftp upload.

Known issue in the current build and already fixed (see
https://dev.openwrt.org/changeset/27102), the next build should be
working again.


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


Re: [OpenWrt-Devel] flash wearout

2011-06-05 Thread Peter Wagner
Am Freitag, 3. Mai 2011, 04:11:43 schrieb Philip Prindeville:
 On 5/31/11 10:48 AM, Peter Wagner wrote:
  Am Dienstag, 31. Mai 2011, 17:52:58 schrieb Philip Prindeville:
  On 5/30/11 4:00 PM, Peter Wagner wrote:
  Hi,
  
  while i was reading some init files i stumbled upon this:
  
  /sbin/wifi detect  /etc/config/wireless
  
  grep -qs config /etc/config/wireless  {
  
/sbin/wifi up
  
  } || {
  
rm -f /etc/config/wireless
  
  }
  
  this means:
  /sbin/wifi detect  /etc/config/wireless
  
  /sbin/wifi only outputs something if /etc/config/wireless doesnt exist
  but even if the files exist /etc/config/wireless modification time gets
  updated. this means even when the wifi is allready configured the
  modtime of the file gets updated everytime the system boots.
  
  i created this patch - maybe there is a better way to fix this.
  
  I would test for the file changing with respect to the existing copy,
  rather than non-zero length.
  
  If you change out hardware, or if you had a wireless interface but now
  have removed it, you don't want to retain invalid information.
  
  I'd use cmp -s to compare the two files.
  
  this wont work - because if the file wireless exists the script output
  nothing ... so if you attach a new wifi card - you would have to remove
  the file and restart the router or do a wifi detect 
  /etc/config/wireless ...
  
  and if the file is empty (the one wifi detect created) cmp will also
  return something != 0...
 
 That's a glitch. Why should wifi detect care if there's a file already
 present or not? It should ignore it.
 

yeah but if i have a /etc/config/wireless file and do a wifi detect i get no 
output - when i delete the file it gives me the standard file... like

server /root # ls -la /etc/config/wireless
-rw-r--r--1 root root   321 Jan 27 00:27 /etc/config/wireless
server /root # wifi detect
server /root # rm /etc/config/wireless
server /root # wifi detect
config wifi-device  radio0
option type mac80211
option channel  11
option macaddr  xx:xx:xx:xx:xx:xx
option hwmode   11g

# REMOVE THIS LINE TO ENABLE WIFI:
option disabled 1

config wifi-iface
option device   radio0
option network  lan
option mode ap
option ssid OpenWrt
option encryption none


i modified the patch, now it doesnt use wc anymore 


regards
Peter

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

diff --git a/package/base-files/files/etc/init.d/network b/package/base-files/files/etc/init.d/network
index c2095a4..4a59a49 100755
--- a/package/base-files/files/etc/init.d/network
+++ b/package/base-files/files/etc/init.d/network
@@ -9,12 +9,15 @@ boot() {
 
 	include /lib/network
 	setup_switch
-	/sbin/wifi detect  /etc/config/wireless
+
+	/sbin/wifi detect  /tmp/wireless.tmp
+	[ -s /tmp/wireless.tmp ]  {
+		cat /tmp/wireless.tmp  /etc/config/wireless
+	}
 	grep -qs config /etc/config/wireless  {
 		/sbin/wifi up
-	} || {
-		rm -f /etc/config/wireless
 	}
+	rm -f /tmp/wireless.tmp
 
 	scan_interfaces
 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Current trunk bricks WRT160NL's

2011-06-05 Thread Tim Fletcher
On Sun, 2011-06-05 at 19:14 +0200, Jonas Gorski wrote:
 On 5 June 2011 18:32, Tim Fletcher t...@night-shade.org.uk wrote:

 Known issue in the current build and already fixed (see
 https://dev.openwrt.org/changeset/27102), the next build should be
 working again.

Thanks, time to learn about u-boot and serial ports :)

-- 
Tim Fletcher t...@night-shade.org.uk

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


Re: [OpenWrt-Devel] flash wearout v2

2011-06-05 Thread Peter Wagner
Am Sonntag, 5. Mai 2011, 20:02:13 schrieb Peter Wagner:
 Am Sonntag, 5. Mai 2011, 19:54:22 schrieb Peter Wagner:
  Am Freitag, 3. Mai 2011, 04:11:43 schrieb Philip Prindeville:
   On 5/31/11 10:48 AM, Peter Wagner wrote:
Am Dienstag, 31. Mai 2011, 17:52:58 schrieb Philip Prindeville:
On 5/30/11 4:00 PM, Peter Wagner wrote:
Hi,

while i was reading some init files i stumbled upon this:

/sbin/wifi detect  /etc/config/wireless

grep -qs config /etc/config/wireless  {

  /sbin/wifi up

} || {

  rm -f /etc/config/wireless

}

this means:
/sbin/wifi detect  /etc/config/wireless

/sbin/wifi only outputs something if /etc/config/wireless doesnt
exist but even if the files exist /etc/config/wireless modification
time gets updated. this means even when the wifi is allready
configured the modtime of the file gets updated everytime the
system boots.

i created this patch - maybe there is a better way to fix this.

I would test for the file changing with respect to the existing
copy, rather than non-zero length.

If you change out hardware, or if you had a wireless interface but
now have removed it, you don't want to retain invalid information.

I'd use cmp -s to compare the two files.

this wont work - because if the file wireless exists the script
output nothing ... so if you attach a new wifi card - you would have
to remove the file and restart the router or do a wifi detect 
/etc/config/wireless ...

and if the file is empty (the one wifi detect created) cmp will also
return something != 0...
   
   That's a glitch. Why should wifi detect care if there's a file
   already present or not? It should ignore it.
  
  yeah but if i have a /etc/config/wireless file and do a wifi detect i get
  no output - when i delete the file it gives me the standard file... like
  
  server /root # ls -la /etc/config/wireless
  -rw-r--r--1 root root   321 Jan 27 00:27
  /etc/config/wireless server /root # wifi detect
  server /root # rm /etc/config/wireless
  server /root # wifi detect
  config wifi-device  radio0
  
  option type mac80211
  option channel  11
  option macaddr  xx:xx:xx:xx:xx:xx
  option hwmode   11g
  
  # REMOVE THIS LINE TO ENABLE WIFI:
  option disabled 1
  
  config wifi-iface
  
  option device   radio0
  option network  lan
  option mode ap
  option ssid OpenWrt
  option encryption none
  
  i modified the patch, now it doesnt use wc anymore 
  
  
  regards
  Peter
  
   ___
   openwrt-devel mailing list
   openwrt-devel@lists.openwrt.org
   https://lists.openwrt.org/mailman/listinfo/openwrt-devel
 
 no this patch wont work  the old one with wc -l is the working one ;)
 
 regards

sorry for the noise but as the file is created one line befor the test it can 
be assumend the file is there so . this version was correct ...

regards
peter
diff --git a/package/base-files/files/etc/init.d/network b/package/base-files/files/etc/init.d/network
index c2095a4..fc51221 100755
--- a/package/base-files/files/etc/init.d/network
+++ b/package/base-files/files/etc/init.d/network
@@ -9,11 +9,14 @@ boot() {
 
 	include /lib/network
 	setup_switch
-	/sbin/wifi detect  /etc/config/wireless
+
+	/sbin/wifi detect  /tmp/wireless.tmp
+	[ -s /tmp/wireless.tmp ]  {
+		cat /tmp/wireless.tmp  /etc/config/wireless
+	}
+	rm -f /tmp/wireless.tmp
 	grep -qs config /etc/config/wireless  {
 		/sbin/wifi up
-	} || {
-		rm -f /etc/config/wireless
 	}
 
 	scan_interfaces
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] flash wearout

2011-06-05 Thread Philip Prindeville
On 6/5/11 10:54 AM, Peter Wagner wrote:
 Am Freitag, 3. Mai 2011, 04:11:43 schrieb Philip Prindeville:
 On 5/31/11 10:48 AM, Peter Wagner wrote:
 Am Dienstag, 31. Mai 2011, 17:52:58 schrieb Philip Prindeville:
 On 5/30/11 4:00 PM, Peter Wagner wrote:
 Hi,

 while i was reading some init files i stumbled upon this:

 /sbin/wifi detect  /etc/config/wireless

 grep -qs config /etc/config/wireless  {

   /sbin/wifi up

 } || {

   rm -f /etc/config/wireless

 }

 this means:
 /sbin/wifi detect  /etc/config/wireless

 /sbin/wifi only outputs something if /etc/config/wireless doesnt exist
 but even if the files exist /etc/config/wireless modification time gets
 updated. this means even when the wifi is allready configured the
 modtime of the file gets updated everytime the system boots.

 i created this patch - maybe there is a better way to fix this.

 I would test for the file changing with respect to the existing copy,
 rather than non-zero length.

 If you change out hardware, or if you had a wireless interface but now
 have removed it, you don't want to retain invalid information.

 I'd use cmp -s to compare the two files.

 this wont work - because if the file wireless exists the script output
 nothing ... so if you attach a new wifi card - you would have to remove
 the file and restart the router or do a wifi detect 
 /etc/config/wireless ...

 and if the file is empty (the one wifi detect created) cmp will also
 return something != 0...

 That's a glitch. Why should wifi detect care if there's a file already
 present or not? It should ignore it.

 
 yeah but if i have a /etc/config/wireless file and do a wifi detect i get no 
 output - when i delete the file it gives me the standard file... like
 
 server /root # ls -la /etc/config/wireless
 -rw-r--r--1 root root   321 Jan 27 00:27 /etc/config/wireless
 server /root # wifi detect
 server /root # rm /etc/config/wireless
 server /root # wifi detect
 config wifi-device  radio0
 option type mac80211
 option channel  11
 option macaddr  xx:xx:xx:xx:xx:xx
 option hwmode   11g
 
 # REMOVE THIS LINE TO ENABLE WIFI:
 option disabled 1
 
 config wifi-iface
 option device   radio0
 option network  lan
 option mode ap
 option ssid OpenWrt
 option encryption none
 
 
 i modified the patch, now it doesnt use wc anymore 
 
 
 regards
 Peter

You misunderstand me. I'm saying that wifi detect should generate an output 
file regardless of whether /etc/config/wireless exists or not. Capture the 
output into /tmp, and if it's different from what's in /etc/config/wireless 
then copy it over.

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


Re: [OpenWrt-Devel] flash wearout v2

2011-06-05 Thread Philip Prindeville
On 6/5/11 11:10 AM, Peter Wagner wrote:
 Am Sonntag, 5. Mai 2011, 20:02:13 schrieb Peter Wagner:
 Am Sonntag, 5. Mai 2011, 19:54:22 schrieb Peter Wagner:
 Am Freitag, 3. Mai 2011, 04:11:43 schrieb Philip Prindeville:
 On 5/31/11 10:48 AM, Peter Wagner wrote:
 Am Dienstag, 31. Mai 2011, 17:52:58 schrieb Philip Prindeville:
 On 5/30/11 4:00 PM, Peter Wagner wrote:
 Hi,

 while i was reading some init files i stumbled upon this:

 /sbin/wifi detect  /etc/config/wireless

 grep -qs config /etc/config/wireless  {

 /sbin/wifi up

 } || {

 rm -f /etc/config/wireless

 }

 this means:
 /sbin/wifi detect  /etc/config/wireless

 /sbin/wifi only outputs something if /etc/config/wireless doesnt
 exist but even if the files exist /etc/config/wireless modification
 time gets updated. this means even when the wifi is allready
 configured the modtime of the file gets updated everytime the
 system boots.

 i created this patch - maybe there is a better way to fix this.

 I would test for the file changing with respect to the existing
 copy, rather than non-zero length.

 If you change out hardware, or if you had a wireless interface but
 now have removed it, you don't want to retain invalid information.

 I'd use cmp -s to compare the two files.

 this wont work - because if the file wireless exists the script
 output nothing ... so if you attach a new wifi card - you would have
 to remove the file and restart the router or do a wifi detect 
 /etc/config/wireless ...

 and if the file is empty (the one wifi detect created) cmp will also
 return something != 0...

 That's a glitch. Why should wifi detect care if there's a file
 already present or not? It should ignore it.

 yeah but if i have a /etc/config/wireless file and do a wifi detect i get
 no output - when i delete the file it gives me the standard file... like

 server /root # ls -la /etc/config/wireless
 -rw-r--r--1 root root   321 Jan 27 00:27
 /etc/config/wireless server /root # wifi detect
 server /root # rm /etc/config/wireless
 server /root # wifi detect
 config wifi-device  radio0

 option type mac80211
 option channel  11
 option macaddr  xx:xx:xx:xx:xx:xx
 option hwmode   11g
 
 # REMOVE THIS LINE TO ENABLE WIFI:
 option disabled 1

 config wifi-iface

 option device   radio0
 option network  lan
 option mode ap
 option ssid OpenWrt
 option encryption none

 i modified the patch, now it doesnt use wc anymore 


 regards
 Peter

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

 no this patch wont work  the old one with wc -l is the working one ;)

 regards
 
 sorry for the noise but as the file is created one line befor the test it can 
 be assumend the file is there so . this version was correct ...
 
 regards
 peter

+   cat /tmp/wireless.tmp  /etc/config/wireless


Why  and not  ?

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


Re: [OpenWrt-Devel] [PATCH 1/1] alix2: add UCI files for network and wireless

2011-06-05 Thread Philip Prindeville
On 6/5/11 12:57 AM, John Crispin wrote:
 On 05/06/11 07:47, Philip Prindeville wrote:
 On 6/4/11 6:29 PM, Jonas Gorski wrote:
 On 5 June 2011 00:36, Philip Prindeville
 philipp_s...@redfish-solutions.com wrote:
 The alix2 boards include a miniPCI slot; this is typically used for Wifi 
 cards. Preconfigure wifi.

 The alix2 boards also contain 2 or 3 Ethernet ports. Provision the first 
 two as a bridge.


 Ugh... I have several objections to this, but I just saw the goes
 target has the same ones already present.

 First of all, you would achieve the same by directly putting uci
 config files into alix2/base-files/etc/config/ (like the olpc target
 has).

 Secondly:

 +set wireless.wlan0.type=mac80211

 what if I want to use madwifi?

 +set wireless.wlan0.hwmode=11g

 So I'm not allowed to use 11n?

 +set wireless.wlan0.country=US

 What if I'm not in US?

 +set wireless.@wifi-iface[-1].ssid=typhoon

 What's wrong with Openwrt, the default everywhere else? ;)

 +set wireless.@wifi-iface[-1].key=passphrase

 Ugh, vulnerable to a dictionary attack ...

 +set wireless.@wifi-iface[-1].hidden=0

 This is afaik needless, as 0/false is the default when the key is not 
 present.

 What if I have an alix2 with 2 mini PCI slots and two wifi cards? Then
 my second one won't be visible.

 Also why is wifi /enabled/ by default with a weak password? Security
 wise this is A Bad Idea.

 The network part looks a-okay configuration wise, but I don't like the
 generation at firstboot. Also I'm not sure what happens if I change
 the default network config in menuconfig when building my own image.
 Dynamically setting the network configuration might be acceptable if
 there e.g. would be a check on how many eths are present and then
 assigning the eths to wan and lan.


 Jonas


 I was going by the example of one of the other platforms, I forget which. 
 Maybe
 target/linux/atheros/base-files/etc/uci-defaults/network ...

 I can change the Wifi to be off, and change the SSID. The reason I put 
 values was as placekeepers, so that someone getting into /etc/config/wifi 
 would be able to see what they needed to change by hand.

 I'm not sure there are any Alix's currently in production with 2 miniPCI 
 slots, or if there ever have been.

 I also decided to do it as a series of mods applied to the standard 
 configuration, so that if the main canned config changed, I wouldn't have 
 to modify the platform configs as well. They would just layer their changes 
 atop the main configuration as deltas.

 -Philip



 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/mailman/listinfo/openwrt-devel
 
 wifi should always be of, 11d neutral and use OpenWrt as a ssid. also
 there should be no default password/passphrase of any kind
 
 also the wireless config normally gets generated on boot using wifi detect
 
 John

Ok, so off by default, 11d neutral, no default passphrase, and ssid of 
Openwrt.

And if the wifi config is that controversial, we can just commit the 
/etc/uci-defaults/network hunk...

-Philip
Index: target/linux/x86/alix2/base-files/etc/uci-defaults/network
===
--- target/linux/x86/alix2/base-files/etc/uci-defaults/network  (revision 0)
+++ target/linux/x86/alix2/base-files/etc/uci-defaults/network  (revision 0)
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+uci batch __EOF__
+
+delete network.lan
+
+set network.lan=interface
+set network.lan.type=bridge
+set network.lan.ifname=eth0 eth1
+set network.lan.proto=static
+set network.lan.ipaddr=192.168.1.1
+set network.lan.netmask=255.255.255.0
+set network.lan.nat=1
+
+commit network
+__EOF__
Index: target/linux/x86/alix2/base-files/etc/uci-defaults/wireless
===
--- target/linux/x86/alix2/base-files/etc/uci-defaults/wireless (revision 0)
+++ target/linux/x86/alix2/base-files/etc/uci-defaults/wireless (revision 0)
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+[ -f /etc/config/wireless ] || echo package wireless  /etc/config/wireless
+
+uci batch __EOF__
+
+delete wireless.radio0
+delete wireless.@wifi-iface[0]
+
+set wireless.wlan0=wifi-device
+set wireless.wlan0.type=mac80211
+set wireless.wlan0.phy=phy0
+set wireless.wlan0.channel=auto
+
+add wireless wifi-iface
+set wireless.@wifi-iface[-1].device=wlan0
+set wireless.@wifi-iface[-1].network=lan
+set wireless.@wifi-iface[-1].mode=ap
+set wireless.@wifi-iface[-1].ssid=Openwrt
+set wireless.@wifi-iface[-1].encryption=psk2+aes
+set wireless.@wifi-iface[-1].hidden=0
+set wireless.@wifi-iface[-1].disabled=1
+
+commit wireless
+__EOF__
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel