Skip to content

Conversation

@decoupca
Copy link
Contributor

Fixes: #9068

Disallows assigning a broadcast address or network ID to an interface.

Copy link
Member

@jeremystretch jeremystretch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this!

@jeremystretch jeremystretch merged commit 005e3fd into netbox-community:develop May 22, 2023
@kkthxbye-code
Copy link
Contributor

kkthxbye-code commented May 23, 2023

Doing validation like this in the form has the side-effect of only applying to the UI. This is an issue with large parts of the netbox codebase, but I think we should try to avoid it if possible.

With the PR it is now possible to create 10.0.0.0/24 in the API and assign it to an interface. When editing the new IP in the UI and saving without changes it gets the validation error. Not sure what the right solution is. Either the validation logic has to be in both the model form and the serializer, or the validation needs to be done on the model.

@jeremystretch - Any input? I would classify this fix as being buggy, as it makes the UI and API behave differently.

@jeremystretch
Copy link
Member

It's not perfect but it is inline with the existing validation logic. I'm happy to review any proposed improvements.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validation of IP Addresses when of type network or broadcast

3 participants