[OpenWrt-Devel] [bcm6358] fix enet1 mii clk

2010-04-28 Thread Miguel GAIO
Hi,

The attached patch fixup the setup of MII clock for case enet1 is linked
to external switch for 6358 soc base boards.

Warning! Despite, this improves stability on NB4 and 96358VW boards, it
must be confirmed on other boards.

Kind Regards,

Miguel
Index: openwrt.org/target/linux/brcm63xx/patches-2.6.32/250-6358-enet1-external-mii-clk.patch
===
--- openwrt.org/target/linux/brcm63xx/patches-2.6.32/250-6358-enet1-external-mii-clk.patch	(revision 0)
+++ openwrt.org/target/linux/brcm63xx/patches-2.6.32/250-6358-enet1-external-mii-clk.patch	(revision 0)
@@ -0,0 +1,22 @@
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -1308,6 +1308,8 @@ void __init board_prom_init(void)
+ 		if (BCMCPU_IS_6348())
+ 			val |= GPIO_MODE_6348_G3_EXT_MII |
+ GPIO_MODE_6348_G0_EXT_MII;
++		else if (BCMCPU_IS_6358())
++			val |= GPIO_MODE_6358_ENET1_MII_CLK_INV;
+ 	}
+ 
+ 	bcm_gpio_writel(val, GPIO_MODE_REG);
+--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
 b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
