Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

[DONOTMERGE] networking: Add IPNetDeepCopy function #451

Closed
wants to merge 2 commits into from
Closed

[DONOTMERGE] networking: Add IPNetDeepCopy function #451

wants to merge 2 commits into from

Conversation

mrkz
Copy link
Contributor

@mrkz mrkz commented Aug 12, 2016

IPNetDeepCopy will create a full copy of a IPNet struct

Signed-off-by: Simental Magana, Marcos [email protected]

@coveralls
Copy link

coveralls commented Aug 12, 2016

Coverage Status

Coverage increased (+0.003%) to 65.461% when pulling e2acbee on mrkz:ipnet_deepcopy into d6cef89 on 01org:master.

@mrkz
Copy link
Contributor Author

mrkz commented Aug 12, 2016

This PR conflicts with #425, as both add the networking/libsnnet/utils_test.go file, either this or #425 is merged first, the last one to be merged will be rebased against master to ensure a clean merge.

@sameo
Copy link

sameo commented Aug 12, 2016

@mrkz I merged #425, please rebase that one now.

@coveralls
Copy link

coveralls commented Aug 12, 2016

Coverage Status

Coverage decreased (-0.8%) to 64.656% when pulling 033e851 on mrkz:ipnet_deepcopy into d3c5489 on 01org:master.

@sameo
Copy link

sameo commented Aug 12, 2016

@mrkz @mcastelino Would you guys mind amending the commit message with an explanation as to why this is needed ?

@mcastelino
Copy link
Contributor

@sameo the go network library lacks a deepcopy implementation for IP and IPNet. We were using the .Mask to implement deep copy. This implementation will replace the mask with a more efficient implementation. It may make sense to export this out of libsnnet to as it will be useful elsewhere in our code.

@mcastelino
Copy link
Contributor

@mrkz can we also test with IPv6 addresses also just to be safe.

@mrkz mrkz changed the title networking: Add IPNetDeepCopy function [DONOTMERGE] networking: Add IPNetDeepCopy function Aug 25, 2016
@mrkz
Copy link
Contributor Author

mrkz commented Aug 25, 2016

Needs rework for failing tests

mrkz added 2 commits January 10, 2017 10:47
`IPNetDeepCopy` will create a full copy of a IPNet struct

Signed-off-by: Simental Magana, Marcos <[email protected]>
previously `IP.Mask` was used to copy an IPNet struct,
now that we provide a proper function to create IPNet
copies we can make use of it and avoid Mask hacks.

Signed-off-by: Simental Magana, Marcos <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants