{"action":"created","comment":{"url":"https://api.github.com/repos/natsys/tempesta/pulls/comments/44012237","id":44012237,"diff_hunk":"@@ -0,0 +1,427 @@\n+/**\n+ *  \t\tTempesta FW\n+ *\n+ * Copyright (C) 2015 Tempesta Technologies, Inc.\n+ *\n+ * This program is free software; you can redistribute it and/or modify it\n+ * under the terms of the GNU General Public License as published by\n+ * the Free Software Foundation; either version 2 of the License,\n+ * or (at your option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful, but WITHOUT\n+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n+ * FOR A PARTICULAR PURPOSE.\n+ *\n+ * See the GNU General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU General Public License along with\n+ * his program; if not, write to the Free Software Foundation, Inc., 59\n+ * Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n+ */\n+\n+#include <linux/inet.h>\n+\n+#include \"../../gfsm.h\"\n+#include \"../../http.h\"\n+//#include \"../../log.h\"\n+\n+#include \"helpers.h\"\n+#include \"kallsyms_helper.h\"\n+#include \"test.h\"\n+\n+#define FRANG_HASH_BITS 17\n+#define FRANG_FREQ\t8\n+#define HANDLER_OFF\t0\n+typedef struct {\n+\tunsigned long\tts;\n+\tunsigned int\tconn_new;\n+\tunsigned int\treq;\n+} FrangRates;\n+\n+/**\n+ * Main descriptor of client resource accounting.\n+ * @lock can be removed if RSS is tuned to schedule packets based on\n+ * <proto, src_ip> touple. However, the hashing could produce bad CPU load\n+ * balancing so, such settings are not desireble.\n+ *\n+ * @last_ts\t- last access time to the descriptor;\n+ * @conn_curr\t- current connections number;\n+ * @addr\t- client IPv6 address (w/o port);\n+ * @history\t- bursts history organized as a ring-buffer;\n+ */\n+\n+typedef struct frang_account_t {\n+\tstruct hlist_node\thentry;\n+\tunsigned long\t\tlast_ts;\n+\tunsigned int\t\tconn_curr;\n+\tspinlock_t\t\tlock;\n+\tstruct in6_addr\t\taddr;\n+\tFrangRates\t\thistory[FRANG_FREQ];\n+} FrangAcc;\n+\n+typedef struct {\n+\tstruct hlist_head\tlist;\n+\tspinlock_t\t\tlock;\n+} FrangHashBucket;\n+\n+FrangHashBucket frang_hash[1 << FRANG_HASH_BITS] = {\n+\t[0 ... ((1 << FRANG_HASH_BITS) - 1)] = {\n+\t\tHLIST_HEAD_INIT,\n+\t\t__SPIN_LOCK_UNLOCKED(lock)\n+\t}\n+};\n+\n+","path":"tempesta_fw/t/unit/test_frang.c","position":74,"original_position":74,"commit_id":"c569ee625923745f431a03a75435199532853dab","original_commit_id":"c569ee625923745f431a03a75435199532853dab","user":{"login":"avbelov23","id":4706398,"avatar_url":"https://avatars.githubusercontent.com/u/4706398?v=3","gravatar_id":"","url":"https://api.github.com/users/avbelov23","html_url":"https://github.com/avbelov23","followers_url":"https://api.github.com/users/avbelov23/followers","following_url":"https://api.github.com/users/avbelov23/following{/other_user}","gists_url":"https://api.github.com/users/avbelov23/gists{/gist_id}","starred_url":"https://api.github.com/users/avbelov23/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avbelov23/subscriptions","organizations_url":"https://api.github.com/users/avbelov23/orgs","repos_url":"https://api.github.com/users/avbelov23/repos","events_url":"https://api.github.com/users/avbelov23/events{/privacy}","received_events_url":"https://api.github.com/users/avbelov23/received_events","type":"User","site_admin":false},"body":"?","created_at":"2015-11-05T13:46:57Z","updated_at":"2015-11-05T13:46:57Z","html_url":"https://github.com/natsys/tempesta/pull/319#discussion_r44012237","pull_request_url":"https://api.github.com/repos/natsys/tempesta/pulls/319","_links":{"self":{"href":"https://api.github.com/repos/natsys/tempesta/pulls/comments/44012237"},"html":{"href":"https://github.com/natsys/tempesta/pull/319#discussion_r44012237"},"pull_request":{"href":"https://api.github.com/repos/natsys/tempesta/pulls/319"}}},"pull_request":{"url":"https://api.github.com/repos/natsys/tempesta/pulls/319","id":48184683,"html_url":"https://github.com/natsys/tempesta/pull/319","diff_url":"https://github.com/natsys/tempesta/pull/319.diff","patch_url":"https://github.com/natsys/tempesta/pull/319.patch","issue_url":"https://api.github.com/repos/natsys/tempesta/issues/319","number":319,"state":"open","locked":false,"title":"147 05","user":{"login":"sergsever","id":10198669,"avatar_url":"https://avatars.githubusercontent.com/u/10198669?v=3","gravatar_id":"","url":"https://api.github.com/users/sergsever","html_url":"https://github.com/sergsever","followers_url":"https://api.github.com/users/sergsever/followers","following_url":"https://api.github.com/users/sergsever/following{/other_user}","gists_url":"https://api.github.com/users/sergsever/gists{/gist_id}","starred_url":"https://api.github.com/users/sergsever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergsever/subscriptions","organizations_url":"https://api.github.com/users/sergsever/orgs","repos_url":"https://api.github.com/users/sergsever/repos","events_url":"https://api.github.com/users/sergsever/events{/privacy}","received_events_url":"https://api.github.com/users/sergsever/received_events","type":"User","site_admin":false},"body":"#147 ","created_at":"2015-10-20T10:55:32Z","updated_at":"2015-11-05T13:46:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"913850dc123dcb880dee1c43e2a94fe9df06843f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/natsys/tempesta/pulls/319/commits","review_comments_url":"https://api.github.com/repos/natsys/tempesta/pulls/319/comments","review_comment_url":"https://api.github.com/repos/natsys/tempesta/pulls/comments{/number}","comments_url":"https://api.github.com/repos/natsys/tempesta/issues/319/comments","statuses_url":"https://api.github.com/repos/natsys/tempesta/statuses/c569ee625923745f431a03a75435199532853dab","head":{"label":"natsys:ls_147_05","ref":"ls_147_05","sha":"c569ee625923745f431a03a75435199532853dab","user":{"login":"natsys","id":8489938,"avatar_url":"https://avatars.githubusercontent.com/u/8489938?v=3","gravatar_id":"","url":"https://api.github.com/users/natsys","html_url":"https://github.com/natsys","followers_url":"https://api.github.com/users/natsys/followers","following_url":"https://api.github.com/users/natsys/following{/other_user}","gists_url":"https://api.github.com/users/natsys/gists{/gist_id}","starred_url":"https://api.github.com/users/natsys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natsys/subscriptions","organizations_url":"https://api.github.com/users/natsys/orgs","repos_url":"https://api.github.com/users/natsys/repos","events_url":"https://api.github.com/users/natsys/events{/privacy}","received_events_url":"https://api.github.com/users/natsys/received_events","type":"Organization","site_admin":false},"repo":{"id":23121600,"name":"tempesta","full_name":"natsys/tempesta","owner":{"login":"natsys","id":8489938,"avatar_url":"https://avatars.githubusercontent.com/u/8489938?v=3","gravatar_id":"","url":"https://api.github.com/users/natsys","html_url":"https://github.com/natsys","followers_url":"https://api.github.com/users/natsys/followers","following_url":"https://api.github.com/users/natsys/following{/other_user}","gists_url":"https://api.github.com/users/natsys/gists{/gist_id}","starred_url":"https://api.github.com/users/natsys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natsys/subscriptions","organizations_url":"https://api.github.com/users/natsys/orgs","repos_url":"https://api.github.com/users/natsys/repos","events_url":"https://api.github.com/users/natsys/events{/privacy}","received_events_url":"https://api.github.com/users/natsys/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/natsys/tempesta","description":"High performance HTTP accelerator and firewall for WAF and DDoS prevention","fork":false,"url":"https://api.github.com/repos/natsys/tempesta","forks_url":"https://api.github.com/repos/natsys/tempesta/forks","keys_url":"https://api.github.com/repos/natsys/tempesta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/natsys/tempesta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/natsys/tempesta/teams","hooks_url":"https://api.github.com/repos/natsys/tempesta/hooks","issue_events_url":"https://api.github.com/repos/natsys/tempesta/issues/events{/number}","events_url":"https://api.github.com/repos/natsys/tempesta/events","assignees_url":"https://api.github.com/repos/natsys/tempesta/assignees{/user}","branches_url":"https://api.github.com/repos/natsys/tempesta/branches{/branch}","tags_url":"https://api.github.com/repos/natsys/tempesta/tags","blobs_url":"https://api.github.com/repos/natsys/tempesta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/natsys/tempesta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/natsys/tempesta/git/refs{/sha}","trees_url":"https://api.github.com/repos/natsys/tempesta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/natsys/tempesta/statuses/{sha}","languages_url":"https://api.github.com/repos/natsys/tempesta/languages","stargazers_url":"https://api.github.com/repos/natsys/tempesta/stargazers","contributors_url":"https://api.github.com/repos/natsys/tempesta/contributors","subscribers_url":"https://api.github.com/repos/natsys/tempesta/subscribers","subscription_url":"https://api.github.com/repos/natsys/tempesta/subscription","commits_url":"https://api.github.com/repos/natsys/tempesta/commits{/sha}","git_commits_url":"https://api.github.com/repos/natsys/tempesta/git/commits{/sha}","comments_url":"https://api.github.com/repos/natsys/tempesta/comments{/number}","issue_comment_url":"https://api.github.com/repos/natsys/tempesta/issues/comments{/number}","contents_url":"https://api.github.com/repos/natsys/tempesta/contents/{+path}","compare_url":"https://api.github.com/repos/natsys/tempesta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/natsys/tempesta/merges","archive_url":"https://api.github.com/repos/natsys/tempesta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/natsys/tempesta/downloads","issues_url":"https://api.github.com/repos/natsys/tempesta/issues{/number}","pulls_url":"https://api.github.com/repos/natsys/tempesta/pulls{/number}","milestones_url":"https://api.github.com/repos/natsys/tempesta/milestones{/number}","notifications_url":"https://api.github.com/repos/natsys/tempesta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/natsys/tempesta/labels{/name}","releases_url":"https://api.github.com/repos/natsys/tempesta/releases{/id}","created_at":"2014-08-19T18:44:05Z","updated_at":"2015-10-30T15:28:12Z","pushed_at":"2015-11-05T13:38:51Z","git_url":"git://github.com/natsys/tempesta.git","ssh_url":"git@github.com:natsys/tempesta.git","clone_url":"https://github.com/natsys/tempesta.git","svn_url":"https://github.com/natsys/tempesta","homepage":"","size":5106,"stargazers_count":75,"watchers_count":75,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":68,"forks":15,"open_issues":68,"watchers":75,"default_branch":"master"}},"base":{"label":"natsys:master","ref":"master","sha":"42c58718cc1a249d04e89ff73f6f9e52e620ebf6","user":{"login":"natsys","id":8489938,"avatar_url":"https://avatars.githubusercontent.com/u/8489938?v=3","gravatar_id":"","url":"https://api.github.com/users/natsys","html_url":"https://github.com/natsys","followers_url":"https://api.github.com/users/natsys/followers","following_url":"https://api.github.com/users/natsys/following{/other_user}","gists_url":"https://api.github.com/users/natsys/gists{/gist_id}","starred_url":"https://api.github.com/users/natsys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natsys/subscriptions","organizations_url":"https://api.github.com/users/natsys/orgs","repos_url":"https://api.github.com/users/natsys/repos","events_url":"https://api.github.com/users/natsys/events{/privacy}","received_events_url":"https://api.github.com/users/natsys/received_events","type":"Organization","site_admin":false},"repo":{"id":23121600,"name":"tempesta","full_name":"natsys/tempesta","owner":{"login":"natsys","id":8489938,"avatar_url":"https://avatars.githubusercontent.com/u/8489938?v=3","gravatar_id":"","url":"https://api.github.com/users/natsys","html_url":"https://github.com/natsys","followers_url":"https://api.github.com/users/natsys/followers","following_url":"https://api.github.com/users/natsys/following{/other_user}","gists_url":"https://api.github.com/users/natsys/gists{/gist_id}","starred_url":"https://api.github.com/users/natsys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natsys/subscriptions","organizations_url":"https://api.github.com/users/natsys/orgs","repos_url":"https://api.github.com/users/natsys/repos","events_url":"https://api.github.com/users/natsys/events{/privacy}","received_events_url":"https://api.github.com/users/natsys/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/natsys/tempesta","description":"High performance HTTP accelerator and firewall for WAF and DDoS prevention","fork":false,"url":"https://api.github.com/repos/natsys/tempesta","forks_url":"https://api.github.com/repos/natsys/tempesta/forks","keys_url":"https://api.github.com/repos/natsys/tempesta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/natsys/tempesta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/natsys/tempesta/teams","hooks_url":"https://api.github.com/repos/natsys/tempesta/hooks","issue_events_url":"https://api.github.com/repos/natsys/tempesta/issues/events{/number}","events_url":"https://api.github.com/repos/natsys/tempesta/events","assignees_url":"https://api.github.com/repos/natsys/tempesta/assignees{/user}","branches_url":"https://api.github.com/repos/natsys/tempesta/branches{/branch}","tags_url":"https://api.github.com/repos/natsys/tempesta/tags","blobs_url":"https://api.github.com/repos/natsys/tempesta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/natsys/tempesta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/natsys/tempesta/git/refs{/sha}","trees_url":"https://api.github.com/repos/natsys/tempesta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/natsys/tempesta/statuses/{sha}","languages_url":"https://api.github.com/repos/natsys/tempesta/languages","stargazers_url":"https://api.github.com/repos/natsys/tempesta/stargazers","contributors_url":"https://api.github.com/repos/natsys/tempesta/contributors","subscribers_url":"https://api.github.com/repos/natsys/tempesta/subscribers","subscription_url":"https://api.github.com/repos/natsys/tempesta/subscription","commits_url":"https://api.github.com/repos/natsys/tempesta/commits{/sha}","git_commits_url":"https://api.github.com/repos/natsys/tempesta/git/commits{/sha}","comments_url":"https://api.github.com/repos/natsys/tempesta/comments{/number}","issue_comment_url":"https://api.github.com/repos/natsys/tempesta/issues/comments{/number}","contents_url":"https://api.github.com/repos/natsys/tempesta/contents/{+path}","compare_url":"https://api.github.com/repos/natsys/tempesta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/natsys/tempesta/merges","archive_url":"https://api.github.com/repos/natsys/tempesta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/natsys/tempesta/downloads","issues_url":"https://api.github.com/repos/natsys/tempesta/issues{/number}","pulls_url":"https://api.github.com/repos/natsys/tempesta/pulls{/number}","milestones_url":"https://api.github.com/repos/natsys/tempesta/milestones{/number}","notifications_url":"https://api.github.com/repos/natsys/tempesta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/natsys/tempesta/labels{/name}","releases_url":"https://api.github.com/repos/natsys/tempesta/releases{/id}","created_at":"2014-08-19T18:44:05Z","updated_at":"2015-10-30T15:28:12Z","pushed_at":"2015-11-05T13:38:51Z","git_url":"git://github.com/natsys/tempesta.git","ssh_url":"git@github.com:natsys/tempesta.git","clone_url":"https://github.com/natsys/tempesta.git","svn_url":"https://github.com/natsys/tempesta","homepage":"","size":5106,"stargazers_count":75,"watchers_count":75,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":68,"forks":15,"open_issues":68,"watchers":75,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/natsys/tempesta/pulls/319"},"html":{"href":"https://github.com/natsys/tempesta/pull/319"},"issue":{"href":"https://api.github.com/repos/natsys/tempesta/issues/319"},"comments":{"href":"https://api.github.com/repos/natsys/tempesta/issues/319/comments"},"review_comments":{"href":"https://api.github.com/repos/natsys/tempesta/pulls/319/comments"},"review_comment":{"href":"https://api.github.com/repos/natsys/tempesta/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/natsys/tempesta/pulls/319/commits"},"statuses":{"href":"https://api.github.com/repos/natsys/tempesta/statuses/c569ee625923745f431a03a75435199532853dab"}}}}