VLAN TAG IS STRIPPED FROM PACKETS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VLAN TAG IS STRIPPED FROM PACKETS

6,739 Views
eladyosef
Contributor I

Hi, I'm working on P2041 custom board and trying to capture VLAN tagged packets.

I'm setting up LINUX BRIDGE between fm1-gb0/1 and installing net-hook in the bridge (attached sample code).

Inside the net-hook, I'm dumping the SK_BUFF and the VLAN TAG is missing from the packet.

I can only see it in the skb->vlan_tci attribute.

(see attached txt capture file)

 

Is it kconfig/driver problem?

How can I get the VLAN TAG (0x81XX) as part of the packet?

Where is the driver's source file?

 

I also checked the driver's info by ethtool

 

root@p2041rdb:~# ethtool -i fm1-gb0

driver: fsl_dpa

version:

firmware-version: 0

bus-info: fsl,dpaa.10

supports-statistics: no

supports-test: no

supports-eeprom-access: no

supports-register-dump: no

root@p2041rdb:~# ethtool -k fm1-gb0

Offload parameters for fm1-gb0:

rx-checksumming: off

tx-checksumming: on

scatter-gather: off

tcp-segmentation-offload: off

udp-fragmentation-offload: off

generic-segmentation-offload: off

generic-receive-offload: on

large-receive-offload: off

rx-vlan-offload: off

tx-vlan-offload: off

ntuple-filters: off

receive-hashing: off

 

 

I'm also attaching my kconfig file.

 

 

Thanks

 

Elad

Original Attachment has been moved to: crgn_dbg_nethook.c.zip

Original Attachment has been moved to: corenet32_smp_crgn_config.conf.zip

Original Attachment has been moved to: packet_capture.txt.zip

Labels (1)
0 Kudos
6 Replies

2,098 Views
yipingwang
NXP TechSupport
NXP TechSupport

It is needed to create a VLAN with vconfig command first.

In the function __netif_receive_skb, if the received is a 802.1q protocol packet("0x8100" is followed the MAC address), it calls vlan_untag function, in this function vlan_id is read out and assigned to skb->vlan_tci, then delete vlan_head. If skb->vlan_tci is found, the function vlan_do_receive(skb) will be executed, and vlan_dev(eth0.10)is decided via skb->vlan_tci, and it redirects skb->dev(eth0) to vlan_dev(eth0.10), then eliminate vlan_tci in skb at last, the skb looks like a normal packet which is received by vlan_dev.

0 Kudos

2,098 Views
yipingwang
NXP TechSupport
NXP TechSupport

In a VLAN switch, ethernet interfaces can be configured as access ports or trunk ports.

An access port can have only one VLAN configured on the interface, the traffic on the access port should be without VLAN tag.

A trunk port can have two or more VLANs configured on the interface, the device uses the IEEE 802.1Q method which uses a VLAN tag inserted into the frame header.

When a trunk port receives a packet which is transmitted to the local VLAN, the VLAN tag is removed in the function vlan_skb_recv and then  this packet enter into bridge processing. In the bridge, all the ports belong to the same VLAN, the packet is transmitted without VLAN tag.

0 Kudos

2,098 Views
eladyosef
Contributor I

Hi thanks for the reply. I'll try to more accurate in my question.

My net hook job is to capture user-defined TCP sessions packets in the Bridge and pass to user-space for additional stuff.

From user space the packets are sent back to the proper destination.

I'm setting up simple Linux bridge without any VLAN configurations.

I placed trace-call in my net-hook and got the following

Oct 24 10:43:14 p2041rdb user.info kernel: Packet<42> bytes. VLAN <333>  in-IF<fm1-gb1> out-IF<(null)>

Oct 24 10:43:14 p2041rdb user.warn kernel: Call Trace:

Oct 24 10:43:14 p2041rdb user.warn kernel: [effd5d50] [c00077cc] show_stack+0x48/0x15c (unreliable)

Oct 24 10:43:14 p2041rdb user.warn kernel: [effd5d90] [f91f205c] ipin_hook_func+0x5c/0x60 [vlan_hook_test_module]

Oct 24 10:43:14 p2041rdb user.warn kernel: [effd5da0] [c0400a14] nf_iterate+0xa0/0xf0

Oct 24 10:43:14 p2041rdb user.warn kernel: [effd5dd0] [c0400adc] nf_hook_slow+0x78/0x164

Oct 24 10:43:14 p2041rdb user.warn kernel: [effd5e20] [c04c26c4] br_handle_frame+0x1e4/0x268

Oct 24 10:43:14 p2041rdb user.warn kernel: [effd5e40] [c03dbc48] __netif_receive_skb+0x158/0x3dc

Oct 24 10:43:14 p2041rdb user.warn kernel: [effd5e90] [c03dd5c4] netif_receive_skb+0x4c/0xf0

Oct 24 10:43:14 p2041rdb user.warn kernel: [effd5ec0] [c03671dc] _dpa_rx+0x1b4/0x388


Deeper investigation pointed that the function __netif_receive_skb() calls vlan_untag() for all packets that have VLAN tag 0x81XX.

(packets with 0x91XX, etc' are skipping the call)


Inside vlan_untag() there is only early return condition in case that skb->vlan_tci is already populated.

In other cases it calls vlan_reorder_heaer() that strips the vlan from the packet


I compared older and newer kernel versions and it looks totally different source.


Elad


0 Kudos

2,098 Views
yipingwang
NXP TechSupport
NXP TechSupport

Configure VLAN

ifconfig eth0 0.0.0.0 up

vconfig eth0 10

ifconfig eth0.10 up

Create a bridge for this VLAN

brctl addbr brvlan10

brctl addif brvlan10 eth0.10

Add netwok interfaces for this VLAN

ifconfig eth1 0.0.0.0 up

brctl addif brvlan10 eth1

ifconfig eth2 0.0.0.0 up

brctl addif brvlan10 eth2

0 Kudos

2,098 Views
eladyosef
Contributor I

    ifconfig fm1-gb0 up

    ifconfig fm1-gb1 up

    brctl addbr bridge0

    brctl addif bridge0 fm1-gb0

    brctl addif bridge0 fm1-gb1

    ifconfig bridge0 10.254.2.21 netmask 255.255.255.248 up

0 Kudos

2,098 Views
yipingwang
NXP TechSupport
NXP TechSupport

Would you please share how you configured VLAN and created a vlan bridge under Linux?

0 Kudos