-
Notifications
You must be signed in to change notification settings - Fork 53
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
Exporter fails to parse IPv6 link-local addresses with zone IDs #10
Labels
Comments
Ma27
added a commit
to Ma27/prometheus_wireguard_exporter
that referenced
this issue
Nov 2, 2019
This is a fairly ugly hack to temporarily work around the issue MindFlavor#10. Until now Rust doesn't support so-called zone-ids[1] in link-local IPv6 socket-addresses and has a pending RFC on this topic. As I'm encountering this issue on one of my machines I decided to work around this issue (for now) by removing the zone-id from the IPv6 address. This won't harm any other cases as `regex.replace_all` simply returns the input if the regex doesn't match: ``` >> extern crate regex; >> let re = regex::Regex::new(r"^\[(?P<ip>[A-Fa-f0-9:]+)%(.*)\]:(?P<port>[0-9]+)$"); >> let rs = re.replace_all("fairly unrelated stuff", "[$ip]:$port"); >> rs "fairly unrelated stuff" ``` Please note that (1) this regex isn't RFC-compliant[2] and is just a heuristic to remove zone-ids that currently break this exporter and (2) this is something that probably shouldn't be merged as-is. I mainly pushed this since I needed a workaround for this issue (and others probably too), but it may be better to wait for proper support from the language. [1] https://tools.ietf.org/html/rfc4007#section-11
I will close it for now since @Ma27 solution addresses it. We'll probably need to revise the code some time in the future to see if the upstream crate solved the issue. |
Tbh I'd prefer to leave this open until we have a proper solution. The problem is still there, we just worked around it (which is valid in our case since zone-ids broke the exporter before). |
Good point! Reopened. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I recently discovered that link-local IPv6 addresses can't be parsed by the exporter and cause errors like this in the log:
The reason for this error is that link-local IPv6 addresses can have a so-called zone-id as described in RFC 4007, Section 11 to disambiguate local addresses. In my case one peer had the IPv6 socket address
[fe80::d457:12ff:fe48:176b%ens3]:34216
withens3
being a predictably named network interface.The problem here is that the socket and IP parsers of Rust in
std::net
appear to be unable to parse zone IDs:The reason for this failure is that the parser doesn't appear to support those addresses. There's currently a pending discussion in rust-lang/rfcs about the issue.
The text was updated successfully, but these errors were encountered: