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

Make Genhash-Script IPv6 compatible #9

Open
pfennig42 opened this issue Apr 13, 2022 · 0 comments
Open

Make Genhash-Script IPv6 compatible #9

pfennig42 opened this issue Apr 13, 2022 · 0 comments

Comments

@pfennig42
Copy link

Problem

ATM the IPEntry-Struct is stored in an integer with a length of 32 bytes (https://github.com/activecm/safelist-tools/blob/main/genhash/main.go#L48). Therefore only IPv4-Adresses can be stored.
When trying to use an IPv6-Adress, the script throws an error [*] Error reading data from .: json: cannot unmarshal number 42540766490510755371168322545197776895 into Go struct field EntryIPRange.ranges.ranges.end of type uint32

Replication

Try to hash an entry like that: { "comment": "", "name": "Public: fe80::/62", "ranges": { "dst": true, "network_uuid": { "Kind": 4, "Data": "/////////////////////w==" }, "ranges": [ { "end": 338288524927261089654018896841347694592, "start": 338288524927261089727805873136185901055 } ], "src": false }, "schema_version": 5, "type": "cidr" },

Possbile fix

Unfortunately I did not find a way where GO would support uint128, to store a IPv6, natively. But there are workarounds (e.g https://pkg.go.dev/lukechampine.com/uint128). An other way could be to re-implement it.

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