Skip to content

conntrack: T7482: Fix custom timeouts #4628

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: current
Choose a base branch
from

Conversation

ryanzuwala
Copy link
Contributor

Fix custom conntrack timeout rules and add smoketests

Change summary

Custom timeout rules were previously not working at all.

The problem is that the firewall rules were originally configured to jump directly to the VYOS_CT_TIMEOUT chain from the PREROUTING and OUTPUT base chains. But those two base chains have a priority of raw (-300), and conntrack hooks at priority -200, therefore any rules that modify conntrack entries must have a priority above -200.

So I removed the VYOS_CT_TIMEOUT jumps from PREROUTING and OUTPUT, and created my own prerouting and output base chains with priority -199 to perform the jump to VYOS_CT_TIMEOUT. The two timeout jumping base chains are only created if custom timeout rules have been configured by an administrator.

To tidy up the nftables config, it also removes the empty VYOS_CT_TIMEOUT chain if there are no custom timeout rules created, since nothing else uses it.

I also added much more extensive smoke testing for this to ensure it doesn't accidentally break in the future. Custom timeout rules are very important to have for VoIP, and I'm sure there are plenty of other use cases for it as well.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

https://vyos.dev/T7482

Related PR(s)

How to test / Smoketest result

Experiment with creating custom conntrack timeout rules and verifying the records are being updated in conntrack.

Here is an IPv4 example using DNS traffic from a server with IP address 172.16.99.2:

configure

# UDP rule using DNS as an example
set system conntrack timeout custom ipv4 rule 1 destination port '53'
set system conntrack timeout custom ipv4 rule 1 protocol udp replied '700'
set system conntrack timeout custom ipv4 rule 1 protocol udp unreplied '700'
set system conntrack timeout custom ipv4 rule 1 source address '172.16.99.2'

commit ; save

Using this DNS example rule, you'll need to generate some DNS queries from your 172.16.99.2 server. You can just use dig google.com or ping a domain name.

After querying DNS records, run conntrack -E or show conntrack table ipv4 | grep "172.16.99.2", and you should see your new timeouts of 700 seconds instead of the default of 30 for unreplied and 180 for stream.

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

Copy link

github-actions bot commented Jul 29, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

Copy link

github-actions bot commented Jul 29, 2025

👍
No issues in PR Title / Commit Title

@ryanzuwala
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

vyosbot added a commit to vyos/vyos-cla-signatures that referenced this pull request Jul 29, 2025
@ryanzuwala ryanzuwala force-pushed the ryanzuwala/T7482 branch 5 times, most recently from ac1a402 to 8cf9cda Compare August 2, 2025 02:36
Fix custom conntrack timeout rules and add smoketests
Copy link

github-actions bot commented Aug 2, 2025

CI integration 👍 passed!

Details

CI logs

  • CLI Smoketests (no interfaces) 👍 passed
  • CLI Smoketests (interfaces only) 👍 passed
  • Config tests 👍 passed
  • RAID1 tests 👍 passed
  • TPM tests 👍 passed

Copy link
Member

@dmbaturin dmbaturin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexk37's testing shows that the basics work and I see no issues with the implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants