69c9f53e99
to be imported Metasploit framework: This goal of this project is to provide a consistent interface to LBL's libpcap packet capture library. This project was created because the currently available ruby-pcap library is poorly designed and has been unmaintained since 2000. This does not provide packet processing functionality, it simply provides the interface for capturing packets. This version has been forked by the Metasploit project. ok jasper@
34 lines
1.4 KiB
Plaintext
34 lines
1.4 KiB
Plaintext
$OpenBSD: patch-pcaprub_c,v 1.1.1.1 2010/12/23 10:29:52 stephan Exp $
|
|
--- pcaprub.c.orig Tue Dec 14 11:58:51 2010
|
|
+++ pcaprub.c Tue Dec 14 12:02:43 2010
|
|
@@ -314,6 +314,7 @@ static VALUE
|
|
rbpcap_dump(VALUE self, VALUE caplen, VALUE pktlen, VALUE packet)
|
|
{
|
|
rbpcap_t *rbp;
|
|
+ struct timeval tv;
|
|
struct pcap_pkthdr pcap_hdr;
|
|
|
|
if(TYPE(packet) != T_STRING)
|
|
@@ -325,7 +326,9 @@ rbpcap_dump(VALUE self, VALUE caplen, VALUE pktlen, VA
|
|
|
|
Data_Get_Struct(self, rbpcap_t, rbp);
|
|
|
|
- gettimeofday(&pcap_hdr.ts, NULL);
|
|
+ gettimeofday(&tv, NULL);
|
|
+ pcap_hdr.ts.tv_sec = tv.tv_sec;
|
|
+ pcap_hdr.ts.tv_usec = tv.tv_usec;
|
|
pcap_hdr.caplen = NUM2UINT(caplen);
|
|
pcap_hdr.len = NUM2UINT(pktlen);
|
|
|
|
@@ -489,10 +492,6 @@ Init_pcaprub()
|
|
rb_define_const(rb_cPcap, "DLT_PPP_BSDOS", INT2NUM(DLT_PPP_BSDOS));
|
|
rb_define_const(rb_cPcap, "DLT_IEEE802_11", INT2NUM(DLT_IEEE802_11));
|
|
rb_define_const(rb_cPcap, "DLT_IEEE802_11_RADIO", INT2NUM(DLT_IEEE802_11_RADIO));
|
|
- rb_define_const(rb_cPcap, "DLT_IEEE802_11_RADIO_AVS", INT2NUM(DLT_IEEE802_11_RADIO_AVS));
|
|
- rb_define_const(rb_cPcap, "DLT_LINUX_SLL", INT2NUM(DLT_LINUX_SLL));
|
|
- rb_define_const(rb_cPcap, "DLT_PRISM_HEADER", INT2NUM(DLT_PRISM_HEADER));
|
|
- rb_define_const(rb_cPcap, "DLT_AIRONET_HEADER", INT2NUM(DLT_AIRONET_HEADER));
|
|
|
|
rb_define_singleton_method(rb_cPcap, "new", rbpcap_new_s, 0);
|
|
|