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

Disallow invalid VLAN/VNI value during network creation #1069

Merged
merged 2 commits into from
Nov 17, 2017

Conversation

kahou82
Copy link
Member

@kahou82 kahou82 commented Nov 15, 2017

Currently, netctl parse the pkgTag input as an integer directly.
Therefore when user put a garbage in pkgTag, the conversion will
default it to 0 instead.

This patchset is to cast the input to string and perform further
validation logic before we create network

Signed-off-by: Kahou Lei kalei@cisco.com

Currently, netctl parse the pkgTag input as an integer directly.
Therefore when user put a garbage in pkgTag, the conversion will
default it to 0 instead.

This patchset is to cast the input to string and perform further
validation logic before we create network

Signed-off-by: Kahou Lei <kalei@cisco.com>
netctl/netctl.go Outdated
var pktTag int
var err error
if len(pktTagInString) > 0 {
pktTag, err = strconv.Atoi(pktTagInString)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit, drop the declaration of err on 538 and use
pktTag, err := strconv.Atoi(pktTagInString)

Copy link
Member Author

Choose a reason for hiding this comment

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

I can't as pktTag need to be used in line 560.

Copy link
Contributor

Choose a reason for hiding this comment

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

just the err, pktTag still decalred on 537, not a blocker

@kahou82
Copy link
Member Author

kahou82 commented Nov 15, 2017

This is the issue refer to contiv/install#182

chrisplo
chrisplo previously approved these changes Nov 15, 2017
@chrisplo
Copy link
Contributor

build PR

@rchirakk
Copy link
Contributor

isn't it more appropriate to change to cli.Intflag ?https://github.com/contiv/netplugin/blob/master/netctl/commands.go#L219

@kahou82
Copy link
Member Author

kahou82 commented Nov 16, 2017

@rchirakk i thought pkt-tag can represent multiple VLAN IDs and VNIs and therefore it was using String for the command input?

@chrisplo chrisplo dismissed their stale review November 16, 2017 03:51

there seems to be a mismatch with expected input values and implementation

@kahou82
Copy link
Member Author

kahou82 commented Nov 16, 2017

@chrisplo please review again

@kahou82
Copy link
Member Author

kahou82 commented Nov 16, 2017

build PR

1 similar comment
@kahou82
Copy link
Member Author

kahou82 commented Nov 16, 2017

build PR

@unclejack unclejack merged commit b6cffca into contiv:master Nov 17, 2017
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.

5 participants