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

VirtualMachine model does not check family of ip address assigned as primary_ip4/6 #10220

Closed
amhn opened this issue Aug 30, 2022 · 1 comment · Fixed by #10235
Closed

VirtualMachine model does not check family of ip address assigned as primary_ip4/6 #10220

amhn opened this issue Aug 30, 2022 · 1 comment · Fixed by #10235
Assignees
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@amhn
Copy link
Contributor

amhn commented Aug 30, 2022

NetBox version

v3.3.1

Python version

3.10

Steps to Reproduce

  1. Create virtual machine "vm1"
  2. Create VM interface "vm_int1"
  3. Create IP address "127.0.0.1/8"
  4. Assign 127.0.0.1/8 to VM interface "vm_int1"
  5. Execute PATCH request to /api/virtualization/virtual-machines/ (Insert respective Ids of VM and IP):
curl -X PATCH \
      -H  "accept: application/json" -H  "Authorization: Token $NETBOX_TOKEN" \
      --data '{"primary_ip6": 1}' -H "Content-Type: application/json" 
      "http://localhost:8000/api/virtualization/virtual-machines/1/"

Expected Behavior

An error is returned that an IPv4 address can not be assigned as primary_ipv6

Observed Behavior

IPv4 address is assigned as primary_ip6
image

@amhn amhn added the type: bug A confirmed report of unexpected behavior in the application label Aug 30, 2022
@jeremystretch jeremystretch added the status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation label Aug 31, 2022
@jeremystretch
Copy link
Member

We may be able to reuse some of the validation that we have in place for this on the Device model, however that also checks for interfaces on virtual chassis members, which doesn't apply to virtual machines.

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels Sep 1, 2022
@jeremystretch jeremystretch self-assigned this Sep 1, 2022
jeremystretch added a commit that referenced this issue Sep 1, 2022
Fixes #10220: Validate IP version when assigning primary IPs to a VM
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants