Modify

Opened 4 years ago

Last modified 3 years ago

#14156 new defect

Edimax 3G 6200n - eth0 switch starts in dummy bridge mode, which confuses the WAN DHCP server

Reported by: wzab Owned by: developers
Priority: normal Milestone: Chaos Calmer 15.05
Component: kernel Version: Trunk
Keywords: ralink eth0 switch Cc:

Description

I have compiled the newest trunk for my Edimax 3G 6200n.
As this version incorrectly configures the eth0 switch, I have added appropriate configuration manually, as described in https://forum.openwrt.org/viewtopic.php?id=40280

Now the switch is finally configured correctly with ports assigned to VLANs (LAN and WAN), but another problem occured.
The Access Point didn't receive IP via DHCP from the cable modem connected to the WAN port. The only situation, when DHCP worked correctly, was if I switched off and on the cable modem with running AP, or when I disconnected and reconnected the cable between AP and cable modem.

Detailed investigation (reported in https://forum.openwrt.org/viewtopic.php?pid=212343 ) has shown that the problem is associated with the fact, that the eth0 switch is initially configured as a dummy bridge.
At this stage packets from the LAN network with different sender's MACs are leaking to the WAN port confusing the cable modem. Even if there is no LAN trafic, but user uses MAC cloning, the failsafe-mode notification is sent with original MAC, while further DHCP requests are sent with the cloned one, confusing the cable modem.

It seems, that the code intializing the eth0 bridge should be changed so, that
it starts in disabled mode, or at least with disabled WAN port.

Attachments (1)

0300-NET-MIPS-rt3052-boot-switch.patch (1.3 KB) - added by wzab 4 years ago.
patch for correct configuration of the rt3502 switch already at boot (patch prepared by brnt, copied to the newest trunk)

Download all attachments as: .zip

Change History (13)

comment:1 Changed 4 years ago by wzab66

I have checked the esw_rt3052.c code and datasheet RT3050_5x_V2.0_081408_0902.pdf, and I have stated, that the default configuration of the switch, sets all ports as LAN ports, which may cause the problem described in my original report.

The solution maybe could be setting of the ".port_map" field in the rt305x_esw structure to RT305X_ESW_PMAP_LLLLWL instead of RT305X_ESW_PMAP_LLLLLL.

Unfortunately currently I have no possibility to verify if the above correction fixes the problem.

Last edited 4 years ago by wzab66 (previous) (diff)

comment:2 Changed 4 years ago by wzab66

I have checked sources more thoroughly, and I can see, that the port_map field is initialized from the appropriate dts file property:

file trunk/target/linux/ramips/dts/3G-6200N.dts :

64
65 esw@10110000 {
66 status = "okay";
67 ralink,portmap = <0x2f>;
68 };

And the 0x2F is RT305X_ESW_PMAP_LLLLWL

So at the moment it seems, that either the device is not correctly recognized
as compatible with 3g-6200N or there is something wrong with the switch initialization
procedure.

Another problem may be the fact, that the .vlan_config field in itial configuration is set to
RT305X_ESW_VLAN_CONFIG_NONE, but it seems, that the .vlan_config field is not used at all...

Last edited 4 years ago by wzab66 (previous) (diff)

comment:3 Changed 4 years ago by wzab66

I have added the message printing the "port_map" value in the esw_hw_init function, just before this value is written to the configuration register (lines 658-671 in esw_rt2052.c file):

/*

  • Unused HW feature, but still nice to be consistent here...
  • This is also exported to userspace ('lan' attribute) so it's
  • conveniently usable to decide which ports go into the wan vlan by
  • default. */

printk(KERN_INFO "Check: port_map=%x\n",(int) port_map);

esw_rmw(esw, RT305X_ESW_REG_SGC2,

RT305X_ESW_SGC2_LAN_PMAP_M << RT305X_ESW_SGC2_LAN_PMAP_S,
port_map << RT305X_ESW_SGC2_LAN_PMAP_S);

/* make the switch leds blink */
for (i = 0; i < RT305X_ESW_NUM_LEDS; i++)

esw->ports[i].led = 0x05;

The value written to the RT305X_ESW_REG_SGC2 register seems to be correct:
[ 0.670000] Check: port_map=2f

And now I really don't understand, why my AP starts in a dumb bridge mode allowing packets from the LAN connectors to travel to WAN network, and confuse the cable modem...

Changed 4 years ago by wzab

patch for correct configuration of the rt3502 switch already at boot (patch prepared by brnt, copied to the newest trunk)

comment:4 Changed 4 years ago by wzab66

Thanks to the information provided by user zloop ( https://forum.openwrt.org/viewtopic.php?pid=213439#p213439 ) and user brnt ( /ticket/13337.html ), I could port (well, in fact simply "copy") the patch provided by brnt to the newest trunk.

I have verified, that this has cured my problem. It seems, that packets are not leaking now.
Thanks a lot.

comment:5 Changed 4 years ago by guenther.racz@…

tested on r39120 and it does not work.

comment:6 Changed 4 years ago by wzab

Could you please specify in a more detailed way what doesn't work?
It doesn't compile, or compiles but doesn't work?
To have the Ethernet switch working in my access point, I had also to modify
the /etc/config/network using the serial console, after the reflashed router was
restarted for the first time, as described in https://forum.openwrt.org/viewtopic.php?id=46271

comment:7 Changed 4 years ago by wzab

Today I had to reflash one of my routers, and I have found, the the /etc/config/network file which I have to use should contain the following commands:

root@OpenWrt:/# cat /etc/config/network
config switch

option name 'rt305x'
option reset '1'
option enable_vlan '1'


config switch_vlan

option device 'rt305x'
option vlan '1'
option ports '0 1 2 3 6t'


config switch_vlan

option device 'rt305x'
option vlan '2'
option ports '4 6t'

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.1'
option type 'bridge'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option macaddr '00:1f:1f:f1:9e:2c'

config interface 'wan'

option ifname 'eth0.2'
option proto 'dhcp'
option macaddr '00:1f:1f:f1:9e:2d'

comment:8 Changed 4 years ago by wzab

OK. I've checked the newest version BARRIER BREAKER (Bleeding Edge, r39155)
And with the patch 0300-NET-MIPS-rt3052-boot-switch.patch and the /etc/config/network given in the previous post, the AP seems to work.
There is however one issue.
When I booted AP the first time, it started in the failsafe mode, displaying:

  • failsafe button BTN_0 was pressed -
  • failsafe -

It appeared, that the switch WiFi ON/OFF is now interpreted as a failsafe button.
I set it in position "OFF" and AP started normally with LAN ethernet ports working.

comment:9 Changed 4 years ago by wzab

OK. I've checked the newest version BARRIER BREAKER (Bleeding Edge, r39155)
And with the patch 0300-NET-MIPS-rt3052-boot-switch.patch and the /etc/config/network given in the previous post, the AP seems to work.
There is however one issue.
When I booted AP the first time, it started in the failsafe mode, displaying:

  • failsafe button BTN_0 was pressed -
  • failsafe -

It appeared, that the switch WiFi ON/OFF is now interpreted as a failsafe button.
I set it in position "OFF" and AP started normally with LAN ethernet ports working.

comment:10 Changed 4 years ago by guenti

Sorry for my late answer, i was in holiday.
Deleted my Builddir, compiled latest Trunk without errors.
Ethernet works fine now, but it doesnt store any Settings.
After reboot or Powercycle, any Settings are gone.
Next issue, 3g doesnt work.
I have alot of strange Entries in syslog and kernellog...
Thanks for your help

comment:11 Changed 4 years ago by wzab

Last time when my Edimax didn't store any settings I have found that
my image was too big so it used the ramdisk based overlay instaed of
the jffs2 based overlay.
Can it be the reason in your case?

I had also problems with 3G in the last Trunk. I reported them as:
/ticket/14679.html

comment:12 Changed 3 years ago by guenti

does not work on latest trunk r42223

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.