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

Dual ipv6 addresses not parsed correctly #34

Open
bbannier opened this issue Aug 18, 2022 · 2 comments
Open

Dual ipv6 addresses not parsed correctly #34

bbannier opened this issue Aug 18, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@bbannier
Copy link
Member

bbannier commented Aug 18, 2022

Looks like currently the grammar does not support parsing dual ipv6 addresses.

# x.zeek
event zeek_init()
	{
	print [2001:db8:0:0:0:FFFF:192.168.0.5];
	print [2001:db8::FFFF:192.168.0.5];
	}
$ zeek-format x.zeek
cannot parse line 3, col 8: "2001:db8:0:0:0:FFFF:"
# x.zeek
event zeek_init()
        {
        print [ 2001:db8:0:0:0:FFFF: 192.168.0.5];
        print [2001:db8::FFFF:192 .168.0.5 ];
        }

This currently produces broken output with zeek-format.

@bbannier bbannier added the bug Something isn't working label Aug 18, 2022
@bbannier bbannier transferred this issue from zeek/tree-sitter-zeek Aug 19, 2022
@ckreibich
Copy link
Member

Oh yeah, good one Benjamin. The IPv6 parser is super simple and doesn't match Zeek's. I just grabbed an IPv6 regex at the time, kicking that can down the road. We should make that parser match Zeek's.

@vpax
Copy link

vpax commented Oct 17, 2022

Here's another bug I just ran across - let me know if I should create a separate issue.

Original:

event zeek_init()
{
local site = set(0.0.0.0, 0.0.0.5, 0.0.0.128, [dada:beef::],
[dada:beef::ffff], [dada:beef::ffff:ffff],
[dada:beef::ffff:ffff:ffff],
[dada:beef::ffff:ffff:ffff:ffff]);
}

zeek-format'ed:

event zeek_init()
{
local site = set(0.0.0.0, 0.0.0.5, 0.0.0.128, [dada:beef::], [
dada:beef::ffff], [dada:beef::ffff:ffff], [
dada:beef::ffff:ffff:ffff], [dada:beef::ffff:ffff:ffff:ffff]);
}

which leads to parse errors, because Zeek requires that IPv6 addresses appear on the same line as the [ that introduces them.

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

3 participants