Skip to content

perf: skip netfilter hook work when WAN IP is unchanged - #115

Open
dmiales wants to merge 4 commits into
jameszeroX:mainfrom
dmiales:contrib/06-wan-skip
Open

perf: skip netfilter hook work when WAN IP is unchanged#115
dmiales wants to merge 4 commits into
jameszeroX:mainfrom
dmiales:contrib/06-wan-skip

Conversation

@dmiales

@dmiales dmiales commented Jul 28, 2026

Copy link
Copy Markdown

Что и зачем

На коротких DHCP-lease NDM вызывает netfilter.d на каждый renew, обычно с тем же WAN IP. Запоминаем последний WAN IP и, если он не сменился и цепочки целы, пропускаем лишнюю работу по маршрутам/правилам.

Как проверял

На роутере Keenetic (mihomo/TProxy) с частыми renew: цепочки остаются целыми, лишняя работа не выполняется; sh -n.

Часть 6/8 — после части 5.


Часть стека харденинга. Полный порядок влития: 1 inject_var → 2 RCI/dry-run → 3 установка → 4 mihomo-geo → 5 GOMEMLIMIT → 6 WAN-skip → 7 hook-renew → 8 serialize. Ветка включает коммиты предыдущих частей — diff очистится после их мержа.

@dmiales
dmiales force-pushed the contrib/06-wan-skip branch 2 times, most recently from 18c5b90 to 8d138c4 Compare July 29, 2026 00:23
dmiales added 4 commits July 29, 2026 03:28
Unpack XKeen into a temp dir, verify, then move into place so an interrupted
update never leaves a half-written install. Add a gzip -t pre-check for the
mihomo archive with backup restore, and a minimum-size guard for core
downloads to reject truncated/stub files.
Enable geo-auto-update in the generated mihomo config (mihomo manages its own
GeoSite/GeoIP/ASN, XKeen's xray dat files are unused for it). Make 'xkeen -ug'
aware of the active core: for mihomo it explains geo-auto-update and only
reapplies GeoIPSET instead of touching unused xray dat files.
Make the mihomo Go GC soft memory limit configurable via xkeen.json
(.xkeen.gomemlimit_percent / .xkeen.gomemlimit_mb) instead of a hardcoded
value. Default stays at 50% of RAM (unchanged behaviour); an explicit MiB
value has no default. An external GOMEMLIMIT still wins.
On short DHCP leases NDM invokes netfilter.d every renew, usually with the
same WAN IP. Remember the last WAN IP and, if it hasn't changed and the
chains are intact, skip the redundant route/rule work.
@dmiales
dmiales force-pushed the contrib/06-wan-skip branch from 8d138c4 to b6241e5 Compare July 29, 2026 00:29
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.

1 participant