{"action":"closed","number":102,"pull_request":{"url":"https://api.github.com/repos/docker/vpnkit/pulls/102","id":82207687,"html_url":"https://github.com/docker/vpnkit/pull/102","diff_url":"https://github.com/docker/vpnkit/pull/102.diff","patch_url":"https://github.com/docker/vpnkit/pull/102.patch","issue_url":"https://api.github.com/repos/docker/vpnkit/issues/102","number":102,"state":"closed","locked":false,"title":"Fix the UDP NAT, add a suite of tests","user":{"login":"djs55","id":198586,"avatar_url":"https://avatars.githubusercontent.com/u/198586?v=3","gravatar_id":"","url":"https://api.github.com/users/djs55","html_url":"https://github.com/djs55","followers_url":"https://api.github.com/users/djs55/followers","following_url":"https://api.github.com/users/djs55/following{/other_user}","gists_url":"https://api.github.com/users/djs55/gists{/gist_id}","starred_url":"https://api.github.com/users/djs55/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djs55/subscriptions","organizations_url":"https://api.github.com/users/djs55/orgs","repos_url":"https://api.github.com/users/djs55/repos","events_url":"https://api.github.com/users/djs55/events{/privacy}","received_events_url":"https://api.github.com/users/djs55/received_events","type":"User","site_admin":false},"body":"Originally we tried to build a \"full-cone\" UDP NAT to make NAT traversal easier. Our external listening `SOCK_DGRAM` sockets will accept traffic from anywhere and forward it to the VM. However in the beginning we accidentally associated the NAT rule with the destination server address -- probably due to a confusion between `src` and `dst` in `slirp.ml`. This meant that -- for example -- when a new DNS request arrived, all requests (including those destined for other people) would go to the new client by mistake.\r\n\r\nWhen this mistake was discovered we switched to one NAT rule per `(src, src_port, dst, dst_port)` tuple but this resulted in a lot of NAT rules all \"connected\" back to the same server (`src, src_port)`. This meant that (a) we wasted sockets in the -- likely -- case of there being lots of external hosts; and (b) we had lots of separate expiry timers, causing the unexpected expiry of some of the rules.\r\n\r\nThis PR changes slirp to associate the NAT rules with the internal `(src, src_ip)` address. This is consistent with the NAT being \"full-cone\" i.e. once the rule is in place, anyone can send traffic to it and have it forwarded to the VM; and any traffic from the VM from this address to anywhere shares the same rule and resets the same expiry timer.\r\n\r\nThis PR adds a suite of UDP tests and which check that\r\n\r\n- UDP NAT to an external server works\r\n- 2 source ports talking to the same external server don't share/overwrite the same NAT rule (previous bug which broke DNS)\r\n- NAT traversal works i.e. the external address is good for other people to use\r\n- 1 source port talking to 2 destination ports do share the same NAT rule (+ listening socket + expiry time)\r\n","created_at":"2016-08-22T15:05:27Z","updated_at":"2016-08-23T10:10:17Z","closed_at":"2016-08-23T10:10:17Z","merged_at":"2016-08-23T10:10:17Z","merge_commit_sha":"31dc9a72cbf51a9368d37dcbf649a34eafefc0af","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/docker/vpnkit/pulls/102/commits","review_comments_url":"https://api.github.com/repos/docker/vpnkit/pulls/102/comments","review_comment_url":"https://api.github.com/repos/docker/vpnkit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/vpnkit/issues/102/comments","statuses_url":"https://api.github.com/repos/docker/vpnkit/statuses/0173b6f63fb0f3fa9d9f429f09df432c8efeda7b","head":{"label":"djs55:full-cone-nat","ref":"full-cone-nat","sha":"0173b6f63fb0f3fa9d9f429f09df432c8efeda7b","user":{"login":"djs55","id":198586,"avatar_url":"https://avatars.githubusercontent.com/u/198586?v=3","gravatar_id":"","url":"https://api.github.com/users/djs55","html_url":"https://github.com/djs55","followers_url":"https://api.github.com/users/djs55/followers","following_url":"https://api.github.com/users/djs55/following{/other_user}","gists_url":"https://api.github.com/users/djs55/gists{/gist_id}","starred_url":"https://api.github.com/users/djs55/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djs55/subscriptions","organizations_url":"https://api.github.com/users/djs55/orgs","repos_url":"https://api.github.com/users/djs55/repos","events_url":"https://api.github.com/users/djs55/events{/privacy}","received_events_url":"https://api.github.com/users/djs55/received_events","type":"User","site_admin":false},"repo":{"id":59369036,"name":"vpnkit","full_name":"djs55/vpnkit","owner":{"login":"djs55","id":198586,"avatar_url":"https://avatars.githubusercontent.com/u/198586?v=3","gravatar_id":"","url":"https://api.github.com/users/djs55","html_url":"https://github.com/djs55","followers_url":"https://api.github.com/users/djs55/followers","following_url":"https://api.github.com/users/djs55/following{/other_user}","gists_url":"https://api.github.com/users/djs55/gists{/gist_id}","starred_url":"https://api.github.com/users/djs55/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djs55/subscriptions","organizations_url":"https://api.github.com/users/djs55/orgs","repos_url":"https://api.github.com/users/djs55/repos","events_url":"https://api.github.com/users/djs55/events{/privacy}","received_events_url":"https://api.github.com/users/djs55/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/djs55/vpnkit","description":"A toolkit for embedding VPN capabilities in your application","fork":true,"url":"https://api.github.com/repos/djs55/vpnkit","forks_url":"https://api.github.com/repos/djs55/vpnkit/forks","keys_url":"https://api.github.com/repos/djs55/vpnkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/djs55/vpnkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/djs55/vpnkit/teams","hooks_url":"https://api.github.com/repos/djs55/vpnkit/hooks","issue_events_url":"https://api.github.com/repos/djs55/vpnkit/issues/events{/number}","events_url":"https://api.github.com/repos/djs55/vpnkit/events","assignees_url":"https://api.github.com/repos/djs55/vpnkit/assignees{/user}","branches_url":"https://api.github.com/repos/djs55/vpnkit/branches{/branch}","tags_url":"https://api.github.com/repos/djs55/vpnkit/tags","blobs_url":"https://api.github.com/repos/djs55/vpnkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/djs55/vpnkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/djs55/vpnkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/djs55/vpnkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/djs55/vpnkit/statuses/{sha}","languages_url":"https://api.github.com/repos/djs55/vpnkit/languages","stargazers_url":"https://api.github.com/repos/djs55/vpnkit/stargazers","contributors_url":"https://api.github.com/repos/djs55/vpnkit/contributors","subscribers_url":"https://api.github.com/repos/djs55/vpnkit/subscribers","subscription_url":"https://api.github.com/repos/djs55/vpnkit/subscription","commits_url":"https://api.github.com/repos/djs55/vpnkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/djs55/vpnkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/djs55/vpnkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/djs55/vpnkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/djs55/vpnkit/contents/{+path}","compare_url":"https://api.github.com/repos/djs55/vpnkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/djs55/vpnkit/merges","archive_url":"https://api.github.com/repos/djs55/vpnkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/djs55/vpnkit/downloads","issues_url":"https://api.github.com/repos/djs55/vpnkit/issues{/number}","pulls_url":"https://api.github.com/repos/djs55/vpnkit/pulls{/number}","milestones_url":"https://api.github.com/repos/djs55/vpnkit/milestones{/number}","notifications_url":"https://api.github.com/repos/djs55/vpnkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/djs55/vpnkit/labels{/name}","releases_url":"https://api.github.com/repos/djs55/vpnkit/releases{/id}","deployments_url":"https://api.github.com/repos/djs55/vpnkit/deployments","created_at":"2016-05-21T16:06:30Z","updated_at":"2016-05-21T16:06:32Z","pushed_at":"2016-08-23T09:19:34Z","git_url":"git://github.com/djs55/vpnkit.git","ssh_url":"git@github.com:djs55/vpnkit.git","clone_url":"https://github.com/djs55/vpnkit.git","svn_url":"https://github.com/djs55/vpnkit","homepage":"","size":1076,"stargazers_count":0,"watchers_count":0,"language":"OCaml","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"docker:master","ref":"master","sha":"755f0efcec1ac838457ce31d44144299c1318cfa","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":58395340,"name":"vpnkit","full_name":"docker/vpnkit","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/vpnkit","description":"A toolkit for embedding VPN capabilities in your application","fork":false,"url":"https://api.github.com/repos/docker/vpnkit","forks_url":"https://api.github.com/repos/docker/vpnkit/forks","keys_url":"https://api.github.com/repos/docker/vpnkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/vpnkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/vpnkit/teams","hooks_url":"https://api.github.com/repos/docker/vpnkit/hooks","issue_events_url":"https://api.github.com/repos/docker/vpnkit/issues/events{/number}","events_url":"https://api.github.com/repos/docker/vpnkit/events","assignees_url":"https://api.github.com/repos/docker/vpnkit/assignees{/user}","branches_url":"https://api.github.com/repos/docker/vpnkit/branches{/branch}","tags_url":"https://api.github.com/repos/docker/vpnkit/tags","blobs_url":"https://api.github.com/repos/docker/vpnkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/vpnkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/vpnkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/vpnkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/vpnkit/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/vpnkit/languages","stargazers_url":"https://api.github.com/repos/docker/vpnkit/stargazers","contributors_url":"https://api.github.com/repos/docker/vpnkit/contributors","subscribers_url":"https://api.github.com/repos/docker/vpnkit/subscribers","subscription_url":"https://api.github.com/repos/docker/vpnkit/subscription","commits_url":"https://api.github.com/repos/docker/vpnkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/vpnkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/vpnkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/vpnkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/vpnkit/contents/{+path}","compare_url":"https://api.github.com/repos/docker/vpnkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/vpnkit/merges","archive_url":"https://api.github.com/repos/docker/vpnkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/vpnkit/downloads","issues_url":"https://api.github.com/repos/docker/vpnkit/issues{/number}","pulls_url":"https://api.github.com/repos/docker/vpnkit/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/vpnkit/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/vpnkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/vpnkit/labels{/name}","releases_url":"https://api.github.com/repos/docker/vpnkit/releases{/id}","deployments_url":"https://api.github.com/repos/docker/vpnkit/deployments","created_at":"2016-05-09T17:31:35Z","updated_at":"2016-08-22T07:38:43Z","pushed_at":"2016-08-23T10:10:17Z","git_url":"git://github.com/docker/vpnkit.git","ssh_url":"git@github.com:docker/vpnkit.git","clone_url":"https://github.com/docker/vpnkit.git","svn_url":"https://github.com/docker/vpnkit","homepage":"","size":1010,"stargazers_count":205,"watchers_count":205,"language":"OCaml","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":38,"mirror_url":null,"open_issues_count":20,"forks":38,"open_issues":20,"watchers":205,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/vpnkit/pulls/102"},"html":{"href":"https://github.com/docker/vpnkit/pull/102"},"issue":{"href":"https://api.github.com/repos/docker/vpnkit/issues/102"},"comments":{"href":"https://api.github.com/repos/docker/vpnkit/issues/102/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/vpnkit/pulls/102/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/vpnkit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/vpnkit/pulls/102/commits"},"statuses":{"href":"https://api.github.com/repos/docker/vpnkit/statuses/0173b6f63fb0f3fa9d9f429f09df432c8efeda7b"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"djs55","id":198586,"avatar_url":"https://avatars.githubusercontent.com/u/198586?v=3","gravatar_id":"","url":"https://api.github.com/users/djs55","html_url":"https://github.com/djs55","followers_url":"https://api.github.com/users/djs55/followers","following_url":"https://api.github.com/users/djs55/following{/other_user}","gists_url":"https://api.github.com/users/djs55/gists{/gist_id}","starred_url":"https://api.github.com/users/djs55/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djs55/subscriptions","organizations_url":"https://api.github.com/users/djs55/orgs","repos_url":"https://api.github.com/users/djs55/repos","events_url":"https://api.github.com/users/djs55/events{/privacy}","received_events_url":"https://api.github.com/users/djs55/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"commits":12,"additions":548,"deletions":247,"changed_files":77}}
{"actor":{"display_login":"djs55"}}