feat(deploy): systemd unit to load/clear left4me_mark nftables table
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
076bfb72ca
commit
fbb342db87
2 changed files with 35 additions and 0 deletions
|
|
@ -0,0 +1,14 @@
|
|||
[Unit]
|
||||
Description=left4me nftables packet marking (DSCP EF + priority for srcds)
|
||||
After=network-pre.target
|
||||
Before=network.target
|
||||
Wants=network-pre.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/usr/sbin/nft -f /usr/local/lib/left4me/nft/left4me-mark.nft
|
||||
ExecStop=/usr/sbin/nft delete table inet left4me_mark
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -14,6 +14,7 @@ BUILD_SLICE = DEPLOY / "files/usr/local/lib/systemd/system/l4d2-build.slice"
|
|||
SYSCTL_CONF = DEPLOY / "files/etc/sysctl.d/99-left4me.conf"
|
||||
GLOBAL_REFRESH_SERVICE = DEPLOY / "files/usr/local/lib/systemd/system/left4me-refresh-global-overlays.service"
|
||||
GLOBAL_REFRESH_TIMER = DEPLOY / "files/usr/local/lib/systemd/system/left4me-refresh-global-overlays.timer"
|
||||
NFT_MARK_UNIT = DEPLOY / "files/usr/local/lib/systemd/system/left4me-nft-mark.service"
|
||||
SANDBOX_UNIT_DIR = DEPLOY / "files/usr/local/lib/systemd/system"
|
||||
SYSTEMCTL_HELPER = DEPLOY / "files/usr/local/libexec/left4me/left4me-systemctl"
|
||||
JOURNALCTL_HELPER = DEPLOY / "files/usr/local/libexec/left4me/left4me-journalctl"
|
||||
|
|
@ -735,3 +736,23 @@ def test_nft_mark_file_marks_left4me_udp_with_dscp_ef_and_priority():
|
|||
|
||||
# skb->priority class 6:0, set inline alongside DSCP.
|
||||
assert "meta priority set 0006:0000" in text
|
||||
|
||||
|
||||
def test_nft_mark_unit_loads_and_clears_left4me_table():
|
||||
assert NFT_MARK_UNIT.is_file()
|
||||
text = NFT_MARK_UNIT.read_text()
|
||||
|
||||
# Loads the rules early so the very first packet srcds emits is marked.
|
||||
assert "After=network-pre.target" in text
|
||||
assert "Before=network.target" in text
|
||||
assert "Wants=network-pre.target" in text
|
||||
|
||||
# Oneshot lifecycle: load on start, drop on stop.
|
||||
assert "Type=oneshot" in text
|
||||
assert "RemainAfterExit=yes" in text
|
||||
assert (
|
||||
"ExecStart=/usr/sbin/nft -f /usr/local/lib/left4me/nft/left4me-mark.nft"
|
||||
in text
|
||||
)
|
||||
assert "ExecStop=/usr/sbin/nft delete table inet left4me_mark" in text
|
||||
assert "WantedBy=multi-user.target" in text
|
||||
|
|
|
|||
Loading…
Reference in a new issue