Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Apr 1998 10:04:11 -0400
From:      ribo@watson.ibm.com (Bob Flavin)
To:        questions@FreeBSD.ORG
Subject:   IFF_PROMISC getting into promiscuous mode
Message-ID:  <9804091404.AA20462@ribox.watson.ibm.com>

next in thread | raw e-mail | index | archive | help
How do you get an ethernet adapter running in promiscuous mode?

I open a socket:

  sock = socket(AF_INET, SOCK_DGRAM, 0);

and GET, OR and SET the IFF_DEBUG and IFF_PROMISC bits with
 
  ioctl(sock, SIOCGIFFLAGS, (char*)&ifr);
  ...
  ioctl(sock, SIOCSIFFLAGS, (char*)&ifr);

this seems to work because:  ifconfig fxp0  shows the DEBUG and PROMISC
flags on.  However, I don't get a stream of packets in the loop that
read()'s packets.  That uses another socket, previously opened as:

  s = socket(AF_INET, SOCK_RAW, IPPROTO_IP);

(On another system (AIX) I use AF_INTF for the read() socket, FreeBSD doesn't
seem to have this.)

What do I do?  Do you have any samples of (non-BPF) sniffer code?

Bob


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9804091404.AA20462>