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

Options API is broken and needs to be changed/removed #1

Open
mkcms opened this issue Jun 6, 2020 · 0 comments
Open

Options API is broken and needs to be changed/removed #1

mkcms opened this issue Jun 6, 2020 · 0 comments

Comments

@mkcms
Copy link
Contributor

mkcms commented Jun 6, 2020

Currently we store options for each exporter device like this (pseudocode):

options = map<field, value>();

But this is wrong, because in Netflow9 there can be multiple option values for a given option field.
This is because option packets are divided into multiple FLOWS, and each flow is independent.

For example:

OPTION TEMPLATE
  FLOWSET0
    FLOW0
      SAMPLER_ID = 100
      SAMPLING_INTERVAL = 10
    FLOW1
      SAMPLER_ID = 101
      SAMPLING_INTERVAL = 100

With current implementation of nf9_get_option if you asked for SAMPLER_ID option you would get 101, and for SAMPLING_INTERVAL - 100. And you have no way of getting the values in the first flow.

So I propose that we either:

  1. Change the way options are stored and the API to retrieve them

    options = vector<map<field, value>>();
    
    int nf9_get_option(const nf9_state* st, unsigned flow, nf9_field which, void* dst, size_t *size);

    (note the added flow param, which is the index of the flow)

  2. Remove the options API.

    And leave option handling for the user. We'd just have to make sure that the user can retrieve values from an options packet. This would simplify the code a lot, but we would lose some functionality.

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