{"action":"created","comment":{"url":"https://api.github.com/repos/cilium/cilium/pulls/comments/143487914","pull_request_review_id":68006428,"id":143487914,"diff_hunk":"@@ -64,54 +64,54 @@ func (i IngressRule) Validate() error {\n \t\treturn fmt.Errorf(\"too many ingress L3 entries %d/%d\", l, MaxCIDREntries)\n \t}\n \n-\tfor _, p := range i.FromCIDR {\n-\t\tif err := p.Validate(); err != nil {\n+\tfor n := range i.FromCIDR {\n+\t\tif err := i.FromCIDR[n].Sanitize(); err != nil {\n \t\t\treturn err\n \t\t}\n \t}\n \n-\tfor _, p := range i.FromCIDRSet {\n-\t\tif err := p.Validate(); err != nil {\n+\tfor n := range i.FromCIDRSet {\n+\t\tif err := i.FromCIDRSet[n].Sanitize(); err != nil {\n \t\t\treturn err\n \t\t}\n \t}\n \n \treturn nil\n }\n \n-// Validate validates an egress policy rule\n-func (e EgressRule) Validate() error {\n+// Sanitize validates an egress policy rule\n+func (e EgressRule) Sanitize() error {\n \tif len(e.ToCIDR) > 0 && len(e.ToPorts) > 0 {\n \t\treturn fmt.Errorf(\"Combining ToPorts and ToCIDR is not supported yet\")\n \t}\n \n-\tfor _, p := range e.ToPorts {\n-\t\tif err := p.Validate(); err != nil {\n+\tfor i := range e.ToPorts {\n+\t\tif err := e.ToPorts[i].Sanitize(); err != nil {\n \t\t\treturn err\n \t\t}\n \t}\n \tif l := len(e.ToCIDR); l > MaxCIDREntries {\n \t\treturn fmt.Errorf(\"too many egress L3 entries %d/%d\", l, MaxCIDREntries)\n \t}\n-\tfor _, p := range e.ToCIDR {\n-\t\tif err := p.Validate(); err != nil {\n+\tfor i := range e.ToCIDR {\n+\t\tif err := e.ToCIDR[i].Sanitize(); err != nil {\n \t\t\treturn err\n \t\t}\n \t}\n \n-\tfor _, p := range e.ToCIDRSet {\n-\t\tif err := p.Validate(); err != nil {\n+\tfor i := range e.ToCIDRSet {\n+\t\tif err := e.ToCIDRSet[i].Sanitize(); err != nil {\n \t\t\treturn err\n \t\t}\n \t}\n \n \treturn nil\n }\n \n-// Validate validates Kafka rules\n+// Sanitize validates Kafka rules\n // TODO we need to add support to check\n // wildcard and prefix/suffix later on.\n-func (kr PortRuleKafka) Validate() error {\n+func (kr PortRuleKafka) Sanitize() error {","path":"pkg/policy/api/rule_validation.go","position":110,"original_position":110,"commit_id":"a26e623ef88ec9dd0cf58764d207070c5d97c321","original_commit_id":"e3c0c31d93353d0c91b348b72c4f5cd8a483f059","user":{"login":"tgraf","id":1417913,"avatar_url":"https://avatars1.githubusercontent.com/u/1417913?v=4","gravatar_id":"","url":"https://api.github.com/users/tgraf","html_url":"https://github.com/tgraf","followers_url":"https://api.github.com/users/tgraf/followers","following_url":"https://api.github.com/users/tgraf/following{/other_user}","gists_url":"https://api.github.com/users/tgraf/gists{/gist_id}","starred_url":"https://api.github.com/users/tgraf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgraf/subscriptions","organizations_url":"https://api.github.com/users/tgraf/orgs","repos_url":"https://api.github.com/users/tgraf/repos","events_url":"https://api.github.com/users/tgraf/events{/privacy}","received_events_url":"https://api.github.com/users/tgraf/received_events","type":"User","site_admin":false},"body":"marked private","created_at":"2017-10-09T14:45:10Z","updated_at":"2017-10-09T14:45:10Z","html_url":"https://github.com/cilium/cilium/pull/1705#discussion_r143487914","pull_request_url":"https://api.github.com/repos/cilium/cilium/pulls/1705","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/cilium/cilium/pulls/comments/143487914"},"html":{"href":"https://github.com/cilium/cilium/pull/1705#discussion_r143487914"},"pull_request":{"href":"https://api.github.com/repos/cilium/cilium/pulls/1705"}},"in_reply_to_id":143481196},"pull_request":{"url":"https://api.github.com/repos/cilium/cilium/pulls/1705","id":145052408,"html_url":"https://github.com/cilium/cilium/pull/1705","diff_url":"https://github.com/cilium/cilium/pull/1705.diff","patch_url":"https://github.com/cilium/cilium/pull/1705.patch","issue_url":"https://api.github.com/repos/cilium/cilium/issues/1705","number":1705,"state":"open","locked":false,"title":"policy/l4: Fix merging of L7 rules","user":{"login":"tgraf","id":1417913,"avatar_url":"https://avatars1.githubusercontent.com/u/1417913?v=4","gravatar_id":"","url":"https://api.github.com/users/tgraf","html_url":"https://github.com/tgraf","followers_url":"https://api.github.com/users/tgraf/followers","following_url":"https://api.github.com/users/tgraf/following{/other_user}","gists_url":"https://api.github.com/users/tgraf/gists{/gist_id}","starred_url":"https://api.github.com/users/tgraf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgraf/subscriptions","organizations_url":"https://api.github.com/users/tgraf/orgs","repos_url":"https://api.github.com/users/tgraf/repos","events_url":"https://api.github.com/users/tgraf/events{/privacy}","received_events_url":"https://api.github.com/users/tgraf/received_events","type":"User","site_admin":false},"body":"* Allow merging L4 rules with no L7 rules, no parser and no redirect\r\n  port with other L4 rules\r\n\r\n* Correctly write back the copy of rules into the hashtable of per\r\n  endpoint rules\r\n\r\nSigned-off-by: Thomas Graf <thomas@cilium.io>","created_at":"2017-10-06T00:48:48Z","updated_at":"2017-10-09T14:45:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"edaaaca21682ff62f006c98d7601d229aa17dd57","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/cilium/cilium/pulls/1705/commits","review_comments_url":"https://api.github.com/repos/cilium/cilium/pulls/1705/comments","review_comment_url":"https://api.github.com/repos/cilium/cilium/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cilium/cilium/issues/1705/comments","statuses_url":"https://api.github.com/repos/cilium/cilium/statuses/a26e623ef88ec9dd0cf58764d207070c5d97c321","head":{"label":"cilium:fix-l7-rule-merge","ref":"fix-l7-rule-merge","sha":"a26e623ef88ec9dd0cf58764d207070c5d97c321","user":{"login":"cilium","id":21054566,"avatar_url":"https://avatars0.githubusercontent.com/u/21054566?v=4","gravatar_id":"","url":"https://api.github.com/users/cilium","html_url":"https://github.com/cilium","followers_url":"https://api.github.com/users/cilium/followers","following_url":"https://api.github.com/users/cilium/following{/other_user}","gists_url":"https://api.github.com/users/cilium/gists{/gist_id}","starred_url":"https://api.github.com/users/cilium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cilium/subscriptions","organizations_url":"https://api.github.com/users/cilium/orgs","repos_url":"https://api.github.com/users/cilium/repos","events_url":"https://api.github.com/users/cilium/events{/privacy}","received_events_url":"https://api.github.com/users/cilium/received_events","type":"Organization","site_admin":false},"repo":{"id":48109239,"name":"cilium","full_name":"cilium/cilium","owner":{"login":"cilium","id":21054566,"avatar_url":"https://avatars0.githubusercontent.com/u/21054566?v=4","gravatar_id":"","url":"https://api.github.com/users/cilium","html_url":"https://github.com/cilium","followers_url":"https://api.github.com/users/cilium/followers","following_url":"https://api.github.com/users/cilium/following{/other_user}","gists_url":"https://api.github.com/users/cilium/gists{/gist_id}","starred_url":"https://api.github.com/users/cilium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cilium/subscriptions","organizations_url":"https://api.github.com/users/cilium/orgs","repos_url":"https://api.github.com/users/cilium/repos","events_url":"https://api.github.com/users/cilium/events{/privacy}","received_events_url":"https://api.github.com/users/cilium/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cilium/cilium","description":"Linux Native, HTTP Aware Networking and Security for Containers","fork":false,"url":"https://api.github.com/repos/cilium/cilium","forks_url":"https://api.github.com/repos/cilium/cilium/forks","keys_url":"https://api.github.com/repos/cilium/cilium/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cilium/cilium/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cilium/cilium/teams","hooks_url":"https://api.github.com/repos/cilium/cilium/hooks","issue_events_url":"https://api.github.com/repos/cilium/cilium/issues/events{/number}","events_url":"https://api.github.com/repos/cilium/cilium/events","assignees_url":"https://api.github.com/repos/cilium/cilium/assignees{/user}","branches_url":"https://api.github.com/repos/cilium/cilium/branches{/branch}","tags_url":"https://api.github.com/repos/cilium/cilium/tags","blobs_url":"https://api.github.com/repos/cilium/cilium/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cilium/cilium/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cilium/cilium/git/refs{/sha}","trees_url":"https://api.github.com/repos/cilium/cilium/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cilium/cilium/statuses/{sha}","languages_url":"https://api.github.com/repos/cilium/cilium/languages","stargazers_url":"https://api.github.com/repos/cilium/cilium/stargazers","contributors_url":"https://api.github.com/repos/cilium/cilium/contributors","subscribers_url":"https://api.github.com/repos/cilium/cilium/subscribers","subscription_url":"https://api.github.com/repos/cilium/cilium/subscription","commits_url":"https://api.github.com/repos/cilium/cilium/commits{/sha}","git_commits_url":"https://api.github.com/repos/cilium/cilium/git/commits{/sha}","comments_url":"https://api.github.com/repos/cilium/cilium/comments{/number}","issue_comment_url":"https://api.github.com/repos/cilium/cilium/issues/comments{/number}","contents_url":"https://api.github.com/repos/cilium/cilium/contents/{+path}","compare_url":"https://api.github.com/repos/cilium/cilium/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cilium/cilium/merges","archive_url":"https://api.github.com/repos/cilium/cilium/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cilium/cilium/downloads","issues_url":"https://api.github.com/repos/cilium/cilium/issues{/number}","pulls_url":"https://api.github.com/repos/cilium/cilium/pulls{/number}","milestones_url":"https://api.github.com/repos/cilium/cilium/milestones{/number}","notifications_url":"https://api.github.com/repos/cilium/cilium/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cilium/cilium/labels{/name}","releases_url":"https://api.github.com/repos/cilium/cilium/releases{/id}","deployments_url":"https://api.github.com/repos/cilium/cilium/deployments","created_at":"2015-12-16T12:33:31Z","updated_at":"2017-10-09T02:56:09Z","pushed_at":"2017-10-09T14:38:21Z","git_url":"git://github.com/cilium/cilium.git","ssh_url":"git@github.com:cilium/cilium.git","clone_url":"https://github.com/cilium/cilium.git","svn_url":"https://github.com/cilium/cilium","homepage":"","size":88067,"stargazers_count":1028,"watchers_count":1028,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":108,"mirror_url":null,"open_issues_count":210,"forks":108,"open_issues":210,"watchers":1028,"default_branch":"master"}},"base":{"label":"cilium:master","ref":"master","sha":"957c664e904e7a674e5f3852fdd936d17f9261ab","user":{"login":"cilium","id":21054566,"avatar_url":"https://avatars0.githubusercontent.com/u/21054566?v=4","gravatar_id":"","url":"https://api.github.com/users/cilium","html_url":"https://github.com/cilium","followers_url":"https://api.github.com/users/cilium/followers","following_url":"https://api.github.com/users/cilium/following{/other_user}","gists_url":"https://api.github.com/users/cilium/gists{/gist_id}","starred_url":"https://api.github.com/users/cilium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cilium/subscriptions","organizations_url":"https://api.github.com/users/cilium/orgs","repos_url":"https://api.github.com/users/cilium/repos","events_url":"https://api.github.com/users/cilium/events{/privacy}","received_events_url":"https://api.github.com/users/cilium/received_events","type":"Organization","site_admin":false},"repo":{"id":48109239,"name":"cilium","full_name":"cilium/cilium","owner":{"login":"cilium","id":21054566,"avatar_url":"https://avatars0.githubusercontent.com/u/21054566?v=4","gravatar_id":"","url":"https://api.github.com/users/cilium","html_url":"https://github.com/cilium","followers_url":"https://api.github.com/users/cilium/followers","following_url":"https://api.github.com/users/cilium/following{/other_user}","gists_url":"https://api.github.com/users/cilium/gists{/gist_id}","starred_url":"https://api.github.com/users/cilium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cilium/subscriptions","organizations_url":"https://api.github.com/users/cilium/orgs","repos_url":"https://api.github.com/users/cilium/repos","events_url":"https://api.github.com/users/cilium/events{/privacy}","received_events_url":"https://api.github.com/users/cilium/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cilium/cilium","description":"Linux Native, HTTP Aware Networking and Security for Containers","fork":false,"url":"https://api.github.com/repos/cilium/cilium","forks_url":"https://api.github.com/repos/cilium/cilium/forks","keys_url":"https://api.github.com/repos/cilium/cilium/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cilium/cilium/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cilium/cilium/teams","hooks_url":"https://api.github.com/repos/cilium/cilium/hooks","issue_events_url":"https://api.github.com/repos/cilium/cilium/issues/events{/number}","events_url":"https://api.github.com/repos/cilium/cilium/events","assignees_url":"https://api.github.com/repos/cilium/cilium/assignees{/user}","branches_url":"https://api.github.com/repos/cilium/cilium/branches{/branch}","tags_url":"https://api.github.com/repos/cilium/cilium/tags","blobs_url":"https://api.github.com/repos/cilium/cilium/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cilium/cilium/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cilium/cilium/git/refs{/sha}","trees_url":"https://api.github.com/repos/cilium/cilium/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cilium/cilium/statuses/{sha}","languages_url":"https://api.github.com/repos/cilium/cilium/languages","stargazers_url":"https://api.github.com/repos/cilium/cilium/stargazers","contributors_url":"https://api.github.com/repos/cilium/cilium/contributors","subscribers_url":"https://api.github.com/repos/cilium/cilium/subscribers","subscription_url":"https://api.github.com/repos/cilium/cilium/subscription","commits_url":"https://api.github.com/repos/cilium/cilium/commits{/sha}","git_commits_url":"https://api.github.com/repos/cilium/cilium/git/commits{/sha}","comments_url":"https://api.github.com/repos/cilium/cilium/comments{/number}","issue_comment_url":"https://api.github.com/repos/cilium/cilium/issues/comments{/number}","contents_url":"https://api.github.com/repos/cilium/cilium/contents/{+path}","compare_url":"https://api.github.com/repos/cilium/cilium/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cilium/cilium/merges","archive_url":"https://api.github.com/repos/cilium/cilium/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cilium/cilium/downloads","issues_url":"https://api.github.com/repos/cilium/cilium/issues{/number}","pulls_url":"https://api.github.com/repos/cilium/cilium/pulls{/number}","milestones_url":"https://api.github.com/repos/cilium/cilium/milestones{/number}","notifications_url":"https://api.github.com/repos/cilium/cilium/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cilium/cilium/labels{/name}","releases_url":"https://api.github.com/repos/cilium/cilium/releases{/id}","deployments_url":"https://api.github.com/repos/cilium/cilium/deployments","created_at":"2015-12-16T12:33:31Z","updated_at":"2017-10-09T02:56:09Z","pushed_at":"2017-10-09T14:38:21Z","git_url":"git://github.com/cilium/cilium.git","ssh_url":"git@github.com:cilium/cilium.git","clone_url":"https://github.com/cilium/cilium.git","svn_url":"https://github.com/cilium/cilium","homepage":"","size":88067,"stargazers_count":1028,"watchers_count":1028,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":108,"mirror_url":null,"open_issues_count":210,"forks":108,"open_issues":210,"watchers":1028,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cilium/cilium/pulls/1705"},"html":{"href":"https://github.com/cilium/cilium/pull/1705"},"issue":{"href":"https://api.github.com/repos/cilium/cilium/issues/1705"},"comments":{"href":"https://api.github.com/repos/cilium/cilium/issues/1705/comments"},"review_comments":{"href":"https://api.github.com/repos/cilium/cilium/pulls/1705/comments"},"review_comment":{"href":"https://api.github.com/repos/cilium/cilium/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cilium/cilium/pulls/1705/commits"},"statuses":{"href":"https://api.github.com/repos/cilium/cilium/statuses/a26e623ef88ec9dd0cf58764d207070c5d97c321"}},"author_association":"OWNER"}}
{"actor":{"display_login":"tgraf"}}