-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add dad-timeout feature for nmcli #10844
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
userlerueda
wants to merge
2
commits into
ansible-collections:main
Choose a base branch
from
userlerueda:userlerueda-feat-dad-timeout
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| minor_changes: | ||
| - nmcli - add support for duplicate address detection (DAD) timeout configuration via new parameters ``dad_timeout4`` and ``dad_timeout6`` which map to the ``ipv4.dad-timeout`` and ``ipv6.dad-timeout`` NetworkManager properties (https://github.com/ansible-collections/community.general/pull/XXXX). | ||
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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -273,6 +273,14 @@ | |||||
| type: bool | ||||||
| default: true | ||||||
| version_added: 3.3.0 | ||||||
| dad_timeout4: | ||||||
| description: | ||||||
| - Timeout in milliseconds for IPv4 duplicate address detection (DAD). | ||||||
| - Set to V(0) to disable DAD, or a positive value to enable it with the specified timeout. | ||||||
| - Maps to the C(ipv4.dad-timeout) NetworkManager property. | ||||||
| - This helps prevent IP address conflicts by detecting duplicate addresses before assignment. | ||||||
| type: int | ||||||
| version_added: 10.1.0 | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
same below |
||||||
| ip6: | ||||||
| description: | ||||||
| - List of IPv6 addresses to this interface. | ||||||
|
|
@@ -385,6 +393,14 @@ | |||||
| type: str | ||||||
| choices: [default, default-or-eui64, eui64, stable-privacy] | ||||||
| version_added: 4.2.0 | ||||||
| dad_timeout6: | ||||||
| description: | ||||||
| - Timeout in milliseconds for IPv6 duplicate address detection (DAD). | ||||||
| - Set to V(0) to disable DAD, or a positive value to enable it with the specified timeout. | ||||||
| - Maps to the C(ipv6.dad-timeout) NetworkManager property. | ||||||
| - This helps prevent IP address conflicts by detecting duplicate addresses before assignment. | ||||||
| type: int | ||||||
| version_added: 10.1.0 | ||||||
| mtu: | ||||||
| description: | ||||||
| - The connection MTU, for example V(9000). This can not be applied when creating the interface and is done once the | ||||||
|
|
@@ -1678,6 +1694,18 @@ | |||||
| slave_type: ovs-port | ||||||
| type: ethernet | ||||||
| state: present | ||||||
|
|
||||||
| ## Configuring duplicate address detection (DAD) timeout | ||||||
| - name: Configure connection with IPv4 and IPv6 DAD timeout | ||||||
| community.general.nmcli: | ||||||
| conn_name: ens192 | ||||||
| type: ethernet | ||||||
| ip4: 192.168.1.100/24 | ||||||
| ip6: 2001:db8::100/64 | ||||||
| state: present | ||||||
| dad_timeout4: 3000 # Enable IPv4 DAD with 3-second timeout | ||||||
| dad_timeout6: 1000 # Enable IPv6 DAD with 1-second timeout | ||||||
| may_fail4: false # Fail if IPv4 configuration fails | ||||||
| """ | ||||||
|
|
||||||
| RETURN = r"""# | ||||||
|
|
@@ -1745,6 +1773,7 @@ def __init__(self, module): | |||||
| self.dns4_ignore_auto = module.params['dns4_ignore_auto'] | ||||||
| self.method4 = module.params['method4'] | ||||||
| self.may_fail4 = module.params['may_fail4'] | ||||||
| self.dad_timeout4 = module.params['dad_timeout4'] | ||||||
| self.ip6 = module.params['ip6'] | ||||||
| self.gw6 = module.params['gw6'] | ||||||
| self.gw6_ignore_auto = module.params['gw6_ignore_auto'] | ||||||
|
|
@@ -1758,6 +1787,7 @@ def __init__(self, module): | |||||
| self.method6 = module.params['method6'] | ||||||
| self.ip_privacy6 = module.params['ip_privacy6'] | ||||||
| self.addr_gen_mode6 = module.params['addr_gen_mode6'] | ||||||
| self.dad_timeout6 = module.params['dad_timeout6'] | ||||||
| self.mtu = module.params['mtu'] | ||||||
| self.stp = module.params['stp'] | ||||||
| self.priority = module.params['priority'] | ||||||
|
|
@@ -1877,6 +1907,7 @@ def connection_options(self, detect_change=False): | |||||
| 'ipv4.never-default': self.never_default4, | ||||||
| 'ipv4.method': self.ipv4_method, | ||||||
| 'ipv4.may-fail': self.may_fail4, | ||||||
| 'ipv4.dad-timeout': self.dad_timeout4, | ||||||
| 'ipv6.addresses': self.enforce_ipv6_cidr_notation(self.ip6), | ||||||
| 'ipv6.dns': self.dns6, | ||||||
| 'ipv6.dns-search': self.dns6_search, | ||||||
|
|
@@ -1888,7 +1919,8 @@ def connection_options(self, detect_change=False): | |||||
| 'ipv6.route-metric': self.route_metric6, | ||||||
| 'ipv6.method': self.ipv6_method, | ||||||
| 'ipv6.ip6-privacy': self.ip_privacy6, | ||||||
| 'ipv6.addr-gen-mode': self.addr_gen_mode6 | ||||||
| 'ipv6.addr-gen-mode': self.addr_gen_mode6, | ||||||
| 'ipv6.dad-timeout': self.dad_timeout6 | ||||||
| }) | ||||||
| # when 'method' is disabled the 'may_fail' no make sense but accepted by nmcli with keeping 'yes' | ||||||
| # force ignoring to save idempotency | ||||||
|
|
@@ -2299,7 +2331,9 @@ def settings_type(setting): | |||||
| '802-11-wireless.mac-address-blacklist'}: | ||||||
| return list | ||||||
| elif setting in {'connection.autoconnect-priority', | ||||||
| 'connection.autoconnect-retries'}: | ||||||
| 'connection.autoconnect-retries', | ||||||
| 'ipv4.dad-timeout', | ||||||
| 'ipv6.dad-timeout'}: | ||||||
| return int | ||||||
| return str | ||||||
|
|
||||||
|
|
@@ -2671,6 +2705,7 @@ def main(): | |||||
| dns4_ignore_auto=dict(type='bool', default=False), | ||||||
| method4=dict(type='str', choices=['auto', 'link-local', 'manual', 'shared', 'disabled']), | ||||||
| may_fail4=dict(type='bool', default=True), | ||||||
| dad_timeout4=dict(type='int'), | ||||||
| dhcp_client_id=dict(type='str'), | ||||||
| ip6=dict(type='list', elements='str'), | ||||||
| gw6=dict(type='str'), | ||||||
|
|
@@ -2695,6 +2730,7 @@ def main(): | |||||
| method6=dict(type='str', choices=['ignore', 'auto', 'dhcp', 'link-local', 'manual', 'shared', 'disabled']), | ||||||
| ip_privacy6=dict(type='str', choices=['disabled', 'prefer-public-addr', 'prefer-temp-addr', 'unknown']), | ||||||
| addr_gen_mode6=dict(type='str', choices=['default', 'default-or-eui64', 'eui64', 'stable-privacy']), | ||||||
| dad_timeout6=dict(type='int'), | ||||||
| # Bond Specific vars | ||||||
| mode=dict(type='str', default='balance-rr', | ||||||
| choices=['802.3ad', 'active-backup', 'balance-alb', 'balance-rr', 'balance-tlb', 'balance-xor', 'broadcast']), | ||||||
|
|
||||||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.