openwrt / openwrt/firewall4

creating NOTRACK firewall rules are bogus

Open
#14 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
ucode
Stars
27
Forks
37
PR merge metrics
No merged PRs in 30d

Description

In my case , i want to remove connection tracking on DNS on my local network only .

I added 2 rules

extract of /etc/config/firewall

# rule A
config rule
	option name 'dont track DNS queries'
	option src 'lan'
	option dest_port '53'
	option target 'NOTRACK'
# rule B
config rule
	option name 'dont track DNS queries'
	option src_port '53'
	option dest 'lan'
	option target 'NOTRACK'

  1. rule A is too wide , because capture packet in forward mode

current nft ruleset

	chain raw_prerouting {
		type filter hook prerouting priority raw; policy accept;
		iifname "br-lan" jump notrack_lan comment "!fw4: Handle lan IPv4/IPv6 notrack traffic"
	}

	chain notrack_lan {
		tcp dport 53 counter packets 0 bytes 0 notrack comment "!fw4: dont track DNS queries"
		udp dport 53 counter packets 1298 bytes 91957 notrack comment "!fw4: dont track DNS queries"
	}

the rule in raw_prerouting must be something like this

      iifname "br-lan" fib daddr . iif type local  jump notrack_lan comment "!fw4: Handle lan IPv4/IPv6 notrack traffic"
  1. rule B does not generate nft rule

so firewall4 must generate a block like this

	chain raw_output {
		type filter hook output priority raw; policy accept;
		oifname "br-lan" jump notrack_output_lan comment "!fw4: Handle lan IPv4/IPv6 notrack output traffic"
	}
	chain notrack_output_lan {
		tcp sport 53 counter packets 0 bytes 0 notrack comment "!fw4: dont track DNS queries"
		udp sport 53 counter packets 921 bytes 73525 notrack comment "!fw4: dont track DNS queries"
	}

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start with the /etc/config/firewall examples and compare the current nft ruleset for rule A with the requested local-destination match. Then examine why rule B produces no raw output chain. Done means LAN DNS traffic is limited to the intended local destinations and output DNS traffic receives the requested NOTRACK handling.

Written by the indexing model from the issue text.

Assessment

Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.