-
Notifications
You must be signed in to change notification settings - Fork 0
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
291 atomic ip block #306
Merged
Merged
291 atomic ip block #306
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
91b1c1a
code for implementing atomic for ipBlockTerm
ShiriMoran 0e93761
Merge branch 'main' into 291_atomic_ip_block
ShiriMoran e8ad291
revert committed by mistake
ShiriMoran fd5f72d
update Conjunction functions to handle IPBlocks (not checked yet(
ShiriMoran 660deb7
IsTautology no longer false for all impl over atomicTerm structs
ShiriMoran dfc7f69
update func (c *Conjunction) isTautology() bool
ShiriMoran 54b17e4
minor code improvements
ShiriMoran 16c2646
improvred comment
ShiriMoran d293e67
merge with main leftovers
ShiriMoran 8743041
separate unit tests to two files
ShiriMoran d4d52cb
tests IpBlockTerm String()
ShiriMoran 41ec110
check negation (1)
ShiriMoran e655f71
added a test and fixed bugs it revealed
ShiriMoran 6d73254
simplified code
ShiriMoran 26de2a3
isNegateOf check
ShiriMoran c303e31
isNegateOf negative check
ShiriMoran eed6546
fix bug
ShiriMoran a137743
IsTautology() tests added
ShiriMoran 41078d8
disjoint tests added
ShiriMoran 976eedb
supersetOf tests added
ShiriMoran 28ac23a
added tests for func (c *Conjunction) add(atom atomic) *Conjunction;
ShiriMoran df97678
test added
ShiriMoran f14a67a
test added
ShiriMoran 838b301
test added
ShiriMoran 3e25ebe
test added
ShiriMoran 6f90fce
extended isEmptySet
ShiriMoran ffcc75a
extended disjoint; made isEmptySet more efficient
ShiriMoran 5f5f2d3
added isEmptySet tests
ShiriMoran 3c3901f
minor syntactic refactor
ShiriMoran 2f86483
tests isTautology()
ShiriMoran 13a76e9
Conjunction isEmptySet is actually isFalse; does not hold for an empt…
ShiriMoran f5eeb40
tests contains
ShiriMoran 66d9c8f
added explanation to tests
ShiriMoran f3e3191
added explanation to tests
ShiriMoran 9f5d181
1. 0.0.0.0/0 is implied also by Conj with no ipblockTerm. Fixed code …
ShiriMoran cd274a8
added IsContradiction() to atomic interface
ShiriMoran 4dddb38
simplified "(c *Conjunction) contains(atom atomic) bool" so that it d…
ShiriMoran a0c1fc1
simplified "func (ipBlockTerm *ipBlockAtomicTerm) supersetOf(otherAto…
ShiriMoran 0718d22
clarified comment
ShiriMoran 4aa2067
Merge branch 'main' into 291_atomic_ip_block
ShiriMoran ea6b40b
merge with main
ShiriMoran d06a12d
lint
ShiriMoran d269354
lint
ShiriMoran b6f19a9
CR
ShiriMoran d6f6a2d
CR
ShiriMoran e124609
CR
ShiriMoran 6dad6ba
CR: add getBlock() to atomic interface
ShiriMoran bbf17d2
lint
ShiriMoran 3b281a8
my fix to my PR comment
haim-kermany 7666748
Merge branch '291_atomic_ip_block' of https://github.com/np-guard/vmw…
haim-kermany 5ec6d7b
lint
ShiriMoran 5d4338c
Merge remote-tracking branch 'origin/291_atomic_ip_block' into 291_at…
ShiriMoran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package symbolicexpr | ||
|
||
import "github.com/np-guard/models/pkg/netset" | ||
|
||
// contradiction implementation; contradiction is the negation of tautology | ||
|
||
func (contradiction) String() string { | ||
return "empty set" | ||
} | ||
|
||
func (contradiction) name() string { | ||
return "" | ||
} | ||
|
||
func (contradiction) negate() atomic { | ||
return tautology{} | ||
} | ||
|
||
func (contradiction) isNegation() bool { | ||
return false | ||
} | ||
|
||
func (contradiction) IsTautology() bool { | ||
return false | ||
} | ||
|
||
func (contradiction) IsContradiction() bool { | ||
return true | ||
} | ||
|
||
// returns true iff otherAt is negation of | ||
// once we cache the atomic terms, we can just compare pointers | ||
func (contradiction) isNegateOf(atom atomic) bool { | ||
return atom.IsTautology() | ||
} | ||
func (contradiction) AsSelector() (string, bool) { | ||
return "", false | ||
} | ||
|
||
// contradiction is disjoint to any atomic term | ||
func (contradiction) disjoint(atomic, *Hints) bool { | ||
return true | ||
} | ||
|
||
func (contradiction) supersetOf(atom atomic, hints *Hints) bool { | ||
return false | ||
} | ||
|
||
func (contradiction) getBlock() *netset.IPBlock { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why
false
for this case?can use config details about internal addresses ranges?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If atom is an
ipBlockTerm
andotherAtom
is atagTerm
or agroupTerm
then there is no way we can compare them (groupTerm
is used only when we failed to analyze the group's expression).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if an expression is defined over VM properties, it may only capture internal VM addresses.
and in such case if IPBlock is known to be external, can infer they are disjoint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can infer they are disjoint at the moment of synthesis. We can not infer they are meant to be disjoint.
And since using IPs to refer to internal is defined a bad practice, I don't think we should develop methodology for this case (as "guessing" disjointness)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, please open a separate issue for discussing/considering this later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#314