net_lwip_webserver: drop oversized frames in linkoutput

Closed Beginner friendly
#4,284 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c
Domain
networking

Research direction

Start in examples/device/net_lwip_webserver/src/main.c at linkoutput_fn() and read how it passes pbufs to tud_network_xmit(); check the network class transmit path if considering the alternative fix. Reject frames whose p->tot_len exceeds CFG_TUD_NET_MTU, return ERR_BUF, and count the drop. Done when oversized frames are dropped before transmission and the drop is counted.

Written by the indexing model from the issue text.

Description

followup Prio 📌

Follow-up from #4279.

examples/device/net_lwip_webserver/src/main.c:114 linkoutput_fn() hands any pbuf to tud_network_xmit() without checking p->tot_len against CFG_TUD_NET_MTU. #4279 fixes the normal path by setting netif->mtu so lwIP fragments, but a frame that bypasses IP fragmentation (raw/etharp output, or a misconfigured MTU) still reaches the class oversized; CDC-ECM then fails bulk-IN with -EOVERFLOW on the host and misframes the stream, as seen before #4279 on stm32f407disco.

Remaining work: drop frames with p->tot_len > CFG_TUD_NET_MTU in linkoutput_fn() (return ERR_BUF, count the drop), or bound it in the class tud_network_xmit() path so every user is covered.

Deferred: #4279 kept to the MTU setting the issue reported.

Dominant language
C
Stars
7.3k
Forks
1.6k
Avg merge
1d 15h
Merged PRs (30d)
99

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hathach/tinyusb

All issues in hathach/tinyusb

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.