0

I am using an FPGA to create IPv4/UDP packets.

Below is what the packet looks like. Wireshark doesn't flag it for errors at all. I'm using a UDP checksum of 0x0000 (allowed for IPv4), the MAC/IP destination matches, and the FCS and IPv4 checksum is correct.

I can only see the packets if I enable rx-all on the pc MAC using EthTool.

sudo ethtool -K enp2s0 rx-all on

If this is off (the usual mode of operation), these packets get dropped by the PC before reaching wireshark, and they're marked as frame errors.

sudo ethtool -S enp2s0 doesn't show anything helpful.

And I have double checked the dest MAC/IP with my pc.

If I take out the IPv4 portion of the header (so just a raw Ethernet packet), the packets are let through even with rx-all off. (I can include that too below but it's already a lot to include as-is). Since the raw packet works, I'm fairly certain I have the MII interface and Ethernet framing correct.

I've been over everything I can't figure out why these packets are still being dropped. My goal is to create UDP packets that can be transmitted over a normal network (through switches, etc).

Is there anything else I've missed? Do I need to serve up ARP packets as well? Do I need the UDP checksum anyway?

$ sudo ifconfig enp2s0
enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.100  netmask 255.255.255.0  broadcast 192.168.1.255
        ether 74:d4:35:aa:9d:1a  txqueuelen 1000  (Ethernet)
        RX packets 26372  bytes 13819100 (13.1 MiB)
        RX errors 177  dropped 0  overruns 0  frame 177
        TX packets 1613  bytes 137389 (134.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

$ sudo ethtool -S enp2s0
NIC statistics:
     tx_packets: 1597
     rx_packets: 26372
     tx_errors: 0
     rx_errors: 0
     rx_missed: 0
     align_errors: 0
     tx_single_collisions: 0
     tx_multi_collisions: 0
     unicast: 26372
     broadcast: 0
     multicast: 0
     tx_aborted: 0
     tx_underrun: 0

Frame 1257: 54 bytes on wire (432 bits), 54 bytes captured (432 bits) on interface enp2s0, id 0
    Section number: 1
    Interface id: 0 (enp2s0)
    Encapsulation type: Ethernet (1)
    Arrival Time: Nov 24, 2023 15:24:18.467278031 SAST
    [Time shift for this packet: 0.000000000 seconds]
    Epoch Time: 1700832258.467278031 seconds
    [Time delta from previous captured frame: 0.127289169 seconds]
    [Time delta from previous displayed frame: 0.127289169 seconds]
    [Time since reference or first frame: 4627.139850121 seconds]
    Frame Number: 1257
    Frame Length: 54 bytes (432 bits)
    Capture Length: 54 bytes (432 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    [Protocols in frame: eth:ethertype:ip:udp:data]
    [Coloring Rule Name: UDP]
    [Coloring Rule String: udp]
Ethernet II, Src: PcsCompu_fb:dd:66 (08:00:27:fb:dd:66), Dst: Giga-Byt_aa:9d:1a (74:d4:35:aa:9d:1a)
    Destination: Giga-Byt_aa:9d:1a (74:d4:35:aa:9d:1a)
    Source: PcsCompu_fb:dd:66 (08:00:27:fb:dd:66)
    Type: IPv4 (0x0800)
Internet Protocol Version 4, Src: 192.168.1.101, Dst: 192.168.1.100
    0100 .... = Version: 4
    .... 0101 = Header Length: 20 bytes (5)
    Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
        0000 00.. = Differentiated Services Codepoint: Default (0)
        .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0)
    Total Length: 40
    Identification: 0x0000 (0)
    000. .... = Flags: 0x0
    ...0 0000 0000 0000 = Fragment Offset: 0
    Time to Live: 64
    Protocol: UDP (17)
    Header Checksum: 0xf6ab [correct]
    [Header checksum status: Good]
    [Calculated Checksum: 0xf6ab]
    Source Address: 192.168.1.101
    Destination Address: 192.168.1.100
User Datagram Protocol, Src Port: 65535, Dst Port: 65535
    Source Port: 65535
    Destination Port: 65535
    Length: 20
    Checksum: 0x0000 [zero-value ignored]
        [Checksum Status: Not present]
    [Stream index: 43]
    [Timestamps]
        [Time since first frame: 43.780741653 seconds]
        [Time since previous frame: 40.026103244 seconds]
    UDP payload (12 bytes)
Data (12 bytes)
    Data: 53574954434845533a2087e0
    [Length: 12]

Previously asked on network engineering stackexchange.

1 Answer 1

0

Figured it out, finally!!

Turns out the packet was too short. The minimum ethernet packet length is 64B, this packet was 54B.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .