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

Reject incorrect CIDR routes #91

Merged
merged 3 commits into from
Sep 28, 2021
Merged

Conversation

sumukhatv
Copy link
Collaborator

@sumukhatv sumukhatv commented Sep 22, 2021

Configuring incorrect CIDR addresses as routes is not permitted in SONiC and this PR will reject such incorrect routes from being configured using RestAPI.

In a batch config, if one or more routes are incorrect, only those routes will be rejected while the correct routes will be configured and an appropriate return-code will be sent.

Fixes: #74

@sumukhatv sumukhatv requested a review from prsunny September 22, 2021 23:50
@@ -1075,6 +1075,20 @@ func ConfigVrouterVrfIdRoutesPatch(w http.ResponseWriter, r *http.Request) {
defer local_pt.Delete()

for _, r := range attr {

ip, network, err := net.ParseCIDR(r.IPPrefix)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change looks good to me. It is better to provide some comments above and an example on expectation for future clarity.

@sonic-net sonic-net deleted a comment from azure-pipelines bot Sep 28, 2021
@sonic-net sonic-net deleted a comment from azure-pipelines bot Sep 28, 2021
@liushilongbuaa
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@sumukhatv sumukhatv marked this pull request as ready for review September 28, 2021 16:34
@sumukhatv sumukhatv requested a review from prsunny September 28, 2021 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Restapi] Validate IP prefix while configuring route
3 participants