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

ip: Fix routes on empty address #2677

Merged
merged 2 commits into from
May 22, 2024

Conversation

cathay4t
Copy link
Member

Nmstate fails when applying below state:

---
routes:
  config:
  - destination: 198.51.100.0/24
    metric: 150
    next-hop-interface: eth1
    table-id: 254
interfaces:
  - name: eth1
    type: ethernet
    state: up
    ipv4:
      enabled: true
      address: []

The error message is:

NmstateError: InvalidArgument: The next hop interface of desired Route
'destination: 198.51.100.0/24 next-hop-interface: eth1 metric: 150
table-id: 254' has been marked as IPv4 disabled

The root cause is nmstate try to set ipv4.enabled to false when got
empty address, this then lead to incorrect validation.

To fix this issue, removed the sanitize on setting ipv4.enabled to
false on empty address, but ignore ipvX.enabled in validation stage
when got empty IP address list.

Integration test case updated.

Nmstate fails when applying below state:

```yml
---
routes:
  config:
  - destination: 198.51.100.0/24
    metric: 150
    next-hop-interface: eth1
    table-id: 254
interfaces:
  - name: eth1
    type: ethernet
    state: up
    ipv4:
      enabled: true
      address: []
```

The error message is:

    NmstateError: InvalidArgument: The next hop interface of desired Route
    'destination: 198.51.100.0/24 next-hop-interface: eth1 metric: 150
    table-id: 254' has been marked as IPv4 disabled

The root cause is nmstate try to set `ipv4.enabled` to false when got
empty address, this then lead to incorrect validation.

To fix this issue, removed the sanitize on setting `ipv4.enabled` to
false on empty address, but ignore `ipvX.enabled` in validation stage
when got empty IP address list.

Integration test case updated.

Signed-off-by: Gris Ge <fge@redhat.com>
Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/nmstate-nmstate-2677
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@cathay4t cathay4t enabled auto-merge (rebase) May 22, 2024 00:56
@cathay4t cathay4t merged commit 56d0749 into nmstate:base May 22, 2024
25 of 27 checks passed
@cathay4t cathay4t deleted the fix_route_empty_address branch May 22, 2024 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants