{"action":"created","comment":{"url":"https://api.github.com/repos/nodogsplash/nodogsplash/pulls/comments/72003102","id":72003102,"diff_hunk":"@@ -89,29 +89,40 @@ unsigned int FW_MARK_MASK;             /**< @brief Iptables mask: bitwise or of\n char *\n arp_get(const char req_ip[])\n {\n-\tFILE *proc;\n-\tchar ip[INET6_ADDRSTRLEN];\n-\tchar mac[18];\n+\tint type = 0;\n+\tint flags = 0;\n+\tchar ip[16] = {0};\n+\tchar mac[18] = {0};\n+\tchar mask[16] = {0};\n+\tchar line[128] = {0};\n+\tchar dev[128] = {0};\n \tchar *reply = NULL;\n+\tFILE *proc_arp = NULL;\n \n-\tif (!(proc = fopen(\"/proc/net/arp\", \"r\"))) {\n+\tif (!(proc_arp = fopen(\"/proc/net/arp\", \"r\"))) {\n \t\treturn NULL;\n \t}\n \n \t/* Skip first line */\n-\twhile (!feof(proc) && fgetc(proc) != '\\n');\n+\tfgets(line, sizeof(line), proc_arp);\n \n \t/* Find ip, copy mac in reply */\n-\treply = NULL;\n-\twhile (!feof(proc) && (fscanf(proc, \" %15[0-9.] %*s %*s %17[A-Fa-f0-9:] %*s %*s\", ip, mac) == 2)) {\n-\t\tif (strcmp(ip, req_ip) == 0) {\n+\twhile (fgets(line, sizeof(line), proc_arp))\n+\t{\n+\t\tif (sscanf(line, \"%s 0x%x 0x%x %s %s %s\\n\",","path":"src/firewall.c","position":32,"original_position":32,"commit_id":"fd981b0965bcfc4fa145da35fc019d51bb512d25","original_commit_id":"fd981b0965bcfc4fa145da35fc019d51bb512d25","user":{"login":"chengdanhao","id":11373523,"avatar_url":"https://avatars.githubusercontent.com/u/11373523?v=3","gravatar_id":"","url":"https://api.github.com/users/chengdanhao","html_url":"https://github.com/chengdanhao","followers_url":"https://api.github.com/users/chengdanhao/followers","following_url":"https://api.github.com/users/chengdanhao/following{/other_user}","gists_url":"https://api.github.com/users/chengdanhao/gists{/gist_id}","starred_url":"https://api.github.com/users/chengdanhao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chengdanhao/subscriptions","organizations_url":"https://api.github.com/users/chengdanhao/orgs","repos_url":"https://api.github.com/users/chengdanhao/repos","events_url":"https://api.github.com/users/chengdanhao/events{/privacy}","received_events_url":"https://api.github.com/users/chengdanhao/received_events","type":"User","site_admin":false},"body":"@mwarning \r\n\r\nYes, you are right, my code lacks validation checks.\r\n\r\nThe arp_get function can't get MAC address through client's IP, and in fact, I am not totally understand your code, so I use a understanding way to realize my requirement.","created_at":"2016-07-25T02:30:03Z","updated_at":"2016-07-25T02:30:03Z","html_url":"https://github.com/nodogsplash/nodogsplash/pull/125#discussion_r72003102","pull_request_url":"https://api.github.com/repos/nodogsplash/nodogsplash/pulls/125","_links":{"self":{"href":"https://api.github.com/repos/nodogsplash/nodogsplash/pulls/comments/72003102"},"html":{"href":"https://github.com/nodogsplash/nodogsplash/pull/125#discussion_r72003102"},"pull_request":{"href":"https://api.github.com/repos/nodogsplash/nodogsplash/pulls/125"}}},"pull_request":{"url":"https://api.github.com/repos/nodogsplash/nodogsplash/pulls/125","id":78438173,"html_url":"https://github.com/nodogsplash/nodogsplash/pull/125","diff_url":"https://github.com/nodogsplash/nodogsplash/pull/125.diff","patch_url":"https://github.com/nodogsplash/nodogsplash/pull/125.patch","issue_url":"https://api.github.com/repos/nodogsplash/nodogsplash/issues/125","number":125,"state":"open","locked":false,"title":"fix bug : OpenWRT cannot get mac from arp tables","user":{"login":"chengdanhao","id":11373523,"avatar_url":"https://avatars.githubusercontent.com/u/11373523?v=3","gravatar_id":"","url":"https://api.github.com/users/chengdanhao","html_url":"https://github.com/chengdanhao","followers_url":"https://api.github.com/users/chengdanhao/followers","following_url":"https://api.github.com/users/chengdanhao/following{/other_user}","gists_url":"https://api.github.com/users/chengdanhao/gists{/gist_id}","starred_url":"https://api.github.com/users/chengdanhao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chengdanhao/subscriptions","organizations_url":"https://api.github.com/users/chengdanhao/orgs","repos_url":"https://api.github.com/users/chengdanhao/repos","events_url":"https://api.github.com/users/chengdanhao/events{/privacy}","received_events_url":"https://api.github.com/users/chengdanhao/received_events","type":"User","site_admin":false},"body":"I find this problem in OpenWrt Barrier Breaker 14.07","created_at":"2016-07-22T07:59:23Z","updated_at":"2016-07-25T02:30:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9e5f1d53b0e66c4c03808e32b776670c1c0edd5c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/nodogsplash/nodogsplash/pulls/125/commits","review_comments_url":"https://api.github.com/repos/nodogsplash/nodogsplash/pulls/125/comments","review_comment_url":"https://api.github.com/repos/nodogsplash/nodogsplash/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodogsplash/nodogsplash/issues/125/comments","statuses_url":"https://api.github.com/repos/nodogsplash/nodogsplash/statuses/fd981b0965bcfc4fa145da35fc019d51bb512d25","head":{"label":"chengdanhao:master","ref":"master","sha":"fd981b0965bcfc4fa145da35fc019d51bb512d25","user":{"login":"chengdanhao","id":11373523,"avatar_url":"https://avatars.githubusercontent.com/u/11373523?v=3","gravatar_id":"","url":"https://api.github.com/users/chengdanhao","html_url":"https://github.com/chengdanhao","followers_url":"https://api.github.com/users/chengdanhao/followers","following_url":"https://api.github.com/users/chengdanhao/following{/other_user}","gists_url":"https://api.github.com/users/chengdanhao/gists{/gist_id}","starred_url":"https://api.github.com/users/chengdanhao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chengdanhao/subscriptions","organizations_url":"https://api.github.com/users/chengdanhao/orgs","repos_url":"https://api.github.com/users/chengdanhao/repos","events_url":"https://api.github.com/users/chengdanhao/events{/privacy}","received_events_url":"https://api.github.com/users/chengdanhao/received_events","type":"User","site_admin":false},"repo":{"id":63934282,"name":"nodogsplash","full_name":"chengdanhao/nodogsplash","owner":{"login":"chengdanhao","id":11373523,"avatar_url":"https://avatars.githubusercontent.com/u/11373523?v=3","gravatar_id":"","url":"https://api.github.com/users/chengdanhao","html_url":"https://github.com/chengdanhao","followers_url":"https://api.github.com/users/chengdanhao/followers","following_url":"https://api.github.com/users/chengdanhao/following{/other_user}","gists_url":"https://api.github.com/users/chengdanhao/gists{/gist_id}","starred_url":"https://api.github.com/users/chengdanhao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chengdanhao/subscriptions","organizations_url":"https://api.github.com/users/chengdanhao/orgs","repos_url":"https://api.github.com/users/chengdanhao/repos","events_url":"https://api.github.com/users/chengdanhao/events{/privacy}","received_events_url":"https://api.github.com/users/chengdanhao/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chengdanhao/nodogsplash","description":"Nodogsplash offers a simple way to provide restricted access to an Internet connection using a captive portal. Pull requests are welcome!","fork":true,"url":"https://api.github.com/repos/chengdanhao/nodogsplash","forks_url":"https://api.github.com/repos/chengdanhao/nodogsplash/forks","keys_url":"https://api.github.com/repos/chengdanhao/nodogsplash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chengdanhao/nodogsplash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chengdanhao/nodogsplash/teams","hooks_url":"https://api.github.com/repos/chengdanhao/nodogsplash/hooks","issue_events_url":"https://api.github.com/repos/chengdanhao/nodogsplash/issues/events{/number}","events_url":"https://api.github.com/repos/chengdanhao/nodogsplash/events","assignees_url":"https://api.github.com/repos/chengdanhao/nodogsplash/assignees{/user}","branches_url":"https://api.github.com/repos/chengdanhao/nodogsplash/branches{/branch}","tags_url":"https://api.github.com/repos/chengdanhao/nodogsplash/tags","blobs_url":"https://api.github.com/repos/chengdanhao/nodogsplash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chengdanhao/nodogsplash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chengdanhao/nodogsplash/git/refs{/sha}","trees_url":"https://api.github.com/repos/chengdanhao/nodogsplash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chengdanhao/nodogsplash/statuses/{sha}","languages_url":"https://api.github.com/repos/chengdanhao/nodogsplash/languages","stargazers_url":"https://api.github.com/repos/chengdanhao/nodogsplash/stargazers","contributors_url":"https://api.github.com/repos/chengdanhao/nodogsplash/contributors","subscribers_url":"https://api.github.com/repos/chengdanhao/nodogsplash/subscribers","subscription_url":"https://api.github.com/repos/chengdanhao/nodogsplash/subscription","commits_url":"https://api.github.com/repos/chengdanhao/nodogsplash/commits{/sha}","git_commits_url":"https://api.github.com/repos/chengdanhao/nodogsplash/git/commits{/sha}","comments_url":"https://api.github.com/repos/chengdanhao/nodogsplash/comments{/number}","issue_comment_url":"https://api.github.com/repos/chengdanhao/nodogsplash/issues/comments{/number}","contents_url":"https://api.github.com/repos/chengdanhao/nodogsplash/contents/{+path}","compare_url":"https://api.github.com/repos/chengdanhao/nodogsplash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chengdanhao/nodogsplash/merges","archive_url":"https://api.github.com/repos/chengdanhao/nodogsplash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chengdanhao/nodogsplash/downloads","issues_url":"https://api.github.com/repos/chengdanhao/nodogsplash/issues{/number}","pulls_url":"https://api.github.com/repos/chengdanhao/nodogsplash/pulls{/number}","milestones_url":"https://api.github.com/repos/chengdanhao/nodogsplash/milestones{/number}","notifications_url":"https://api.github.com/repos/chengdanhao/nodogsplash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chengdanhao/nodogsplash/labels{/name}","releases_url":"https://api.github.com/repos/chengdanhao/nodogsplash/releases{/id}","deployments_url":"https://api.github.com/repos/chengdanhao/nodogsplash/deployments","created_at":"2016-07-22T07:45:35Z","updated_at":"2016-07-22T07:45:36Z","pushed_at":"2016-07-22T07:56:47Z","git_url":"git://github.com/chengdanhao/nodogsplash.git","ssh_url":"git@github.com:chengdanhao/nodogsplash.git","clone_url":"https://github.com/chengdanhao/nodogsplash.git","svn_url":"https://github.com/chengdanhao/nodogsplash","homepage":"","size":1033,"stargazers_count":0,"watchers_count":0,"language":"C","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":"nodogsplash:master","ref":"master","sha":"1f67797d748913fc56611c164b71e0e45d8cb520","user":{"login":"nodogsplash","id":4403602,"avatar_url":"https://avatars.githubusercontent.com/u/4403602?v=3","gravatar_id":"","url":"https://api.github.com/users/nodogsplash","html_url":"https://github.com/nodogsplash","followers_url":"https://api.github.com/users/nodogsplash/followers","following_url":"https://api.github.com/users/nodogsplash/following{/other_user}","gists_url":"https://api.github.com/users/nodogsplash/gists{/gist_id}","starred_url":"https://api.github.com/users/nodogsplash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodogsplash/subscriptions","organizations_url":"https://api.github.com/users/nodogsplash/orgs","repos_url":"https://api.github.com/users/nodogsplash/repos","events_url":"https://api.github.com/users/nodogsplash/events{/privacy}","received_events_url":"https://api.github.com/users/nodogsplash/received_events","type":"Organization","site_admin":false},"repo":{"id":9999135,"name":"nodogsplash","full_name":"nodogsplash/nodogsplash","owner":{"login":"nodogsplash","id":4403602,"avatar_url":"https://avatars.githubusercontent.com/u/4403602?v=3","gravatar_id":"","url":"https://api.github.com/users/nodogsplash","html_url":"https://github.com/nodogsplash","followers_url":"https://api.github.com/users/nodogsplash/followers","following_url":"https://api.github.com/users/nodogsplash/following{/other_user}","gists_url":"https://api.github.com/users/nodogsplash/gists{/gist_id}","starred_url":"https://api.github.com/users/nodogsplash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodogsplash/subscriptions","organizations_url":"https://api.github.com/users/nodogsplash/orgs","repos_url":"https://api.github.com/users/nodogsplash/repos","events_url":"https://api.github.com/users/nodogsplash/events{/privacy}","received_events_url":"https://api.github.com/users/nodogsplash/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nodogsplash/nodogsplash","description":"Nodogsplash offers a simple way to provide restricted access to an Internet connection using a captive portal. Pull requests are welcome!","fork":false,"url":"https://api.github.com/repos/nodogsplash/nodogsplash","forks_url":"https://api.github.com/repos/nodogsplash/nodogsplash/forks","keys_url":"https://api.github.com/repos/nodogsplash/nodogsplash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodogsplash/nodogsplash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodogsplash/nodogsplash/teams","hooks_url":"https://api.github.com/repos/nodogsplash/nodogsplash/hooks","issue_events_url":"https://api.github.com/repos/nodogsplash/nodogsplash/issues/events{/number}","events_url":"https://api.github.com/repos/nodogsplash/nodogsplash/events","assignees_url":"https://api.github.com/repos/nodogsplash/nodogsplash/assignees{/user}","branches_url":"https://api.github.com/repos/nodogsplash/nodogsplash/branches{/branch}","tags_url":"https://api.github.com/repos/nodogsplash/nodogsplash/tags","blobs_url":"https://api.github.com/repos/nodogsplash/nodogsplash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodogsplash/nodogsplash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodogsplash/nodogsplash/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodogsplash/nodogsplash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodogsplash/nodogsplash/statuses/{sha}","languages_url":"https://api.github.com/repos/nodogsplash/nodogsplash/languages","stargazers_url":"https://api.github.com/repos/nodogsplash/nodogsplash/stargazers","contributors_url":"https://api.github.com/repos/nodogsplash/nodogsplash/contributors","subscribers_url":"https://api.github.com/repos/nodogsplash/nodogsplash/subscribers","subscription_url":"https://api.github.com/repos/nodogsplash/nodogsplash/subscription","commits_url":"https://api.github.com/repos/nodogsplash/nodogsplash/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodogsplash/nodogsplash/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodogsplash/nodogsplash/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodogsplash/nodogsplash/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodogsplash/nodogsplash/contents/{+path}","compare_url":"https://api.github.com/repos/nodogsplash/nodogsplash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodogsplash/nodogsplash/merges","archive_url":"https://api.github.com/repos/nodogsplash/nodogsplash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodogsplash/nodogsplash/downloads","issues_url":"https://api.github.com/repos/nodogsplash/nodogsplash/issues{/number}","pulls_url":"https://api.github.com/repos/nodogsplash/nodogsplash/pulls{/number}","milestones_url":"https://api.github.com/repos/nodogsplash/nodogsplash/milestones{/number}","notifications_url":"https://api.github.com/repos/nodogsplash/nodogsplash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodogsplash/nodogsplash/labels{/name}","releases_url":"https://api.github.com/repos/nodogsplash/nodogsplash/releases{/id}","deployments_url":"https://api.github.com/repos/nodogsplash/nodogsplash/deployments","created_at":"2013-05-11T12:29:13Z","updated_at":"2016-07-23T17:38:55Z","pushed_at":"2016-07-22T07:59:23Z","git_url":"git://github.com/nodogsplash/nodogsplash.git","ssh_url":"git@github.com:nodogsplash/nodogsplash.git","clone_url":"https://github.com/nodogsplash/nodogsplash.git","svn_url":"https://github.com/nodogsplash/nodogsplash","homepage":"","size":1164,"stargazers_count":170,"watchers_count":170,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":88,"mirror_url":null,"open_issues_count":41,"forks":88,"open_issues":41,"watchers":170,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodogsplash/nodogsplash/pulls/125"},"html":{"href":"https://github.com/nodogsplash/nodogsplash/pull/125"},"issue":{"href":"https://api.github.com/repos/nodogsplash/nodogsplash/issues/125"},"comments":{"href":"https://api.github.com/repos/nodogsplash/nodogsplash/issues/125/comments"},"review_comments":{"href":"https://api.github.com/repos/nodogsplash/nodogsplash/pulls/125/comments"},"review_comment":{"href":"https://api.github.com/repos/nodogsplash/nodogsplash/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodogsplash/nodogsplash/pulls/125/commits"},"statuses":{"href":"https://api.github.com/repos/nodogsplash/nodogsplash/statuses/fd981b0965bcfc4fa145da35fc019d51bb512d25"}}}}
{"actor":{"display_login":"chengdanhao"}}