Skip to content

Reject incorrect CIDR routes#91

Merged
sumukhatv merged 3 commits intosonic-net:masterfrom
sumukhatv:ip-prefix-bug
Sep 28, 2021
Merged

Reject incorrect CIDR routes#91
sumukhatv merged 3 commits intosonic-net:masterfrom
sumukhatv:ip-prefix-bug

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

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