Skip to content

cherry-pick: lwIP adapter (#452) and Redis rate limiting (#453) to main - #454

Merged
gg582 merged 3 commits into
mainfrom
chore/main-picks-lwip-redis
Oct 27, 2026
Merged

gg582 merged 3 commits into
mainfrom
chore/main-picks-lwip-redis

Conversation

@gg582

@gg582 gg582 commented Oct 27, 2026

Copy link
Copy Markdown
Member

Summary

Cherry-picks the dev merges since #451 that belong on main, in dev order (git cherry-pick -x):

Doxygen auto-commits stay divergent, as before.

Conflict resolution

#452 adds the lib/lwip submodule (lwIP STABLE-2_2_1_RELEASE, used by tests only). Other gitlinks are unchanged, and main keeps its own lsquic pin (2b30189).

How it was verified

On the picked tree, with main's submodule pins (lsquic 2b30189):

  • make -j16 all and make -k test: all targets pass, exit 0. This includes test_lwip_adapter, test_rate_limit_redis and test_redis_timeout.
  • make baremetal-smoke: hello, hello-rtc and hello-lwip PASS.
  • make redis-rate-limit-e2e against a local redis-server: the strict two-process integration passes.
  • check_test_wiring, check_api_baseline (incl. the v4 guarantee), check_env_knobs, check_api_test_coverage, check_inline_exports, malloc_lint.sh, scripts/ci unit tests: OK.
  • scripts/ci/cppcheck.sh with cppcheck 2.13 (the CI version): no findings.

gg582 and others added 2 commits October 27, 2026 09:52
…452)

* feat(port): serve a CWIST app over lwIP's raw TCP API (#447 Phase 3)

- include/cwist/sys/port/lwip.h + src/sys/port/lwip.c: a listener on a
  raw-API tcp_pcb (NO_SYS-safe). Requests are framed by Content-Length with
  the parser's CL/TE rules (501 for Transfer-Encoding, 400 for CL+TE or a
  bad/conflicting CL, 431/413 above the configured caps), answered with
  100 Continue on Expect, parsed and run through cwist_app_dispatch, and
  serialized. Keep-alive follows request and response as on the socket
  path; pipelined requests are answered in order. Responses go out
  zero-copy via tcp_write and are freed once acknowledged; while one is
  in flight, excess input is refused back to lwIP so the window throttles
  the peer. Connection cap, idle timeout via tcp_poll, HEAD without body,
  SOF_REUSEADDR when SO_REUSE is on.
- The adapter is compiled by the firmware next to its own lwIP and
  lwipopts.h; it uses only public CWIST API and is not part of libcwist.
- lib/lwip: lwIP STABLE-2_2_1_RELEASE, vendored for the tests only.
- tests/test_lwip_adapter.c (make test): real lwIP TCP over the loopback
  netif in one process, covering keep-alive, pipelining, split bodies,
  100-continue, every framing error, Connection: close, HTTP/1.0, HEAD, a
  20 KB response through a 2-segment send window, the connection cap, the
  idle timeout and teardown. Clean under ASan/UBSan/LSan.
- tests/baremetal/hello_lwip.c joins make baremetal-smoke: the same stack
  on Cortex-M7 under qemu-arm.

* fix(port): keep cppcheck off the lwIP option #error

cppcheck analyzes src/ without the firmware's lwIP tree, so LWIP_TCP was
undefined and the requirement check fired. lwip/opt.h always defines
LWIP_TCP and LWIP_CALLBACK_API, so check only once it has been seen; a
real build with LWIP_TCP=0 still hits the #error.

(cherry picked from commit ad7ecad)
* feat(middleware): add shared Redis rate limiting

* test(redis): fix GCC buffer and pipe declarations

* fix(redis): Potential fix for pull request finding 'CodeQL / Potentially overflowing call to snprintf'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* fix(redis): validate frame encoding before pooled I/O

Preserve the upstream Autofix commit and supersede its void encoder with the independently reviewed checked implementation. Reject formatting failures and capacity mismatches before acquiring a connection; cover bounds and formatter failures without suppressing CodeQL.

---------

Co-authored-by: 이윤진(Lee Yunjin) <168180007+gg582@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Lee Yunjin <gzblues61@daum.net>
(cherry picked from commit 29df1ac)
reply += chunk
if reply == b"+PONG\r\n":
return
except OSError:
Comment thread scripts/ci/redis_rate_limit_e2e.py
@github-actions

Copy link
Copy Markdown
Contributor

This PR targets main, but CWIST's contribution flow lands work on dev first (see CONTRIBUTING.md). Automatic redirect onto dev failed -- the commits didn't cherry-pick cleanly (likely a real content conflict against dev's current state, not just a base-branch mismatch).

A maintainer needs to recreate this PR's commits against dev by hand (git cherry-pick, preserving authorship) and close this one in favor of the recreation. Labeled needs-manual-dev-redirect for visibility.

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
@gg582
gg582 merged commit 9c0ac04 into main Oct 27, 2026
39 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants