{"action":"created","issue":{"url":"https://api.github.com/repos/msantos/procket/issues/17","labels_url":"https://api.github.com/repos/msantos/procket/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/msantos/procket/issues/17/comments","events_url":"https://api.github.com/repos/msantos/procket/issues/17/events","html_url":"https://github.com/msantos/procket/issues/17","id":54418931,"number":17,"title":"gen_udp:open returns {error,einval} for ETH_P_ALL socket","user":{"login":"RushOnline","id":130976,"avatar_url":"https://avatars.githubusercontent.com/u/130976?v=3","gravatar_id":"","url":"https://api.github.com/users/RushOnline","html_url":"https://github.com/RushOnline","followers_url":"https://api.github.com/users/RushOnline/followers","following_url":"https://api.github.com/users/RushOnline/following{/other_user}","gists_url":"https://api.github.com/users/RushOnline/gists{/gist_id}","starred_url":"https://api.github.com/users/RushOnline/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RushOnline/subscriptions","organizations_url":"https://api.github.com/users/RushOnline/orgs","repos_url":"https://api.github.com/users/RushOnline/repos","events_url":"https://api.github.com/users/RushOnline/events{/privacy}","received_events_url":"https://api.github.com/users/RushOnline/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-01-15T07:05:31Z","updated_at":"2015-01-15T16:32:33Z","closed_at":"2015-01-15T16:27:19Z","body":"I've wrote function to listen raw ethernet packets:\r\n\r\n```erlang\r\nethernet_socket( Device ) ->\r\n\t{ok, Socket} = procket:socket(?AF_PACKET, ?SOCK_RAW, ?ETH_P_ALL), \r\n\tIfindex = packet:ifindex(Socket, Device),\r\n    Sockaddr_ll = <<\r\n        ?PF_PACKET:16/native,   % sll_family: PF_PACKET\r\n        ?ETH_P_ALL:16,\t\t\t% sll_protocol: Physical layer protocol\r\n        Ifindex:32/native,      % sll_ifindex: Interface number\r\n        0:16,                   % sll_hatype: Header type\r\n        0:8,                    % sll_pkttype: Packet type\r\n        0:8,                    % sll_halen: address length\r\n        0:8,                    % sll_addr[8]: physical layer address\r\n        0:8,                    % sll_addr[8]: physical layer address\r\n        0:8,                    % sll_addr[8]: physical layer address\r\n        0:8,                    % sll_addr[8]: physical layer address\r\n        0:8,                    % sll_addr[8]: physical layer address\r\n        0:8,                    % sll_addr[8]: physical layer address\r\n        0:8,                    % sll_addr[8]: physical layer address\r\n        0:8                     % sll_addr[8]: physical layer address\r\n    >>,\r\n    ok = procket:bind(Socket, Sockaddr_ll),\r\n\t{ok, Socket}.\r\n```\r\n\r\nI want to receive messages from this socket:\r\n\r\n```erlang\r\n% Erlang/OTP 17 [erts-6.3] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]\r\n\r\n> {ok, EthernetSocket} = ethernet_socket( Device ).\r\n{ok, 8}.\r\n\r\n> {ok, Socket} = gen_udp:open(0, [ { fd, EthernetSocket } ] ). \r\n** exception error: no match of right hand side value {error,einval}\r\n```\r\n\r\nWhat I'm doing wrong? Please help!"},"comment":{"url":"https://api.github.com/repos/msantos/procket/issues/comments/70114183","html_url":"https://github.com/msantos/procket/issues/17#issuecomment-70114183","issue_url":"https://api.github.com/repos/msantos/procket/issues/17","id":70114183,"user":{"login":"RushOnline","id":130976,"avatar_url":"https://avatars.githubusercontent.com/u/130976?v=3","gravatar_id":"","url":"https://api.github.com/users/RushOnline","html_url":"https://github.com/RushOnline","followers_url":"https://api.github.com/users/RushOnline/followers","following_url":"https://api.github.com/users/RushOnline/following{/other_user}","gists_url":"https://api.github.com/users/RushOnline/gists{/gist_id}","starred_url":"https://api.github.com/users/RushOnline/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RushOnline/subscriptions","organizations_url":"https://api.github.com/users/RushOnline/orgs","repos_url":"https://api.github.com/users/RushOnline/repos","events_url":"https://api.github.com/users/RushOnline/events{/privacy}","received_events_url":"https://api.github.com/users/RushOnline/received_events","type":"User","site_admin":false},"created_at":"2015-01-15T16:32:33Z","updated_at":"2015-01-15T16:32:33Z","body":"> Do you mean using a dedicated, external Unix port process?\r\nYes, I'm working on communication with specific chip over backplane. \"Ethernet\" is chip specific too, so I need raw socket. But you code is very good, I was learn many things from it. Thank you again!"}}