Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - promiscuous mode in QNX 6.41 on x86 platform: (1 Item)
   
promiscuous mode in QNX 6.41 on x86 platform  
Hi,
I have a problem with promiscuous mode in QNX 6.41 on x86 platform.

When I use devn-rtl8169.so (from QNX 6.40 instalation) everything is OK - promiscuous mode works.
In file /etc/system/enum/devices/net is
mount(-Tio-pkt "-opci=$(index),vid=0x$(ven),did=0x$(dev)" /lib/dll/devn-rtl8169.so, "/dev/io-net/en$(netnum)") 

When I use devnp-rtl8169.so promiscuous mode doesn't work.
In file /etc/system/enum/devices/net is
mount(-Tio-pkt "-opci=$(index),vid=0x$(ven),did=0x$(dev)" /lib/dll/devnp-rtl8169.so, "/dev/io-net/en$(netnum)") 

As an interface I use libpcap.a library. All src code is below.

It seems that new drivers devnp* make device rt0 and promiscuous mode doesn't work.
Is this only termporary phase (there are devn* and devnp* drivers in instalation) or promiscuous mode won't be suported 

any more?
Or should I set promiscuous mode in other way? (pcap_open_live - the third parameter is set to 1)

Pavel Šimek

//all src code
#include <sys/neutrino.h>	// #define _NTO_VERSION
#include <pcap.h>

int main()
{
    pcap_if_t *alldevs;
    pcap_if_t *d;
    int inum;
    int i=0;
    pcap_t *adhandle;
    int res;
    char errbuf[PCAP_ERRBUF_SIZE];
    struct tm *ltime;
    char timestr[16];
    struct pcap_pkthdr *header;
    const u_char *pkt_data;
    if(pcap_findalldevs(&alldevs, errbuf) == -1){
      fprintf(stderr,"Error in pcap_findalldevs: %s\n", errbuf);
      return -1;
    } 
    /* Print the list */
    for(d=alldevs; d; d=d->next)
    {
        printf("%d. %s", ++i, d->name);
        if (d->description)
            printf(" (%s)\n", d->description);
        else
            printf(" (No description available)\n");
    }
	
    if(i==0)
    {
        printf("\nNo interfaces found! Make sure WinPcap is installed.\n");
        return -1;
    }
    
    printf("Enter the interface number (1-%d):",i);
    scanf("%d", &inum);
    
    if(inum < 1 || inum > i)
    {
        printf("\nInterface number out of range.\n");
        /* Free the device list */
        pcap_freealldevs(alldevs);
        return -1;
    }
	
    /* Jump to the selected adapter */
    for(d=alldevs, i=0; i< inum-1 ;d=d->next, i++);
    	/* Open the adapter */
        if ((adhandle= pcap_open_live(d->name, 65536, 1 /* nonzero promiscuous*/, 100, errbuf )) == NULL)
        {
            fprintf(stderr,"\nUnable to open the adapter. %s is not supported by WinPcap\n", d->name);
		/* Free the device list */
		pcap_freealldevs(alldevs);
		return -1;
        }
    printf("\nlistening on %s...QNX:%d\n", d->name, _NTO_VERSION);	
        /* At this point, we don't need any more the device list. Free it */
    pcap_freealldevs(alldevs);
	/* Retrieve the packets */
    while((res = pcap_next_ex( adhandle, &header, &pkt_data)) >= 0){	
            if(res == 0)
                continue;	
            /* convert the timestamp to readable format */
            ltime=localtime(&header->ts.tv_sec);
            strftime( timestr, sizeof timestr, "%H:%M:%S", ltime);	
            printf("%s,%.6d len:%d\n", timestr, header->ts.tv_usec, header->len);
    }
    if(res == -1){
        printf("Error reading the packets: %s\n", pcap_geterr(adhandle));
        return -1;
    }	
    pcap_close(adhandle);  
    return 0;
}