Skip to content

Propagate vm-config.net-* features through NetVM chain#791

Open
Codingisinmyblud wants to merge 1 commit into
QubesOS:mainfrom
Codingisinmyblud:fix-mtu-propagation
Open

Propagate vm-config.net-* features through NetVM chain#791
Codingisinmyblud wants to merge 1 commit into
QubesOS:mainfrom
Codingisinmyblud:fix-mtu-propagation

Conversation

@Codingisinmyblud
Copy link
Copy Markdown

@Codingisinmyblud Codingisinmyblud commented Mar 19, 2026

This patch fixes the Qubes OS bug #10758, propagating vm-config.net-* features to the descendant qubes in the NetVM chain, thus making the vm-config.net-* features visible in the Qubes DB of the descendant qubes.

In the current implementation, if a NetVM has a vm-config.net-mtu, the descendant qubes will not inherit the vm-config.net-mtu automatically. However, the in-qube networking scripts of the descendant qubes read the configuration from the Qubes DB.

This patch introduces the propagation of the vm-config.net-* features from the NetVM chain to the descendant qubes. The propagation code has been introduced in the file qubes/vm/mix/net.py. The propagation code performs the following actions:

on domain-qdb-create: the qube inherits the effective vm-config.net-* features from the NetVM chain

on domain-feature-set:, the vm-config.net- features of the NetVM are propagated to the running descendant qubes, except when overridden

on domain-feature-delete:, the descendants of the NetVM inherit the next upstream vm-config.net- feature or delete the entry if there are no more upstream features

Fixes: QubesOS/qubes-issues#10758

@Codingisinmyblud Codingisinmyblud force-pushed the fix-mtu-propagation branch 5 times, most recently from 9cc12f8 to 8c60b09 Compare March 20, 2026 14:40
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 96.96970% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 70.15%. Comparing base (53ca30f) to head (7344bb8).

Files with missing lines Patch % Lines
qubes/vm/mix/net.py 96.96% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #791   +/-   ##
=======================================
  Coverage   70.15%   70.15%           
=======================================
  Files          61       61           
  Lines       13995    14028   +33     
=======================================
+ Hits         9818     9842   +24     
- Misses       4177     4186    +9     
Flag Coverage Δ
unittests 70.15% <96.96%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@marmarek
Copy link
Copy Markdown
Member

See further discussion in QubesOS/qubes-issues#10758

Signed-off-by: Qasim Khawaja <dotboss1010@gmail.com>
@ben-grande
Copy link
Copy Markdown
Contributor

Issue description is outdated.

Comment thread qubes/vm/mix/net.py
def effective_mtu(self):
"""Effective MTU for this domain. Inherited from netvm if not
set explicitly."""
netvm = self
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please don't refer to a qube that may not be a netvm as such, it makes reading a bit confusing.

Comment thread qubes/vm/mix/net.py
# pylint: disable=unused-argument
eff_mtu = self.effective_mtu
if eff_mtu is not None:
self.untrusted_qdb.write("/vm-config/net-mtu", str(eff_mtu))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think it needs to be in the vm-config namespace anymore.

Comment thread qubes/vm/mix/net.py
Comment on lines +283 to +291
def effective_mtu(self):
"""Effective MTU for this domain. Inherited from netvm if not
set explicitly."""
netvm = self
while netvm is not None:
if hasattr(netvm, "mtu") and netvm.mtu is not None:
return netvm.mtu
netvm = getattr(netvm, "netvm", None)
return None
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Alternative would be to build it into mtu property default value itself, I think it would be easier this way. Something like:

def default_mtu(self):
    if self.netvm:
        return self.netvm.mtu
    return None

and then use that function as default= in the property definition.

Comment thread qubes/vm/mix/net.py
"""Propagate mtu changes to connected VMs."""

# pylint: disable=unused-argument
def _update_descendants(netvm):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Following the single mtu property pattern proposed above, this may fire property-reset:mtu event on VMs with vm.property_is_default("mtu") (instead of checking for not None`), and the rest be moved outside of the loop (to do it only for vm that got the event, not all its descendants - this would be handled by firing event there).

Copy link
Copy Markdown
Contributor

@ben-grande ben-grande left a comment

Choose a reason for hiding this comment

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

Minor review.

@ben-grande
Copy link
Copy Markdown
Contributor

Hi. Do you plan to continue on this?

@Codingisinmyblud
Copy link
Copy Markdown
Author

Yeah, sorry just got a little busy. Should send a fix in a bit hopefully

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.

Make Qubes MTU configurable / inherit from sys-net uplink MTU

3 participants