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

Improve PI unique packet generation #1945

Merged
merged 5 commits into from
Oct 1, 2019

Conversation

safchain
Copy link
Collaborator

@safchain safchain commented Aug 1, 2019

This aims to fix generation of unique packet ID when injecting from multiple nodes to one

@dvandra
Copy link
Contributor

dvandra commented Aug 30, 2019

This is very useful to get a unique flow from multiple nodes to one destination.
But we need something to identify the source node per unique flow.
We need something either in flow or capture to identify source node per unique flow.

I am working on this and will soon update a patch.

cmd.Flags().StringVarP(&srcMAC, "src-mac", "", "", "source node MAC")
cmd.Flags().StringVarP(&dstMAC, "dst-mac", "", "", "destination node MAC")
cmd.Flags().Uint16VarP(&srcPort, "src-port", "", 0, "source port for TCP packet")
cmd.Flags().Uint16VarP(&dstPort, "dst-port", "", 0, "destination port for TCP packet")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is these changes needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not really but make command line more consistent, this doesn't break the API

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@safchain
Copy link
Collaborator Author

safchain commented Sep 2, 2019

Using the mode unique per node we should be able to identify the flows. Let say we take the srcPort of 50000 and we do have 5 source nodes then we know that the source ports will be between 50000 and 50005. We can use the same approach with the ICMP ID

@safchain safchain changed the title WIP Improve PI unique packet generation Improve PI unique packet generation Sep 24, 2019
@safchain
Copy link
Collaborator Author

run skydive-compile-tests

@safchain safchain marked this pull request as ready for review September 24, 2019 15:53
@safchain safchain force-pushed the improve-pi-inc-backup branch 2 times, most recently from add5f43 to 4d1bb77 Compare September 25, 2019 06:00
@safchain
Copy link
Collaborator Author

run skydive-cdd-overview-tests
run skydive-compile-tests
run skydive-functional-tests-backend-orientdb

@safchain
Copy link
Collaborator Author

run skydive-functional-tests-backend-orientdb
run skydive-functional-tests-backend-elasticsearch
run skydive-functional-tests-backend-orientdb

@safchain
Copy link
Collaborator Author

run skydive-cdd-overview-tests

@safchain
Copy link
Collaborator Author

run skydive-cdd-overview-tests
run skydive-functional-tests-backend-orientdb
run skydive-k8s-tests

if nodeID, host, ok := toRegister(nr); ok {
nps[nodeID] = nodeTask{nodeID, host, nr.Resource}
}
/*switch i.(type) {
Copy link
Member

Choose a reason for hiding this comment

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

Should be removed instead of commented ?

return h.applyGremlinExpr(query)

if nodes := h.applyGremlinExpr(query); len(nodes) > 0 {
for _, i := range nodes {
Copy link
Member

Choose a reason for hiding this comment

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

Could this be done in applyGremlinExpr ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

applyGremlinExpr is called somewhere else so I would prefer to keep this as it is

api/types/types.go Outdated Show resolved Hide resolved
scripts/gendecoder/main.go Outdated Show resolved Hide resolved
api/types/types.go Outdated Show resolved Hide resolved
cmd/injector/standalone.go Outdated Show resolved Hide resolved
@safchain safchain force-pushed the improve-pi-inc-backup branch 5 times, most recently from 9b8e602 to 1ec024c Compare September 27, 2019 16:25
cmd.Flags().StringVarP(&packetType, "type", "", "icmp4", "packet type: icmp4, icmp6, tcp4, tcp6, udp4 and udp6")
cmd.Flags().StringVarP(&payload, "payload", "", "", "payload")
cmd.Flags().StringVar(&pcap, "pcap", "", "PCAP file")
cmd.Flags().Uint16VarP(&id, "id", "", 0, "ICMP identification")
cmd.Flags().BoolVarP(&increment, "increment", "", false, "increment ICMP id for each packet")
cmd.Flags().Int64VarP(&incrementPayload, "incrementPayload", "", 0, "increase payload for each packet")
cmd.Flags().StringVarP(&mode, "mode", "", "unique", "specify mode of packet generation, `unique` or `random`")
Copy link
Member

Choose a reason for hiding this comment

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

Would be nice to check if the specified value is either "unique" or "random"

@safchain safchain force-pushed the improve-pi-inc-backup branch 4 times, most recently from 0b82fa0 to 94d9905 Compare October 1, 2019 06:52
@lebauce
Copy link
Member

lebauce commented Oct 1, 2019

run skydive-functional-tests-backend-orientdb

@@ -23,7 +23,7 @@ class PacketInjection(object):
def __init__(self, uuid="", src="", dst="", srcip="", dstip="", srcmac="",
dstmac="", srcport=0, dstport=0, type="icmp4", payload="",
trackingid="", icmpid=0, count=1, interval=0,
increment=False, starttime="", ttl=64):
mode=0, starttime="", ttl=64):
Copy link
Member

Choose a reason for hiding this comment

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

Should be mode="" now

if _, ok := allowedTypes[pi.Type]; !ok {
return errors.New("given type is not supported")
}

if pi.Mode != "" && pi.Mode != "unique" && pi.Mode != "random" {
Copy link
Member

Choose a reason for hiding this comment

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

pi.Mode != PIModeUniqPerNode && pi.Mode != PIModeRandom

@safchain
Copy link
Collaborator Author

safchain commented Oct 1, 2019

run skydive-cdd-overview-tests

1 similar comment
@safchain
Copy link
Collaborator Author

safchain commented Oct 1, 2019

run skydive-cdd-overview-tests

@lebauce lebauce merged commit d77bd29 into skydive-project:master Oct 1, 2019
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.

3 participants