-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plugins): add experimental pktmon plugin for Windows (#235)
# Description This is the first of many commits to add Windows flow support via pktmon in the form of a Retina plugin. ## Related Issue If this pull request is related to any issue, please mention it here. Additionally, make sure that the issue is assigned to you before submitting this pull request. ## Checklist - [x] I have read the [contributing documentation](https://retina.sh/docs/contributing). - [x] I signed and signed-off the commits (`git commit -S -s ...`). See [this documentation](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification) on signing commits. - [x] I have correctly attributed the author(s) of the code. - [x] I have tested the changes locally. - [x] I have followed the project's style guidelines. - [ ] I have updated the documentation, if necessary. - [ ] I have added tests, if applicable. ## Screenshots (if applicable) or Testing Completed Please add any relevant screenshots or GIFs to showcase the changes made. ## Additional Notes Add any additional notes or context about the pull request here. This is an experimental build, and in the current form remains half present. Omitting Windows cgo for the time being. --- Please refer to the [CONTRIBUTING.md](../CONTRIBUTING.md) file for more information on how to contribute to this project. --------- Signed-off-by: Mathew Merrick <[email protected]>
- Loading branch information
Showing
16 changed files
with
1,392 additions
and
87 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,3 +37,4 @@ dist/ | |
bin/ | ||
|
||
image-metadata-*.json | ||
*packetmonitorsupport*/ |
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
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
pkg/plugin/windows/pktmon/packetmonitorsupport/* | ||
*.tar | ||
pkg/plugin/windows/pktmon/packetmonitorsupport/* | ||
*.tar |
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 |
---|---|---|
|
@@ -109,3 +109,5 @@ func ToPrometheusType(metric interface{}) prometheus.Collector { | |
return nil | ||
} | ||
} | ||
|
||
type DropReasonType uint32 |
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,61 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
package metrics | ||
|
||
import "github.com/cilium/cilium/api/v1/flow" | ||
|
||
// Alert: this ordering should match the drop_reason_t enum ordering | ||
// in dropreason.h of DropReason plugin | ||
const ( | ||
IPTABLE_RULE_DROP DropReasonType = iota | ||
IPTABLE_NAT_DROP | ||
TCP_CONNECT_BASIC | ||
TCP_ACCEPT_BASIC | ||
TCP_CLOSE_BASIC | ||
CONNTRACK_ADD_DROP | ||
UNKNOWN_DROP | ||
) | ||
|
||
func GetDropType(value uint32) DropReasonType { | ||
switch value { | ||
case 0: | ||
return IPTABLE_RULE_DROP | ||
case 1: | ||
return IPTABLE_NAT_DROP | ||
case 2: | ||
return TCP_CONNECT_BASIC | ||
case 3: | ||
return TCP_ACCEPT_BASIC | ||
case 4: | ||
return TCP_CLOSE_BASIC | ||
case 5: | ||
return CONNTRACK_ADD_DROP | ||
default: | ||
return UNKNOWN_DROP | ||
} | ||
} | ||
|
||
func GetDropTypeFlowDropReason(dr flow.DropReason) string { | ||
return GetDropType(uint32(dr)).String() | ||
} | ||
|
||
func (d DropReasonType) String() string { | ||
switch d { | ||
case IPTABLE_RULE_DROP: | ||
return "IPTABLE_RULE_DROP" | ||
case IPTABLE_NAT_DROP: | ||
return "IPTABLE_NAT_DROP" | ||
case TCP_CONNECT_BASIC: | ||
return "TCP_CONNECT_BASIC" | ||
case TCP_ACCEPT_BASIC: | ||
return "TCP_ACCEPT_BASIC" | ||
case TCP_CLOSE_BASIC: | ||
return "TCP_CLOSE_BASIC" | ||
case CONNTRACK_ADD_DROP: | ||
return "CONNTRACK_ADD_DROP" | ||
case UNKNOWN_DROP: | ||
return "UNKNOWN_DROP" | ||
default: | ||
return "UNKNOWN_DROP" | ||
} | ||
} |
Oops, something went wrong.