为什么 802.1q 协议数据包会被接口自动丢弃?

为什么 802.1q 协议数据包会被接口自动丢弃?

我在主机中使用 IEC61850_SV 协议传输一系列测试数据包,如下所示:

01 0C CD 04 00 03 00 0C CD 04 00 00 81 00 80 01 88 BA 40 03 01 24 00 00 00 00 60 82 01 18 80 01 01 A2 82 01 11 30 82 01 0D 80 1B 50 53 53 43 36 30 31 4D 55 53 56 2F 4C 4C 4E 30 24 4D 53 24 4D 53 56 43 42 30 31 82 02 0B C6 83 04 00 00 00 01 85 01 00 87 81 E0 00 00 00 FA 00 00 00 00 FF EC C5 D9 00 00 00 00 FF EC C5 D9 00 00 00 00 00 12 19 12 00 00 00 00 00 12 19 12 00 00 00 00 00 01 21 24 00 00 00 00 00 01 21 24 00 00 00 00 EC C5 D9 00 00 00 00 00 12 19 12 00 00 00 00 00 01 21 24 00 00 00 00 FF 90 FD E8 00 00 00 00 FF 90 FD E8 00 00 00 00 00 68 7C DF 00 00 00 00 00 68 7C DF 00 00 00 00 00 06 85 39 00 00 00 00 00 06 85 39 00 00 00 00 FF 90 FD E8 00 00 00 00 FF 90 FD E8 00 00 00 00 00 00 00 0F 00 00 00 00 00 00 00 0F 00 00 00 00 FF 90 FD E8 00 00 00 00 FF 90 FD E8 00 00 00 00 00 68 7C DF 00 00 00 00 00 68 7C DF 00 00 00 00 00 06 85 39 00 00 00 00 00 06 85 39 00 00 0 0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

    Num                                  000001
    Length                               314
    Capture Length                       310
    time difference                      0.000000000 sec
ethernet - II                                [0/14]
    target                               01:0C:CD:04:00:03  [0/6]
    source                               00:0C:CD:04:00:00  [6/6]
    protocal                             0x8100  (VLAN)  [12/2]
802.1Q vlan protocal                        [14/4]
    Label                                [14/2]
    User priority                        100. ....    [14/1]  0x00E0
    CFI                                  ...0 ....    [14/1]  0x0010
    VlAN num                             .... 0000 0000 0001  (1)  [14/2]  0x0FFF
    protocal                             0x88ba  (IEC61850_SV)  [16/2]
IEC61850 sample value                       [18/21]
    Id                                   0x4003  [18/2]
    length                               292  [20/2]
    reserved bit1                        0x0  [22/2]
    reserved bit2                        0x0  [24/2]
    savPdu                              [30/0]
        application service data units                       1  [32/1]
        Sequence ASDU                   [37/0]
            ASDU                        [37/0]
Additional data                                    [39/271]
    bytes                                271 bytes  [39/271]
FCs
    FCs                                  0x2F0CA2EA  

然后我在目标机器中使用 tcpdump 来捕获数据包。日志显示如下:

 09:06:02.562846 00:0c:cd:04:00:00 (oui Unknown) > 01:0c:cd:04:00:03 (oui Unknown), 802.1Q, length 310: 
09:06:02.574656 00:0c:cd:04:00:00 (oui Unknown) > 01:0c:cd:04:00:03 (oui Unknown), 802.1Q, length 310: 
09:06:02.589684 00:0c:cd:04:00:00 (oui Unknown) > 01:0c:cd:04:00:03 (oui Unknown), 802.1Q, length 310: 
09:06:02.605706 00:0c:cd:04:00:00 (oui Unknown) > 01:0c:cd:04:00:03 (oui Unknown), 802.1Q, length 310: 
09:06:02.620610 00:0c:cd:04:00:00 (oui Unknown) > 01:0c:cd:04:00:03 (oui Unknown), 802.1Q, length 310: 
09:06:02.635996 00:0c:cd:04:00:00 (oui Unknown) > 01:0c:cd:04:00:03 (oui Unknown), 802.1Q, length 310: 
09:06:02.650857 00:0c:cd:04:00:00 (oui Unknown) > 01:0c:cd:04:00:03 (oui Unknown), 802.1Q, length 310: 
09:06:02.665517 00:0c:cd:04:00:00 (oui Unknown) > 01:0c:cd:04:00:03 (oui Unknown), 802.1Q, length 310: 
09:06:02.680210 00:0c:cd:04:00:00 (oui Unknown) > 01:0c:cd:04:00:03 (oui Unknown), 802.1Q, length 310: 
09:06:02.695342 00:0c:cd:04:00:00 (oui Unknown) > 01:0c:cd:04:00:03 (oui Unknown), 802.1Q, length 310: 
10 packets captured
10 packets received by filter
0 packets dropped by kernel
10 packets dropped by interface

奇怪的是所有 vlan 协议数据包都被接口丢弃。然后我使用vconfig add eth0 1添加eth0.1端口,并使用eth0.1接收数据包,它显示数据包已正确接收。

因为其他数据包(如 ARP)将被接口正确接收。我想知道为什么带有vlan协议的数据包会被接口自动丢弃,而不是被接口接收,但无法被网络层解析。同样的,数据链路层直接丢弃它,内核没有得到任何数据。

 cat /proc/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
  eth1:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
    lo:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  eth0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0

除了添加vlan之外,内核还有什么办法可以直接接收这些数据包吗?

相关内容