Skip to content

Conversation

lukedirtwalker
Copy link
Collaborator

@lukedirtwalker lukedirtwalker commented Jan 30, 2020

Allow :port without [].
Use net library functions instead of manual parsing.

Fixes #3647


This change is Reviewable

Allow <IPv4>:port without [].
Use net library functions instead of manual parsing.

Fixes scionproto#3647
Copy link

@mkowalski mkowalski left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @lukedirtwalker and @oncilla)


go/lib/snet/udpaddr_test.go, line 139 at r1 (raw file):

		{address: "", isError: true},
		{address: "1-ff00:0:301,1.2.3.4", isError: true},
		{address: "1-ff00:0:300,[1.2.3.4]:80",

Shouldn't this one be raising an error?

@lukedirtwalker lukedirtwalker added the i/breaking change PR that breaks forwards or backwards compatibility label Jan 30, 2020
Copy link
Collaborator Author

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @mkowalski and @oncilla)


go/lib/snet/udpaddr_test.go, line 139 at r1 (raw file):

Previously, mkowalski (Mateusz Kowalski) wrote…

Shouldn't this one be raising an error?

It would make the code much more complicated to make this raise an error. Not sure it's worth the gain. It would also break everyone who uses it currently like this. I think the more important part is that we allow IPv4 without [].

Or what would be the advantage of disallowing this?

Copy link

@mkowalski mkowalski left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 2 files reviewed, all discussions resolved (waiting on @oncilla)


go/lib/snet/udpaddr_test.go, line 139 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

It would make the code much more complicated to make this raise an error. Not sure it's worth the gain. It would also break everyone who uses it currently like this. I think the more important part is that we allow IPv4 without [].

Or what would be the advantage of disallowing this?

No any obvious advantage apart from the fact currently we are accepting syntax which is incorrect. Anyway, I'm marking this as non-blocking as I don't really want to push for disallowing what is currently working

Copy link

@mkowalski mkowalski left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @lukedirtwalker and @oncilla)


go/lib/snet/udpaddr_test.go, line 158 at r1 (raw file):

			port: 5,
		},
		{address: "1-ff00:0:302,[::1]:60000",

I would be very happy to see also tests for 1-ff00:0:302,[::1] and 1-ff00:0:302,::1 and "1-ff00:0:302,::1:60000"

@lukedirtwalker
Copy link
Collaborator Author

Closing in favor of #3650

oncilla added a commit that referenced this pull request 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>
@lukedirtwalker lukedirtwalker deleted the pubSnetUDPAddr branch February 3, 2020 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i/breaking change PR that breaks forwards or backwards compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IPv4 addresses enclosed in brackets against RFC3986
2 participants