-
Notifications
You must be signed in to change notification settings - Fork 393
T3680: protocols: add dhclient hooks for dhcp-interface static routes #4622
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
Conversation
|
👍 |
10bfcfa to
302bb7c
Compare
|
@sever-sever My apologies, I've been busy with other projects. I believe I've resolved the smoketest issue, one is running now. |
|
@hedrok could you check and approve this PR if all works fine? |
sever-sever
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have a similar logic for ipsec-dhclient-hook
I don't expect any harm here.
|
Thanks for your work and patience. I've tried simple topology With configurations: vyos-server: vyos-client With such configuration I can still reproduce all 3 issues, to reproduce 2nd one I've deleted vyos-server and created new one with 10.147.1 instead of 10.1.1, but client after that still has In I think the reason is that FRRender ( Do you check your changes on VyOS-rolling release? Do I understand correctly that this PR should fix the issue
? If not, please describe what exactly this PR fixes so that I can check that, thanks again. |
|
Hi @hedrok,
Did you renew DHCP on the client interface after changing the server subnet? DHCP won't instantly renew under such conditions, you have to trigger it with
I can't identify any logic in
Your understanding is correct. For total clarity:
This can't be easily solved as the DHCP hook gets called before the DHCP interface list at
This issue will also occur as a result of the DHCP hook being called before the interface list file is generated (same problem as 1). |
|
@hedrok I've done some work on a new approach that I believe may solve the entire original issue. Please take a look and give me your thoughts: MattKobayashi/vyos-1x@current...MattKobayashi:vyos-1x:T3680-dev |
|
I've almost finalized an update to your previous solution: 856a88e At a glance my variant updates vyos-configd/FRRender so that it takes into account that dhcp interfaces could have changed and yours forces protocols_static to apply FRR configuration without I like my option more as if other places (not only protocols_static) require updates according to DHCP update it will be trivial to update my solution so that everything is done through But anyway my plan is:
|
|
I've finalized and tested my solution, it has two commits:
Fixes all three subissues. Now I'll review your new changes, I'll write back on Monday latest. If you have a chance to take a look and test my commits, it would be great. For review convienience I've created PR to your branch in your repo: MattKobayashi#1 |
|
High-level review of suggested changes:
We can even leave just As IP address of the interface is not important for update.
Personally I prefer previous version: reading whole config is relatively costly operation + in such case when adding
So if you are ok with my version, you can merge my PR, add your change in 1 with Thanks for your time. |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
|
Conflicts have been resolved. A maintainer will review the pull request shortly. |
|
Hi @hedrok, your changes seem like a more robust solution to me, so I've merged your PR and added a commit to keep the comparison of routers instead of IP addresses. Hopefully this can be merged soon! |
|
Only test fails which is known issue in FRR. @MattKobayashi thanks for fixing my linting issues - sorry you had to do that. |
Solves the problem that vyos-configs in FRRender caches configuation and DHCP changes are ignored. * Add src/helpers/vyos-request-configd-update.py that requests vyos-configd to update FRR configuration. * Make dhclient hooks use it instead of calling protocols_static.py * Make FRRender cache not only configuration but also DHCP gateways so that is any of them changes, FRR configuration is updated
|
CI integration ❌ failed! Details
|
|
I've rebased branch, squashed most commits. Rechecked everything, fixes all issues in https://vyos.dev/T5811 and https://vyos.dev/T3680:
CI for test_interfaces_cli failed only for known failure: @sever-sever please re-review and merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| socket.send_string(request) | ||
|
|
||
| message = socket.recv() | ||
| print(f"Received reply {request} [ {message} ]") |
Copilot
AI
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable name in the f-string is incorrect. It should print {message} in the context of 'Received reply', but the variable used is {request} which was already sent. This should likely be printing information about the message received, not re-printing the request.
| print(f"Received reply {request} [ {message} ]") | |
| print(f"Received reply {message}") |
| # - FAIL: DHCP failed, remove routes | ||
| # - RELEASE: lease released, remove routes | ||
| # - STOP: dhclient stopped, remove routes | ||
| if [ "$reason" == "PREINIT" ] || [ "$reason" == "EXPIRE" ] || [ "$reason" == "FAIL" ] || [ "$reason" == "RELEASE" ] || [ "$reason" == "STOP" ]; then |
Copilot
AI
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In bash scripts, use = instead of == for POSIX compliance in string comparisons within [ ] brackets, or use [[ ]] with ==. While == works in [ ] on many systems, it's not POSIX standard and using = is more portable.
| if [ "$reason" == "PREINIT" ] || [ "$reason" == "EXPIRE" ] || [ "$reason" == "FAIL" ] || [ "$reason" == "RELEASE" ] || [ "$reason" == "STOP" ]; then | |
| if [ "$reason" = "PREINIT" ] || [ "$reason" = "EXPIRE" ] || [ "$reason" = "FAIL" ] || [ "$reason" = "RELEASE" ] || [ "$reason" = "STOP" ]; then |
| if [ "$reason" == "RENEW" ] || [ "$reason" == "REBIND" ]; then | ||
| if [ "$old_routers" == "$new_routers" ]; then |
Copilot
AI
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In bash scripts, use = and != instead of == and != for POSIX compliance in string comparisons within [ ] brackets, or use [[ ]]. While these operators work in [ ] on many systems, using = is more portable for POSIX compliance.
| if [ "$reason" == "RENEW" ] || [ "$reason" == "REBIND" ]; then | |
| if [ "$old_routers" == "$new_routers" ]; then | |
| if [ "$reason" = "RENEW" ] || [ "$reason" = "REBIND" ]; then | |
| if [ "$old_routers" = "$new_routers" ]; then |
| if [ "$reason" == "RENEW" ] || [ "$reason" == "REBIND" ]; then | ||
| if [ "$old_routers" == "$new_routers" ]; then |
Copilot
AI
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In bash scripts, use = and != instead of == and != for POSIX compliance in string comparisons within [ ] brackets, or use [[ ]]. While these operators work in [ ] on many systems, using = is more portable for POSIX compliance.
| if [ "$reason" == "RENEW" ] || [ "$reason" == "REBIND" ]; then | |
| if [ "$old_routers" == "$new_routers" ]; then | |
| if [ "$reason" = "RENEW" ] || [ "$reason" = "REBIND" ]; then | |
| if [ "$old_routers" = "$new_routers" ]; then |
|
As I'm not an author of PR, I can't resolve comments from CoPilot, so I'll reply here. Yes, maybe it is extra information, but it is just copied from official As for using |
|
@MattKobayashi thanks again, merged at last :) |
Change summary
This PR adds
dhclienthooks to the image that re-configure static routes configured withdhcp-interfacewhen an DHCP state change occurs on one of those interfaces. The code is inspired by (and largely identical to) the existingdhclienthooks for IPsec interfaces. This resolves the issue reported in T3680 of static routes withdhcp-interfaceas the next hop not being added to or removed from FRRouting when DHCP is renewed on an interface. The other issues mentioned in T3680 persist.Types of changes
Related Task(s)
https://vyos.dev/T3680
Related PR(s)
How to test / Smoketest result
Checklist: