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

IPv4 addresses enclosed in brackets against RFC3986 #3647

Closed
mkowalski opened this issue Jan 30, 2020 · 0 comments · Fixed by #3650
Closed

IPv4 addresses enclosed in brackets against RFC3986 #3647

mkowalski opened this issue Jan 30, 2020 · 0 comments · Fixed by #3650

Comments

@mkowalski
Copy link

mkowalski commented Jan 30, 2020

Currently toml files use the following syntax for addresses of control services

Address = "[242.254.0.22]:31005"

According to RFC3986 this syntax is reserved for IPv6 and futures

A host identified by an Internet Protocol literal address, version 6
   [RFC3513] or later, is distinguished by enclosing the IP literal
   within square brackets ("[" and "]").  This is the only place where
   square bracket characters are allowed in the URI syntax.

The current behaviour is inconsistent as toml files also contain IPs without enclosing brackets, like agent = "172.17.0.1:6831".

Probably the following regex (https://github.com/scionproto/scion/blob/master/go/lib/snet/udpaddr.go#L29-L30) should be updated to handle this more properly

var addrRegexp = regexp.MustCompile(
    `^(?P<ia>\d+-[\d:A-Fa-f]+),\[(?P<host>[^\]]+)\](?P<port>:\d+)?$`)
lukedirtwalker added a commit to lukedirtwalker/scion that referenced this issue Jan 30, 2020
Allow <IPv4>:port without [].
Use net library functions instead of manual parsing.

Fixes scionproto#3647
oncilla pushed a commit to oncilla/scion that referenced this issue Jan 31, 2020
Allow <IPv4>:port without [].
Use net library functions instead of manual parsing.

Fixes scionproto#3647
oncilla added a commit that referenced this issue Feb 3, 2020
Allow :port without [] for IPv4.
Use net library functions instead of manual parsing.

```
Recommended:
  - isd-as,ipv4:port   (e.g., 1-ff00:0:300,192.168.1.1:8080)
  - isd-as,[ipv6]:port (e.g., 1-ff00:0:300,[f00d::1337]:808)

 Others:
  - isd-as,[ipv4]:port (e.g., 1-ff00:0:300,[192.168.1.1]:80)
  - isd-as,[ipv4]      (e.g., 1-ff00:0:300,[192.168.1.1])
  - isd-as,[ipv6]      (e.g., 1-ff00:0:300,[f00d::1337])
  - isd-as,ipv4        (e.g., 1-ff00:0:300,192.168.1.1)
  - isd-as,ipv6        (e.g., 1-ff00:0:300,f00d::1337)

 Not supported:
  - isd-as,ipv6:port    (caveat if ipv6:port builds a valid ipv6 address,
                         it will successfully parse as ipv6 without error)
```

Fixes #3647

based on #3648

Co-authored-by: Lukas Vogel <lukedirtwalker@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant