jwbensley/Etherate

Doubling of stats on Rx host

jwbensley opened this issue · 3 comments

DanP via Skype has shown that his Rx host is double counting frames received from Tx:

TX:
Seconds         Mbps Tx         MBs Tx          FrmTx/s         Frames Tx
1               661.46          78              55122           55122
2               975.24          195             81270           136392
3               975.23          311             81269           217661
4               975.42          427             81285           298946

RX
Seconds         Mbps Rx         MBs Rx          FrmRx/s         Frames Rx
1               767.50          91              64301           64301
2               1940.10         322             162542          226843
3               1940.29         554             162558          389401
4               1940.21         785             162551          551952
5               1940.32         1016            162560          714512

Traffis is being sent from Tx to FF:FF:FF:FF:FF:FF (because BUM testing is required) and a VLAN tag is being used on sender and receiver (the same at both sides). This is over an MPLS pseudowire, the ingress router interfaces (connected to Tx host) and egress router interface (connected to Rx host) both show the correct ingress and egress speed respectively (which is the speed shown by the Tx host). Only the Rx host is showing double the frame rate stats within Etherate.

Topology:
SERVER1 -> NE20 (BUM FILTER) -> MPLS -> MX104 -> SERVER2

When the BUM filters are enabled on the routers only 10Mbps of traffic is passing over the pseudowire but the Rx host shows 20Mbps of traffic incomming within Etherate. Physical device and router interfaces correctly show 10Mbps.

root@test1:~/Etherate# etherate -V
Etherate version 0.13.beta 2017-07

root@test1:~/Etherate# uname -a
Linux test1 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 GNU/Linux

When a tagged VLAN interface is present the SOCK_RAW socket gets two copies of the frame.

This should be ETH_P_ALL not ETH_P_IP: https://github.com/jwbensley/Etherate/blob/master/defaults.c#L289

Replace with...

    test_interface->sock_addr.sll_family   = AF_PACKET;
    test_interface->sock_addr.sll_protocol = htons(ETH_P_ALL);

Also bind() to the physical interface to only receive one copy of the frame:

int32_t sock_bind = bind(test_interface->sock_fd, (struct sockaddr *)&test_interface->sock_addr,
                             sizeof(test_interface->sock_addr));

    if (sock_bind == -1) {
        perror("Can't bind socket to interface");
        return EXIT_FAILURE;
}

Fixed in V.15. Documentation update to recommend only PHY interface is used.