google / gopacket

Provides packet processing capabilities for Go
BSD 3-Clause "New" or "Revised" License
6.22k stars 1.11k forks source link

"pfring NewRing error: no such device" when trying to open pfring ZC interface from zbalance_ipc #147

Open LrsK opened 8 years ago

LrsK commented 8 years ago

PF_RING in ZC-mode comes with a program zbalance_ipc that can send the output of one or more ZC-queues to different virtual PF_RING interfaces that end up with names like "zc:99@0" and "zc:99@1" etc.

When using gopacket (which otherwise works fine with normal ZC-interfaces like e.g. "zc:eth3") a "no such device" error is returned. As far as I can tell there is nothing special happening inside NewRing() besides calling C.pfring_open(). Using these virtual interfaces work fine with the example programs that come with PF_RING.

Is this somehow a bug with gopacket? It seems to be doing basically the same thing as the C-examples I've seen that work fine, but returns the error.

Code that fails:

log.Printf("Opening pf_ring on interface %q", *iface)
ring, err = pfring.NewRing(*iface, uint32(*snaplen), pfring.FlagPromisc) // <- fails
if err != nil {
    log.Printf("Error: %s, Ring: %v\n", err, ring)
    return
}

err = ring.Enable()
if err != nil {
    log.Printf("Error: %s\n", err)
    return
}

packetSources = append(packetSources, gopacket.NewPacketSource(ring, layers.LinkTypeEthernet))

log.Printf("New pf_ring.")
defer ring.Close()
rbenedet commented 7 years ago

I encounter the same issue when opening a device like like "zc:99@0" after using zbalance_ipc in this way:

zbalance_ipc -i eth3 -c 99 -n 2

Has there been any progress on this issue?

Thanks in advance.

LrsK commented 7 years ago

Since opening this issue, I have moved away from using PF_RING, as I was able to handle the traffic load using AF_PACKET with clustering, and so I have not worked on this any further. Make sure you actually need PF_RING for your load. I have also heard from others working with PF_RING that the zbalance_ipc tool is not production ready, although this was some time ago.