[tcpdump-workers] Problem with pcap_set_datalink DLT_IEEE802_11_RADIO

2013-09-11 Thread Elton Lika
I am using libpcap-dev 0.9.8 in Ubuntu 12.04 on my laptop.

Setting my wlan0 interface to monitor mode using iwconfig and tcpdump -i
wlan0 -y IEEE802_11_RADIO

works fine but when doing it in C it fails with an DLT not supported by
device error.

 

Here is the source code excerpt that fails:

 

/* Set device in monitor mode */

if(pcap_can_set_rfmon(handle)) {

if(pcap_set_rfmon(handle, 1) ==
PCAP_ERROR_ACTIVATED) {

 

   printf("Failed to activate monitor
mode\n");

   exit(EXIT_FAILURE);

}

}else{

printf("Cannot set monitor mode\n");

exit(EXIT_FAILURE);

}



/* Set additional settings for pcap */

pcap_set_snaplen(handle, 2048);

pcap_set_promisc(handle, 1);

pcap_set_timeout(handle, 100);

pcap_activate(handle);



/* Set datalink type */

if(pcap_set_datalink(handle, DLT_IEEE802_11_RADIO) == -1) {   //
returns -1 on device that supports this DLT

printf("Couldn't set datalink type %s: %s\n",
device, pcap_geterr(handle));

}

 

What could be the problem?

 

Thanks in advance.

Elton Lika

___
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers


Re: [tcpdump-workers] Problem with pcap_set_datalinkDLT_IEEE802_11_RADIO

2013-09-12 Thread Elton Lika

Also pcap_list_datalinks returns only DLT_NULL for the device.

On 09/11/2013 09:56 AM, Elton Lika wrote:

I am using libpcap-dev 0.9.8 in Ubuntu 12.04 on my laptop.

Setting my wlan0 interface to monitor mode using iwconfig and tcpdump -i
wlan0 -y IEEE802_11_RADIO

works fine but when doing it in C it fails with an DLT not supported by
device error.

  


Here is the source code excerpt that fails:

  


 /* Set device in monitor mode */

 if(pcap_can_set_rfmon(handle)) {

 if(pcap_set_rfmon(handle, 1) ==
PCAP_ERROR_ACTIVATED) {

  


printf("Failed to activate monitor
mode\n");

exit(EXIT_FAILURE);

 }

 }else{

 printf("Cannot set monitor mode\n");

 exit(EXIT_FAILURE);

 }

 


 /* Set additional settings for pcap */

 pcap_set_snaplen(handle, 2048);

 pcap_set_promisc(handle, 1);

 pcap_set_timeout(handle, 100);

 pcap_activate(handle);

 


 /* Set datalink type */

 if(pcap_set_datalink(handle, DLT_IEEE802_11_RADIO) == -1) {   //
returns -1 on device that supports this DLT

 printf("Couldn't set datalink type %s: %s\n",
device, pcap_geterr(handle));

 }

  


What could be the problem?

  


Thanks in advance.

Elton Lika

___
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers




___
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers