Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - BPF promiscuous mode: (6 Items)
   
BPF promiscuous mode  
hi,

I am working on a BPF device which i create as /dev/bf0

using the following call
bff = open(bpf_dev, O_RDWR))

but when i try to set it in promiscuous mode using ioctl 
ioctl (bff, BIOCPROMISC, &set) == 0)

it returns a ERROR.
I am currently working on QNX 6.4.0 x86pc.

is this mode not supported currently ?
Re: BPF promiscuous mode  
Did you try to bind the interface before the ioctl?

struct ifreq reader_if;
char if_name[128];

...
  strcpy( if_name, "en0" );

  // bind interface
  strcpy( reader_if.ifr_name, if_name );
  if ( ioctl( bpffd, BIOCSETIF, &reader_if ) )
  {
    printf( "error: bpf setif ioctl error %d\n", errno );
    close( bpffd );
    return -2;
  }

  if ( opt_promiscuous )
  {
	  if ( ioctl( bpffd, BIOCPROMISC, NULL ) == -1 )
	  {
	    printf( "error: bpf promiscuous ioctl error %d\n", errno );
	    close( bpffd );
	    return -3;
	  }
  }
   
Re: BPF promiscuous mode  
hi ,

yeah i m binding the interface en0.
the earlier call to ioctl using parameters BIOCSETIF and BIOCIMMEDIATE returns a success.
but the next call using BIOCPROMISC as one of the parameters fails.
RE: BPF promiscuous mode  
On another note, we've just recently updated the wiki pages / docs to
indicate that you should use "ioctl_socket" instead of "ioctl" when
using BPF.  The support for the ioctl is included with the stack (see
the bpf.c:bpf_ioctl in trunk/sys/net/bpf.c).

	Robert.

-----Original Message-----
From: Dennis Kellly [mailto:community-noreply@qnx.com] 
Sent: Tuesday, January 27, 2009 9:40 AM
To: technology-networking
Subject: Re: BPF promiscuous mode

Did you try to bind the interface before the ioctl?

struct ifreq reader_if;
char if_name[128];

...
  strcpy( if_name, "en0" );

  // bind interface
  strcpy( reader_if.ifr_name, if_name );
  if ( ioctl( bpffd, BIOCSETIF, &reader_if ) )
  {
    printf( "error: bpf setif ioctl error %d\n", errno );
    close( bpffd );
    return -2;
  }

  if ( opt_promiscuous )
  {
	  if ( ioctl( bpffd, BIOCPROMISC, NULL ) == -1 )
	  {
	    printf( "error: bpf promiscuous ioctl error %d\n", errno );
	    close( bpffd );
	    return -3;
	  }
  }
   


_______________________________________________
Technology
http://community.qnx.com/sf/go/post20838
Re: RE: BPF promiscuous mode  
made that change to setting all ioctl to ioctl_socket .. 
but things don't seem to work here.
lemme execute something more simpler n check ..
Re: RE: BPF promiscuous mode  
nope nothing works i have given up ... 
the only work around is to slay the io-pkt and reload it along with the 
"-dpcnet promiscuous  " options.

nicinfo confirms that promiscuous mode comes up then.