Skip to content
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

T7016: force delete only dynamic IPv4 address from interface #4278

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

yzguy
Copy link
Contributor

@yzguy yzguy commented Jan 5, 2025

Change summary

#4250 introduced a bug that attempts to delete dynamic IPv6 addresses on an interface when that interface is being removed from being a DHCP client. The prefix length is not passed to the ip del command so therefore it fails to delete it throwing an exception

The issue seems to be:

  1. IPv6 addresses are not supposed to be deleted when IPv4 DHCP client is removed from the interface
  2. If an IPv4 address is being deleted, it needs it's CIDR to be passed to ip del for it to successfully delete it
Traceback (most recent call last):
  File "/usr/libexec/vyos/services/vyos-configd", line 139, in run_script
    script.apply(c)
  File "/usr/libexec/vyos//conf_mode/interfaces_ethernet.py", line 336, in apply
    e.update(ethernet)
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/ethernet.py", line 532, in update
    super().update(config)
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/interface.py", line 1663, in update
    self.del_addr('dhcp')
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/interface.py", line 1280, in del_addr
    self.set_dhcp(False)
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/interface.py", line 1430, in set_dhcp
    self.del_addr(address)
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/interface.py", line 1285, in del_addr
    self._cmd(f'{netns_cmd} ip addr del {addr} dev {self.ifname}')
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/control.py", line 64, in _cmd
    return cmd(command, self.debug)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/vyos/utils/process.py", line 155, in cmd
    raise OSError(code, feedback)
FileNotFoundError: [Errno 2] failed to run command:  ip addr del 2600:3c0e::f03c:93ff:fed7:f58a dev eth0
returned:
exit code: 2

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)

Related PR(s)

How to test / Smoketest result

set interfaces ethernet eth0 address 'dhcp'
set interfaces ethernet eth0 ipv6 address autoconf

Ensure you have an IPv4/IPv6 address from DHCP/SLAAC on eth0

Then try to remove DHCP client

delete interfaces ethernet eth0 address dhcp
compare
commit

The IPv6 address will try and be deleted but fails due to missing prefix length, causing an exception to be thrown

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 Jan 5, 2025

👍
No issues in PR Title / Commit Title

@yzguy yzguy changed the title T7106: only delete inet addresses before smoketest T7106: properly delete only inet addresses before smoketest Jan 5, 2025
@yzguy yzguy changed the title T7106: properly delete only inet addresses before smoketest T7106: force delete only dynamic IPv4 address from interface Jan 5, 2025
@c-po c-po changed the title T7106: force delete only dynamic IPv4 address from interface T7016: force delete only dynamic IPv4 address from interface Jan 5, 2025
@yzguy
Copy link
Contributor Author

yzguy commented Jan 5, 2025

Fixed the commit message to have the correct task ID

Copy link

github-actions bot commented Jan 5, 2025

CI integration ❌ failed!

Details

CI logs

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

@c-po c-po merged commit 9c091f0 into vyos:current Jan 6, 2025
12 of 14 checks passed
@yzguy yzguy deleted the T7016 branch January 6, 2025 11:27
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.

3 participants