Modify

Opened 5 years ago

Closed 23 months ago

#10202 closed enhancement (fixed)

Add support for port mirroring in rtl8366rb

Reported by: Colin Leitner <colin.leitner@…> Owned by: jow
Priority: normal Milestone: Chaos Calmer 15.05
Component: luci Version: Trunk
Keywords: Cc:

Description

I needed to analyze some network traffic and had no hub in reach.

The TL-WR1043NDs switch (RTL8366RB) supports port mirroring, but the driver lacks the necessary swlib attributes to enable it.

I've enhanced the driver to support the following new attributes:

config 'switch'
	option 'enable_mirror_rx' '0'
	option 'enable_mirror_tx' '0'
	option 'enable_monitor_isolation' '0'
	option 'enable_mirror_pause_frames' '0'
	option 'mirror_monitor_port' '0'
	option 'mirror_source_port' '0'

I posted the patch for the driver to the openwrt-devel mailing list and attached the LuCI patch to this ticket.

On a side note, vlan.lua should probably be renamed to switch.lua.

Thanks, Colin

Attachments (2)

vlan.lua.patch (1.6 KB) - added by anonymous 5 years ago.
Patch to support the new RTL8366RB switch attributes in LuCI
revised-vlan.lua.patch (1.3 KB) - added by colin.leitner@… 3 years ago.
LuCI configuration for port mirroring (revised patch for AR8327 support)

Download all attachments as: .zip

Change History (9)

Changed 5 years ago by anonymous

Patch to support the new RTL8366RB switch attributes in LuCI

comment:1 Changed 5 years ago by swalker

  • Owner set to jow
  • Status changed from new to assigned

comment:2 Changed 4 years ago by andy@…

Trying out this patch on openwrt 12.9 Beta on a "TP-Link TL-WR1043N/ND v1" but swconfig
attribute "enable_mirror_rx" seams to be missing. Mirroring on the router would have been convinient to try out IDS Secure Onion.

root@OpenWrt:~# swconfig dev rtl8366rb help
switch0: rtl8366rb(RTL8366RB), ports: 6 (cpu @ 5), vlans: 4096

--switch

Attribute 1 (int): enable_learning (Enable learning, enable aging)
Attribute 2 (int): enable_vlan (Enable VLAN mode)
Attribute 3 (int): enable_vlan4k (Enable VLAN 4K mode)
Attribute 4 (none): reset_mibs (Reset all MIB counters)
Attribute 5 (int): blinkrate (Get/Set LED blinking rate (0 = 43ms, 1 = 84ms, 2 = 120ms, 3 = 170ms, 4 = 340ms, 5 = 670ms))
Attribute 6 (int): enable_qos (Enable QOS)
Attribute 7 (none): apply (Activate changes in the hardware)
Attribute 8 (none): reset (Reset the switch)

--vlan

Attribute 1 (string): info (Get vlan information)
Attribute 2 (int): fid (Get/Set vlan FID)
Attribute 3 (ports): ports (VLAN port mapping)

--port

Attribute 1 (none): reset_mib (Reset single port MIB counters)
Attribute 2 (string): mib (Get MIB counters for port)
Attribute 3 (int): led (Get/Set port group (0 - 3) led mode (0 - 15))
Attribute 4 (int): disable (Get/Set port state (enabled or disabled))
Attribute 5 (int): rate_in (Get/Set port ingress (incoming) bandwidth limit in kbps)
Attribute 6 (int): rate_out (Get/Set port egress (outgoing) bandwidth limit in kbps)
Attribute 7 (int): pvid (Primary VLAN ID)
Attribute 8 (string): link (Get port link information)

comment:3 Changed 4 years ago by andy@…

Have you created a patch on rtl8366rb.c as also as enable_mirror_rx is missing from table rtl8366rb_globals

https://dev.openwrt.org/browser/trunk/target/linux/generic/files/drivers/net/phy/rtl8366rb.c

comment:4 Changed 3 years ago by anonymous

The patch has been posted, but ignored or overlooked :): http://patchwork.openwrt.org/patch/1466/

Changed 3 years ago by colin.leitner@…

LuCI configuration for port mirroring (revised patch for AR8327 support)

comment:5 Changed 3 years ago by andy@…

I have applied both the vlan.lua patch and rtl8366rb.c and also set it to mirror port 3 to port 4, and yes this is working as it should. I verified that wireshark and yes traffic not designated for port 4 is showing up.

The patch for rtl8366rb.c need to be applied in the local dir as (generic-2.6 -> generic) is renamed in svn since that patch was done.

Note! One need to reboot the TL-WR1043N before it's working, as it seems to set the global registers on boot.

swconfig dev rtl8366rb show
Global attributes:

enable_learning: 1
enable_vlan: 1
enable_vlan4k: 1
blinkrate: 0
enable_qos: 1
enable_mirror_rx: 1
enable_mirror_tx: 1
enable_monitor_isolation: 0
enable_mirror_pause_frames: 0
mirror_monitor_port: 4
mirror_source_port: 3

Port 0:
...

comment:6 Changed 2 years ago by jow

  • Milestone changed from Backfire 10.03.2 to Chaos Calmer (trunk)

Milestone Backfire 10.03.2 deleted

comment:7 Changed 23 months ago by jow

  • Resolution set to fixed
  • Status changed from assigned to closed

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.