+@@ -402,6 +402,8 @@
+ #define GPIO_MODE_6358_EXTRA_SPI_SS	(1  7)
+ #define GPIO_MODE_6358_SERIAL_LED	(1  10)
+ #define GPIO_MODE_6358_UTOPIA		(1  12)
++#define GPIO_MODE_6358_ENET0_MII_CLK_INV (1  30)
++#define GPIO_MODE_6358_ENET1_MII_CLK_INV (1  31)
+ 
+ 
+ /*
Index: openwrt.org/target/linux/brcm63xx/patches-2.6.33/250-6358-enet1-external-mii-clk.patch
===
--- openwrt.org/target/linux/brcm63xx/patches-2.6.33/250-6358-enet1-external-mii-clk.patch	(revision 0)
+++ openwrt.org/target/linux/brcm63xx/patches-2.6.33/250-6358-enet1-external-mii-clk.patch	(revision 0)
@@ -0,0 +1,22 @@
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -1308,6 +1308,8 @@ void __init board_prom_init(void)
+ 		if (BCMCPU_IS_6348())
+ 			val |= GPIO_MODE_6348_G3_EXT_MII |
+ GPIO_MODE_6348_G0_EXT_MII;
++		else if (BCMCPU_IS_6358())
++			val |= GPIO_MODE_6358_ENET1_MII_CLK_INV;
+ 	}
+ 
+ 	bcm_gpio_writel(val, GPIO_MODE_REG);
+--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
 b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
+@@ -402,6 +402,8 @@
+ #define GPIO_MODE_6358_EXTRA_SPI_SS	(1  7)
+ #define GPIO_MODE_6358_SERIAL_LED	(1  10)
+ #define GPIO_MODE_6358_UTOPIA		(1  12)
++#define GPIO_MODE_6358_ENET0_MII_CLK_INV (1  30)
++#define GPIO_MODE_6358_ENET1_MII_CLK_INV (1  31)
+ 
+ 
+ /*
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [bcm6358] fix enet1 mii clk

2010-04-28 Thread Florian Fainelli
Hi Miguel,

On Wednesday 28 April 2010 11:39:34 Miguel GAIO wrote:
 Hi,
 
 The attached patch fixup the setup of MII clock for case enet1 is linked
 to external switch for 6358 soc base boards.
 
 Warning! Despite, this improves stability on NB4 and 96358VW boards, it
 must be confirmed on other boards.

This patch looks fine to me. I will give it a test on an evaluation. Meanwhile, 
it can go in.

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


Re: [OpenWrt-Devel] [bcm6358] fix enet1 mii clk

2010-04-28 Thread Raphaël HUCK
Le Wed, 28 Apr 2010 11:39:34 +0200,
Miguel GAIO miguel.g...@efixo.com a écrit :

 Hi,
 
 The attached patch fixup the setup of MII clock for case enet1 is
 linked to external switch for 6358 soc base boards.
 
 Warning! Despite, this improves stability on NB4 and 96358VW boards,
 it must be confirmed on other boards.
 
 Kind Regards,
 
 Miguel

Applied in r21231. Thanks Miguel!

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


Re: [OpenWrt-Devel] [PATCH] Disable IPv6 autoconfiguration

2010-04-28 Thread Jo-Philipp Wich
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi.

 Therefore I believe that the /etc/sysctl.conf file should have
 net.ipv6.conf.all.forwarding=1 set by default.

A default firewall solution is needed before it can be made the default.

Even if you or me do not need a firewall it is not acceptable to do this
without in release images.


~ Jow
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkvYSiYACgkQdputYINPTPOuPgCfazEJeAOYiRrTX1xxngFE4EVv
REAAoJrzqQSyrBTZccjEPU/pGqoRr5A4
=6fLS
-END PGP SIGNATURE-
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] Disable IPv6 autoconfiguration

2010-04-28 Thread Benjamin Cama
Le mardi 27 avril 2010 à 19:32 +0200, Alina Friedrichsen a écrit :
 Routers must not react on router advertisements (written in someone RFC)
 or you have a security problem.

Mmhhh ... you're right, I may not have thought enough in a router
perspective.

 IPv6 autoconfiguration and DHCPv6 are together and alone the counterpart
 to DHCP in IPv4. Both can be implemented on the same interface at the
 same time.

I didn't see it that way before ... Maybe I was wrong.

  For me too. If find that it ties too much dhcp and IPv6
  autoconfiguration together. To me, even if both have the same goal, the
  reason of their existence is different : DHCP is kind of bad hack on a
  problem that IPv6 solved more cleanly and that is more general.
 
 But on a dual stack network you want to use both. This proto option is
 only called dhcp because of historical reasons not technical, I think.
 On any operating system that support IPv6, you get IPv6
 autoconfiguration too, if you select DHCP. See Ubuntu, see Windows 7
 and Vista.

On my Debian (which should be almost like Ubuntu) Network Manager call
that Automatic connection. I don't know for Windows.
I understand that you may want to name it dhcp for historical reasons.
I think the main problem is that we want to get a single name for both
IPv4 and IPv6. Furthermore, I looked at
http://wiki.openwrt.org/doc/uci/network and I see that their is a way,
with alias, to kind of separate both. I never used that option, does
anyone see it as a good way to separate IPv4 and IPv6 configuration
for an interface ?

  I don't agree. I don't have any particular use case, but wanting a
  static IPv4 address doesn't mean to me that i'll also absolutely want a
  static IPv6 one. The former case is used more often than the latter, and
  there is not always an implication relation between the two.
 
 As I say, let this only the default setting in the different proto
 options and add a new uci option to overwrite this setting.

 My thought was, maybe rename proto dhcp to somewhat more protocol
 independent, so that it applies to both IP versions.

May be a good solution. But what about backward compatibility ? So that
people don't wonder what is this xyz proto option ? (even if auto
sounds quite straightforward to me)
I just play devil's advocate here : the further I think to it, the more
I see dhcp proto as not so bad.

  To me, the most interesting option is static IPv4 with IPv6
  autoconfiguration, which is what is done today by default.
 
 As I say, add a option to overwrite the default setting. In the most
 cases a static interface with IPv6 autoconfiguration is a security
 issue.

OK. You convinced me that for an OS like OpenWRT, this is a good
default.

To summarize, now (with your patch) by default we have no IPv6
autoconfiguration taking place except on proto dhcp configured
interfaces, right ?
For people who want IPv4 DHCP but static IPv6 address, their is an
example on the wiki (cited earlier) that does this, but I think you
still get the autoconfigured address, too.
And for those who want static IPv4 and IPv6 autoconfiguration, there is
no solution yet ... Yet, this may not be an interesting case.

So, what to do ? I think your patch is good, but there are some cases
left. Maybe we could simply disable IPv6 autoconfiguration altogether by
default, and enable it only when ipv6addr is auto, for example ?
(new code needed, I could do that)
This kind of let the proto option for IPv4 only, and move the way we
do ipv6 in the ipv6addr option, and I don't know if everyone will be
comfortable with this.
So, what do you think ?

Regards,
benjamin

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


Re: [OpenWrt-Devel] [PATCH] Disable IPv6 autoconfiguration

2010-04-28 Thread Malte S. Stretz
Moin,

On Wednesday 28 April 2010 16:45:58 Jo-Philipp Wich wrote:
  Therefore I believe that the /etc/sysctl.conf file should have
  net.ipv6.conf.all.forwarding=1 set by default.
 
 A default firewall solution is needed before it can be made the default.
 
 Even if you or me do not need a firewall it is not acceptable to do this
 without in release images.

Last year I posted [1] a rewrite of the firewall script to add IPv6 support 
and judging from the replies (zero) it didn't look like anybody was 
interested.  The most recent version is also available here [2].  It is 
probably far from perfect but a start.

I've been AFK for the last few months and didn't track the recent development 
so I guess some patches are needed to make it work with Backfire and to 
incorporate the latest changes.  But it did work quite well back then.

Cheers,
Malte

[1]http://article.gmane.org/gmane.comp.embedded.openwrt.devel/3634
[2]http://gitorious.org/sixwrt/packages/trees/master/package/firewall
-- 
   
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [backfire][bug] setting LAN mac address, makes router inaccessible from LAN

2010-04-28 Thread Matthias Buecher / Germany
When changing the LAN mac address on a WRT54G v2.2 the router becomes
inaccessible from the LAN (no ping, no SSH, etc.).
The same happens on a WRT350Nv2 (Orion CPU), therefore it seems to be a
general issue.

Only revived the router back via serial access, as Backfire brcm47xx
(Linux 2.6) provides no WLAN to access the router.
So for others without serial access or JTAG, this issue is like a
bricked router.
This issue should definitely be on the known problems page [1] and
verified on other devices.

The patch from ticket #7111 [2] also fixed this issue on the WRT54G.
Could the developers and/or patch team commit this to trunk and Backfire.

Thanks in advance
Maddes

[1] https://dev.openwrt.org/milestone/Backfire%2010.03
(not listed anymore on https://dev.openwrt.org/milestone/)
[2] https://dev.openwrt.org/ticket/7111

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


[OpenWrt-Devel] New firewall (was: [PATCH] Disable IPv6 autoconfiguration)

2010-04-28 Thread Jo-Philipp Wich
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Malte.

So I gave it a try now and it works well for me, will do some more ipv6
testing in the next days. I also ported several fixes from the trunk
version of the uci firewall, added some compat code and hotplug events.

Attached are two patches, one against package/firewall from current
trunk (for users who want to try it) and one against the latest rev from
your git repository. Maybe you want to review it.

If testing reveals no further issues, I'll replace the default firewall
was your improved version.


~ Jow
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkvYvDAACgkQdputYINPTPM2rgCfXyCYx3Drj14vX983WrAvSNMi
wfsAni4E5G80eNmzqyG79VU+xPwTFPUg
=Sx5E
-END PGP SIGNATURE-
Index: package/firewall/files/20-firewall
===
--- package/firewall/files/20-firewall	(revision 2)
+++ package/firewall/files/20-firewall	(working copy)
@@ -1,5 +0,0 @@
-. /lib/firewall/uci_firewall.sh
-unset ZONE
-config_get ifname $INTERFACE ifname
-[ $ifname == lo ]  exit 0
-fw_event $ACTION $INTERFACE
Index: package/firewall/files/firewall.hotplug
===
--- package/firewall/files/firewall.hotplug	(revision 0)
+++ package/firewall/files/firewall.hotplug	(revision 0)
@@ -0,0 +1,19 @@
+#!/bin/sh
+# This script is executed as part of the hotplug event with
+# HOTPLUG_TYPE=iface, triggered by various scripts when an interface
+# is configured (ACTION=ifup) or deconfigured (ACTION=ifdown).  The
+# interface is available as INTERFACE, the real device as DEVICE.
+. /etc/functions.sh
+
+[ $DEVICE == lo ]  exit 0
+
+. /lib/firewall/core.sh
+fw_is_loaded || exit 0
+fw_init
+
+case $ACTION in
+	ifup)
+		fw_configure_interface $INTERFACE add $DEVICE ;;
+	ifdown)
+		fw_configure_interface $INTERFACE del $DEVICE ;;
+esac
Index: package/firewall/files/lib/core.sh
===
--- package/firewall/files/lib/core.sh	(revision 0)
+++ package/firewall/files/lib/core.sh	(revision 0)
@@ -0,0 +1,136 @@
+# Copyright (C) 2009 OpenWrt.org
+
+FW_LIBDIR=${FW_LIBDIR:-/lib/firewall}
+
+. $FW_LIBDIR/fw.sh
+include /lib/network
+
+fw_start() {
+	fw_init
+
+	FW_DEFAULTS_APPLIED=
+
+	fw_is_loaded  {
+		echo firewall already loaded 2
+		exit 1
+	}
+	uci_set_state firewall core  firewall_state
+
+	fw_clear DROP
+
+	fw_callback pre core
+
+	echo Loading defaults
+	fw_config_once fw_load_defaults defaults
+
+	echo Loading zones
+	config_foreach fw_load_zone zone
+
+	echo Loading forwardings
+	config_foreach fw_load_forwarding forwarding
+
+	echo Loading redirects
+	config_foreach fw_load_redirect redirect
+
+	echo Loading rules
+	config_foreach fw_load_rule rule
+
+	echo Loading includes
+	config_foreach fw_load_include include
+
+	[ -n $FW_NOTRACK_DISABLED ]  {
+		echo Optimizing conntrack
+		config_foreach fw_load_notrack_zone zone
+	}
+
+	echo Loading interfaces
+	config_foreach fw_configure_interface interface add
+
+	fw_callback post core
+
+	uci_set_state firewall core loaded 1
+}
+
+fw_stop() {
+	fw_init
+
+	fw_callback pre stop
+
+	fw_clear ACCEPT
+
+	fw_callback post stop
+
+	uci_revert_state firewall
+	config_clear
+	unset FW_INITIALIZED
+}
+
+fw_restart() {
+	fw_stop
+	fw_start
+}
+
+fw_reload() {
+	fw_restart
+}
+
+fw_is_loaded() {
+	local bool
+	config_get_bool bool core loaded 0
+	return $((! $bool))
+}
+
+
+fw_die() {
+	echo Error: $@ 2
+	fw_log error $@
+	fw_stop
+	exit 1
+}
+
+fw_log() {
+	local level=$1
+	[ -n $2 ] || {
+		shift
+		level=notice
+	}
+	logger -t firewall -p user.$level $@
+}
+
+
+fw_init() {
+	[ -z $FW_INITIALIZED ] || return 0
+
+	. $FW_LIBDIR/config.sh
+
+	scan_interfaces
+	fw_config_append firewall
+
+	local hooks=core stop defaults zone notrack synflood
+	local file lib hk pp
+	for file in $FW_LIBDIR/core_*.sh; do
+		. $file
+		hk=$(basename $file .sh)
+		hk=${hk#core_}
+		append hooks $hk
+	done
+	for file in $FW_LIBDIR/*.sh; do
+		lib=$(basename $file .sh)
+		lib=${lib##[0-9][0-9]_}
+		case $lib in
+			core*|fw|config|uci_firewall) continue ;;
+		esac
+		. $file
+		for hk in $hooks; do
+			for pp in pre post; do
+type ${lib}_${pp}_${hk}_cb /dev/null 
+	append FW_CB_${pp}_${hk} ${lib}
+			done
+		done
+	done
+
+	fw_callback post init
+
+	FW_INITIALIZED=1
+	return 0
+}
Index: package/firewall/files/lib/core_interface.sh
===
--- package/firewall/files/lib/core_interface.sh	(revision 0)
+++ package/firewall/files/lib/core_interface.sh	(revision 0)
@@ -0,0 +1,86 @@
+# Copyright (C) 2009 OpenWrt.org
+
+fw_configure_interface() {
+	local iface=$1
+	local action=$2
+	local ifname=$3
+
+	local status;
+	config_get_bool status $iface up 0
+	[ $status == 1 ] || return 0
+
+	[ -n $ifname ] || {
+		config_get ifname $iface ifname
+