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

[GetSets] Fetching Sets from table with maps fails #171

Open
ziggie1984 opened this issue Jun 7, 2022 · 4 comments
Open

[GetSets] Fetching Sets from table with maps fails #171

ziggie1984 opened this issue Jun 7, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@ziggie1984
Copy link

Problem1

As soon as I want to fetch Sets of a table which has a map included the nflib reports an error:

Error Fetching Sets - could not determine data type 1cd

When I delete the Map Fetching Sets works perfect.

Problem 2

Fetching tables reports very high numbers for Use uint32 // NFTA_TABLE_USE (Number of chains in table) for example:

Table has only 2 chains but GetTable reports very high number:

2022/06/07 09:41:28 &{filter 100663296 0 1}

Is there maybe a short workaround to make it work?

@stapelberg
Copy link
Collaborator

I don’t understand what the problems are. At the very minimum, please always include a standalone program that illustrates what the problem is.

You might have to dig into the code yourself to fix this in the short term, I don’t know how much time I have to look into this.

@stapelberg stapelberg added the bug Something isn't working label Sep 9, 2022
@ziggie1984
Copy link
Author

ziggie1984 commented Dec 7, 2022

Ok, will fix the issue, we need to also check for concatenation types when fetching the sets otherwise the types will not match.
I did neglect the error in my custom software but now I need a fix, will create a PR this week

@ziggie1984
Copy link
Author

FYI:

The problem lies here: https://github.com/google/nftables/blob/main/set.go#L705

In case the datatype is concatenated we need to call the validateKeyType Function which will fix the issue and check if all concatenated types are valid.

invalidMagic, ok := validateKeyType(nftMagic); !ok {
				return nil, fmt.Errorf("could not determine data type %+v", invalidMagic)
			} 

@ziggie1984
Copy link
Author

Will run some more tests maybe also include the possibility to decode a concatenated type (separate function), so that one can easily compare the data types before changing the set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants