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

Some suggestions for better IPv6 support #31

Merged
merged 11 commits into from
Sep 18, 2023

Conversation

dopheide-esnet
Copy link
Contributor

@dopheide-esnet dopheide-esnet commented Aug 30, 2023

When specifying addresses in the [instances] section of a config there were two issues:

[instances]
agent-zeek-test-cluster1.es.net = 127.0.0.1:2151
agent-zeek-test-cluster2.es.net = 2001:400:211::122:2151
  1. Previously there was no support for specifying an ipv6 address at all. This should allow the above to work as well as if the v6 address is inside []'s.

  2. There's a sort in brokertypes.py that ended up trying to compare IPv4 vs IPv6 addresses causing 'ipaddress' to throw a TypeError. What I've implement here is just a basic assumption that IPv4 is less than IPv6.

zeekclient/types.py Outdated Show resolved Hide resolved
zeekclient/brokertypes.py Outdated Show resolved Hide resolved
dopheide-esnet and others added 2 commits August 30, 2023 11:53
Taking Arne's suggestion, much nicer.

Co-authored-by: Arne Welzel <[email protected]>
zeekclient/types.py Outdated Show resolved Hide resolved
Copy link
Member

@ckreibich ckreibich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Dop — I hadn't gone near IPv6 at all so it's great that you found this. It's also a good reminder that IPv6 should be in the external testsuite.

We should have a few IP address tests in test_config_io.py to cover the parsing of configs with addresses. They could work like this one, just with spelled-out IPv4/v6 addresses for instances.

It would also be good to have a test that spells out an instance's host and port, but doesn't use an IP address. I think it's currently not spelled out anywhere, but due to the underlying handling the host value needs to be an address, not a hostname. (This needn't be in this PR. It's also hopefully temporary, since eventually the framework should support hostnames and addresses throughout.)

The other day we merged #32, which means you need to rebase this one and likely tweak formatting a bit.

Let me know if you have cycles for these, otherwise I'm happy to cherry-pick your commits and take over.

zeekclient/brokertypes.py Show resolved Hide resolved
zeekclient/types.py Outdated Show resolved Hide resolved
@dopheide-esnet
Copy link
Contributor Author

Okay, we should have checking for valid IPs and tests for those now. As you mentioned, I did not implement accepting hostnames yet until the underlying code does as well.

Copy link
Member

@ckreibich ckreibich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great Dop, thank you. Are you up for rebasing on top of master? It's a bit fiddly due to the reformat, but otherwise not bad. Otherwise I can copy the commits from your branch and do it.

@dopheide-esnet
Copy link
Contributor Author

I'll be honest... I have no idea how to do that. :)

This looks great Dop, thank you. Are you up for rebasing on top of master? It's a bit fiddly due to the reformat, but otherwise not bad. Otherwise I can copy the commits from your branch and do it.

role = MANAGER
port = 5000
"""
cfp = self.parserFromString(ini_input)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This got renamed to parse_from_string recently.

Here and below.

@ckreibich ckreibich merged commit 855b037 into zeek:master Sep 18, 2023
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

Successfully merging this pull request may close these issues.

4 participants