This is not Go-specific, I hope I'm not breaking some unwritten rule by
replying.

> I just figured this out.  I need to manually set the NIC to promiscuous 
> mode.

> Now the question is, is there a way to set the NIC to promiscuous mode
> in code, like in pcap.openlive?

You want to call sysctl(SIOCGIFFLAGS), set the IFF_PROMISC flag in
ifr.ifr_flags, and pass the results back to sysctl(SIOCSIFFLAGS).
I guess one could also use rtnetlink, if one were so inclined.

If I were you, I'd cheat:

  ifname := "eth0"
  cmd := exec.Command("ip", "link", "set", "dev", ifname, "promisc", "on")
  err := cmd.Run()

-- Juliusz

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to