{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/38941190","id":38941190,"diff_hunk":"@@ -0,0 +1,96 @@\n+/*\n+Copyright 2015 The Kubernetes Authors All rights reserved.\n+\n+Licensed under the Apache License, Version 2.0 (the \"License\");\n+you may not use this file except in compliance with the License.\n+You may obtain a copy of the License at\n+\n+    http://www.apache.org/licenses/LICENSE-2.0\n+\n+Unless required by applicable law or agreed to in writing, software\n+distributed under the License is distributed on an \"AS IS\" BASIS,\n+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+See the License for the specific language governing permissions and\n+limitations under the License.\n+*/\n+\n+package hairpin\n+\n+import (\n+\t\"fmt\"\n+\t\"io/ioutil\"\n+\t\"net\"\n+\t\"os/exec\"\n+\t\"path\"\n+\t\"regexp\"\n+\t\"strconv\"\n+\n+\t\"github.com/golang/glog\"\n+)\n+\n+const (\n+\tsysfsNetPath            = \"/sys/devices/virtual/net\"\n+\thairpinModeRelativePath = \"brport/hairpin_mode\"\n+\thairpinEnable           = \"1\"\n+)\n+\n+var (\n+\tethtoolOutputRegex = regexp.MustCompile(\"peer_ifindex: (\\\\d+)\")\n+)\n+\n+func SetUpContainer(containerPid int, containerInterfaceName string) error {\n+\thostIfName, err := FindPairInterfaceOfContainerInterface(containerPid, containerInterfaceName)\n+\tif err != nil {\n+\t\tglog.Infof(\"Unable to find pair interface, setting up all interfaces: %v\", err)\n+\t\treturn SetUpAllInterfaces()\n+\t}\n+\treturn SetUpInterface(hostIfName)\n+}\n+\n+// This may be moved to a util package.\n+func FindPairInterfaceOfContainerInterface(containerPid int, containerInterfaceName string) (string, error) {\n+\tnsenterPath, err := exec.LookPath(\"nsenter\")\n+\tif err != nil {\n+\t\treturn \"\", err","path":"pkg/kubelet/network/hairpin/hairpin.go","position":54,"original_position":54,"commit_id":"3f63b08526b7cc5142a60631d2bc67541cd0cac2","original_commit_id":"3f63b08526b7cc5142a60631d2bc67541cd0cac2","user":{"login":"thockin","id":5595220,"avatar_url":"https://avatars.githubusercontent.com/u/5595220?v=3","gravatar_id":"","url":"https://api.github.com/users/thockin","html_url":"https://github.com/thockin","followers_url":"https://api.github.com/users/thockin/followers","following_url":"https://api.github.com/users/thockin/following{/other_user}","gists_url":"https://api.github.com/users/thockin/gists{/gist_id}","starred_url":"https://api.github.com/users/thockin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thockin/subscriptions","organizations_url":"https://api.github.com/users/thockin/orgs","repos_url":"https://api.github.com/users/thockin/repos","events_url":"https://api.github.com/users/thockin/events{/privacy}","received_events_url":"https://api.github.com/users/thockin/received_events","type":"User","site_admin":false},"body":"Is the returned error useful enough?  Does it contain the command we searched for?","created_at":"2015-09-08T15:39:18Z","updated_at":"2015-09-08T15:39:18Z","html_url":"https://github.com/kubernetes/kubernetes/pull/13628#discussion_r38941190","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/13628","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/38941190"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/13628#discussion_r38941190"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/13628"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/13628","id":44301439,"html_url":"https://github.com/kubernetes/kubernetes/pull/13628","diff_url":"https://github.com/kubernetes/kubernetes/pull/13628.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/13628.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/13628","number":13628,"state":"open","locked":false,"title":"Fix #13375 with a hairpin \"plugin-like\" interface","user":{"login":"MikaelCluseau","id":3868856,"avatar_url":"https://avatars.githubusercontent.com/u/3868856?v=3","gravatar_id":"","url":"https://api.github.com/users/MikaelCluseau","html_url":"https://github.com/MikaelCluseau","followers_url":"https://api.github.com/users/MikaelCluseau/followers","following_url":"https://api.github.com/users/MikaelCluseau/following{/other_user}","gists_url":"https://api.github.com/users/MikaelCluseau/gists{/gist_id}","starred_url":"https://api.github.com/users/MikaelCluseau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MikaelCluseau/subscriptions","organizations_url":"https://api.github.com/users/MikaelCluseau/orgs","repos_url":"https://api.github.com/users/MikaelCluseau/repos","events_url":"https://api.github.com/users/MikaelCluseau/events{/privacy}","received_events_url":"https://api.github.com/users/MikaelCluseau/received_events","type":"User","site_admin":false},"body":"Hi,\r\n\r\nfor this fix, I needed to find the host-side interface of the veth pair. It seemed to be best in the pod status, along with the pod's IP and other informations like that, as it will allow reuse.\r\n\r\nI tried to follow the existing kubelet's network plugin interface, but it doesn't offer the right extension point with the right interface. Since it began to look like another kind of plugin, I just put a hook in the docker manager at the best place I could find.\r\n\r\n/cc @thockin ","created_at":"2015-09-06T11:56:30Z","updated_at":"2015-09-08T15:39:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"656029b96181dc70f4b2c735e1dc0308d8c8145a","assignee":{"login":"thockin","id":5595220,"avatar_url":"https://avatars.githubusercontent.com/u/5595220?v=3","gravatar_id":"","url":"https://api.github.com/users/thockin","html_url":"https://github.com/thockin","followers_url":"https://api.github.com/users/thockin/followers","following_url":"https://api.github.com/users/thockin/following{/other_user}","gists_url":"https://api.github.com/users/thockin/gists{/gist_id}","starred_url":"https://api.github.com/users/thockin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thockin/subscriptions","organizations_url":"https://api.github.com/users/thockin/orgs","repos_url":"https://api.github.com/users/thockin/repos","events_url":"https://api.github.com/users/thockin/events{/privacy}","received_events_url":"https://api.github.com/users/thockin/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/13628/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/13628/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/13628/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/3f63b08526b7cc5142a60631d2bc67541cd0cac2","head":{"label":"MikaelCluseau:wip-hairpin","ref":"wip-hairpin","sha":"3f63b08526b7cc5142a60631d2bc67541cd0cac2","user":{"login":"MikaelCluseau","id":3868856,"avatar_url":"https://avatars.githubusercontent.com/u/3868856?v=3","gravatar_id":"","url":"https://api.github.com/users/MikaelCluseau","html_url":"https://github.com/MikaelCluseau","followers_url":"https://api.github.com/users/MikaelCluseau/followers","following_url":"https://api.github.com/users/MikaelCluseau/following{/other_user}","gists_url":"https://api.github.com/users/MikaelCluseau/gists{/gist_id}","starred_url":"https://api.github.com/users/MikaelCluseau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MikaelCluseau/subscriptions","organizations_url":"https://api.github.com/users/MikaelCluseau/orgs","repos_url":"https://api.github.com/users/MikaelCluseau/repos","events_url":"https://api.github.com/users/MikaelCluseau/events{/privacy}","received_events_url":"https://api.github.com/users/MikaelCluseau/received_events","type":"User","site_admin":false},"repo":{"id":38017462,"name":"kubernetes","full_name":"MikaelCluseau/kubernetes","owner":{"login":"MikaelCluseau","id":3868856,"avatar_url":"https://avatars.githubusercontent.com/u/3868856?v=3","gravatar_id":"","url":"https://api.github.com/users/MikaelCluseau","html_url":"https://github.com/MikaelCluseau","followers_url":"https://api.github.com/users/MikaelCluseau/followers","following_url":"https://api.github.com/users/MikaelCluseau/following{/other_user}","gists_url":"https://api.github.com/users/MikaelCluseau/gists{/gist_id}","starred_url":"https://api.github.com/users/MikaelCluseau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MikaelCluseau/subscriptions","organizations_url":"https://api.github.com/users/MikaelCluseau/orgs","repos_url":"https://api.github.com/users/MikaelCluseau/repos","events_url":"https://api.github.com/users/MikaelCluseau/events{/privacy}","received_events_url":"https://api.github.com/users/MikaelCluseau/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MikaelCluseau/kubernetes","description":"Container Cluster Manager from Google","fork":true,"url":"https://api.github.com/repos/MikaelCluseau/kubernetes","forks_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/forks","keys_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/teams","hooks_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/events","assignees_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/tags","blobs_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/languages","stargazers_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/subscription","commits_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/merges","archive_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/downloads","issues_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/MikaelCluseau/kubernetes/releases{/id}","created_at":"2015-06-24T23:56:24Z","updated_at":"2015-06-24T23:56:31Z","pushed_at":"2015-09-07T06:30:17Z","git_url":"git://github.com/MikaelCluseau/kubernetes.git","ssh_url":"git@github.com:MikaelCluseau/kubernetes.git","clone_url":"https://github.com/MikaelCluseau/kubernetes.git","svn_url":"https://github.com/MikaelCluseau/kubernetes","homepage":"http://kubernetes.io","size":104863,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"96e0ed5749608d4cc32f61b3674deb04c8fa90ad","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"repo":{"id":20580498,"name":"kubernetes","full_name":"kubernetes/kubernetes","owner":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubernetes/kubernetes","description":"Container Cluster Manager from Google","fork":false,"url":"https://api.github.com/repos/kubernetes/kubernetes","forks_url":"https://api.github.com/repos/kubernetes/kubernetes/forks","keys_url":"https://api.github.com/repos/kubernetes/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/kubernetes/teams","hooks_url":"https://api.github.com/repos/kubernetes/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/kubernetes/events","assignees_url":"https://api.github.com/repos/kubernetes/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/kubernetes/tags","blobs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/kubernetes/languages","stargazers_url":"https://api.github.com/repos/kubernetes/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/kubernetes/subscription","commits_url":"https://api.github.com/repos/kubernetes/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/kubernetes/merges","archive_url":"https://api.github.com/repos/kubernetes/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/kubernetes/downloads","issues_url":"https://api.github.com/repos/kubernetes/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/kubernetes/releases{/id}","created_at":"2014-06-06T22:56:04Z","updated_at":"2015-09-08T14:16:42Z","pushed_at":"2015-09-08T15:31:38Z","git_url":"git://github.com/kubernetes/kubernetes.git","ssh_url":"git@github.com:kubernetes/kubernetes.git","clone_url":"https://github.com/kubernetes/kubernetes.git","svn_url":"https://github.com/kubernetes/kubernetes","homepage":"http://kubernetes.io","size":398326,"stargazers_count":10123,"watchers_count":10123,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2473,"mirror_url":null,"open_issues_count":1700,"forks":2473,"open_issues":1700,"watchers":10123,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/13628"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/13628"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/13628"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/13628/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/13628/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/13628/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/3f63b08526b7cc5142a60631d2bc67541cd0cac2"}}}}