-
Notifications
You must be signed in to change notification settings - Fork 29
NETOBSERV-2307: NETOBSERV-2315: fix several IPFIX issues #1019
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b044453
NETOBSERV-2307: NETOBSERV-2315: fix several IPFIX issues
jotak d56febe
fix sending decoded tcpflags on ipfix
jotak 743583a
Use patched go-ipfix, add write+read test...
jotak 587ece1
Add simple example of ipfix ingester
jotak fe96c83
Warn about deprecated API usage
jotak 0d88640
fix race
jotak 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 hidden or 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 hidden or 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,16 @@ | ||
# Use it with: | ||
# ./flowlogs-pipeline --config=contrib/local/ipfix-collector-stdout.yaml | ||
log-level: info | ||
pipeline: | ||
- name: ingest | ||
- name: write | ||
follows: ingest | ||
parameters: | ||
- name: ingest | ||
ingest: | ||
type: ipfix | ||
ipfix: | ||
port: 2055 | ||
- name: write | ||
write: | ||
type: stdout |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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,64 @@ | ||
/* | ||
* Copyright (C) 2022 IBM, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package api | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/netsampler/goflow2/producer" | ||
) | ||
|
||
type IngestIpfix struct { | ||
HostName string `yaml:"hostName,omitempty" json:"hostName,omitempty" doc:"the hostname to listen on; defaults to 0.0.0.0"` | ||
Port uint `yaml:"port,omitempty" json:"port,omitempty" doc:"the port number to listen on, for IPFIX/NetFlow v9. Omit or set to 0 to disable IPFIX/NetFlow v9 ingestion. If both port and portLegacy are omitted, defaults to 2055"` | ||
PortLegacy uint `yaml:"portLegacy,omitempty" json:"portLegacy,omitempty" doc:"the port number to listen on, for legacy NetFlow v5. Omit or set to 0 to disable NetFlow v5 ingestion"` | ||
Workers uint `yaml:"workers,omitempty" json:"workers,omitempty" doc:"the number of netflow/ipfix decoding workers"` | ||
Sockets uint `yaml:"sockets,omitempty" json:"sockets,omitempty" doc:"the number of listening sockets"` | ||
Mapping []producer.NetFlowMapField `yaml:"mapping,omitempty" json:"mapping,omitempty" doc:"custom field mapping"` | ||
} | ||
|
||
func (i *IngestIpfix) SetDefaults() { | ||
if i.HostName == "" { | ||
i.HostName = "0.0.0.0" | ||
} | ||
if i.Port == 0 && i.PortLegacy == 0 { | ||
i.Port = 2055 | ||
} | ||
if i.Workers == 0 { | ||
i.Workers = 1 | ||
} | ||
if i.Sockets == 0 { | ||
i.Sockets = 1 | ||
} | ||
} | ||
|
||
func (i *IngestIpfix) String() string { | ||
hasMapping := "no" | ||
if len(i.Mapping) > 0 { | ||
hasMapping = "yes" | ||
} | ||
return fmt.Sprintf( | ||
"hostname=%s, port=%d, portLegacy=%d, workers=%d, sockets=%d, mapping=%s", | ||
i.HostName, | ||
i.Port, | ||
i.PortLegacy, | ||
i.Workers, | ||
i.Sockets, | ||
hasMapping, | ||
) | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Be carefull since this is still used in multiple places such in:
https://github.com/netobserv/netobserv-ebpf-agent/blob/ba5c7c6ffaea7dfaaf61aeb3111bdd14a86c871d/e2e/ipfix/manifests/20-flp-transformer.yml#L53
flowlogs-pipeline/network_definitions/config.yaml
Lines 7 to 10 in 19fb27b
flowlogs-pipeline/contrib/kubernetes/flowlogs-pipeline.conf.yaml
Lines 24 to 27 in 19fb27b
flowlogs-pipeline/hack/examples/docker-ipfix-config.yaml
Lines 23 to 26 in 19fb27b
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.
done (except the first which is a different thing, it's the conf-generator tool, which I didn't touch here)
Also added a warn log for deprecated API usage