T8454: fix VRF-blind port availability check in service_https#5109
Open
statio wants to merge 1 commit intovyos:currentfrom
Open
T8454: fix VRF-blind port availability check in service_https#5109statio wants to merge 1 commit intovyos:currentfrom
statio wants to merge 1 commit intovyos:currentfrom
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
👍 |
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
Apr 3, 2026
bf1a045 to
a5cbd5c
Compare
sever-sever
requested changes
Apr 4, 2026
python/vyos/utils/network.py
Outdated
| import socket | ||
|
|
||
| protocol = socket.SOCK_STREAM if protocol == 'tcp' else socket.SOCK_DGRAM | ||
| proto = socket.SOCK_STREAM if protocol == "tcp" else socket.SOCK_DGRAM |
Member
There was a problem hiding this comment.
Why did you change quotes in several places?
Some changes are not related to this PR
When service https is configured with a listen-address on a VRF interface, adding or changing the vrf option causes the commit to fail with "TCP port 443 is used by another service!" even though no conflict exists. Root cause: check_port_availability() performs a socket.bind() in the default network namespace. When the listen-address belongs to a VRF interface the address is unreachable from the default namespace, so the bind fails with OSError which is misinterpreted as "port in use". The secondary check via is_listen_port_bind_service() also fails because psutil cannot see sockets bound inside a VRF. Fix: add an optional vrf parameter to check_port_availability(). When set, the socket bind test is executed inside the VRF namespace via ip vrf exec, so that VRF interface addresses are reachable and the port availability result is correct. service_https verify() now passes the configured VRF (if any) to check_port_availability(). Non-VRF configurations are unaffected. Add smoke test for HTTPS with listen-address inside a VRF.
a5cbd5c to
b4eaefd
Compare
|
CI integration 👍 passed! Details
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change summary
When service https is configured with a listen-address on a VRF interface, adding or changing the vrf option causes the commit to fail with "TCP port 443 is used by another service!" even though no conflict exists.
Root cause: check_port_availability() performs a socket.bind() in the default network namespace. When the listen-address belongs to a VRF interface the address is unreachable from the default namespace, so the bind fails with OSError which is misinterpreted as "port in use". The secondary check via is_listen_port_bind_service() also fails because psutil cannot see sockets bound inside a VRF.
Fix: add an optional vrf parameter to check_port_availability(). When set, the socket bind test is executed inside the VRF namespace via ip vrf exec, so that VRF interface addresses are reachable and the port availability result is correct.
service_https verify() now passes the configured VRF (if any) to check_port_availability(). Non-VRF configurations are unaffected.
Add smoke test for HTTPS with listen-address inside a VRF.
Types of changes
Related Task(s)
Related PR(s)
How to test / Smoketest result
Added
test_listen_address_vrftotest_service_https.py. The test:mgmtwith a dummy interface and addressservice httpswithlisten-addressandvrfpointing to the VRF$ /usr/libexec/vyos/tests/smoke/cli/test_service_https.py TestHTTPSService.test_listen_address_vrfTesting done directly in current-rolling release router build. Zero errors.
Checklist: