mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2026-03-04 00:01:12 -05:00
Feature: Support copying connmark/fwmark from incoming DNS request to upstream connection #3024
Labels
No labels
P1: Critical
P2: High
P3: Medium
P4: Low
UI
bug
cannot reproduce
compatibility
dependencies
docker
documentation
duplicate
enhancement
enhancement
external libs
feature request
good first issue
help wanted
infrastructure
invalid
localization
needs investigation
performance
potential-duplicate
question
recurrent
research
snap
waiting for data
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/AdGuardHome#3024
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ewildgoose on GitHub (Sep 6, 2021).
Hi, One feature that I need from dnsmasq is the ability to copy the packet mark (or connection mark) from the incoming DNS request, over to the outgoing upstream request.
The purpose of this is to allow monitoring and aggregating of bandwidth data (or blocking the request) by setting per user connmarks. (Actually I also use this for multi-internet connection routing, as different users may be policy routed out through different internet connections, based on the fwmark/connmark assigned to them).
It's a generally useful trick, to be able to persist some user data through some "proxy" type application which otherwise mixes together data from multiple users, but where you still want to be able to do "per user" type network stuff on the otherside of the proxy app, eg choosing upstream internet connections, throttling, marking captive portal users, bandwidth tracking, etc.
In general the way I have implemented this for other little internal services (that I've created) is just to read the fwmark of the first packet (using equiv of getopts(so_socket, sol_mark)), then I set this same mark on the new connection. External firewall rules take care of copying the packet mark to the connection mark. In this way the output connection has the same connmark as the incoming connection. (assuming linux, then conntrack will mark the incoming DNS response with the same mark, ie it groups UDP packets under a kind of virtual "connection")
I have no familiarity with the adguard code. Ideally I'm hoping someone likes this idea and will either implement or send me a quote, but at least if someone more familiar with the code can give me a leg up then I will look to create my own patch and submit. Thanks for listening