{"action":"created","issue":{"url":"https://api.github.com/repos/google/gopacket/issues/79","labels_url":"https://api.github.com/repos/google/gopacket/issues/79/labels{/name}","comments_url":"https://api.github.com/repos/google/gopacket/issues/79/comments","events_url":"https://api.github.com/repos/google/gopacket/issues/79/events","html_url":"https://github.com/google/gopacket/issues/79","id":74432743,"number":79,"title":"gopacket Layers not work correct with OpenVZ venet devices","user":{"login":"mrqwer88","id":7100008,"avatar_url":"https://avatars.githubusercontent.com/u/7100008?v=3","gravatar_id":"","url":"https://api.github.com/users/mrqwer88","html_url":"https://github.com/mrqwer88","followers_url":"https://api.github.com/users/mrqwer88/followers","following_url":"https://api.github.com/users/mrqwer88/following{/other_user}","gists_url":"https://api.github.com/users/mrqwer88/gists{/gist_id}","starred_url":"https://api.github.com/users/mrqwer88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrqwer88/subscriptions","organizations_url":"https://api.github.com/users/mrqwer88/orgs","repos_url":"https://api.github.com/users/mrqwer88/repos","events_url":"https://api.github.com/users/mrqwer88/events{/privacy}","received_events_url":"https://api.github.com/users/mrqwer88/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-05-08T17:17:58Z","updated_at":"2015-05-08T20:23:48Z","closed_at":"2015-05-08T20:23:48Z","body":"Hello!\r\nInside openvz container with venet network gopacket.Layers/gopacket.packet.Layer see only **Ethernet** layout.\r\nI use for test - \r\n```\r\npackage main\r\n\r\nimport (\r\n\t\"code.google.com/p/getopt\"\r\n\t\"fmt\"\r\n\t\"github.com/google/gopacket\"\r\n\t\"github.com/google/gopacket/layers\"\r\n\t\"github.com/google/gopacket/pcap\"\r\n\t\"os\"\r\n)\r\n\r\nfunc main() {\r\n\toptInterface := getopt.StringLong(\"interface\", 'i', \"eth0\", \"Set our interface to sniff\")\r\n\r\n\toptHelp := getopt.BoolLong(\"help\", 'h', \"Print help message\")\r\n\r\n\tgetopt.Parse()\r\n\r\n\tif *optHelp {\r\n\t\tgetopt.Usage()\r\n\t\tos.Exit(0)\r\n\t}\r\n\tif handle, err := pcap.OpenLive(*optInterface, 1600, true, 0); err != nil {\r\n\t\tpanic(err)\r\n\t} else if err := handle.SetBPFFilter(\"udp dst port 53\"); err != nil { // optional\r\n\t\tpanic(err)\r\n\t} else {\r\n\r\n\t\tfor i := 0; i < 5; i++ {\r\n\t\t\tdata, _, err := handle.ReadPacketData()\r\n\t\t\tif err != nil {\r\n\t\t\t\tpanic(err)\r\n\t\t\t}\r\n\r\n\t\t\tpacket := gopacket.NewPacket(data, layers.LayerTypeEthernet, gopacket.Default)\r\n\t\t\tfor _, layer := range packet.Layers() {\r\n\t\t\t\tfmt.Println(\"PACKET LAYER:\", layer.LayerType())\r\n\t\t\t}\r\n\t\t\tfmt.Printf(\"\\n\\n\")\r\n\t\t}\r\n\t}\r\n}\r\n``` \r\nAnd I generate trafic with \r\n```\r\ndig @ip example.org\r\n```\r\nOn phisical server it work good - \r\n```\r\n./check_gopacket_layers  -ibond0\r\nPACKET LAYER: Ethernet\r\nPACKET LAYER: IPv4\r\nPACKET LAYER: UDP\r\nPACKET LAYER: DNS\r\n\r\n\r\nPACKET LAYER: Ethernet\r\nPACKET LAYER: IPv4\r\nPACKET LAYER: UDP\r\nPACKET LAYER: DNS\r\n\r\n...\r\n```\r\nBut in openvz container it see only Ethernet layer - \r\n```\r\n./check_gopacket_layers  -i venet0\r\nPACKET LAYER: Ethernet\r\n\r\n\r\nPACKET LAYER: Ethernet\r\n\r\n\r\nPACKET LAYER: Ethernet\r\n\r\n\r\nPACKET LAYER: Ethernet\r\n\r\n\r\nPACKET LAYER: Ethernet\r\n\r\n\r\n```\r\nCould you help me with it?\r\nPS I tryed set \"venet0:0\" as interface, but it have same result."},"comment":{"url":"https://api.github.com/repos/google/gopacket/issues/comments/100352119","html_url":"https://github.com/google/gopacket/issues/79#issuecomment-100352119","issue_url":"https://api.github.com/repos/google/gopacket/issues/79","id":100352119,"user":{"login":"mrqwer88","id":7100008,"avatar_url":"https://avatars.githubusercontent.com/u/7100008?v=3","gravatar_id":"","url":"https://api.github.com/users/mrqwer88","html_url":"https://github.com/mrqwer88","followers_url":"https://api.github.com/users/mrqwer88/followers","following_url":"https://api.github.com/users/mrqwer88/following{/other_user}","gists_url":"https://api.github.com/users/mrqwer88/gists{/gist_id}","starred_url":"https://api.github.com/users/mrqwer88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrqwer88/subscriptions","organizations_url":"https://api.github.com/users/mrqwer88/orgs","repos_url":"https://api.github.com/users/mrqwer88/repos","events_url":"https://api.github.com/users/mrqwer88/events{/privacy}","received_events_url":"https://api.github.com/users/mrqwer88/received_events","type":"User","site_admin":false},"created_at":"2015-05-08T20:23:48Z","updated_at":"2015-05-08T20:23:48Z","body":"Sorry - it is my bad, not bug.\r\n\r\nWith venet handle.LinkType() are **Linux SLL**, not **Ethernet**.\r\nWith correct second arg like\r\n```\r\npacket := gopacket.NewPacket(data, handle.LinkType(), gopacket.Default)\r\n```\r\nit work correct - \r\n```\r\n./check_gopacket_layers -i venet0\r\n[0 0 255 255 0 0 0 0 0 0 0 0 0 0 8 0 69 0 0 72 240 51 0 0 54 17 235 242 93 100 147 71 159 253 23 214 109 3 0 53 0 52 169 149 72 134 1 32 0 1 0 0 0 0 0 1 8 109 114 113 119 101 114 56 56 3 115 112 98 2 114 117 0 0 1 0 1 0 0 41 16 0 0 0 0 0 0 0]\r\nLinux SLL\r\nPACKET LAYER: Linux SLL\r\nPACKET LAYER: IPv4\r\nPACKET LAYER: UDP\r\nPACKET LAYER: DNS\r\n```\r\n\r\nThanks a lot!"}}