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

Parsing of sflow SourceID from sample record is wrong #178

Open
dbardbar opened this issue Jan 1, 2023 · 0 comments
Open

Parsing of sflow SourceID from sample record is wrong #178

dbardbar opened this issue Jan 1, 2023 · 0 comments

Comments

@dbardbar
Copy link
Contributor

dbardbar commented Jan 1, 2023

According to the sflow RFC 3176, page 19, the struct flow_sample contains 4 bytes of source id, where the first byte is the type (0 = ifindex, 1 = smonVlanDataSource, etc), and the remaining 3 bytes is the actual value (interface index, vlan id, etc)

The code in flow_sample reads only the first 1 byte, skipping the other 3, and declares this as "SourceID". See FlowSample's unmarshel method. This is wrong.
The code in flow_counter does the right thing, and reads those 4 bytes into two fields, SourceIDType and SourceIDIdx. See CounterSample's unmarshal method.

I suggest we copy the code behaviour from sflow_counter.go to sflow_sample.go. This leads to breaking of the output, which isn't that great, but honestly can't think of anybody today who reads the the current SourceID field from the JSON, as it contains no useful information.

Input from the community on this would be appreciated.

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

No branches or pull requests

1 participant