Changes of Revision 70
[-] [+] | Changed | nprobe.changes |
[-] [+] | Changed | nprobe.spec ^ |
[-] [+] | Added | nprobe-6.11-GeoIPdat-dir.patch ^ |
@@ -0,0 +1,20 @@ +--- nprobe.c.orig 2011-04-03 13:53:36.000000000 +0200 ++++ nprobe.c 2011-04-04 10:44:26.309788419 +0200 +@@ -3601,7 +3601,7 @@ + + #ifdef HAVE_GEOIP + if(readOnlyGlobals.geo_ip_asn_db == NULL) +- readASs("GeoIPASNum.dat"); ++ readASs("/usr/lib/nprobe/GeoIPASNum.dat"); + + if(!readOnlyGlobals.enableGeoIP) { + if(readOnlyGlobals.geo_ip_city_db != NULL) { +@@ -3610,7 +3610,7 @@ + } + } else { + if(readOnlyGlobals.geo_ip_city_db == NULL) +- readCities("GeoLiteCity.dat"); ++ readCities("/usr/lib/nprobe/GeoLiteCity.dat"); + } + #endif + | ||
[-] [+] | Added | nprobe-6.11-configure.in.patch ^ |
@@ -0,0 +1,11 @@ +--- configure.in.orig 2012-12-17 23:15:51.344038582 +0100 ++++ configure.in 2012-12-18 12:39:20.908040235 +0100 +@@ -363,7 +363,7 @@ + PWD=`pwd`/.. + LIBPCAP_ARM="${PWD}/libpcap-1.1.1-ARM" + PLATFORM=`uname -m` +-PF_RING_HOME=${HOME}/PF_RING ++PF_RING_HOME=${PWD}/PF_RING + + if test -d "${PF_RING_HOME}"; then + LDFLAGS="${LDFLAGS} -L${PWD}/PF_RING/userland/lib -L${PWD}/PF_RING/userland/libpcap" | ||
Changed | GeoIPASNum.dat.gz ^ | |
Changed | GeoLiteCity.dat.gz ^ | |
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/ChangeLog ^ |
@@ -1,3 +1,39 @@ +--------------------------------------- +2013-01-09 PF_RING 5.5.2 + +* PF_RING library + - New pfring_open() flag PF_RING_DNA_FIXED_RSS_Q_0 to send all traffic to queue 0. + Other queues can be selected using hw filters (DNA cards with hw filtering only). + - Added ability to create a stats file under /proc/net/pf_ring/stats so that + applications can report stats via the /proc filesystem. + - pfring_set_application_stats() for reporting stats + - pfring_get_appl_stats_file_name() for getting the exac filename where the app sets the statistics + +* DNA drivers + - Flow Control disabled by default with the ixgbe-dna driver + +* Sample apps + - New pfdump.c sample app + - Userspace BPF support with DNA in pfcount.c + - pfcount.c and pfsend.c update to report stats using pfring_set_application_stats() + +* Libzero + - New experimental pfring_register_zerocopy_tx_ring() + - New pfdnacluster_mt_rss_frwd sample app (packet forwarding using Libzero + DNA Cluster for rx/balancing and standard DNA with zero-copy on RSS queues for tx) + +* Libpcap + - pcap_get_pfring_id() + - pcap_set_master_id() + - pcap_set_master() + - pcap_set_application_name() + - pcap_set_watermark() + +* BUG fixes + - Fix for corrupted VLAN tagged packets + - Fix for wrong packet len with vlan stripping offload + +--------------------------------------- 2012-11-24 PF_RING 5.5.1 - updated ixgbe driver to release 3.11.33 | ||
Changed | PF_RING-5.5.2-svn.tar.bz2/doc/PF_RING-UsersGuide.pages ^ | |
Changed | PF_RING-5.5.2-svn.tar.bz2/doc/UsersGuide.pdf ^ | |
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/drivers/DNA/e1000-8.0.35-DNA/src/e1000_dna.c ^ |
@@ -19,7 +19,7 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define MAX_NUM_ADAPTERS 8 +#define MAX_NUM_ADAPTERS 16 #define DEBUG | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/drivers/DNA/e1000e-2.0.0.1-DNA/src/e1000e_dna.c ^ |
@@ -1,7 +1,7 @@ /* * - * (C) 2008-11 - Luca Deri <deri@ntop.org> - * (C) 2011 - Alfredo Cardigliano <cardigliano@ntop.org> + * (C) 2008-12 - Luca Deri <deri@ntop.org> + * (C) 2011-12 - Alfredo Cardigliano <cardigliano@ntop.org> * * * This program is free software; you can redistribute it and/or modify @@ -19,7 +19,7 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define MAX_NUM_ADAPTERS 8 +#define MAX_NUM_ADAPTERS 16 static char *adapters_to_enable[MAX_NUM_ADAPTERS] = { 0 }; module_param_array(adapters_to_enable, charp, NULL, 0444); @@ -195,7 +195,6 @@ int i, debug = 0; struct e1000_ring *rx_ring = adapter->rx_ring; union e1000_rx_desc_extended *rx_desc; - struct e1000_buffer *buffer_info; struct e1000_hw *hw = &adapter->hw; u32 staterr; @@ -207,7 +206,6 @@ rx_ring->next_to_clean = i; rx_desc = E1000_RX_DESC_EXT(*rx_ring, i); staterr = le32_to_cpu(rx_desc->wb.upper.status_error); - buffer_info = &rx_ring->buffer_info[i]; if(unlikely(debug)) printk(KERN_INFO | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/drivers/DNA/igb-3.4.7-DNA/src/igb_dna.c ^ |
@@ -683,11 +683,11 @@ struct igb_ring *rx_ring, int budget) { union e1000_adv_rx_desc *rx_desc; u32 staterr; - u16 i, last_cleaned_idx; + u16 i; struct igb_adapter *adapter = q_vector->adapter; struct e1000_hw *hw = &adapter->hw; - last_cleaned_idx = i = E1000_READ_REG(hw, E1000_RDT(rx_ring->reg_idx)); + i = E1000_READ_REG(hw, E1000_RDT(rx_ring->reg_idx)); if(++i == rx_ring->count) i = 0; | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/drivers/DNA/ixgbe-3.10.16-DNA/src/ixgbe_api.c ^ |
@@ -44,6 +44,16 @@ { s32 status; +#ifdef ENABLE_DNA + if((hw->subsystem_vendor_id == 0x1374) /* Silicom subvendor id */ + && (hw->subsystem_device_id == 0x0F00)) + hw->silicom.has_hw_ts_card = 1; /* Silicom Hw Timestamping card found */ + else + hw->silicom.has_hw_ts_card = 0; + + /* printk("[DNA] Silicom TS Card: %d\n", hw->silic_ts_card); */ +#endif + /* * Set the mac type */ | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/drivers/DNA/ixgbe-3.10.16-DNA/src/ixgbe_dna.c ^ |
@@ -202,8 +202,8 @@ switch (hw->mac.type) { case ixgbe_mac_82598EB: return intel_ixgbe_82598; - case ixgbe_mac_82599EB: - return intel_ixgbe_82599; + case ixgbe_mac_82599EB: + return(hw->silicom.has_hw_ts_card ? intel_ixgbe_82599_ts : intel_ixgbe_82599); default: return intel_ixgbe; } | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/drivers/DNA/ixgbe-3.10.16-DNA/src/ixgbe_type.h ^ |
@@ -3216,6 +3216,12 @@ bool adapter_stopped; bool force_full_reset; bool allow_unsupported_sfp; + +#ifdef ENABLE_DNA + struct { + bool has_hw_ts_card; + } silicom; +#endif }; #define ixgbe_call_func(hw, func, params, error) \ | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/drivers/DNA/ixgbe-3.10.16-DNA/src/load_dna_driver.sh ^ |
@@ -15,7 +15,7 @@ # We assume that you have compiled PF_RING insmod ../../../../kernel/pf_ring.ko -# Default (as many queues as the number of processors) +# As many queues as the number of processors #insmod ./ixgbe.ko RSS=0,0,0,0 # Disable multiqueue @@ -24,7 +24,7 @@ # Configure the number of TX and RX slots #insmod ./ixgbe.ko RSS=1,1,1,1 num_rx_slots=32768 num_tx_slots=4096 -# Enable 8 queues +# Enable 16 queues #insmod ./ixgbe.ko MQ=1,1,1,1 RSS=16,16,16,16 # Enable max number of hw filters | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/drivers/PF_RING_aware/intel/ixgbe/ixgbe-3.11.33/src/ixgbe.h ^ |
@@ -179,6 +179,13 @@ counter |= current_counter; \ } +#ifdef HAVE_PF_RING +typedef struct { + u32 sec, nsec; + u8 status; +} silicom_ts_t; +#endif + struct vf_stats { u64 gprc; u64 gorc; | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/drivers/PF_RING_aware/intel/ixgbe/ixgbe-3.11.33/src/ixgbe_api.c ^ |
@@ -44,6 +44,16 @@ { s32 status; +#ifdef HAVE_PF_RING + if((hw->subsystem_vendor_id == 0x1374) /* Silicom subvendor id */ + && (hw->subsystem_device_id == 0x0F00)) + hw->silicom.has_hw_ts_card = 1; /* Silicom Hw Timestamping card found */ + else + hw->silicom.has_hw_ts_card = 0; + + /* printk("[DNA] Silicom TS Card: %d\n", hw->silic_ts_card); */ +#endif + /* * Set the mac type */ | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/drivers/PF_RING_aware/intel/ixgbe/ixgbe-3.11.33/src/ixgbe_main.c ^ |
@@ -1663,7 +1663,7 @@ if(*hook->transparent_mode != standard_linux_path) { u_int8_t skb_reference_in_use; int rc = hook->ring_handler(skb, 1, 1, &skb_reference_in_use, - q_vector->rx.ring->queue_index, + q_vector->rx.ring->queue_index, q_vector->adapter->num_rx_queues); if(rc > 0 /* Packet handled by PF_RING */) { @@ -2146,6 +2146,55 @@ cleaned_count++; +#ifdef HAVE_PF_RING + if(q_vector->adapter->hw.silicom.has_hw_ts_card) { + unsigned char sil_buf[9]; + silicom_ts_t *signature; + u_int num_count = 0, ts_len; + + STRIP_TS: + skb_copy_bits(skb, skb->len - 9, sil_buf, 9); + signature = (silicom_ts_t *)sil_buf; + + if(0) + printk(KERN_DEBUG "Raw dump: %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", + sil_buf[0],sil_buf[1],sil_buf[2],sil_buf[3],sil_buf[4], + sil_buf[5],sil_buf[6],sil_buf[7],sil_buf[8]); + + if (signature->status == 0xC3) + { + ts_len = 9; +#if(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)) + skb->tstamp = ktime_set((long)ntohl(signature->sec), (long)ntohl(signature->nsec)); +#else + skb->tstamp.off_sec = ntohl(signature->sec); + skb->tstamp.off_usec = ntohl(signature->nsec) / 1000; +#endif + q_vector->adapter->hw.silicom.last_9_bytes_ts_sec = signature->sec; + } else if (signature->status == 0xC2) { + ts_len = 5; +#if(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)) + skb->tstamp = ktime_set((long)ntohl(q_vector->adapter->hw.silicom.last_9_bytes_ts_sec), (long)ntohl(signature->nsec)); +#else + skb->tstamp.off_sec = ntohl(q_vector->adapter->hw.silicom.last_9_bytes_ts_sec); + skb->tstamp.off_usec = ntohl(signature->nsec) / 1000; +#endif + } else { + ts_len = 0; + + if(num_count++ == 0) { + /* printk(KERN_DEBUG "Trying to strip CRC\n"); */ + skb->tail -= 4, skb->len -= 4; + goto STRIP_TS; + } else { + /* printk(KERN_DEBUG "There is no Silicom's TS\n"); */ + skb->tail += 4, skb->len += 4; + } + } + + skb->tail -= ts_len, skb->len -= ts_len; + } +#endif /* place incomplete frames back on ring for completion */ if (ixgbe_is_non_eop(rx_ring, rx_desc, skb)) continue; | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/drivers/PF_RING_aware/intel/ixgbe/ixgbe-3.11.33/src/ixgbe_type.h ^ |
@@ -3222,6 +3222,13 @@ int api_version; bool force_full_reset; bool allow_unsupported_sfp; + +#ifdef HAVE_PF_RING + struct { + bool has_hw_ts_card; + u32 last_9_bytes_ts_sec; + } silicom; +#endif }; #define ixgbe_call_func(hw, func, params, error) \ | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/kernel/linux/pf_ring.h ^ |
@@ -2,8 +2,7 @@ * * Definitions for packet ring * - * 2004-12 Luca Deri <deri@ntop.org> - * Alfredo Cardigliano <cardigliano@ntop.org> + * 2004-13 ntop.org * */ @@ -26,7 +25,7 @@ #define RING_MAGIC #define RING_MAGIC_VALUE 0x88 -#define RING_FLOWSLOT_VERSION 14 /* +#define RING_FLOWSLOT_VERSION 15 /* Increment whenever we change slot or packet header layout (e.g. we add/move a field */ @@ -43,8 +42,8 @@ #define pfring_ptr ax25_ptr /* Versioning */ -#define RING_VERSION "5.5.2" -#define RING_VERSION_NUM 0x050502 +#define RING_VERSION "5.5.3" +#define RING_VERSION_NUM 0x050503 /* Set */ #define SO_ADD_TO_CLUSTER 99 @@ -702,7 +701,8 @@ intel_ixgbe_82598, intel_ixgbe_82599, intel_igb_82580, - intel_e1000 + intel_e1000, + intel_ixgbe_82599_ts } dna_device_model; typedef struct { @@ -714,8 +714,7 @@ } mem_ring_info; typedef enum { - dna_v1 = 0, - dna_v2 + dna_v1 = 0 } dna_version; typedef struct { @@ -795,7 +794,7 @@ typedef enum { standard_nic_family = 0, /* No Hw Filtering */ - intel_82599_family, + intel_82599_family } pfring_device_type; typedef struct { @@ -809,15 +808,19 @@ /* ************************************************* */ #define DNA_CLUSTER_MAX_NUM_SLAVES 32 +#define DNA_CLUSTER_MAX_HP_DIR_LEN 256 +#define DNA_CLUSTER_OPT_HUGEPAGES 1 << 2 /* from pfring_zero.h (TO FIX) */ struct create_dna_cluster_info { u_int32_t cluster_id; u_int32_t mode; /* socket_mode */ + u_int32_t options; u_int32_t num_slots; /* total number of rx/tx nic/slaves slots */ u_int32_t num_slaves; u_int32_t slave_mem_len; /* per slave shared memory size */ u_int32_t master_persistent_mem_len; - u_int32_t recovered; /* fresh or recovered */ + char hugepages_dir[DNA_CLUSTER_MAX_HP_DIR_LEN]; + u_int32_t recovered; /* fresh or recovered */ u_int64_t dma_addr[]; }; @@ -826,6 +829,9 @@ u_int32_t slave_id; u_int32_t auto_slave_id; /* ask for the next free id (bool) */ u_int32_t mode; /* socket_mode */ + u_int32_t options; + u_int32_t slave_mem_len; + char hugepages_dir[DNA_CLUSTER_MAX_HP_DIR_LEN]; }; struct dna_cluster_global_stats { @@ -979,6 +985,7 @@ u_int32_t id; u_int32_t num_slaves; socket_mode mode; + u_int32_t options; u_int8_t master; u_int8_t active_slaves[DNA_CLUSTER_MAX_NUM_SLAVES]; @@ -988,6 +995,8 @@ u_int32_t slave_shared_memory_len; /* per slave len */ char *shared_memory; + char hugepages_dir[DNA_CLUSTER_MAX_HP_DIR_LEN]; + u_int32_t master_persistent_memory_len; char *master_persistent_memory; struct dna_cluster_global_stats *stats; | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/kernel/pf_ring.c ^ |
@@ -1,7 +1,6 @@ /* *************************************************************** * - * (C) 2004-12 - Luca Deri <deri@ntop.org> - * Alfredo Cardigliano <cardigliano@ntop.org> + * (C) 2004-13 - ntop.org * * This code includes contributions courtesy of * - Amit D. Chaudhary <amit_ml@rajgad.com> @@ -44,6 +43,7 @@ * - Eric Leblond <eric@regit.org> * - Momina Khan <momina.azam@gmail.com> * - XTao <xutao881001@gmail.com> + * - James Juran <james.juran@mandiant.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -655,6 +655,10 @@ if(pfr->header_len == long_pkt_header) real_slot_size += hdr->extended_hdr.parsed_header_len; + /* padding at the end of the packet (magic number added on insert) */ + real_slot_size += sizeof(u_int16_t); + real_slot_size = ALIGN(real_slot_size, sizeof(u_int64_t)); + if((off + real_slot_size + pfr->slots_info->slot_len) > (pfr->slots_info->tot_mem - sizeof(FlowSlotInfo))) { return 0; } @@ -969,7 +973,7 @@ dev_family = "Intel igb"; break; break; case intel_igb_82580: - dev_family = "Intel igb 82580"; break; + dev_family = "Intel igb 82580/i350 HW TS"; break; break; case intel_ixgbe: dev_family = "Intel ixgbe"; break; @@ -980,6 +984,9 @@ case intel_ixgbe_82599: dev_family = "Intel ixgbe 82599"; break; break; + case intel_ixgbe_82599_ts: + dev_family = "Silicom ixgbe 82599 HW TS"; break; + break; } } else { switch(dev_ptr->device_type) { @@ -1655,6 +1662,11 @@ the_slot_len = pfr->slot_header_len + pfr->bucket_len; + if(unlikely((UINT_MAX - sizeof(FlowSlotInfo)) / the_slot_len < min_num_slots)) { + printk("[PF_RING] ERROR: min_num_slots (%u, slot len = %u) causes memory size to wrap\n", min_num_slots, the_slot_len); + return(-1); + } + tot_mem = sizeof(FlowSlotInfo) + (min_num_slots * the_slot_len); /* Memory is already zeroed */ @@ -2782,23 +2794,25 @@ if((vlan_get_tag(skb, &vlan_tci) == 0) /* The packet is tagged... */ && (hdr->extended_hdr.parsed_pkt.offset.vlan_offset == 0) /* but we have seen no tag -> it has been stripped */) { /* VLAN-tagged packet with stripped VLAN tag */ - u_int16_t *b; - struct vlan_ethhdr *v = vlan_eth_hdr(skb); + u_int16_t *b; + struct vlan_ethhdr *v = vlan_eth_hdr(skb); - hdr->extended_hdr.parsed_pkt.vlan_id = vlan_tci, hdr->extended_hdr.parsed_pkt.offset.vlan_offset += sizeof(struct ethhdr), - hdr->extended_hdr.parsed_pkt.offset.l3_offset += sizeof(struct eth_vlan_hdr); - - if(hdr->extended_hdr.parsed_pkt.offset.l4_offset) hdr->extended_hdr.parsed_pkt.offset.l4_offset += sizeof(struct eth_vlan_hdr); - if(hdr->extended_hdr.parsed_pkt.offset.payload_offset) hdr->extended_hdr.parsed_pkt.offset.payload_offset += sizeof(struct eth_vlan_hdr); - - skb_copy_bits(skb, -displ, &ring_bucket[pfr->slot_header_len + offset], displ); - b = (u_int16_t*)&ring_bucket[pfr->slot_header_len + offset+12]; - b[0] = ntohs(ETH_P_8021Q), b[1] = ntohs(vlan_tci), b[2] = v->h_vlan_proto; - if(skb_copy_bits(skb, 0, &ring_bucket[pfr->slot_header_len + offset + 18], hdr->caplen-16) < 0) - printk("[PF_RING] --> FAULT [skb->len=%u][len=%u]\n", skb->len, hdr->caplen-16); - } else { - skb_copy_bits(skb, -displ, &ring_bucket[pfr->slot_header_len + offset], hdr->caplen); - } + hdr->extended_hdr.parsed_pkt.vlan_id = vlan_tci, hdr->extended_hdr.parsed_pkt.offset.vlan_offset += sizeof(struct ethhdr), + hdr->extended_hdr.parsed_pkt.offset.l3_offset += sizeof(struct eth_vlan_hdr); + + if(hdr->extended_hdr.parsed_pkt.offset.l4_offset) hdr->extended_hdr.parsed_pkt.offset.l4_offset += sizeof(struct eth_vlan_hdr); + if(hdr->extended_hdr.parsed_pkt.offset.payload_offset) hdr->extended_hdr.parsed_pkt.offset.payload_offset += sizeof(struct eth_vlan_hdr); + + skb_copy_bits(skb, -displ, &ring_bucket[pfr->slot_header_len + offset], displ); + b = (u_int16_t*)&ring_bucket[pfr->slot_header_len + offset+12]; + b[0] = ntohs(ETH_P_8021Q), b[1] = ntohs(vlan_tci), b[2] = v->h_vlan_proto; + if(skb_copy_bits(skb, 0, &ring_bucket[pfr->slot_header_len + offset + 18], hdr->caplen-14) < 0) + printk("[PF_RING] --> FAULT [skb->len=%u][len=%u]\n", skb->len, hdr->caplen-16); + + hdr->len += sizeof(struct eth_vlan_hdr); + hdr->caplen = min_val(pfr->bucket_len - offset, hdr->caplen + sizeof(struct eth_vlan_hdr)); + } else + skb_copy_bits(skb, -displ, &ring_bucket[pfr->slot_header_len + offset], hdr->caplen); } else { if(hdr->extended_hdr.parsed_header_len >= pfr->bucket_len) { static u_char print_once = 0; @@ -2845,6 +2859,7 @@ memcpy(ring_bucket, hdr, pfr->slot_header_len); /* Copy extended packet header */ + memset(&ring_bucket[pfr->slot_header_len + offset + hdr->caplen], RING_MAGIC_VALUE, sizeof(u_int16_t)); pfr->slots_info->insert_off = get_next_slot_offset(pfr, off); if(unlikely(enable_debug)) @@ -3853,12 +3868,12 @@ pfr->num_rx_channels = num_rx_channels; /* Constantly updated */ hdr->extended_hdr.parsed_pkt.last_matched_rule_id = (u_int16_t)-1; - atomic_set(&pfr->num_ring_users, 1); + atomic_inc(&pfr->num_ring_users); /* [1] BPF Filtering */ if(pfr->bpfFilter != NULL) { if(bpf_filter_skb(skb, pfr, displ) == 0) { - atomic_set(&pfr->num_ring_users, 0); + atomic_dec(&pfr->num_ring_users); return(-1); } } @@ -3932,7 +3947,7 @@ if(free_parse_mem) free_parse_memory(parse_memory_buffer); - atomic_set(&pfr->num_ring_users, 0); + atomic_dec(&pfr->num_ring_users); return(-1); } @@ -3975,7 +3990,7 @@ if(unlikely(enable_debug)) printk("[PF_RING] %s() returned %d\n", __FUNCTION__, rc); - atomic_set(&pfr->num_ring_users, 0); + atomic_dec(&pfr->num_ring_users); return(rc); } @@ -4277,8 +4292,7 @@ could receive the packet: if none just stop here */ if(ring_table_size == 0) { - /* if(unlikely(enable_debug)) printk("[PF_RING] (0) %s(): returned %d\n", __FUNCTION__, rc); */ - return(rc); + return(0); } // prefetch(skb->data); @@ -4304,8 +4318,7 @@ && (skb->dev && (skb->dev->ifindex < MAX_NUM_IFIDX) && (num_rings_per_device[skb->dev->ifindex] == 0))) { - /* if(unlikely(enable_debug)) printk("[PF_RING] (1) %s(): returned %d\n", __FUNCTION__, rc); */ - return(rc); + return(0); } #ifdef PROFILING @@ -4325,9 +4338,6 @@ but we decided not to handle transmitted packets. */ - rc = 0; - - if(unlikely(enable_debug)) printk("[PF_RING] (2) %s(): returned %d\n", __FUNCTION__, rc); return(0); } @@ -4387,8 +4397,6 @@ skb = skk = defrag_skb(skb, displ, &hdr, &defragmented_skb); if(skb == NULL) { - rc = 0; - if(unlikely(enable_debug)) printk("[PF_RING] (3) %s(): returned %d\n", __FUNCTION__, rc); return(0); } } @@ -4617,8 +4625,7 @@ /* ********************************** */ void register_device_handler(void) { - if(transparent_mode == driver2pf_ring_non_transparent - || (transparent_mode == driver2pf_ring_transparent && !enable_tx_capture)) + if(transparent_mode != standard_linux_path && !enable_tx_capture) return; prot_hook.func = packet_rcv; @@ -4629,8 +4636,7 @@ /* ********************************** */ void unregister_device_handler(void) { - if(transparent_mode == driver2pf_ring_non_transparent - || (transparent_mode == driver2pf_ring_transparent && !enable_tx_capture)) + if(transparent_mode != standard_linux_path && !enable_tx_capture) return; dev_remove_pack(&prot_hook); /* Remove protocol hook */ @@ -4748,8 +4754,8 @@ char *dev_family = "???"; switch(info->device_type) { - case standard_nic_family: dev_family = "Standard NIC"; break; - case intel_82599_family: dev_family = "Intel 82599"; break; + case standard_nic_family: dev_family = "Standard NIC"; break; + case intel_82599_family: dev_family = "Intel 82599"; break; } rlen = sprintf(buf, "Name: %s\n", info->device_name); @@ -5173,6 +5179,7 @@ static struct dna_cluster* dna_cluster_create(u_int32_t dna_cluster_id, u_int32_t num_slots, u_int32_t num_slaves, u_int32_t slave_mem_len, u_int32_t master_persistent_mem_len, socket_mode mode, + u_int32_t options, char *hugepages_dir, struct device *hwdev, u_int32_t slot_len, u_int32_t chunk_len, u_int32_t *recovered) { @@ -5220,12 +5227,14 @@ dnac->id = dna_cluster_id; dnac->num_slaves = num_slaves; dnac->mode = mode; + dnac->options = options; + memcpy(dnac->hugepages_dir, hugepages_dir, DNA_CLUSTER_MAX_HP_DIR_LEN); dnac->master = 0; for (i = 0; i < dnac->num_slaves; i++) dnac->active_slaves[i] = 0; - if(num_slots > 0) { + if(!(dnac->options & DNA_CLUSTER_OPT_HUGEPAGES)) { if((dnac->extra_dma_memory = allocate_extra_dma_memory(hwdev, num_slots, slot_len, chunk_len)) == NULL) { kfree(dnac); dnac = NULL; @@ -5241,16 +5250,18 @@ } } - if(num_slaves > 0) { + if(num_slaves > 0 /* when using direct forwarding num_slaves could also be 0 */) { dnac->slave_shared_memory_len = PAGE_ALIGN(slave_mem_len); - shared_mem_size = dnac->slave_shared_memory_len * num_slaves; - if((dnac->shared_memory = allocate_shared_memory(&shared_mem_size)) == NULL) { - printk("[PF_RING] %s() ERROR: not enough memory for DNA Cluster shared memory\n", __FUNCTION__); - if(num_slots > 0) - free_extra_dma_memory(dnac->extra_dma_memory); - kfree(dnac); - dnac = NULL; - goto unlock; + if (!(dnac->options & DNA_CLUSTER_OPT_HUGEPAGES)) { + shared_mem_size = dnac->slave_shared_memory_len * num_slaves; + if((dnac->shared_memory = allocate_shared_memory(&shared_mem_size)) == NULL) { + printk("[PF_RING] %s() ERROR: not enough memory for DNA Cluster shared memory\n", __FUNCTION__); + if(!(dnac->options & DNA_CLUSTER_OPT_HUGEPAGES)) + free_extra_dma_memory(dnac->extra_dma_memory); + kfree(dnac); + dnac = NULL; + goto unlock; + } } } @@ -5258,8 +5269,9 @@ shared_mem_size = dnac->master_persistent_memory_len; if((dnac->master_persistent_memory = allocate_shared_memory(&shared_mem_size)) == NULL) { printk("[PF_RING] %s() ERROR: not enough memory for DNA Cluster persistent memory\n", __FUNCTION__); - vfree(dnac->shared_memory); - if(num_slots > 0) + if (dnac->shared_memory != NULL) + vfree(dnac->shared_memory); + if(!(dnac->options & DNA_CLUSTER_OPT_HUGEPAGES)) free_extra_dma_memory(dnac->extra_dma_memory); kfree(dnac); dnac = NULL; @@ -5283,8 +5295,8 @@ || (num_slaves > 0 && dnac->slave_shared_memory_len != PAGE_ALIGN(slave_mem_len)) || dnac->master_persistent_memory_len != PAGE_ALIGN(master_persistent_mem_len) || dnac->mode != mode - || (num_slots > 0 && (!dnac->extra_dma_memory || dnac->extra_dma_memory->num_slots != num_slots)) - || (num_slots == 0 && dnac->extra_dma_memory && dnac->extra_dma_memory->num_slots > 0)) { + || (!(dnac->options & DNA_CLUSTER_OPT_HUGEPAGES) && (!dnac->extra_dma_memory || dnac->extra_dma_memory->num_slots != num_slots)) + || ((dnac->options & DNA_CLUSTER_OPT_HUGEPAGES) && dnac->extra_dma_memory && dnac->extra_dma_memory->num_slots > 0)) { dnac = NULL; goto unlock; } @@ -5354,7 +5366,8 @@ } static struct dna_cluster* dna_cluster_attach(u_int32_t dna_cluster_id, u_int32_t *slave_id, u_int32_t auto_slave_id, - wait_queue_head_t *slave_waitqueue, u_int32_t *mode) + wait_queue_head_t *slave_waitqueue, u_int32_t *mode, u_int32_t *options, + u_int32_t *slave_mem_len, char *hugepages_dir) { struct list_head *ptr, *tmp_ptr; struct dna_cluster *entry; @@ -5406,7 +5419,11 @@ } dnac->slave_waitqueue[*slave_id] = slave_waitqueue; + *mode = dnac->mode; + *options = dnac->options; + *slave_mem_len = dnac->slave_shared_memory_len; + memcpy(hugepages_dir, dnac->hugepages_dir, DNA_CLUSTER_MAX_HP_DIR_LEN); break; } @@ -5798,7 +5815,7 @@ /* ************************************* */ -static int do_memory_mmap(struct vm_area_struct *vma, unsigned long size, +static int do_memory_mmap(struct vm_area_struct *vma, unsigned long start_off, unsigned long size, char *ptr, u_int ptr_pg_off, u_int flags, int mode) { unsigned long start; @@ -5806,7 +5823,7 @@ /* we do not want to have this area swapped out, lock it */ vma->vm_flags |= flags; - start = vma->vm_start; + start = vma->vm_start + start_off; if(unlikely(enable_debug)) printk("[PF_RING] %s(mode=%d, size=%lu, ptr=%p)\n", __FUNCTION__, mode, size, ptr); @@ -5853,7 +5870,7 @@ { struct sock *sk = sock->sk; struct pf_ring_socket *pfr = ring_sk(sk); - int rc; + int i, rc; unsigned long mem_id = vma->vm_pgoff; /* using vm_pgoff as memory id */ unsigned long size = (unsigned long)(vma->vm_end - vma->vm_start); @@ -5879,7 +5896,7 @@ if(mem_id < pfr->dna_device->mem_info.rx.packet_memory_num_chunks) { /* DNA: RX packet memory */ - if((rc = do_memory_mmap(vma, size, (void *)pfr->dna_device->rx_packet_memory[mem_id], 0, VM_LOCKED, 1)) < 0) + if((rc = do_memory_mmap(vma, 0, size, (void *)pfr->dna_device->rx_packet_memory[mem_id], 0, VM_LOCKED, 1)) < 0) return(rc); return(0); @@ -5889,7 +5906,7 @@ mem_id -= pfr->dna_device->mem_info.rx.packet_memory_num_chunks; - if((rc = do_memory_mmap(vma, size, (void *)pfr->dna_device->tx_packet_memory[mem_id], 0, VM_LOCKED, 1)) < 0) + if((rc = do_memory_mmap(vma, 0, size, (void *)pfr->dna_device->tx_packet_memory[mem_id], 0, VM_LOCKED, 1)) < 0) return(rc); return(0); @@ -5904,7 +5921,7 @@ if(pfr->extra_dma_memory->virtual_addr == NULL) return(-EINVAL); - if((rc = do_memory_mmap(vma, size, (void *)pfr->extra_dma_memory->virtual_addr[mem_id], 0, VM_LOCKED, 1)) < 0) + if((rc = do_memory_mmap(vma, 0, size, (void *)pfr->extra_dma_memory->virtual_addr[mem_id], 0, VM_LOCKED, 1)) < 0) return(rc); return(0); @@ -5921,14 +5938,25 @@ mem_id -= pfr->extra_dma_memory->num_chunks; } + if (pfr->dna_cluster->options & DNA_CLUSTER_OPT_HUGEPAGES) + return(-EINVAL); + if(pfr->dna_cluster->extra_dma_memory == NULL || pfr->dna_cluster->extra_dma_memory->virtual_addr == NULL) return(-EINVAL); if(mem_id >= pfr->dna_cluster->extra_dma_memory->num_chunks) return(-EINVAL); - if((rc = do_memory_mmap(vma, size, (void *)pfr->dna_cluster->extra_dma_memory->virtual_addr[mem_id], 0, VM_LOCKED, 1)) < 0) + if (size < pfr->dna_cluster->extra_dma_memory->num_chunks * pfr->dna_cluster->extra_dma_memory->chunk_len) + return(-EINVAL); + + for (i = 0; i < pfr->dna_cluster->extra_dma_memory->num_chunks; i++) { + if((rc = do_memory_mmap(vma, i * pfr->dna_cluster->extra_dma_memory->chunk_len, + pfr->dna_cluster->extra_dma_memory->chunk_len, + (void *)pfr->dna_cluster->extra_dma_memory->virtual_addr[i], + 0, VM_LOCKED, 1)) < 0) return(rc); + } return(0); } @@ -5963,7 +5991,7 @@ printk("[PF_RING] mmap [slot_len=%d][tot_slots=%d] for ring on device %s\n", pfr->slots_info->slot_len, pfr->slots_info->min_num_slots, pfr->ring_netdev->dev->name); - if((rc = do_memory_mmap(vma, size, pfr->ring_memory, 0, VM_LOCKED, 0)) < 0) + if((rc = do_memory_mmap(vma, 0, size, pfr->ring_memory, 0, VM_LOCKED, 0)) < 0) return(rc); break; @@ -5975,7 +6003,7 @@ return(-EINVAL); } - if((rc = do_memory_mmap(vma, size, (void *)pfr->dna_device->rx_descr_packet_memory, 0, VM_LOCKED, 1)) < 0) + if((rc = do_memory_mmap(vma, 0, size, (void *)pfr->dna_device->rx_descr_packet_memory, 0, VM_LOCKED, 1)) < 0) return(rc); break; @@ -5987,7 +6015,7 @@ return(-EINVAL); } - if((rc = do_memory_mmap(vma, size, (void *)pfr->dna_device->phys_card_memory, 0, (VM_RESERVED | VM_IO), 2)) < 0) + if((rc = do_memory_mmap(vma, 0, size, (void *)pfr->dna_device->phys_card_memory, 0, (VM_RESERVED | VM_IO), 2)) < 0) return(rc); break; @@ -5999,7 +6027,7 @@ return(-EINVAL); } - if((rc = do_memory_mmap(vma, size, (void *)pfr->dna_device->tx_descr_packet_memory, 0, VM_LOCKED, 1)) < 0) + if((rc = do_memory_mmap(vma, 0, size, (void *)pfr->dna_device->tx_descr_packet_memory, 0, VM_LOCKED, 1)) < 0) return(rc); break; @@ -6011,6 +6039,12 @@ return(-EINVAL); } + if (pfr->dna_cluster->options & DNA_CLUSTER_OPT_HUGEPAGES) { + if(unlikely(enable_debug)) + printk("[PF_RING] %s() failed: trying to allocate kernel memory when using hugepages", __FUNCTION__); + return(-EINVAL); + } + if(size > (pfr->dna_cluster->slave_shared_memory_len * pfr->dna_cluster->num_slaves)) { if(unlikely(enable_debug)) printk("[PF_RING] %s() failed: area too large [%ld > %d]\n", @@ -6018,7 +6052,7 @@ return(-EINVAL); } - if((rc = do_memory_mmap(vma, size, pfr->dna_cluster->shared_memory, 0, VM_LOCKED, 0)) < 0) + if((rc = do_memory_mmap(vma, 0, size, pfr->dna_cluster->shared_memory, 0, VM_LOCKED, 0)) < 0) return(rc); break; @@ -6030,6 +6064,12 @@ return(-EINVAL); } + if (pfr->dna_cluster->options & DNA_CLUSTER_OPT_HUGEPAGES) { + if(unlikely(enable_debug)) + printk("[PF_RING] %s() failed: trying to allocate kernel memory when using hugepages", __FUNCTION__); + return(-EINVAL); + } + if(size > pfr->dna_cluster->slave_shared_memory_len) { if(unlikely(enable_debug)) printk("[PF_RING] %s() failed: area too large [%ld > %d]\n", @@ -6037,7 +6077,7 @@ return(-EINVAL); } - if((rc = do_memory_mmap(vma, size, pfr->dna_cluster->shared_memory, + if((rc = do_memory_mmap(vma, 0, size, pfr->dna_cluster->shared_memory, (pfr->dna_cluster->slave_shared_memory_len / PAGE_SIZE) * pfr->dna_cluster_slave_id, VM_LOCKED, 0)) < 0) return(rc); @@ -6058,7 +6098,7 @@ return(-EINVAL); } - if((rc = do_memory_mmap(vma, size, pfr->dna_cluster->master_persistent_memory, 0, VM_LOCKED, 0)) < 0) + if((rc = do_memory_mmap(vma, 0, size, pfr->dna_cluster->master_persistent_memory, 0, VM_LOCKED, 0)) < 0) return(rc); break; @@ -7565,15 +7605,17 @@ if(pfr->dna_device == NULL || pfr->dna_device->hwdev == NULL) return(-EINVAL); - if(optlen < (sizeof(cdnaci) + sizeof(u_int64_t) * cdnaci.num_slots)) - return(-EINVAL); + if (!(cdnaci.options & DNA_CLUSTER_OPT_HUGEPAGES)) { + if(optlen < (sizeof(cdnaci) + sizeof(u_int64_t) * cdnaci.num_slots)) + return(-EINVAL); + } if(pfr->dna_cluster) /* already called */ return(-EINVAL); pfr->dna_cluster = dna_cluster_create(cdnaci.cluster_id, cdnaci.num_slots, cdnaci.num_slaves, cdnaci.slave_mem_len, cdnaci.master_persistent_mem_len, - cdnaci.mode, + cdnaci.mode, cdnaci.options, cdnaci.hugepages_dir, pfr->dna_device->hwdev, pfr->dna_device->mem_info.rx.packet_memory_slot_len, pfr->dna_device->mem_info.rx.packet_memory_chunk_len, @@ -7596,7 +7638,7 @@ } /* copying dma addresses to userspace at the end of the structure */ - if(cdnaci.num_slots > 0) { + if(!(cdnaci.options & DNA_CLUSTER_OPT_HUGEPAGES) && cdnaci.num_slots > 0) { if(copy_to_user(optval + sizeof(cdnaci), pfr->dna_cluster->extra_dma_memory->dma_addr, sizeof(u_int64_t) * cdnaci.num_slots)) { dna_cluster_remove(pfr->dna_cluster, pfr->dna_cluster_type, 0); @@ -7620,7 +7662,7 @@ return(-EFAULT); pfr->dna_cluster = dna_cluster_attach(adnaci.cluster_id, &adnaci.slave_id, adnaci.auto_slave_id, - &pfr->ring_slots_waitqueue, &adnaci.mode); + &pfr->ring_slots_waitqueue, &adnaci.mode, &adnaci.options, &adnaci.slave_mem_len, adnaci.hugepages_dir); if(pfr->dna_cluster == NULL) { if(unlikely(enable_debug)) @@ -8818,7 +8860,7 @@ #endif printk("[PF_RING] Welcome to PF_RING %s ($Revision: %s$)\n" - "(C) 2004-12 L.Deri <deri@ntop.org>\n", + "(C) 2004-13 ntop.org\n", RING_VERSION, SVN_REV); #if(LINUX_VERSION_CODE > KERNEL_VERSION(2,6,11)) | ||
[-] [+] | Added | PF_RING-5.5.2-svn.tar.bz2/package/etc ^ |
+(directory) | ||
[-] [+] | Added | PF_RING-5.5.2-svn.tar.bz2/package/etc/init ^ |
+(directory) | ||
[-] [+] | Added | PF_RING-5.5.2-svn.tar.bz2/package/etc/init.d ^ |
+(directory) | ||
[-] [+] | Added | PF_RING-5.5.2-svn.tar.bz2/package/etc/init.d/pf_ring ^ |
@@ -0,0 +1,98 @@ +#! /bin/bash +# +# (C) 2003-13 - ntop.org +# +### BEGIN INIT INFO +# Provides: pf_ring +# Required-Start: $local_fs $remote_fs $network $syslog +# Required-Stop: $n2disk $nprobe +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start/stop pf_ring +### END INIT INFO + + +start_pf_ring() { + KERNEL_VERSION=$(uname -r) + + insmod /lib/modules/$KERNEL_VERSION/kernel/net/pf_ring/pf_ring.ko + + DNA_DRIVERS="$(/bin/ls /usr/local/pfring/drivers/DNA/|cut -d '.' -f 1)" + + for D in $DNA_DRIVERS ; do + DRIVER_CONFIG="/etc/pf_ring/dna-$D.conf" + if [ -f $DRIVER_CONFIG ]; then + PARAM="$(cat $DRIVER_CONFIG)" + # Remove the driver first as the original vanilla driver might be the one we want to overwrite + NUM="$(grep $D /proc/modules|wc -l)" + if [ $NUM -gt 0 ]; then + /sbin/rmmod $D + fi + /sbin/insmod /usr/local/pfring/drivers/DNA/$D.ko $PARAM + fi + done + + sleep 1 + + # /sbin/ifup -a + + # Enable all interfaces DNA and non DNA + INTERFACES="$(cat /proc/net/dev | grep ':' | cut -d ':' -f 1|grep -v 'lo' | tr -d '\n' | sed 's/^ //'| sed 's/ / /')" + for D in $INTERFACES ; do + /sbin/ifconfig $D up + done +} + + +stop_pf_ring() { + if [ -f /etc/init.d/nprobe ]; then + /etc/init.d/nprobe stop + sleep 2 + fi + + if [ -f /etc/init.d/n2disk ]; then + /etc/init.d/n2disk stop + sleep 2 + fi + + DNA_DRIVERS="$(/bin/ls /usr/local/pfring/drivers/DNA/|cut -d '.' -f 1)" + for D in $DNA_DRIVERS ; do + DRIVER_CONFIG="/etc/pf_ring/dna-$D.conf" + if [ -f $DRIVER_CONFIG ]; then + NUM="$(grep $D /proc/modules |wc -l)" + if [ $NUM -gt 0 ]; then + /sbin/rmmod $D + fi + fi + done + + NUM="$(grep pf_ring /proc/modules|wc -l)" + if [ $NUM -gt 0 ]; then + /sbin/rmmod pf_ring + fi +} + +######## + +INTERFACE_NAME=$2 + +case "$1" in + start) + start_pf_ring; + ;; + + stop) + stop_pf_ring; + ;; + + restart) + stop_pf_ring; + start_pf_ring; + ;; + + *) + echo "Usage: /etc/init.d/pf_ring {start|stop|restart}" + exit 1 +esac + +exit 0 | ||
[-] [+] | Added | PF_RING-5.5.2-svn.tar.bz2/package/etc/init/pf_ring.conf ^ |
@@ -0,0 +1,14 @@ +# pfring - 2003-13 (C) ntop.org + +description "PF_RING" +author "Luca Deri <deri@ntop.org> and Alfredo Cardigliano <cardigliano@ntop.org>" + +# When to start the service +start on runlevel [2345] + +# When to stop the service +stop on runlevel [016] + +# Start the process +exec /etc/init.d/pf_ring start + | ||
[-] [+] | Deleted | PF_RING-5.5.2-svn.tar.bz2/package/redhat ^ |
-(directory) | ||
[-] [+] | Deleted | PF_RING-5.5.2-svn.tar.bz2/package/redhat/Makefile ^ |
@@ -1,30 +0,0 @@ -# -# RPM Build Process -# -APPL=pfring -PLATFORM =`uname -p` -PACKAGE_VERSION=`cat ../../kernel/linux/pf_ring.h | grep RING_VERSION | head -1 | cut -d '"' -f 2` -PACKAGE=$(APPL)-$(PACKAGE_VERSION)-0.$(PLATFORM).rpm -PACKAGE_PATH=$(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(PACKAGE) - - -package: all build-rpm clean-rpm - -all: - cd ../../;make - -build-rpm: -# Do NOT build package as root (http://wiki.centos.org/HowTos/SetupRpmBuildEnvironment) -# mkdir -p $(HOME)/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} -# echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros - @rpmbuild -bb ./$(APPL).spec --define "pfring_version $(PACKAGE_VERSION)" - @echo "" - @echo "Package contents:" - @rpm -qpl $(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(PACKAGE) - @echo "The package is now available in $(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(PACKAGE)" - -cleanup-rpm: - rm -f $(PACKAGE_PATH) - rm -f $(HOME)/rpmbuild/BUILD/$(PACKAGE) - -clean-rpm: \ No newline at end of file | ||
[-] [+] | Deleted | PF_RING-5.5.2-svn.tar.bz2/package/redhat/configure ^ |
@@ -1,2842 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.63 for Makefile.in 1.0. -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# CDPATH. -$as_unset CDPATH - - -if test "x$CONFIG_SHELL" = x; then - if (eval ":") 2>/dev/null; then - as_have_required=yes -else - as_have_required=no -fi - - if test $as_have_required = yes && (eval ": -(as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=\$LINENO - as_lineno_2=\$LINENO - test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && - test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } -") 2> /dev/null; then - : -else - as_candidate_shells= - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - case $as_dir in - /*) - for as_base in sh bash ksh sh5; do - as_candidate_shells="$as_candidate_shells $as_dir/$as_base" - done;; - esac -done -IFS=$as_save_IFS - - - for as_shell in $as_candidate_shells $SHELL; do - # Try only shells that exist, to save several forks. - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { ("$as_shell") 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -_ASEOF -}; then - CONFIG_SHELL=$as_shell - as_have_required=yes - if { "$as_shell" 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -(as_func_return () { - (exit $1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = "$1" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test $exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } - -_ASEOF -}; then - break -fi - -fi - - done - - if test "x$CONFIG_SHELL" != x; then - for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi - - - if test $as_have_required = no; then - echo This script requires a shell more modern than all the - echo shells that I found on your system. Please install a - echo modern shell, or manually run the script under such a - echo shell if you do have one. - { (exit 1); exit 1; } -fi - - -fi - -fi - - - -(eval "as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0") || { - echo No shell found that supports shell functions. - echo Please tell bug-autoconf@gnu.org about your system, - echo including any error possibly output before this message. - echo This can help us improve future autoconf versions. - echo Configuration will now proceed without shell functions. -} - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - - -exec 7<&0 </dev/null 6>&1 - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Identity of this package. -PACKAGE_NAME='Makefile.in' -PACKAGE_TARNAME='makefile-in' -PACKAGE_VERSION='1.0' -PACKAGE_STRING='Makefile.in 1.0' -PACKAGE_BUGREPORT='' - -ac_subst_vars='LTLIBOBJS -LIBOBJS -KERNEL -DATE -EXTN -VERS -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -' - ac_precious_vars='build_alias -host_alias -target_alias' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { $as_echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { $as_echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 - { (exit 1); exit 1; }; } ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; } -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - { $as_echo "$as_me: error: working directory cannot be determined" >&2 - { (exit 1); exit 1; }; } -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 - { (exit 1); exit 1; }; } - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 - { (exit 1); exit 1; }; } - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures Makefile.in 1.0 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/makefile-in] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of Makefile.in 1.0:";; - esac - cat <<\_ACEOF - -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -Makefile.in configure 1.0 -generated by GNU Autoconf 2.63 - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by Makefile.in $as_me 1.0, which was -generated by GNU Autoconf 2.63. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" -done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args '$ac_arg'" - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) $as_unset $ac_var ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## -## File substitutions. ## -## ------------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - ac_site_file1=$CONFIG_SITE -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test -r "$ac_site_file"; then - { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - - - - - - - - - - - - - - - - - - - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -VERS=`cat ../../kernel/linux/pf_ring.h | grep RING_VERSION | head -1 | cut -d '"' -f 2` -MACHINE=`uname -m` - -if test $MACHINE = "x86_64"; then - EXTN="amd64" -else - EXTN="i386" -fi - -DATE=`date -R` -KERNEL=`uname -r` - - - - - - -ac_config_files="$ac_config_files pfring.spec" - - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) $as_unset $ac_var ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && - { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file - else - { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -:mline -/\\$/{ - N - s,\\\n,, - b mline -} -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.h` - - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: ${CONFIG_STATUS=./config.status} -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# CDPATH. -$as_unset CDPATH - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 - -# Save the log message, to keep $[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by Makefile.in $as_me 1.0, which was -generated by GNU Autoconf 2.63. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTION]... [FILE]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Report bugs to <bug-autoconf@gnu.org>." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_version="\\ -Makefile.in config.status 1.0 -configured by $0, generated by GNU Autoconf 2.63, - with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2008 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" - ac_need_defaults=false;; - --he | --h | --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { $as_echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "pfring.spec") CONFIG_FILES="$CONFIG_FILES pfring.spec" ;; - - *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= - trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status -' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || -{ - $as_echo "$as_me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=' ' -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\).*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\).*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' <conf$$subs.awk | sed ' -/^[^""]/{ - N - s/\n// -} -' >>$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 -$as_echo "$as_me: error: could not setup config files machinery" >&2;} - { (exit 1); exit 1; }; } -_ACEOF - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ -s/:*$// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - - -eval set X " :F $CONFIG_FILES " -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 -$as_echo "$as_me: error: invalid tag $ac_tag" >&2;} - { (exit 1); exit 1; }; };; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} - { (exit 1); exit 1; }; };; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - ac_file_inputs="$ac_file_inputs '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - { as_dir="$ac_dir" - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= - -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p -' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} - - rm -f "$tmp/stdin" - case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; - esac \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } - ;; - - - - esac - -done # for ac_tag - - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - | ||
[-] [+] | Deleted | PF_RING-5.5.2-svn.tar.bz2/package/redhat/configure.in ^ |
@@ -1,22 +0,0 @@ -AC_INIT([Makefile.in], 1.0) - -VERS=`cat ../../kernel/linux/pf_ring.h | grep RING_VERSION | head -1 | cut -d '"' -f 2` -MACHINE=`uname -m` - -if test $MACHINE = "x86_64"; then - EXTN="amd64" -else - EXTN="i386" -fi - -DATE=`date -R` -KERNEL=`uname -r` - -AC_SUBST(VERS) -AC_SUBST(EXTN) -AC_SUBST(DATE) -AC_SUBST(KERNEL) - -AC_CONFIG_FILES(pfring.spec) - -AC_OUTPUT | ||
[-] [+] | Deleted | PF_RING-5.5.2-svn.tar.bz2/package/redhat/pfring.spec.in ^ |
@@ -1,75 +0,0 @@ -Summary: PF_RING network probe -Name: pfring -Version: @VERS@ -Release: 0 -License: GPL -Group: Networking/Utilities -URL: http://www.ntop.org/nProbe.html -Packager: Luca Deri <deri@ntop.org> -# Temporary location where the RPM will be built -BuildRoot: %{_tmppath}/%{name}-%{version}-root -# - -%description -PF_RING kernel module and drivers for high-speed RX/TX package processing - -%install -PATH=/usr/bin:/bin:/usr/sbin:/sbin -if [ -d $RPM_BUILD_ROOT ]; then - \rm -rf $RPM_BUILD_ROOT -fi -mkdir -p $RPM_BUILD_ROOT/usr/local/PF_RING -mkdir -p $RPM_BUILD_ROOT/usr/local/PF_RING/kernel -mkdir -p $RPM_BUILD_ROOT/usr/local/include/linux -mkdir -p $RPM_BUILD_ROOT/usr/local/lib -mkdir -p $RPM_BUILD_ROOT/usr/local/PF_RING/drivers/DNA -mkdir -p $RPM_BUILD_ROOT/usr/local/PF_RING/bin -# Kernel module -cp $HOME/PF_RING/kernel/pf_ring.ko $RPM_BUILD_ROOT/usr/local/PF_RING/kernel -cp $HOME/PF_RING/kernel/linux/pf_ring.h $RPM_BUILD_ROOT/usr/local/include/linux/ -# Userland -cp $HOME/PF_RING/userland/lib/libpfring.a $RPM_BUILD_ROOT/usr/local/lib -cp $HOME/PF_RING/userland/lib/libpfring.so $RPM_BUILD_ROOT/usr/local/lib -cp $HOME/PF_RING/userland/lib/pfring.h $RPM_BUILD_ROOT/usr/local/include -cp $HOME/PF_RING/userland/libpcap/libpcap.a $RPM_BUILD_ROOT/usr/local/lib -cp $HOME/PF_RING/userland/examples/pfcount $RPM_BUILD_ROOT/usr/local/PF_RING/bin -cp $HOME/PF_RING/userland/examples/pfsend $RPM_BUILD_ROOT/usr/local/PF_RING/bin -cp $HOME/PF_RING/userland/examples/pfdnabounce $RPM_BUILD_ROOT/usr/local/PF_RING/bin -cp $HOME/PF_RING/README.FIRST $RPM_BUILD_ROOT/usr/local/PF_RING/ -# DNA Drivers -cp $HOME/PF_RING/drivers/DNA/ixgbe-3.7.17-DNA/src/ixgbe.ko $RPM_BUILD_ROOT/usr/local/PF_RING/drivers/DNA -cp $HOME/PF_RING/drivers/DNA/igb-3.4.7-DNA/src/igb.ko $RPM_BUILD_ROOT/usr/local/PF_RING/drivers/DNA -cp $HOME/PF_RING/drivers/DNA/e1000e-2.0.0.1-DNA/src/e1000e.ko $RPM_BUILD_ROOT/usr/local/PF_RING/drivers/DNA -cp $HOME/PF_RING/drivers/DNA/README.DNA $RPM_BUILD_ROOT/usr/local/PF_RING/drivers/DNA - - -# Clean out our build directory -%clean -rm -fr $RPM_BUILD_ROOT - -%files -/usr/local/PF_RING/kernel/pf_ring.ko -/usr/local/include/linux/pf_ring.h -/usr/local/lib/libpfring.a -/usr/local/lib/libpfring.so -/usr/local/lib/libpcap.a -/usr/local/include/pfring.h -/usr/local/PF_RING/drivers/DNA/README.DNA -/usr/local/PF_RING/drivers/DNA/ixgbe.ko -/usr/local/PF_RING/drivers/DNA/igb.ko -/usr/local/PF_RING/drivers/DNA/e1000e.ko -/usr/local/PF_RING/bin/pfcount -/usr/local/PF_RING/bin/pfsend -/usr/local/PF_RING/bin/pfdnabounce -/usr/local/PF_RING/README.FIRST - -# Set the default attributes of all of the files specified to have an -# owner and group of root and to inherit the permissions of the file -# itself. -%defattr(-, root, root) - -%changelog -* Sat Mar 10 2012 Luca Deri <deri@ntop.org> -- Original upstream version - - | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/package/rpm/pfring.spec.in ^ |
@@ -25,18 +25,22 @@ mkdir -p $RPM_BUILD_ROOT/usr/local/lib mkdir -p $RPM_BUILD_ROOT/usr/local/pfring/drivers/DNA mkdir -p $RPM_BUILD_ROOT/usr/local/bin +mkdir -p $RPM_BUILD_ROOT/etc/init.d +mkdir -p $RPM_BUILD_ROOT/etc/init # Kernel module cp $HOME/PF_RING/kernel/pf_ring.ko $RPM_BUILD_ROOT/usr/local/pfring/kernel cp $HOME/PF_RING/kernel/linux/pf_ring.h $RPM_BUILD_ROOT/usr/local/include/linux/ # Userland -cp $HOME/PF_RING/README.FIRST $RPM_BUILD_ROOT/usr/local/pfring/ +cp $HOME/PF_RING/README.FIRST $RPM_BUILD_ROOT/usr/local/pfring/ cp $HOME/PF_RING/userland/snort/pfring-daq-module/README.1st $RPM_BUILD_ROOT/usr/local/pfring/README-DAQ.1st -cp $HOME/PF_RING/userland/lib/libpfring.a $RPM_BUILD_ROOT/usr/local/lib -cp $HOME/PF_RING/userland/lib/libpfring.so $RPM_BUILD_ROOT/usr/local/lib -cp $HOME/PF_RING/userland/lib/pfring.h $RPM_BUILD_ROOT/usr/local/include -cp $HOME/PF_RING/userland/libpcap/libpcap.a $RPM_BUILD_ROOT/usr/local/lib -cp $HOME/PF_RING/userland/examples/pfcount $RPM_BUILD_ROOT/usr/local/bin -cp $HOME/PF_RING/userland/examples/pfsend $RPM_BUILD_ROOT/usr/local/bin +cp $HOME/PF_RING/userland/lib/libpfring.a $RPM_BUILD_ROOT/usr/local/lib +cp $HOME/PF_RING/userland/lib/libpfring.so $RPM_BUILD_ROOT/usr/local/lib +cp $HOME/PF_RING/userland/lib/pfring.h $RPM_BUILD_ROOT/usr/local/include +cp $HOME/PF_RING/userland/libpcap/libpcap.a $RPM_BUILD_ROOT/usr/local/lib +cp $HOME/PF_RING/userland/examples/pfcount $RPM_BUILD_ROOT/usr/local/bin +cp $HOME/PF_RING/userland/examples/pfsend $RPM_BUILD_ROOT/usr/local/bin +cp $HOME/PF_RING/package/etc/init.d/pf_ring $RPM_BUILD_ROOT/etc/init.d +cp $HOME/PF_RING/package/etc/init/pf_ring.conf $RPM_BUILD_ROOT/etc/init # DNA mkdir -p $RPM_BUILD_ROOT/usr/local/lib/daq #cp $HOME/PF_RING/userland/snort/pfring-daq-module/.libs/daq_pfring.la $RPM_BUILD_ROOT/usr/local/lib/daq @@ -81,6 +85,8 @@ /usr/local/bin/pfsend /usr/local/pfring/README.FIRST /usr/local/pfring/README-DAQ.1st +/etc/init.d/pf_ring +/etc/init/pf_ring.conf # Set the default attributes of all of the files specified to have an # owner and group of root and to inherit the permissions of the file | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/package/ubuntu/debian/postinst ^ |
@@ -2,4 +2,7 @@ /sbin/depmod +echo "Adding the pf_ring startup script" +update-rc.d pf_ring defaults 30 >/dev/null + exit 0 | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/package/ubuntu/debian/postrm ^ |
@@ -1,4 +1,7 @@ #!/bin/sh +if [ "$1" = "purge" ] ; then + update-rc.d pf_ring remove >/dev/null +fi exit 0 | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/package/ubuntu/debian/prerm ^ |
@@ -1,4 +1,5 @@ #! /bin/sh -/sbin/rmmod pfring +/etc/init.d/pf_ring stop + exit 0 \ No newline at end of file | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/package/ubuntu/debian/rules ^ |
@@ -40,8 +40,10 @@ dh_installman # dh_installdebconf -n # Install sources - cp -r ./debian/usr ./debian/lib ./debian/tmp/ + cp -r ./debian/usr ./debian/lib ../etc ./debian/tmp/ -find ./debian/tmp -name "\.svn" -type d -exec /bin/rm -rf {} ';' + -find ./debian/tmp -name "*~" -type d -exec /bin/rm -rf {} ';' + rm -rf ./debian/tmp/etc/init dh_link dh_strip dh_compress | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/examples/Makefile.in ^ |
@@ -22,7 +22,7 @@ # # PF_RING aware libpcap # -O_FLAG = -O2 -DHAVE_PF_RING +O_FLAG = -O2 -DHAVE_PF_RING @HAVE_QAT@ EXTRA_LIBS = PCAPDIR = ../libpcap-1.1.1-ring LIBPCAP = ${PCAPDIR}/libpcap.a ${EXTRA_LIBS} @@ -65,7 +65,7 @@ PFPROGS += pfdnabounce pfdnacluster_master pfdnacluster_multithread pfdnacluster_mt_rss_frwd endif -PCAPPROGS = pcount pwrite +PCAPPROGS = pcount pfwrite TARGETS = ${PFPROGS} ${PCAPPROGS} RCOBJS = ringc.o interval.o @@ -147,8 +147,8 @@ alldevs: alldevs.o ${LIBPCAP} ${LIBPFRING} ${CC} ${CFLAGS} alldevs.o ${LIBPCAP} ${LIBS} -o $@ -pwrite: pwrite.o ${LIBPCAP} ${LIBPFRING} - ${CC} ${CFLAGS} pwrite.o ${LIBPCAP} ${LIBS} -o $@ +pfwrite: pfwrite.o ${LIBPCAP} ${LIBPFRING} + ${CC} ${CFLAGS} pfwrite.o ${LIBPCAP} ${LIBS} -o $@ pfsystest: pfsystest.o ${LIBPFRING} ${CC} ${CFLAGS} pfsystest.o ${LIBS} -o $@ | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/examples/pcount.c ^ |
@@ -288,6 +288,14 @@ if(numPkts == 0) gettimeofday(&startTime, NULL); numPkts++, numBytes += h->len; + + if(verbose == 2) { + int i; + + for(i = 0; i < h->caplen; i++) + printf("%02X ", p[i]); + printf("\n"); + } } /* *************************************** */ @@ -324,12 +332,13 @@ char errbuf[PCAP_ERRBUF_SIZE]; pcap_if_t *devpointer; - printf("pcount\n(C) 2003-12 Deri Luca <deri@ntop.org>\n"); + printf("pcount\n(C) 2003-13 Deri Luca <deri@ntop.org>\n"); printf("-h [Print help]\n"); printf("-i <device> [Device name]\n"); printf("-f <filter> [pcap filter]\n"); printf("-l <len> [Capture length]\n"); - printf("-v [Verbose]\n"); + printf("-S [Do not strip hw timestamps (if present)]\n"); + printf("-v <mode> [Verbose [1: verbose, 2: very verbose (print packet payload)]]\n"); if(pcap_findalldevs(&devpointer, errbuf) == 0) { int i = 0; @@ -349,6 +358,7 @@ char errbuf[PCAP_ERRBUF_SIZE]; int promisc, snaplen = DEFAULT_SNAPLEN;; struct bpf_program fcode; + u_int8_t dont_strip_hw_ts = 0; #if 0 struct sched_param schedparam; @@ -388,7 +398,7 @@ startTime.tv_sec = 0; thiszone = gmt2local(0); - while((c = getopt(argc,argv,"hi:l:vf:")) != '?') { + while((c = getopt(argc,argv,"hi:l:v:f:S")) != '?') { if((c == 255) || (c == -1)) break; switch(c) { @@ -403,11 +413,14 @@ snaplen = atoi(optarg); break; case 'v': - verbose = 1; + verbose = atoi(optarg); break; case 'f': bpfFilter = strdup(optarg); break; + case 'S': + dont_strip_hw_ts = 1; + break; } } @@ -417,6 +430,9 @@ return(-1); } } + + if(!dont_strip_hw_ts) setenv("PCAP_PF_RING_STRIP_HW_TIMESTAMP", "1", 1); + printf("Capturing from %s\n", device); /* hardcode: promisc=1, to_ms=500 */ | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/examples/pfbridge.c ^ |
@@ -49,6 +49,7 @@ printf("-a <device> [First device name]\n"); printf("-b <device> [Second device name]\n"); printf("-g <core_id> Bind this app to a core\n"); + printf("-w <watermark> Watermark\n"); } /* ******************************** */ @@ -71,6 +72,7 @@ u_int8_t verbose = 0, use_pfring_send = 0; int a_ifindex, b_ifindex; int bind_core = -1; + u_int16_t watermark = 1; while((c = getopt(argc,argv, "ha:b:c:fvpg:")) != -1) { switch(c) { @@ -93,6 +95,9 @@ case 'g': bind_core = atoi(optarg); break; + case 'w': + watermark = atoi(optarg); + break; } } @@ -116,6 +121,7 @@ pfring_set_application_name(a_ring, "pfbridge-a"); pfring_set_direction(a_ring, rx_only_direction); pfring_set_socket_mode(a_ring, recv_only_mode); + pfring_set_poll_watermark(a_ring, watermark); pfring_get_bound_device_ifindex(a_ring, &a_ifindex); } | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/examples/pfcount.c ^ |
@@ -74,7 +74,7 @@ #endif u_int8_t wait_for_packet = 1, do_shutdown = 0, add_drop_rule = 0; -u_int8_t use_extended_pkt_header = 0, touch_payload = 0, enable_hw_timestamp = 0; +u_int8_t use_extended_pkt_header = 0, touch_payload = 0, enable_hw_timestamp = 0, dont_strip_timestamps = 0; /* *************************************** */ /* @@ -439,7 +439,6 @@ ehdr = (struct ether_header *) p; if(use_extended_pkt_header) { - printf("%s[if_index=%d]", h->extended_hdr.rx_direction ? "[RX]" : "[TX]", h->extended_hdr.if_index); @@ -513,14 +512,13 @@ } } -#if 0 - { + if(verbose == 2) { int i; - for(i = 0; i < 30 /* h->caplen */; i++) + + for(i = 0; i < h->caplen; i++) printf("%02X ", p[i]); printf("\n"); - } -#endif + } if(unlikely(add_drop_rule)) { if(h->ts.tv_sec == 0) @@ -561,7 +559,7 @@ /* *************************************** */ void printHelp(void) { - printf("pfcount - (C) 2005-12 ntop.org\n\n"); + printf("pfcount - (C) 2005-13 ntop.org\n\n"); printf("-h Print this help\n"); printf("-i <device> Device name. Use:\n" " - ethX@Y for channels\n" @@ -585,9 +583,13 @@ printf("-m Long packet header (with PF_RING extensions)\n"); printf("-r Rehash RSS packets\n"); printf("-s Enable hw timestamping\n"); + printf("-S Do not strip hw timestamps (if present)\n"); printf("-t Touch payload (for force packet load on cache)\n"); +#ifdef ENABLE_QAT_PM + printf("-x <string> Search string on payload. You can specify this option multiple times.\n"); +#endif printf("-u <1|2> For each incoming packet add a drop rule (1=hash, 2=wildcard rule)\n"); - printf("-v Verbose\n"); + printf("-v <mode> Verbose [1: verbose, 2: very verbose (print packet payload)]\n"); } /* *************************************** */ @@ -652,9 +654,14 @@ /* *************************************** */ +#define MAX_NUM_STRINGS 32 + int main(int argc, char* argv[]) { - char *device = NULL, c, buf[32], path[256] = { 0 }, - *reflector_device = NULL; + char *device = NULL, c, buf[32], path[256] = { 0 }, *reflector_device = NULL; +#ifdef ENABLE_QAT_PM + char *to_search[MAX_NUM_STRINGS] = { NULL }; + u_int num_strings_to_search = 0; +#endif u_char mac_address[6] = { 0 }; int promisc, snaplen = DEFAULT_SNAPLEN, rc; u_int clusterId = 0; @@ -705,9 +712,12 @@ startTime.tv_sec = 0; thiszone = gmt2local(0); - while((c = getopt(argc,argv,"hi:c:d:l:vae:n:w:p:b:rg:u:mts" + while((c = getopt(argc,argv,"hi:c:d:l:v:ae:n:w:p:b:rg:u:mtsS" +#ifdef ENABLE_QAT_PM + "x:" +#endif #ifdef ENABLE_BPF - "f:" + "f:" #endif )) != '?') { if((c == 255) || (c == -1)) break; @@ -745,7 +755,7 @@ num_threads = atoi(optarg); break; case 'v': - verbose = 1; + verbose = (atoi(optarg) == 1) ? 1 : 2; break; #ifdef ENABLE_BPF case 'f': @@ -773,6 +783,9 @@ case 's': enable_hw_timestamp = 1; break; + case 'S': + dont_strip_timestamps = 1; + break; case 'g': bind_core = atoi(optarg); break; @@ -788,7 +801,14 @@ break; } +#ifdef ENABLE_QAT_PM + case 'x': + if(num_strings_to_search >= MAX_NUM_STRINGS) { + printf("Too many strings specified (-x): maximum %u\n", MAX_NUM_STRINGS); + } else + to_search[num_strings_to_search++] = strdup(optarg); break; +#endif } } @@ -811,8 +831,10 @@ if(use_extended_pkt_header) flags |= PF_RING_LONG_HEADER; if(promisc) flags |= PF_RING_PROMISC; if(enable_hw_timestamp) flags |= PF_RING_HW_TIMESTAMP; + if(!dont_strip_timestamps) flags |= PF_RING_STRIP_HW_TIMESTAMP; flags |= PF_RING_DNA_SYMMETRIC_RSS; /* Note that symmetric RSS is ignored by non-DNA drivers */ + //printf("flags: %d\n", flags); pd = pfring_open(device, snaplen, flags); if(pd == NULL) { @@ -887,6 +909,20 @@ } } #endif + +#ifdef ENABLE_QAT_PM + if(num_strings_to_search > 0) { + int i; + + for(i=0; i<num_strings_to_search; i++) { + rc = pfring_search_payload(pd, to_search[i]); + if(rc < 0) + printf("pfring_search_payload() returned %d\n", rc); + else + printf("Successfully added string to search '%s'\n", to_search[i]); + } + } +#endif if(clusterId > 0) { rc = pfring_set_cluster(pd, clusterId, cluster_round_robin); | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/examples/pfcount_aggregator.c ^ |
@@ -51,7 +51,7 @@ #define ALARM_SLEEP 1 #define DEFAULT_SNAPLEN 128 #define DEFAULT_DEVICE "eth0" -#define MAX_NUM_DEVS 16 +#define MAX_NUM_DEVS 64 //#define VERBOSE_SUPPORT pfring *pd[MAX_NUM_DEVS]; | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/examples/pfcount_multichannel.c ^ |
@@ -96,7 +96,7 @@ int i; unsigned long long nBytes = 0, nPkts = 0, pkt_dropped = 0; unsigned long long nPktsLast = 0; - double pkt_thpt = 0, delta; + double pkt_thpt = 0, tot_thpt = 0, delta; if(startTime.tv_sec == 0) { gettimeofday(&startTime, NULL); @@ -129,6 +129,7 @@ diff = numPkts[i]-lastPkts[i]; nPktsLast += diff; + tot_thpt += thpt; pps = ((double)diff/(double)(delta/1000)); fprintf(stderr, "=========================\n" "Actual Stats: [channel=%d][%llu pkts][%.1f ms][%.1f pkt/sec]\n", @@ -136,7 +137,6 @@ pkt_thpt += pps; } - lastPkts[i] = numPkts[i]; } } @@ -144,8 +144,8 @@ lastTime.tv_sec = endTime.tv_sec, lastTime.tv_usec = endTime.tv_usec; fprintf(stderr, "=========================\n"); - fprintf(stderr, "Aggregate stats (all channels): [%.1f pkt/sec][%llu pkts dropped]\n", - (double)(nPktsLast*1000)/(double)delta, pkt_dropped); + fprintf(stderr, "Aggregate stats (all channels): [%.1f pkt/sec][%.2f Mbit/sec][%llu pkts dropped]\n", + (double)(nPktsLast*1000)/(double)delta, tot_thpt, pkt_dropped); fprintf(stderr, "=========================\n\n"); } @@ -626,8 +626,11 @@ printf("Capturing from %s\n", device); flags |= PF_RING_PROMISC; /* hardcode: promisc=1 */ -// flags |= PF_RING_DNA_SYMMETRIC_RSS; /* Note that symmetric RSS is ignored by non-DNA drivers */ +#if 0 flags |= PF_RING_DNA_FIXED_RSS_Q_0; +#else + flags |= PF_RING_DNA_SYMMETRIC_RSS; /* Note that symmetric RSS is ignored by non-DNA drivers */ +#endif flags |= PF_RING_LONG_HEADER; num_channels = pfring_open_multichannel(device, snaplen, flags, ring); @@ -688,7 +691,7 @@ if((rc = pfring_set_poll_watermark(ring[i], watermark)) != 0) fprintf(stderr, "pfring_set_poll_watermark returned [rc=%d][watermark=%d]\n", rc, watermark); } - +#if 0 setup_steering(ring[0], "192.168.30.207", -1); /* UTDF */ @@ -700,7 +703,7 @@ setup_steering(ring[0], "224.0.62.2", 2); /* default: should go to channel 0 */ - +#endif if(rehash_rss) pfring_enable_rss_rehash(ring[i]); | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/examples/pfdnabounce.c ^ |
@@ -69,6 +69,8 @@ }; struct dir_info dir_stats[2]; +u_int8_t handle_ts_card = 0; + /* *************************************** */ /* * The time difference in millisecond @@ -229,8 +231,19 @@ /* *************************************** */ -int dummyProcessPacketZero(u_int16_t pkt_len, u_char *pkt, const u_char *user_bytes, u_int8_t direction) { +int dummyProcessPacketZero(u_int32_t *pkt_len, u_char *pkt, const u_char *user_bytes, u_int8_t direction) { struct dir_info *di; + u_int32_t len = *pkt_len; + + if(unlikely(handle_ts_card)) { + u_int8_t ts_len = 0; + switch(pkt[len-1]) { + case 0xC3: ts_len = 9; break; + case 0xC2: ts_len = 5; break; + } + // printf("ts_len: %u\n", ts_len); + len -= ts_len; + } if (bidirectional == 2) di = (struct dir_info *) user_bytes; @@ -250,8 +263,9 @@ #endif di->numPkts++; - di->numBytes += pkt_len + 24 /* 8 Preamble + 4 CRC + 12 IFG */; + di->numBytes += len + 24 /* 8 Preamble + 4 CRC + 12 IFG */; + *pkt_len = len; return DNA_BOUNCER_PASS; } @@ -337,7 +351,7 @@ numCPU = sysconf( _SC_NPROCESSORS_ONLN ); startTime.tv_sec = 0; - while((c = getopt(argc,argv,"hai:o:m:b:c:g:fp")) != -1) { + while((c = getopt(argc,argv,"hai:o:m:b:c:g:fpt")) != -1) { switch(c) { case 'h': printHelp(); @@ -369,6 +383,9 @@ case 'p': print_interface_stats = 1; break; + case 't': + handle_ts_card = 1; + break; } } @@ -383,6 +400,8 @@ printf("Bouncing packets from %s to %s (%s)\n", in_dev, out_dev, bidirectional ? "two-way" : "one-way"); + if(handle_ts_card) printf("Stripping timestamp before bouncing packets\n"); + if(bind_mask != NULL) { char *id; if ((id = strtok(bind_mask, ":")) != NULL) | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/examples/pfsend.c ^ |
@@ -97,6 +97,43 @@ #define DEFAULT_DEVICE "eth0" /* *************************************** */ + +int is_fd_ready(int fd) { + struct timeval timeout = {0}; + fd_set fdset; + FD_ZERO(&fdset); + FD_SET(fd, &fdset); + return (select(fd+1, &fdset, NULL, NULL, &timeout) == 1); +} + +int read_packet_hex(u_char *buf, int buf_len) { + int i = 0, d, bytes = 0; + char c; + char s[3] = {0}; + + if (!is_fd_ready(fileno(stdin))) + return 0; + + while ((d = fgetc(stdin)) != EOF) { + if (d < 0) break; + c = (u_char) d; + if ((c >= '0' && c <= '9') + || (c >= 'a' && c <= 'f') + || (c >= 'A' && c <= 'F')) { + s[i&0x1] = c; + if (i&0x1) { + bytes = (i+1)/2; + sscanf(s, "%2hhx", &buf[bytes-1]); + if (bytes == buf_len) break; + } + i++; + } + } + + return bytes; +} + +/* *************************************** */ /* * The time difference in millisecond */ @@ -178,12 +215,11 @@ /* *************************************** */ void printHelp(void) { - printf("pfsend - (C) 2011 Deri Luca <deri@ntop.org>\n\n"); - + printf("pfsend - (C) 2011 Deri Luca <deri@ntop.org>\n"); + printf("Replay synthetic traffic, or a pcap, or a packet in hex format from standard input.\n\n"); printf("pfsend -i out_dev [-a] [-f <.pcap file>] [-g <core_id>] [-h]\n" " [-l <length>] [-n <num>][-r <rate>] [-m <dst MAC>]\n" " [-w <TX watermark>] [-v]\n\n"); - printf("-a Active send retry\n"); #if 0 printf("-b <cpu %%> CPU pergentage priority (0-99)\n"); @@ -248,7 +284,7 @@ /* ******************************************* */ -static void forge_udp_packet(char *buffer, u_int idx) { +static void forge_udp_packet(u_char *buffer, u_int idx) { int i; struct ip_header *ip_header; struct udp_header *udp_header; @@ -304,7 +340,7 @@ int i, verbose = 0, active_poll = 0, disable_zero_copy = 0; int use_zero_copy_tx = 0; u_int mac_a, mac_b, mac_c, mac_d, mac_e, mac_f; - char buffer[9000]; + u_char buffer[9000]; u_int32_t num_to_send = 0; int bind_core = -1; u_int16_t cpu_percentage = 0; @@ -508,10 +544,17 @@ } } else { struct packet *p = NULL, *last = NULL; + int stdin_packet_len; - for (i = 0; i < num_balanced_pkts; i++) { + if ((stdin_packet_len = read_packet_hex(buffer, sizeof(buffer))) > 0) { + send_len = stdin_packet_len; + } - forge_udp_packet(buffer, i); + for (i = 0; i < num_balanced_pkts; i++) { + + if (stdin_packet_len <= 0) + forge_udp_packet(buffer, i); + /* TODO else: reforge IP only */ p = (struct packet *) malloc(sizeof(struct packet)); if(p) { | ||
[-] [+] | Added | PF_RING-5.5.2-svn.tar.bz2/userland/examples/pfwrite.c ^ |
@@ -0,0 +1,280 @@ +#include <pcap.h> +#include <signal.h> +#include <sched.h> +#include <stdlib.h> + +#define HAVE_PCAP + +#include "pfring.h" +//#include "pfutils.c" + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <string.h> +#include <unistd.h> +#include <sys/mman.h> +#include <errno.h> +#include <sys/poll.h> +#include <time.h> +#include <netinet/in_systm.h> +#include <netinet/in.h> +#include <netinet/ip.h> +#include <netinet/ip6.h> +#include <net/ethernet.h> /* the L2 protocols */ + +unsigned long long numPkts = 0, numBytes = 0; + +#define DEFAULT_DEVICE "eth0" + +pfring *pd; +pcap_dumper_t *dumper = NULL; +FILE *dumper_fd = NULL; +int verbose = 0; +u_int32_t num_pkts=0; + +/* ******************************** */ + +void sigproc(int sig) { + static int called = 0; + + if(called) return; else called = 1; + + if(dumper) + pcap_dump_close(dumper); + else if(dumper_fd) + fclose(dumper_fd); + + pfring_close(pd); + + printf("\nSaved %d packets on disk\n", num_pkts); + exit(0); +} + +/* *************************************** */ + +void printHelp(void) { + + printf("pwrite - (C) 2003-13 Deri Luca <deri@ntop.org>\n"); + printf("-h [Print help]\n"); + printf("-i <device> [Device name]\n"); + printf("-w <dump file> [Dump file path]\n"); + printf("-d [Save packet digest instead of pcap packets]\n"); + printf("-S [Do not strip hw timestamps (if present)]\n"); + printf("\n" + "Please consider using n2disk for dumping\n" + "traces at high speed (http://www.ntop.org/products/n2disk/)\n"); +} + +/* *************************************** */ + +int32_t gmt2local(time_t t) { + int dt, dir; + struct tm *gmt, *loc; + struct tm sgmt; + + if (t == 0) + t = time(NULL); + gmt = &sgmt; + *gmt = *gmtime(&t); + loc = localtime(&t); + dt = (loc->tm_hour - gmt->tm_hour) * 60 * 60 + + (loc->tm_min - gmt->tm_min) * 60; + + /* + * If the year or julian day is different, we span 00:00 GMT + * and must add or subtract a day. Check the year first to + * avoid problems when the julian day wraps. + */ + dir = loc->tm_year - gmt->tm_year; + if (dir == 0) + dir = loc->tm_yday - gmt->tm_yday; + dt += dir * 24 * 60 * 60; + + return (dt); +} + +/* ****************************************************** */ + +/* + * A faster replacement for inet_ntoa(). + */ +char* _intoa(unsigned int addr, char* buf, u_short bufLen) { + char *cp, *retStr; + u_int byte; + int n; + + cp = &buf[bufLen]; + *--cp = '\0'; + + n = 4; + do { + byte = addr & 0xff; + *--cp = byte % 10 + '0'; + byte /= 10; + if (byte > 0) { + *--cp = byte % 10 + '0'; + byte /= 10; + if (byte > 0) + *--cp = byte + '0'; + } + *--cp = '.'; + addr >>= 8; + } while (--n > 0); + + /* Convert the string to lowercase */ + retStr = (char*)(cp+1); + + return(retStr); +} + +/* ************************************ */ + +char* intoa(unsigned int addr) { + static char buf[sizeof "ff:ff:ff:ff:ff:ff:255.255.255.255"]; + + return(_intoa(addr, buf, sizeof(buf))); +} + +/* ************************************ */ + +inline char* in6toa(struct in6_addr addr6) { + static char buf[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"]; + + snprintf(buf, sizeof(buf), + "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", + addr6.s6_addr[0], addr6.s6_addr[1], addr6.s6_addr[2], + addr6.s6_addr[3], addr6.s6_addr[4], addr6.s6_addr[5], addr6.s6_addr[6], + addr6.s6_addr[7], addr6.s6_addr[8], addr6.s6_addr[9], addr6.s6_addr[10], + addr6.s6_addr[11], addr6.s6_addr[12], addr6.s6_addr[13], addr6.s6_addr[14], + addr6.s6_addr[15]); + + return(buf); +} + +/* *************************************** */ + +int main(int argc, char* argv[]) { + char *device = NULL, c, *out_dump = NULL; + u_int flags = 0, dont_strip_hw_ts = 0, dump_digest = 0; + int32_t thiszone; + u_char *p; + struct pfring_pkthdr hdr; + + while((c = getopt(argc,argv,"hi:w:Sd")) != -1) { + switch(c) { + case 'd': + dump_digest = 1; + break; + case 'h': + printHelp(); + return(0); + break; + case 'w': + out_dump = strdup(optarg); + break; + case 'i': + device = strdup(optarg); + break; + case 'S': + dont_strip_hw_ts = 1; + break; + } + } + + if(out_dump == NULL) { + printHelp(); + return(-1); + } + + if(dump_digest) { + if((dumper_fd = fopen(out_dump, "w")) == NULL) { + printf("Unable to create dump file %s\n", out_dump); + return(-1); + } + } else { + dumper = pcap_dump_open(pcap_open_dead(DLT_EN10MB, 16384 /* MTU */), out_dump); + if(dumper == NULL) { + printf("Unable to create dump file %s\n", out_dump); + return(-1); + } + } + + memset(&hdr, 0, sizeof(hdr)); + + flags = PF_RING_PROMISC; + if(dump_digest) flags |= PF_RING_LONG_HEADER; + if(!dont_strip_hw_ts) flags |= PF_RING_STRIP_HW_TIMESTAMP; + + if((pd = pfring_open(device, 1520, flags)) == NULL) { + printf("pfring_open error [%s]\n", strerror(errno)); + return(-1); + } else + pfring_set_application_name(pd, "pwrite"); + + thiszone = gmt2local(0); + printf("Capture device: %s\n", device); + printf("Dump file path: %s\n", out_dump); + + signal(SIGINT, sigproc); + + pfring_enable_ring(pd); + + if(dumper_fd) fprintf(dumper_fd, "# Time\tLen\tEth Type\tVLAN\tL3 Proto\tSrc IP:Port\tDst IP:Port\n"); + + while(1) { + if(pfring_recv(pd, &p, 0, &hdr, 1 /* wait_for_packet */) > 0) { + if(dumper) + pcap_dump((u_char*)dumper, (struct pcap_pkthdr*)&hdr, p); + else { + u_int32_t s, usec, nsec; + + if(hdr.ts.tv_sec == 0) { + memset((void*)&hdr.extended_hdr.parsed_pkt, 0, sizeof(struct pkt_parsing_info)); + pfring_parse_pkt((u_char*)p, (struct pfring_pkthdr*)&hdr, 5, 1, 1); + } + + s = (hdr.ts.tv_sec + thiszone) % 86400; + + if(hdr.extended_hdr.timestamp_ns) { + if (pd->dna.dna_dev.mem_info.device_model != intel_igb_82580 /* other than intel_igb_82580 */) + s = ((hdr.extended_hdr.timestamp_ns / 1000000000) + thiszone) % 86400; + /* "else" intel_igb_82580 has 40 bit ts, using gettimeofday seconds: + * be careful with drifts mixing sys time and hw timestamp */ + usec = (hdr.extended_hdr.timestamp_ns / 1000) % 1000000; + nsec = hdr.extended_hdr.timestamp_ns % 1000; + } else { + usec = hdr.ts.tv_usec; + } + + fprintf(dumper_fd, "%02d:%02d:%02d.%06u%03u" + "\t%d\t%04X\t%u\t%d", + s / 3600, (s % 3600) / 60, s % 60, usec, nsec, + hdr.len, + hdr.extended_hdr.parsed_pkt.eth_type, + hdr.extended_hdr.parsed_pkt.vlan_id, + hdr.extended_hdr.parsed_pkt.l3_proto); + + if(hdr.extended_hdr.parsed_pkt.eth_type == 0x0800 /* IPv4*/ ) { + fprintf(dumper_fd, "\t%s:%d\t", intoa(hdr.extended_hdr.parsed_pkt.ipv4_src), hdr.extended_hdr.parsed_pkt.l4_src_port); + fprintf(dumper_fd, "\t%s:%d\n", intoa(hdr.extended_hdr.parsed_pkt.ipv4_dst), hdr.extended_hdr.parsed_pkt.l4_dst_port); + } else if(hdr.extended_hdr.parsed_pkt.eth_type == 0x86DD /* IPv6*/) { + fprintf(dumper_fd, "\t%s:%d", in6toa(hdr.extended_hdr.parsed_pkt.ipv6_src), hdr.extended_hdr.parsed_pkt.l4_src_port); + fprintf(dumper_fd, "\t%s:%d\n", in6toa(hdr.extended_hdr.parsed_pkt.ipv6_dst), hdr.extended_hdr.parsed_pkt.l4_dst_port); + } else + fprintf(dumper_fd, "\n"); + } + + num_pkts++; + } + } + + if(dumper) + pcap_dump_close(dumper); + else if(dumper_fd) + fclose(dumper_fd); + + pfring_close(pd); + + return(0); +} | ||
[-] [+] | Deleted | PF_RING-5.5.2-svn.tar.bz2/userland/examples/pwrite.c ^ |
@@ -1,150 +0,0 @@ -#include <pcap.h> -#include <signal.h> -#include <sched.h> -#include <stdlib.h> - -#define HAVE_PCAP - -#include "pfring.h" -//#include "pfutils.c" - -pfring *pd; -pcap_dumper_t *dumper = NULL; -int verbose = 0; -u_int32_t num_pkts=0; - -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <string.h> -#include <unistd.h> -#include <sys/mman.h> -#include <errno.h> -#include <sys/poll.h> -#include <time.h> -#include <netinet/in_systm.h> -#include <netinet/in.h> -#include <netinet/ip.h> -#include <net/ethernet.h> /* the L2 protocols */ - -unsigned long long numPkts = 0, numBytes = 0; - -#define DEFAULT_DEVICE "eth0" - -/* ******************************** */ - -void sigproc(int sig) { - static int called = 0; - - if(called) return; else called = 1; - - pcap_dump_close(dumper); - pfring_close(pd); - - printf("Saved %d packets on disk\n", num_pkts); - exit(0); -} - -/* *************************************** */ - -void printHelp(void) { - - printf("pcount\n(C) 2003-12 Deri Luca <deri@ntop.org>\n"); - printf("-h [Print help]\n"); - printf("-i <device> [Device name]\n"); - printf("-w <dump file> [Dump file path]\n"); - printf("-v [Verbose]\n"); -} - -/* *************************************** */ - -int main(int argc, char* argv[]) { - char *device = NULL, c; - -#if 0 - struct sched_param schedparam; - - schedparam.sched_priority = 99; - if(sched_setscheduler(0, SCHED_FIFO, &schedparam) == -1) { - printf("error while setting the scheduler, errno=%i\n",errno); - exit(1); - } - - mlockall(MCL_CURRENT|MCL_FUTURE); - -#define TEST_PROCESSOR_AFFINITY -#ifdef TEST_PROCESSOR_AFFINITY - { - unsigned long new_mask = 1; - unsigned int len = sizeof(new_mask); - unsigned long cur_mask; - pid_t p = 0; /* current process */ - int ret; - - ret = sched_getaffinity(p, len, NULL); - printf(" sched_getaffinity = %d, len = %u\n", ret, len); - - ret = sched_getaffinity(p, len, &cur_mask); - printf(" sched_getaffinity = %d, cur_mask = %08lx\n", ret, cur_mask); - - ret = sched_setaffinity(p, len, &new_mask); - printf(" sched_setaffinity = %d, new_mask = %08lx\n", ret, new_mask); - - ret = sched_getaffinity(p, len, &cur_mask); - printf(" sched_getaffinity = %d, cur_mask = %08lx\n", ret, cur_mask); - } -#endif -#endif - - while((c = getopt(argc,argv,"hi:w:v")) != -1) { - switch(c) { - case 'h': - printHelp(); - return(0); - break; - case 'w': - dumper = pcap_dump_open(pcap_open_dead(DLT_EN10MB, 16384 /* MTU */), optarg); - if(dumper == NULL) { - printf("Unable to open dump file %s\n", optarg); - return(-1); - } - break; - case 'i': - device = strdup(optarg); - break; - case 'v': - verbose = 1; - break; - } - } - - if(dumper == NULL) { - printHelp(); - return(-1); - } - - if((pd = pfring_open(device, 1500, PF_RING_PROMISC)) == NULL) { - printf("pfring_open error [%s]\n", strerror(errno)); - return(-1); - } else - pfring_set_application_name(pd, "pwrite"); - - printf("Capturing from %s\n", device); - - signal(SIGINT, sigproc); - - pfring_enable_ring(pd); - - while(1) { - u_char *buffer; - struct pfring_pkthdr hdr; - - if(pfring_recv(pd, &buffer, 0, &hdr, 1 /* wait_for_packet */) > 0) - pcap_dump((u_char*)dumper, (struct pcap_pkthdr*)&hdr, buffer), num_pkts++; - } - - pcap_dump_close(dumper); - pfring_close(pd); - - return(0); -} | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/COPYING ^ |
@@ -1,165 +1,502 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/Makefile.in ^ |
@@ -34,9 +34,14 @@ DAG_OBJS = @DAG_OBJS@ # +# QAT +# +QAT_OBJS = @QAT_OBJS@ + +# # Object files # -OBJS = pfring.o pfring_mod.o pfring_utils.o pfring_mod_usring.o pfring_hw_filtering.o ${ZERO_OBJS} ${DNA_OBJS} ${VIRTUAL_OBJS} ${DAG_OBJS} +OBJS = pfring.o pfring_mod.o pfring_utils.o pfring_mod_usring.o pfring_hw_filtering.o ${ZERO_OBJS} ${DNA_OBJS} ${VIRTUAL_OBJS} ${DAG_OBJS} ${QAT_OBJS} # # C compiler and flags @@ -45,9 +50,8 @@ # CROSS_COMPILE=arm-mv5sft-linux-gnueabi- # CC = ${CROSS_COMPILE}gcc -CFLAGS = @CFLAGS@ -Wall -fPIC ${INCLUDE} @HAVE_ZERO@ @HAVE_DNA@ @HAVE_VIRTUAL@ @HAVE_DAG@ @HAVE_BPF@ @HAVE_REDIRECTOR@ @HAVE_HW_TIMESTAMP@ -O2 # -g +CFLAGS = @CFLAGS@ -Wall -fPIC ${INCLUDE} @HAVE_ZERO@ @HAVE_DNA@ @HAVE_VIRTUAL@ @HAVE_DAG@ @HAVE_BPF@ @HAVE_REDIRECTOR@ @HAVE_HW_TIMESTAMP@ @HAVE_QAT@ -O2 # -g LDFLAGS = -g -shared - SYSLIBS = -lpthread @SYSLIBS@ # How to make an object file @@ -65,12 +69,12 @@ all: ${TARGETS} -${STATICLIB}: Makefile @ZERO_DEP@ @DNA_DEP@ @VIRTUAL_DEP@ ${OBJS} pfring.h ${RING_H} +${STATICLIB}: Makefile @ZERO_DEP@ @DNA_DEP@ @VIRTUAL_DEP@ @QAT_DEP@ ${OBJS} pfring.h ${RING_H} @echo "=*= making library $@ =*=" ar rs $@ ${OBJS} ranlib $@ -${DYNAMICLIB}: ${OBJS} @ZERO_DEP@ @DNA_DEP@ @VIRTUAL_DEP@ pfring.h ${RING_H} Makefile +${DYNAMICLIB}: ${OBJS} @ZERO_DEP@ @DNA_DEP@ @VIRTUAL_DEP@ @QAT_DEP@ pfring.h ${RING_H} Makefile @echo "=*= making library $@ =*=" ${CC} ${LDFLAGS} ${OBJS} ${SYSLIBS} -o $@ @@ -86,6 +90,9 @@ extract_userspace_ring_lib: ar x @USERSPACE_RING_LIB@ +extract_qat_lib: + ar x @QAT_LIB@ + install: install-static install-shared install-includes: | ||
[-] [+] | Added | PF_RING-5.5.2-svn.tar.bz2/userland/lib/README.QAT ^ |
@@ -0,0 +1,11 @@ +If you want to use Intel QAT PM with PF_RING do +cd .. +svn co https://svn.ntop.org/svn/ntop/trunk/intel/ +cd intel/qat +make +cd ../../lib + +then run ./configure again + +------------------------------------------ +January 2013 - Luca Deri <deri@ntop.org> | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/configure ^ |
@@ -620,6 +620,10 @@ ac_subst_vars='LTLIBOBJS LIBOBJS +QAT_DEP +QAT_OBJS +QAT_LIB +HAVE_QAT HAVE_HW_TIMESTAMP HAVE_REDIRECTOR SILICOM_LIBS @@ -694,6 +698,7 @@ ac_subst_files='' ac_user_opts=' enable_option_checking +enable_rdi enable_bpf ' ac_precious_vars='build_alias @@ -1314,6 +1319,7 @@ --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-rdi Disable Silicom Redirector support in PF_RING --disable-bpf Disable BPF support in PF_RING Some influential environment variables: @@ -3255,12 +3261,13 @@ if test "$GCCMAJOR" -eq 4 && test "$GCCMINOR" -ge 6; then CPUSSE42=`grep -m 1 flags /proc/cpuinfo | grep -o sse4_2` if test "$CPUSSE42" = "sse4_2"; then - CFLAGS="-march=corei7 -mtune=corei7 $CFLAGS" - LIBARCH="_corei7" CPUAVX=`grep -m 1 flags /proc/cpuinfo | grep -o avx` if test "$CPUAVX" = "avx"; then CFLAGS="-march=corei7-avx -mtune=corei7-avx $CFLAGS" LIBARCH="_corei7-avx" + else + CFLAGS="-march=corei7 -mtune=corei7 $CFLAGS" + LIBARCH="_corei7" fi fi fi @@ -3362,6 +3369,21 @@ $as_echo "no" >&6; } fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Intel QAT" >&5 +$as_echo_n "checking Intel QAT... " >&6; } +LIBQAT=../intel/qat/lib/libqat.a +if test -f $LIBQAT; then + HAVE_QAT="-D ENABLE_QAT_PM -I ../intel/qat/include" + QAT_LIB="$LIBQAT" + QAT_OBJS="ac_alg.o CpaPmAPI.o" + QAT_DEP="extract_qat_lib" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found $LIBQAT" >&5 +$as_echo "found $LIBQAT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no $LIBQAT. Please read README.QAT" >&5 +$as_echo "no $LIBQAT. Please read README.QAT" >&6; } +fi + fi for ac_header in librdi.h @@ -3377,8 +3399,15 @@ done -if test "x$ac_cv_header_librdi_h" = x""yes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rdi_init in -lrdi" >&5 +# Check whether --enable-rdi was given. +if test "${enable_rdi+set}" = set; then : + enableval=$enable_rdi; +fi + + +if test "x$enable_rdi" != "xno"; then : + if test "x$ac_cv_header_librdi_h" = x""yes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rdi_init in -lrdi" >&5 $as_echo_n "checking for rdi_init in -lrdi... " >&6; } if ${ac_cv_lib_rdi_rdi_init+:} false; then : $as_echo_n "(cached) " >&6 @@ -3424,17 +3453,18 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking Silicom Redirector support" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking Silicom Redirector support" >&5 $as_echo_n "checking Silicom Redirector support... " >&6; } - if test "x$ac_cv_lib_rdi_rdi_init" = x""yes; then : + if test "x$ac_cv_lib_rdi_rdi_init" = x""yes; then : HAVE_REDIRECTOR="-D HAVE_REDIRECTOR" SILICOM_LIBS="-lrdi" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - else + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - fi + fi + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_handle_alloc in -lnl" >&5 @@ -3542,6 +3572,10 @@ + + + + | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/configure.in ^ |
@@ -17,12 +17,13 @@ if test "$GCCMAJOR" -eq 4 && test "$GCCMINOR" -ge 6; then CPUSSE42=`grep -m 1 flags /proc/cpuinfo | grep -o sse4_2` if test "$CPUSSE42" = "sse4_2"; then - CFLAGS="-march=corei7 -mtune=corei7 $CFLAGS" - LIBARCH="_corei7" CPUAVX=`grep -m 1 flags /proc/cpuinfo | grep -o avx` if test "$CPUAVX" = "avx"; then CFLAGS="-march=corei7-avx -mtune=corei7-avx $CFLAGS" LIBARCH="_corei7-avx" + else + CFLAGS="-march=corei7 -mtune=corei7 $CFLAGS" + LIBARCH="_corei7" fi fi fi @@ -73,23 +74,39 @@ AC_MSG_RESULT(no) fi +AC_MSG_CHECKING([Intel QAT]) +LIBQAT=../intel/qat/lib/libqat.a +if test -f $LIBQAT; then + HAVE_QAT="-D ENABLE_QAT_PM -I ../intel/qat/include" + QAT_LIB="$LIBQAT" + QAT_OBJS="ac_alg.o CpaPmAPI.o" + QAT_DEP="extract_qat_lib" + AC_MSG_RESULT(found $LIBQAT) +else + AC_MSG_RESULT(no $LIBQAT. Please read README.QAT) +fi + dnl> end of pthread_setaffinity_np check fi AC_CHECK_HEADERS([librdi.h]) -dnl> Silicom Redirector NIC -if test "x$ac_cv_header_librdi_h" = x""yes; then : - AC_CHECK_LIB( [rdi], [rdi_init]) +dnl> Silicom Redirector NIC - Default enabled +AC_ARG_ENABLE([rdi], AS_HELP_STRING([--disable-rdi], [Disable Silicom Redirector support in PF_RING])) - AC_MSG_CHECKING([Silicom Redirector support]) - if test "x$ac_cv_lib_rdi_rdi_init" = x""yes; then : +if test "x$enable_rdi" != "xno"; then : + if test "x$ac_cv_header_librdi_h" = x""yes; then : + AC_CHECK_LIB( [rdi], [rdi_init]) + + AC_MSG_CHECKING([Silicom Redirector support]) + if test "x$ac_cv_lib_rdi_rdi_init" = x""yes; then : HAVE_REDIRECTOR="-D HAVE_REDIRECTOR" SILICOM_LIBS="-lrdi" AC_MSG_RESULT(yes) - else + else AC_MSG_RESULT(no) - fi + fi + fi fi AC_CHECK_LIB( [nl], [nl_handle_alloc], [SYSLIBS="$SYSLIBS -lnl"]) @@ -147,6 +164,10 @@ AC_SUBST(SILICOM_LIBS) AC_SUBST(HAVE_REDIRECTOR) AC_SUBST(HAVE_HW_TIMESTAMP) +AC_SUBST(HAVE_QAT) +AC_SUBST(QAT_LIB) +AC_SUBST(QAT_OBJS) +AC_SUBST(QAT_DEP) dnl> AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([../examples/Makefile]) | ||
Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/libs/libpfring_dna_i686.a ^ | |
Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/libs/libpfring_dna_x86_64.a ^ | |
Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/libs/libpfring_dna_x86_64_corei7-avx.a ^ | |
Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/libs/libpfring_dna_x86_64_corei7.a ^ | |
Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/libs/libpfring_mod_virtual_x86_64.a ^ | |
Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/libs/libpfring_zero_i686.a ^ | |
Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/libs/libpfring_zero_x86_64.a ^ | |
Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/libs/libpfring_zero_x86_64_corei7-avx.a ^ | |
Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/libs/libpfring_zero_x86_64_corei7.a ^ | |
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/pfring.c ^ |
@@ -1,6 +1,6 @@ /* * - * (C) 2005-12 - Luca Deri <deri@ntop.org> + * (C) 2005-13 - ntop.org * * * This program is free software; you can redistribute it and/or modify @@ -21,6 +21,10 @@ #include "pfring.h" #include <net/ethernet.h> +#ifdef ENABLE_QAT_PM +#include "pfring_qat.c" +#endif + // #define RING_DEBUG /* ********************************* */ @@ -83,7 +87,7 @@ int i = -1; int mod_found = 0; int ret; - char *str; + char *str, *str1; pfring *ring; #ifdef RING_DEBUG @@ -105,7 +109,8 @@ ring->rss_mode = (flags & PF_RING_DNA_SYMMETRIC_RSS) ? PF_RING_DNA_SYMMETRIC_RSS : 0; ring->rss_mode = (flags & PF_RING_DNA_FIXED_RSS_Q_0) ? PF_RING_DNA_FIXED_RSS_Q_0 : 0; ring->force_timestamp = (flags & PF_RING_TIMESTAMP) ? 1 : 0; - ring->enable_hw_timestamp = (flags & PF_RING_HW_TIMESTAMP) ? 1 : 0; + ring->strip_hw_timestamp = (flags & PF_RING_STRIP_HW_TIMESTAMP) ? 1 : 0; + ring->hw_ts.enable_hw_timestamp = (flags & PF_RING_HW_TIMESTAMP) ? 1 : 0; ring->tx.enabled_rx_packet_send = (flags & PF_RING_RX_PACKET_BOUNCE) ? 1 : 0; #ifdef RING_DEBUG @@ -118,19 +123,43 @@ ring->device_name = NULL; while (pfring_module_list[++i].name) { - char *str1; + str = str1 = NULL; +#ifdef HAVE_DNA + u_int8_t is_dna = 0; + if(!strcmp(pfring_module_list[i].name, "dna")) { + /* DNA module: check proc for renamed interfaces */ + FILE *proc_net_pfr; + char line[256]; + snprintf(line, sizeof(line), "/proc/net/pf_ring/dev/%s/info", device_name); + proc_net_pfr = fopen(line, "r"); + if(proc_net_pfr != NULL) { + const char *str_mode = "Polling Mode:"; + while(fgets(line, sizeof(line), proc_net_pfr) != NULL) { + char *p = &line[0]; + if (!strncmp(p, str_mode, strlen(str_mode))) { + p += strlen(str_mode); + is_dna = (strstr(p, "DNA") != NULL); + break; + } + } + } + } + if (!is_dna) /* if already recognized as dna do not check module prefix */ +#endif if(!(str = strstr(device_name, pfring_module_list[i].name))) continue; if(!pfring_module_list[i].open) continue; - - str1 = strchr(str, ':'); - + mod_found = 1; #ifdef RING_DEBUG printf("pfring_open: found module %s\n", pfring_module_list[i].name); #endif - mod_found = 1; - ring->device_name = str1 ? strdup(++str1) : strdup(device_name); + if (str != NULL) { + str1 = strchr(str, ':'); + if (str1 != NULL) str1++; + } + + ring->device_name = str1 ? strdup(str1) : strdup(device_name); ret = pfring_module_list[i].open(ring); break; } @@ -162,6 +191,14 @@ if(ring->mtu_len == 0) ring->mtu_len = 9000 /* Jumbo MTU */; ring->mtu_len += sizeof(struct ether_header); +#ifdef ENABLE_QAT_PM + ring->qat = (QAThandle*)malloc(sizeof(QAThandle)); + if(ring->qat == NULL) { + printf("[PF_RING] Not enough mempory for QAT\n"); + } else + initQAThandle((QAThandle*)ring->qat); +#endif + ring->initialized = 1; #ifdef RING_DEBUG @@ -254,6 +291,11 @@ pthread_rwlock_destroy(&ring->tx_lock); } +#ifdef ENABLE_QAT_PM + if(ring->qat) + freeHandle((QAThandle*)ring->qat); +#endif + free(ring->device_name); free(ring); } @@ -324,6 +366,22 @@ while(!ring->break_recv_loop) { rc = ring->recv(ring, &buffer, 0, &hdr, wait_for_packet); + +#ifdef ENABLE_QAT_PM + if((rc > 0) && (ring->qat != NULL)) { + QAThandle *qat = (QAThandle*)ring->qat; + + if(qat->patternId > 1) { + /* We have something to search */ + + if(checkMatch(qat, (char*)buffer, hdr.caplen) == 0) + rc = 0; + else + qat->num_filtered++; + } + } +#endif + if(rc < 0) break; else if(rc > 0) { @@ -480,8 +538,15 @@ /* **************************************************** */ int pfring_stats(pfring *ring, pfring_stat *stats) { - if(ring && ring->stats) - return ring->stats(ring, stats); + if(ring && ring->stats) { + int rc = ring->stats(ring, stats); + +#ifdef ENABLE_QAT_PM + stats->droppedbyfilter += ((QAThandle*)ring->qat)->num_filtered; +#endif + + return(rc); + } return(PF_RING_ERROR_NOT_SUPPORTED); } @@ -504,6 +569,19 @@ ring->break_recv_loop = 0; rc = ring->recv(ring, buffer, buffer_len, hdr, wait_for_incoming_packet); +#ifdef ENABLE_QAT_PM + if((rc > 0) && (ring->qat != NULL)) { + QAThandle *qat = (QAThandle*)ring->qat; + + if(qat->patternId > 1) { + /* We have something to search */ + + if(checkMatch(qat, (char*)*buffer, hdr->caplen) == 0) + return(0); + } + } +#endif + if(unlikely(ring->reflector_socket != NULL)) pfring_send(ring->reflector_socket, (char *) *buffer, hdr->caplen, 0 /* flush */); @@ -745,8 +823,16 @@ /* **************************************************** */ int pfring_set_sampling_rate(pfring *ring, u_int32_t rate /* 1 = no sampling */) { - if(ring && ring->set_sampling_rate) - return ring->set_sampling_rate(ring, rate); + if(ring && ring->set_sampling_rate) { + int rc; + + rc = ring->set_sampling_rate(ring, rate); + + if (rc == 0) + ring->sampling_rate = rate; + + return(rc); + } return(PF_RING_ERROR_NOT_SUPPORTED); } @@ -1292,3 +1378,17 @@ /* **************************************************** */ +int pfring_search_payload(pfring *ring, char *string_to_search) { + if (!ring) + return(-1); + +#ifdef ENABLE_QAT_PM + if (!ring->qat) + return(-1); + + return(addStringToSearch((QAThandle*)ring->qat, string_to_search)); +#else + return(-2); +#endif +} + | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/pfring.h ^ |
@@ -1,7 +1,6 @@ /* * - * (C) 2005-12 - Luca Deri <deri@ntop.org> - * Alfredo Cardigliano <cardigliano@ntop.org> + * (C) 2005-13 - ntop.org * * * This program is free software; you can redistribute it and/or modify @@ -47,6 +46,13 @@ #include <librdi.h> #endif +#ifdef ENABLE_QAT_PM +#include <cpa_types.h> +#include "cpa_pm.h" +#include "cpa_pm_compile.h" +#include "pfring_qat.h" +#endif + #define MAX_CAPLEN 65535 #define PAGE_SIZE 4096 @@ -112,7 +118,7 @@ /* ********************************* */ typedef struct { - u_int64_t recv, drop; + u_int64_t recv, drop, droppedbyfilter; } pfring_stat; /* ********************************* */ @@ -130,10 +136,16 @@ /* ********************************* */ struct __pfring { - u_int8_t initialized, enabled, long_header, rss_mode, force_timestamp, enable_hw_timestamp; + u_int8_t initialized, enabled, long_header, rss_mode, force_timestamp, strip_hw_timestamp; packet_direction direction; /* Specify the capture direction for packets */ socket_mode mode; + /* Hardware Timestamp */ + struct { + u_int8_t force_timestamp, is_silicom_hw_timestamp_card, enable_hw_timestamp; + u_int32_t last_hw_timestamp_sec, last_hw_timestamp_nsec; + } hw_ts; + struct { u_int8_t enabled_rx_packet_send; struct pfring_pkthdr *last_received_hdr; /* @@ -145,9 +157,10 @@ /* TODO these fields should be moved in ->priv_data */ /* DNA (Direct NIC Access) */ struct { - u_char dna_mapped_device; - u_int16_t num_rx_pkts_before_dna_sync, num_tx_pkts_before_dna_sync, - dna_rx_sync_watermark, dna_tx_sync_watermark; + u_int8_t dna_mapped_device; + u_int32_t sampling_counter; + u_int16_t num_rx_pkts_before_dna_sync, num_tx_pkts_before_dna_sync; + u_int16_t dna_rx_sync_watermark, dna_tx_sync_watermark; u_int64_t tot_dna_read_pkts, tot_dna_lost_pkts; u_int32_t rx_reg, tx_reg, last_rx_slot_read; u_int32_t num_rx_slots_per_chunk, num_tx_slots_per_chunk; @@ -251,11 +264,13 @@ filtering_mode ft_mode; pfring_device_type ft_device_type; + void *qat; /* Intel QAT PM */ /* All devices */ char *buffer, *slots, *device_name; u_int32_t caplen; u_int16_t slot_header_len, mtu_len /* 0 = unknown */; + u_int32_t sampling_rate; u_int8_t kernel_packet_consumer, is_shutting_down, socket_default_accept_policy; int fd; FlowSlotInfo *slots_info; @@ -273,14 +288,15 @@ /* ********************************* */ - #define PF_RING_DNA_SYMMETRIC_RSS 1 << 0 - #define PF_RING_REENTRANT 1 << 1 - #define PF_RING_LONG_HEADER 1 << 2 - #define PF_RING_PROMISC 1 << 3 - #define PF_RING_TIMESTAMP 1 << 4 - #define PF_RING_HW_TIMESTAMP 1 << 5 - #define PF_RING_RX_PACKET_BOUNCE 1 << 6 - #define PF_RING_DNA_FIXED_RSS_Q_0 1 << 7 + #define PF_RING_DNA_SYMMETRIC_RSS 1 << 0 + #define PF_RING_REENTRANT 1 << 1 + #define PF_RING_LONG_HEADER 1 << 2 + #define PF_RING_PROMISC 1 << 3 + #define PF_RING_TIMESTAMP 1 << 4 + #define PF_RING_HW_TIMESTAMP 1 << 5 + #define PF_RING_RX_PACKET_BOUNCE 1 << 6 + #define PF_RING_DNA_FIXED_RSS_Q_0 1 << 7 + #define PF_RING_STRIP_HW_TIMESTAMP 1 << 8 /* ********************************* */ @@ -382,7 +398,7 @@ void pfring_release_pkt_buff(pfring *ring, pfring_pkt_buff *pkt_handle); int pfring_recv_pkt_buff(pfring *ring, pfring_pkt_buff *pkt_handle, struct pfring_pkthdr *hdr, u_int8_t wait_for_incoming_packet); /* Note: this function fills the buffer pointed by pkt_handle */ int pfring_send_pkt_buff(pfring *ring, pfring_pkt_buff *pkt_handle, u_int8_t flush_packet); /* Note: this function reset the buffer pointed by pkt_handle */ - + int pfring_search_payload(pfring *ring, char *string_to_search); int pfring_register_zerocopy_tx_ring(pfring *ring, pfring *tx_ring); /* PF_RING Socket bundle */ | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/pfring_hw_filtering.h ^ |
@@ -1,7 +1,6 @@ /* * - * (C) 2011-12 - Luca Deri <deri@ntop.org> - * Alfredo Cardigliano <cardigliano@ntop.org> + * (C) 2011-13 - ntop.org * * * This program is free software; you can redistribute it and/or modify | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/pfring_mod.c ^ |
@@ -47,6 +47,8 @@ #define wmb() gcc_mb() #endif +#define ALIGN(a,b) (((a) + ((b)-1) ) & ~((b)-1)) + #if 0 unsigned long long rdtsc() { unsigned long long a; @@ -353,7 +355,7 @@ } } - pfring_enable_hw_timestamp(ring, elem, ring->enable_hw_timestamp ? 1 : 0, 0 /* TX timestamp disabled by default */); + pfring_enable_hw_timestamp(ring, elem, ring->hw_ts.enable_hw_timestamp ? 1 : 0, 0 /* TX timestamp disabled by default */); elem = strtok(NULL, ";,"); } @@ -502,6 +504,15 @@ bktLen = hdr->caplen + hdr->extended_hdr.parsed_header_len; real_slot_len = ring->slot_header_len + bktLen; + + /* padding at the end of the packet (it should contain the magic number) */ + real_slot_len += sizeof(u_int16_t); + real_slot_len = ALIGN(real_slot_len, sizeof(u_int64_t)); + +#if 0 + printf("Real slot len adjusted to %u (MAGIC=%02X)\n", real_slot_len, bucket[ring->slot_header_len + bktLen]); +#endif + if(bktLen > buffer_len) bktLen = buffer_len; if(buffer_len == 0) | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/pfring_mod.h ^ |
@@ -1,7 +1,6 @@ /* * - * (C) 2005-12 - Luca Deri <deri@ntop.org> - * Alfredo Cardigliano <cardigliano@ntop.org> + * (C) 2005-13 - ntop.org * * * This program is free software; you can redistribute it and/or modify | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/pfring_mod_dag.h ^ |
@@ -1,7 +1,6 @@ /* * - * (C) 2005-12 - Luca Deri <deri@ntop.org> - * Alfredo Cardigliano <cardigliano@ntop.org> + * (C) 2005-13 - ntop.org * * * This program is free software; you can redistribute it and/or modify | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/pfring_mod_dna.c ^ |
@@ -130,6 +130,13 @@ /* **************************************************** */ +int pfring_dna_set_sampling_rate(pfring *ring, u_int32_t rate /* 1 = no sampling */) { + /* nothing to do here, just returning success */ + return 0; +} + +/* **************************************************** */ + int pfring_dna_stats(pfring *ring, pfring_stat *stats) { stats->recv = ring->dna.tot_dna_read_pkts; stats->drop = ring->dna.tot_dna_lost_pkts; @@ -155,6 +162,16 @@ pkt = ring->dna_next_packet(ring, buffer, buffer_len, hdr); if(pkt && (hdr->len > 0)) { + + if(unlikely(ring->sampling_rate > 1)) { + if (likely(ring->dna.sampling_counter > 0)) { + ring->dna.sampling_counter--; + goto redo_pfring_recv; + } else { + ring->dna.sampling_counter = ring->sampling_rate-1; + } + } + if(buffer_len > 0) pfring_parse_pkt(*buffer, hdr, 4, 1, 1); @@ -208,6 +225,7 @@ ring->direction = rx_only_direction; ring->close = pfring_dna_close; + ring->set_sampling_rate = pfring_dna_set_sampling_rate; ring->stats = pfring_dna_stats; ring->recv = pfring_dna_recv; ring->enable_ring = pfring_dna_enable_ring; @@ -401,7 +419,7 @@ return rc; } - pfring_enable_hw_timestamp(ring, ring->device_name, ring->enable_hw_timestamp ? 1 : 0, 0 /* TX timestamp disabled by default */); + pfring_enable_hw_timestamp(ring, ring->device_name, ring->hw_ts.enable_hw_timestamp ? 1 : 0, 0 /* TX timestamp disabled by default */); #ifdef DEBUG pfring_dump_dna_stats(ring); | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/pfring_mod_dna.h ^ |
@@ -1,7 +1,6 @@ /* * - * (C) 2005-12 - Luca Deri <deri@ntop.org> - * Alfredo Cardigliano <cardigliano@ntop.org> + * (C) 2005-13 - ntop.org * * * This program is free software; you can redistribute it and/or modify | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/pfring_mod_usring.h ^ |
@@ -1,7 +1,6 @@ /* * - * (C) 2011-12 - Luca Deri <deri@ntop.org> - * Alfredo Cardigliano <cardigliano@ntop.org> + * (C) 2011-13 - ntop.org * * * This program is free software; you can redistribute it and/or modify | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/pfring_mod_virtual.h ^ |
@@ -1,10 +1,6 @@ /* * - * Copyright 2012 - ntop.org - * - * Authors: - * Alfredo Cardigliano <cardigliano@ntop.org> - * Luca Deri <deri@ntop.org> + * Copyright 2012-13 - ntop.org * */ | ||
[-] [+] | Added | PF_RING-5.5.2-svn.tar.bz2/userland/lib/pfring_qat.c ^ |
@@ -0,0 +1,143 @@ +/* + * + * (C) 2013 - ntop.org + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesses General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Part of this code has been taken from Intel QAT PM examples + * + * Many thanks to Intel and in particular + * - Joseph Gasparakis <joseph.gasparakis@intel.com> + * - James Chapman <james.p.chapman@intel.com> + */ + +#include "pfring_qat.h" + +/* *********************************************************** */ + +#define DIM(x) (sizeof(x)/sizeof(x[0])) + +static u_int32_t g_nAppMatches = 0, g_nAppCallbacks = 0; + +/* *********************************************************** */ + +void AppMatchCallback(const CpaInstanceHandle instanceHandle, + CpaPmMatchCtx *pMatchCtx) { + size_t n; + + g_nAppCallbacks++; + for(n=0; n<pMatchCtx->numMatchResults; n++) { + CpaPmMatchResult *pResult = &pMatchCtx->pMatchResult[n]; + + if(pResult->matchLength > 0) { + int *pNumMatches = (int *)pMatchCtx->userData; + + if(pNumMatches != NULL) { + g_nAppMatches += pNumMatches[pResult->patternId]; + } else + g_nAppMatches++; + } + } +} + +/* *********************************************************** */ + +void initQAThandle(QAThandle *handle) { + CpaPmSessionProperty sessionProperty = { CPA_TRUE, 1, { 1 } }; + CpaBufferList bufferList = {1, &handle->flatBuffer, NULL, NULL}; + CpaPmMatchCtx matchCtxList = { + NULL, + &handle->bufferList, + NULL, + CPA_PM_MATCH_OPTION_RESET_SESSION | CPA_PM_MATCH_OPTION_END_OF_SESSION, + AppMatchCallback, + NULL, + DIM(handle->matchResults), + handle->matchResults + }; + + memset(handle, 0, sizeof(QAThandle)); + memcpy(&handle->sessionProperty, &sessionProperty, sizeof(sessionProperty)); + memcpy(&handle->bufferList, &bufferList, sizeof(bufferList)); + memcpy(&handle->matchCtxList, &matchCtxList, sizeof(matchCtxList)); + handle->patternId = 1; + handle->compileOptions = CPA_PM_COMPILE_OPTION_NONE; + + + /* Get an instance */ + cpaPmGetNumInstances(&handle->nInstances); + handle->pHandles = (CpaInstanceHandle *)calloc(handle->nInstances, sizeof(CpaInstanceHandle)); + cpaPmGetInstances(handle->nInstances, handle->pHandles); + handle->instanceHandle = handle->pHandles[0]; + + /* Start the instance */ + cpaPmStartInstance(handle->instanceHandle); + free(handle->pHandles); + + /* Generate and activate a PDB */ + cpaPmPdbCreatePatternSet(handle->instanceHandle, 0, &handle->patternSetHandle); +} + +/* *********************************************************** */ + +int addStringToSearch(QAThandle *handle, char *str) { + + if(handle->searchInitialized) return(-1); + + if(str == NULL) return(-1); + + cpaPmPdbAddPattern(handle->instanceHandle, + handle->patternSetHandle, + handle->patternId++, + CPA_PM_PDB_OPTIONS_CASELESS, + strlen(str), + (const Cpa8U*)str, + (const Cpa16U)1 /* patternGroupId */); + return(0); +} + +/* *********************************************************** */ + +u_int checkMatch(QAThandle *handle, char *data_to_search, u_int data_to_search_len) { + int debug = 0; + + if(!handle->searchInitialized) { + // Compile the patterns and activate the PDB + cpaPmPdbCompile(handle->instanceHandle, handle->patternSetHandle, handle->compileOptions, NULL, &handle->pdbHandle); + + // Activate the pdb + cpaPmActivatePdb(handle->instanceHandle, handle->pdbHandle, NULL); + + /* Setup Session Context and Match Context */ + cpaPmSessionCtxGetSize(handle->instanceHandle, &handle->sessionProperty, &handle->sessionCtxSize); + cpaPmCreateSessionCtx(handle->instanceHandle, &handle->sessionProperty, (Cpa8U *)malloc(handle->sessionCtxSize), &handle->sessionCtx); + handle->matchCtxList.sessionCtx = handle->sessionCtx, handle->matchCtxList.userData = handle->pMatchArray; + handle->searchInitialized = 1; + } + + handle->matchCtxList.pBufferList[0].pBuffers->dataLenInBytes = data_to_search_len; + handle->matchCtxList.pBufferList[0].pBuffers->pData = (u_char*)data_to_search; + + g_nAppMatches = 0, g_nAppCallbacks = 0; + if(debug) printf("Input data: '%s'\n", data_to_search); + cpaPmSearchExec(handle->instanceHandle, &handle->matchCtxList, &handle->pMatchCtxError); + + if(debug) { + printf("App matches = %u\n", g_nAppMatches); + printf("App callbacks = %u\n", g_nAppCallbacks); + } + + return(g_nAppMatches); +} + +/* *********************************************************** */ + +void freeHandle(QAThandle *handle) { + if(handle->pdbHandle) cpaPmPdbRelease(handle->instanceHandle, handle->pdbHandle); + cpaPmStopInstance(handle->instanceHandle); +} + | ||
[-] [+] | Added | PF_RING-5.5.2-svn.tar.bz2/userland/lib/pfring_qat.h ^ |
@@ -0,0 +1,51 @@ +/* + * + * (C) 2013 - ntop.org + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesses General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Part of this code has been taken from Intel QAT PM examples + * + * Many thanks to Intel and in particular + * - Joseph Gasparakis <joseph.gasparakis@intel.com> + * - James Chapman <james.p.chapman@intel.com> + */ + +#ifndef _PFRING_QAT_H_ +#define _PFRING_QAT_H_ + +#include <cpa_types.h> +#include "cpa_pm.h" +#include "cpa_pm_compile.h" + +typedef struct { + Cpa16U nInstances; + CpaInstanceHandle * pHandles; + CpaInstanceHandle instanceHandle; + size_t len; + Cpa32U sessionCtxSize; + CpaPmSessionProperty sessionProperty; + CpaPmSessionCtx sessionCtx; + u_int num_loops; + Cpa32U patternId; + Cpa32U compileOptions; + CpaPmPdbPatternSetHandle patternSetHandle; + CpaPmPdbHandle pdbHandle; + u_int32_t num_matches; + char *pBuffer; + int *pMatchArray; + CpaFlatBuffer flatBuffer; + CpaBufferList bufferList; + CpaPmMatchResult matchResults[50]; + CpaPmMatchCtx matchCtxList; + CpaPmMatchCtx *pMatchCtxError; + u_int8_t searchInitialized; + u_int64_t num_filtered; +} QAThandle; + + +#endif /* _PFRING_QAT_H_ */ | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/lib/pfring_utils.c ^ |
@@ -52,8 +52,7 @@ rc = 0; #ifdef RING_DEBUG - printf("pfring_enable_hw_timestamp(%s) returned %d\n", - device_name, rc); + printf("pfring_enable_hw_timestamp(%s) returned %d\n", device_name, rc); #endif close(sock_fd); | ||
[-] [+] | Changed | PF_RING-5.5.2-svn.tar.bz2/userland/libpcap-1.1.1-ring/pcap-linux.c ^ |
@@ -1168,11 +1168,12 @@ if(!getenv("PCAP_NO_PF_RING")) { /* Code courtesy of Chris Wakelin <c.d.wakelin@reading.ac.uk> */ char *clusterId; - int flags = 0; + int flags = PF_RING_TIMESTAMP; char *appname, *active = getenv("PCAP_PF_RING_ACTIVE_POLL"), *rss_rehash; if(handle->opt.promisc) flags |= PF_RING_PROMISC; if(getenv("PCAP_PF_RING_DNA_RSS")) flags |= PF_RING_DNA_SYMMETRIC_RSS; + if(getenv("PCAP_PF_RING_STRIP_HW_TIMESTAMP")) flags |= PF_RING_STRIP_HW_TIMESTAMP; if(active) pf_ring_active_poll = atoi(active); handle->ring = pfring_open((char*)device, handle->snapshot, flags); | ||
[-] [+] | Added | PF_RING-5.5.2-svn.tar.bz2/vPF_RING/host/qemu-kvm-1.1.1-vpfring-diff ^ |
+(directory) | ||
[-] [+] | Added | PF_RING-5.5.2-svn.tar.bz2/vPF_RING/host/qemu-kvm-1.1.1-vpfring-diff/Makefile.target.patch ^ |
@@ -0,0 +1,14 @@ +--- qemu-kvm-1.1.1/Makefile.target 2012-07-16 09:52:03.000000000 +0200 ++++ qemu-kvm-1.1.1-vpfring-diff/Makefile.target 2012-09-04 01:13:41.000000000 +0200 +@@ -188,6 +188,11 @@ + obj-$(CONFIG_VIRTIO) += virtio-scsi.o + obj-y += vhost_net.o + obj-$(CONFIG_VHOST_NET) += vhost.o ++ ++# vNPlug & vPFRing ++obj-y += vnplug-ctrl.o vnplug-dev.o vpfring.o ++LIBS+=-lpfring -lpcap ++ + obj-$(CONFIG_REALLY_VIRTFS) += 9pfs/virtio-9p-device.o + obj-$(CONFIG_KVM) += kvm.o kvm-all.o + obj-$(CONFIG_NO_KVM) += kvm-stub.o | ||
[-] [+] | Added | PF_RING-5.5.2-svn.tar.bz2/vPF_RING/host/qemu-kvm-1.1.1-vpfring-diff/hw ^ |
+(directory) | ||
[-] [+] | Added | PF_RING-5.5.2-svn.tar.bz2/vPF_RING/host/qemu-kvm-1.1.1-vpfring-diff/hw/vnplug-ctrl.c ^ |
@@ -0,0 +1,401 @@ +/* + * vNPlug CTRL (Virtio) + * + * Authors: + * + * Alfredo Cardigliano <cardigliano@ntop.org> + * + * This work is licensed under the terms of the GNU GPL version 2. + * + */ + +#include "iov.h" +#include "vnplug-ctrl.h" +#include "virtio.h" +/* NOPATCH +#include "virtio-pci.c" // ugly, I know +*/ +#include "vnplug.h" + +//#define VNPLUG_CTRL_DEBUG + +#ifdef VNPLUG_CTRL_DEBUG +#define VNPLUG_CTRL_DEBUG_PRINTF(fmt, ...) do {printf("[vNPlug-CTRL] " fmt, ## __VA_ARGS__); } while (0) +#else +#define VNPLUG_CTRL_DEBUG_PRINTF(fmt, ...) +#endif + +typedef struct VirtIOvNPlugCTRL +{ + VirtIODevice vdev; + VirtQueue *g2h_vq; + + VMChangeStateEntry *vm_state; + uint16_t status; + DeviceState *qdev; +} VirtIOvNPlugCTRL; + +#define VirtIODevice2VirtIOvNPlugCTRL(vdev) ((VirtIOvNPlugCTRL *) vdev) + +/* Clients list */ +static QLIST_HEAD(vnplug_ctrl_clients_head, vNPlugCTRLClientInfo) vnplug_ctrl_clients = + QLIST_HEAD_INITIALIZER(vnplug_ctrl_clients); + +/* ******************************************************************************* */ +/* ************************************************************************* UTILS */ + +static struct vNPlugCTRLClientInfo *vnplug_ctrl_client_by_id(uint32_t client_id) +{ + struct vNPlugCTRLClientInfo *c; + + QLIST_FOREACH(c, &vnplug_ctrl_clients, list) { + VNPLUG_CTRL_DEBUG_PRINTF("we are looking for client id: %d. found client id: %d \n", client_id, c->id); + if (c->id == client_id) + return c; + } + + return NULL; +} + +/* ******************************************************************************* */ +/* ************************************************************** VNPLUG INTERFACE */ + +int vnplug_ctrl_register_client (struct vNPlugCTRLClientInfo *client) +{ + QLIST_INSERT_HEAD(&vnplug_ctrl_clients, client, list); + + VNPLUG_CTRL_DEBUG_PRINTF("registered new client '%s' with id %d \n", client->name, client->id); + + return 0; +} + +void vnplug_ctrl_unregister_client(struct vNPlugCTRLClientInfo *client) +{ + VNPLUG_CTRL_DEBUG_PRINTF("unregistering client '%s' with id %d\n", client->name, client->id); + + // do I need to do something more here? + + QLIST_REMOVE(client, list); +} + +/* ******************************************************************************* */ +/* ************************************************************************ VIRTIO */ + +static void vnplug_ctrl_handle_g2h(VirtIODevice *vdev, VirtQueue *vq) +{ + //VirtIOvNPlugCTRL *s = VirtIODevice2VirtIOvNPlugCTRL(vdev); + VirtQueueElement elem; + + while (virtqueue_pop(vq, &elem)) { + + ssize_t len = 0; + struct iovec *out_sg = &elem.out_sg[0]; + struct iovec *in_sg = &elem.in_sg [0]; + struct vnplug_ctrl_msg_hdr *msg; + int32_t *status_p; + int32_t status = 0x00000000; + struct vNPlugCTRLClientInfo *client; + + VNPLUG_CTRL_DEBUG_PRINTF("vnplug_ctrl_handle_g2h: message received [ out_num=%u in_num=%u ]\n", elem.out_num, elem.in_num); + + if (elem.out_num < 1 || out_sg->iov_len != sizeof(struct vnplug_ctrl_msg_hdr)) { + fprintf(stderr, "[vNPlug-CTRL] vnplug_ctrl_handle_g2h: vnplug_ctrl_msg_hdr not found\n"); + exit(1); + } + + if (elem.in_num < 1 || in_sg->iov_len != sizeof(int32_t)) { + fprintf(stderr, "[vNPlug-CTRL] vnplug_ctrl_handle_g2h: buffer with return status not found\n"); + exit(1); + } + status_p = in_sg->iov_base; + + msg = (struct vnplug_ctrl_msg_hdr *) out_sg->iov_base; + + VNPLUG_CTRL_DEBUG_PRINTF("vnplug_ctrl_handle_g2h: hdr.type=%u hdr.id=%u\n", msg->type, msg->id); + + len += sizeof(struct vnplug_ctrl_msg_hdr); + + switch (msg->type) + { + case VNPLUG_CTRL_MSG_FORWARD: + /* accessing additional buffers in the sg (payload) */ + out_sg++; + if (elem.out_num < 2 || out_sg->iov_len == 0) { + fprintf(stderr, "[vNPlug-CTRL] vnplug_ctrl_handle_g2h: payload expected but not found\n"); + exit(1); + } + + /* accessing an optional ret payload */ + in_sg++; + + if ((client = vnplug_ctrl_client_by_id(msg->id))){ + if (( status = client->msg_handler( + out_sg->iov_base, + out_sg->iov_len, + (elem.in_num>1 && in_sg->iov_len>0) ? in_sg->iov_base : NULL, + (elem.in_num>1 && in_sg->iov_len>0) ? in_sg->iov_len : 0)) + < VNPLUG_CTRL_MSG_RET_SUCCESS ) + status = VNPLUG_CTRL_MSG_RET_CLIENT_ERROR; + } else { + status = VNPLUG_CTRL_MSG_RET_CLIENT_NOT_FOUND; + VNPLUG_CTRL_DEBUG_PRINTF("vnplug_ctrl_handle_g2h: client not found\n"); + } + + len += out_sg->iov_len + + ((elem.in_num>1 && in_sg->iov_len>0) ? in_sg->iov_len : 0); + break; + + default: + VNPLUG_CTRL_DEBUG_PRINTF("vnplug_ctrl_handle_g2h: unrecognized msg type\n"); + } + + memcpy(status_p, &status, sizeof(int32_t)); + len += sizeof(int32_t); + + VNPLUG_CTRL_DEBUG_PRINTF("vnplug_ctrl_handle_g2h: return value is %d\n", *status_p); + + /* len = "size of in" or "size of out+in" ? */ + virtqueue_push(vq, &elem, len); + virtio_notify(vdev, vq); + } +} + +static void vnplug_ctrl_get_config(VirtIODevice *vdev, uint8_t *config_data) +{ + VirtIOvNPlugCTRL *dev = VirtIODevice2VirtIOvNPlugCTRL(vdev); + struct vnplug_ctrl_virtio_config config; + + VNPLUG_CTRL_DEBUG_PRINTF("vnplug_ctrl_get_config: call\n"); + + config.status = dev->status; + + memcpy(config_data, &config, sizeof(config)); +} + +static void vnplug_ctrl_set_config(VirtIODevice *vdev, const uint8_t *config_data) +{ + //VirtIOvNPlugCTRL *dev = VirtIODevice2VirtIOvNPlugCTRL(vdev); + struct vnplug_ctrl_virtio_config config; + + VNPLUG_CTRL_DEBUG_PRINTF("vnplug_ctrl_set_config: call\n"); + + memcpy(&config, config_data, sizeof(config)); + + /* do something with your new configuration */ +} + +static uint32_t vnplug_ctrl_get_features(VirtIODevice *vdev, uint32_t f) +{ + //VirtIOvNPlugCTRL *dev = VirtIODevice2VirtIOvNPlugCTRL(vdev); + + VNPLUG_CTRL_DEBUG_PRINTF("vnplug_ctrl_get_features: call\n"); + + /* Set here you should set your features bitmap with supported features */ + + f |= (1 << VNPLUG_CTRL_STATUS); + + /* or remove features depending on some support, example: */ + /* features &= ~(0x1 << VNPLUG_CTRL_STATUS); */ + + return f; +} + +static uint32_t vnplug_ctrl_bad_features(VirtIODevice *vdev) +{ + uint32_t features = 0; + + VNPLUG_CTRL_DEBUG_PRINTF("vnplug_ctrl_bad_features: call\n"); + + return features; +} + +static void vnplug_ctrl_set_features(VirtIODevice *vdev, uint32_t features) +{ + //VirtIOvNPlugCTRL *s = VirtIODevice2VirtIOvNPlugCTRL(vdev); + + VNPLUG_CTRL_DEBUG_PRINTF("vnplug_ctrl_set_features: call\n"); + + /* + * Use the features bitmap to set your settings + */ +} + +static void vnplug_ctrl_reset(VirtIODevice *vdev) +{ + //VirtIOvNPlugCTRL *s = VirtIODevice2VirtIOvNPlugCTRL(vdev); + + VNPLUG_CTRL_DEBUG_PRINTF("vnplug_ctrl_reset: call\n"); + + /* + * Reset here settings and data structures + */ +} + +static void vnplug_ctrl_set_status(struct VirtIODevice *vdev, uint8_t status) +{ + //VirtIOvNPlugCTRL *s = VirtIODevice2VirtIOvNPlugCTRL(vdev); + + VNPLUG_CTRL_DEBUG_PRINTF("vnplug_ctrl_set_status: call with status=%u\n", status); + + /* + * Update informations according to the status + */ +} + +static void /* int */ vnplug_ctrl_set_params(int blk_enable, int shared, void *opaque) +{ + /* + VirtIOvNPlugCTRL *s = opaque; + + if (1) { // TODO: replace with "running vnplug devices" + fprintf(stderr, "[vNPlug-CTRL] vnplug_ctrl_set_param: Virtual devices running, it is not possible to migrate/save\n"); + return -EINVAL; + } + + return 0; + */ +} + +static void vnplug_ctrl_save(QEMUFile *f, void *opaque) +{ + VirtIOvNPlugCTRL *s = opaque; + + VNPLUG_CTRL_DEBUG_PRINTF("vnplug_ctrl_save: call\n"); + + virtio_save(&s->vdev, f); + + /* + * Maybe you should tell clients to stop&save + * and resume when vnplug_ctrl_load is called + */ + + /* Save your data, example: */ + qemu_put_be16(f, s->status); +} + +static int vnplug_ctrl_load(QEMUFile *f, void *opaque, int version_id) +{ + VirtIOvNPlugCTRL *s = opaque; + + VNPLUG_CTRL_DEBUG_PRINTF("vnplug_ctrl_load: call\n"); + + if (version_id != 1) + return -EINVAL; + + virtio_load(&s->vdev, f); + + /* Read your data, example: */ + s->status = qemu_get_be16(f); + + return 0; +} + +static void vnplug_ctrl_vmstate_change(void *opaque, int running, RunState state) +{ + VirtIOvNPlugCTRL *s = opaque; + + VNPLUG_CTRL_DEBUG_PRINTF("vnplug_ctrl_vmstate_change: call with running=%d\n", running); + + /* + * This is called when vm is started/stopped, + * it will start/stop the backend if appropriate + * e.g. after migration. + */ + vnplug_ctrl_set_status(&s->vdev, s->vdev.status); +} + +VirtIODevice *vnplug_ctrl_init(DeviceState *dev) +{ + VirtIOvNPlugCTRL *s; + + VNPLUG_CTRL_DEBUG_PRINTF("vnplug_ctrl_init: call\n"); + + s = (VirtIOvNPlugCTRL *)virtio_common_init("vnplug-ctrl", + VIRTIO_ID_VNPLUG_CTRL, + sizeof(struct vnplug_ctrl_virtio_config), + sizeof(VirtIOvNPlugCTRL)); + + s->vdev.get_config = vnplug_ctrl_get_config; + s->vdev.set_config = vnplug_ctrl_set_config; + s->vdev.get_features = vnplug_ctrl_get_features; + s->vdev.set_features = vnplug_ctrl_set_features; + s->vdev.bad_features = vnplug_ctrl_bad_features; + s->vdev.reset = vnplug_ctrl_reset; + s->vdev.set_status = vnplug_ctrl_set_status; + + s->g2h_vq = virtio_add_queue(&s->vdev, 32 /* vq size */, vnplug_ctrl_handle_g2h); + + //TESTregister_savevm(dev, "vnplug-ctrl", -1, 1, vnplug_ctrl_save, vnplug_ctrl_load, s); + register_savevm_live(dev, "vnplug-ctrl", -1, 1, vnplug_ctrl_set_params, NULL, vnplug_ctrl_save, vnplug_ctrl_load, s); + + s->vm_state = qemu_add_vm_change_state_handler(vnplug_ctrl_vmstate_change, s); + + return &s->vdev; +} + +void vnplug_ctrl_exit(VirtIODevice *vdev) +{ + VirtIOvNPlugCTRL *s = DO_UPCAST(VirtIOvNPlugCTRL, vdev, vdev); + + VNPLUG_CTRL_DEBUG_PRINTF("vnplug_ctrl_exit: call\n"); + + qemu_del_vm_change_state_handler(s->vm_state); + + vnplug_ctrl_set_status(vdev, 0); + + unregister_savevm(s->qdev, "vnplug-ctrl", s); + + virtio_cleanup(&s->vdev); +} + +/* NOPATCH +static int vnplug_ctrl_init_pci(PCIDevice *pci_dev) +{ + VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); + VirtIODevice *vdev; + + vdev = vnplug_ctrl_init(&pci_dev->qdev); + + virtio_init_pci(proxy, vdev); + + proxy->nvectors = vdev->nvectors; + return 0; +} + +static int vnplug_ctrl_exit_pci(PCIDevice *pci_dev) +{ + VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); + + vnplug_ctrl_exit(proxy->vdev); + return virtio_exit_pci(pci_dev); +} + +static PCIDeviceInfo vnplug_ctrl_info = { + .qdev.name = "vnplug", + .qdev.alias = "vnplug", + .qdev.size = sizeof(VirtIOPCIProxy), + .init = vnplug_ctrl_init_pci, + .exit = vnplug_ctrl_exit_pci, + //.romfile = "pxe-vnplug.rom", + .vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET, + .device_id = PCI_DEVICE_ID_VNPLUG_CTRL, + .revision = VIRTIO_PCI_ABI_VERSION, + .class_id = PCI_CLASS_NETWORK_ETHERNET, + .qdev.props = (Property[]) { + DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features), + DEFINE_PROP_END_OF_LIST(), + }, + .qdev.reset = virtio_pci_reset, +}; + +static void vnplug_ctrl_register_devices(void) +{ + // Useless and can overwrite clients depending on the init order + // QLIST_INIT(&vnplug_ctrl_clients); + + VNPLUG_CTRL_DEBUG_PRINTF("registering to qdev..\n"); + pci_qdev_register(&vnplug_ctrl_info); +} + +device_init(vnplug_ctrl_register_devices); +*/ | ||
[-] [+] | Added | PF_RING-5.5.2-svn.tar.bz2/vPF_RING/host/qemu-kvm-1.1.1-vpfring-diff/hw/vnplug-ctrl.h ^ |
@@ -0,0 +1,58 @@ +/* + * vNPlug CTRL (Virtio) + * + * Authors: + * + * Alfredo Cardigliano <cardigliano@ntop.org> + * + * This work is licensed under the terms of the GNU GPL version 2. + * + */ + +#ifndef VNPLUG_CTRL_H +#define VNPLUG_CTRL_H + +#include "virtio.h" + +#include "pci.h" +#define PCI_DEVICE_ID_VNPLUG_CTRL 0x100f + +/* The ID for vnplug_ctrl */ +#define VIRTIO_ID_VNPLUG_CTRL 15 + + + +/* The feature bitmap for vnplug-ctrl over virtio */ +#define VNPLUG_CTRL_STATUS 0 /* vnplug_ctrl_status available */ + +struct vnplug_ctrl_virtio_config +{ + /* See VNPLUG_CTRL_STATUS feature bit */ +#define VNPLUG_CTRL_STATUS_UP 1 + uint16_t status; + + uint16_t padding; //I'm an alignment maniac :D +}; //__attribute__((packed)); + + + +struct vnplug_ctrl_msg_hdr { +#define VNPLUG_CTRL_MSG_FORWARD 0 /* Forward the message to the client identified by id */ + uint32_t type; + + uint32_t id; + + /* return values */ +/* positive values from handlers are forwarded to guest as they are */ +#define VNPLUG_CTRL_MSG_RET_SUCCESS 0 /* success if ret value >= this value */ +#define VNPLUG_CTRL_MSG_RET_CLIENT_NOT_FOUND -1 +#define VNPLUG_CTRL_MSG_RET_CLIENT_ERROR -2 +}; //__attribute__((packed)); + + + +/* TODO do we really need these here?*/ +VirtIODevice *vnplug_ctrl_init(DeviceState *dev); +void vnplug_ctrl_exit(VirtIODevice *vdev); + +#endif | ||
[-] [+] | Added | PF_RING-5.5.2-svn.tar.bz2/vPF_RING/host/qemu-kvm-1.1.1-vpfring-diff/hw/vnplug-dev.c ^ |
@@ -0,0 +1,436 @@ +/* + * vNPlugDev (PCI Device) + * + * Authors: + * + * Alfredo Cardigliano <cardigliano@ntop.org> + * + * This work is licensed under the terms of the GNU GPL version 2. + * + */ + +#include <sys/mman.h> +#include <sys/types.h> +#include <sys/eventfd.h> + +#include "hw.h" +#include "pc.h" +#include "pci.h" +#include "msix.h" +#include "kvm.h" +#include "migration.h" +#include "qerror.h" + +#include "vnplug.h" +#include "vnplug-dev.h" + +//#define VNPLUGDEV_DEBUG + +#ifdef VNPLUGDEV_DEBUG +#define VNPLUGDEV_DEBUG_PRINTF(fmt, ...) do {printf("[vNPlugDev] " fmt, ## __VA_ARGS__); } while (0) +#else +#define VNPLUGDEV_DEBUG_PRINTF(fmt, ...) +#endif + +static uint32_t vnplug_device_id_counter = 0; + +/* ******************************************************************************************* */ + +/* called when the guest writes to the registers region */ +static void vnplug_dev_io_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) +{ + struct vNPlugDev *s = opaque; + + addr &= 0xffc; + + VNPLUGDEV_DEBUG_PRINTF("io_writel: registers[" TARGET_FMT_plx "] = %" PRIu64 "\n", addr, val); + + if (!((struct vNPlugDevClientInfo *) s->dev_client)->io_writel_handler) + fprintf(stderr, "[vNPlugDev] io_writel: client handler undefined\n"); + else + ((struct vNPlugDevClientInfo *) s->dev_client)->io_writel_handler((struct vNPlugDevClientInfo *) s->dev_client, addr, val); +} + +/* ******************************************************************************************* */ + +/* called when the guest reads from the registers region */ +static uint64_t vnplug_dev_io_read(void *opaque, target_phys_addr_t addr, unsigned size) +{ + struct vNPlugDev *s = opaque; + uint32_t ret = 0; + + addr &= 0xffc; + + if (addr == VNPLUGDEV_REG_OFF_ID){ + ret = s->dev_id; + goto return_ret; + } + + if ( addr >= VNPLUGDEV_REG_OFF_BASE_MM_SIZE && + addr < VNPLUGDEV_REG_OFF_BASE_MM_SIZE + VNPLUGDEV_MAX_MM_BARS * sizeof(uint32_t) && + !(addr & 0x3)){ + ret = s->mm_dev_size[(addr-VNPLUGDEV_REG_OFF_BASE_MM_SIZE)>>2]; + goto return_ret; + } + + if (((struct vNPlugDevClientInfo *) s->dev_client)->io_readl_handler){ + ret = ((struct vNPlugDevClientInfo *) s->dev_client)->io_readl_handler((struct vNPlugDevClientInfo *) s->dev_client, addr); + goto return_ret; + } + + fprintf(stderr, "[vNPlugDev] io_read: client handler undefined\n"); + ret = 0; + +return_ret: + VNPLUGDEV_DEBUG_PRINTF("io_read: registers[" TARGET_FMT_plx "] value=%u\n", addr, ret); + return ret; +} + +/* ******************************************************************************************* */ + +static const MemoryRegionOps vnplug_dev_mmio_ops = { + .read = vnplug_dev_io_read, + .write = vnplug_dev_io_write, + .endianness = DEVICE_NATIVE_ENDIAN, + .impl = { + .min_access_size = 4, + .max_access_size = 4, + }, +}; + +/* ******************************************************************************************* */ + +/* to setup irqfds use on=1, to unset them use on=0 */ +static int setup_irqfds(struct vNPlugDev *s, int on) { + int i, err = 0; + + for (i = 0; i < s->vectors; i++) { + /* irqfd support: interrupts are injected when a signal on an eventfd occurs */ + if ( ( err = kvm_set_irqfd(s->dev.msix_irq_entries[i].gsi, s->backend_eventfds[i], on) ) < 0) + fprintf(stderr, "[vNPlugDev] irqfd warning (err=%d). Not available, or already set?\n", err); + else { + VNPLUGDEV_DEBUG_PRINTF("irqfd %s for host event %d [gsi=%u]\n", on ? "on" : "off", i, s->dev.msix_irq_entries[i].gsi); + } + } + + return err; +} + +/* ******************************************************************************************* */ + +/* to setup ioeventfds use on=1, to unset them use on=0 */ +static int setup_ioeventfds(struct vNPlugDev *s, int on) { + int i, err = 0; + + for (i = 0; i < s->guest_events_n; i++) { + /* setting ioeventfd support to raise an event when a write on + * mmio_pci_addr + VNPLUGDEV_REG_OFF_DOORBELL occurs, passing i as the value to match + * (the relative io_writel handler will not be called) */ + + /* TODO Check if ioeventfds are working with this code */ + + if (on) memory_region_add_eventfd(&s->mmio, VNPLUGDEV_REG_OFF_DOORBELL, 4, true, i, s->guest_eventfds[i]); + else memory_region_del_eventfd(&s->mmio, VNPLUGDEV_REG_OFF_DOORBELL, 4, true, i, s->guest_eventfds[i]); + + //if ( (err = kvm_set_ioeventfd_mmio(s->guest_eventfds[i], s->mmio_pci_addr + VNPLUGDEV_REG_OFF_DOORBELL, i, on, 4 /* long */)) < 0) { + // fprintf(stderr, "[vNPlugDev] ioeventfd warning (err=%d). Not available, or already set?\n", err); + //} else { + VNPLUGDEV_DEBUG_PRINTF("ioeventfd %s for guest event %d\n", on ? "on" : "off", i); + //} + } + + return err; +} + +/* ******************************************************************************************* */ + +static void vnplug_dev_reset(DeviceState *d) +{ + struct vNPlugDev *s = DO_UPCAST(struct vNPlugDev, dev.qdev, d); + int i; + + VNPLUGDEV_DEBUG_PRINTF("reset called\n"); + + msix_reset(&s->dev); + for (i = 0; i < s->vectors; i++) { + if (msix_vector_use(&s->dev, i) != 0) { + VNPLUGDEV_DEBUG_PRINTF("error setting msix vector to used\n"); + } + } + + return; +} + +/* ******************************************************************************************* */ + +static void vnplug_dev_setup_msix(struct vNPlugDev * s) +{ + int i; + + memory_region_init(&s->msix_bar, "vnplug-dev-msix", 0x1000 /* MSIX_PAGE_SIZE */); + + if (msix_init(&s->dev, s->vectors, &s->msix_bar, 1, 0) == 0) { + /* MSI region */ + pci_register_bar(&s->dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->msix_bar); + + VNPLUGDEV_DEBUG_PRINTF("msix initialized (%d vectors)\n", s->vectors); + } else { + VNPLUGDEV_DEBUG_PRINTF("msix initialization failed\n"); + exit(1); + } + + for (i = 0; i < s->vectors; i++) { + if (msix_vector_use(&s->dev, i) != 0) { + VNPLUGDEV_DEBUG_PRINTF("error setting msix vector to used\n"); + } + } +} + +/* ******************************************************************************************* */ + +static const VMStateDescription vmstate_vnplug_device = { + .name = "vnplug-dev", + .fields = (VMStateField []) { + VMSTATE_END_OF_LIST() + } +}; + +/* ******************************************************************************************* */ + +static void vnplug_dev_write_config(PCIDevice *pci_dev, uint32_t address, uint32_t val, int len) +{ + pci_default_write_config(pci_dev, address, val, len); + msix_write_config(pci_dev, address, val, len); +} + +/* ******************************************************************************************* */ + +static int pci_vnplug_dev_init(PCIDevice *dev) +{ + struct vNPlugDev *s = DO_UPCAST(struct vNPlugDev, dev, dev); + uint8_t *pci_conf; + int i; + char ram_block_name[32]; + + struct vNPlugDevClientInfo *client = (struct vNPlugDevClientInfo *) s->dev_client; + if (!client){ + fprintf(stderr, "[vNPlugDev] undefined vNPlug-dev client info\n"); + exit(-1); + } + + s->dev_id = vnplug_device_id_counter++; + + vmstate_register(&dev->qdev, s->dev_id, &vmstate_vnplug_device, s); + + error_set(&s->migration_blocker, QERR_DEVICE_FEATURE_BLOCKS_MIGRATION, "vnplug-dev", "not supported"); + migrate_add_blocker(s->migration_blocker); + + pci_conf = s->dev.config; + pci_conf[PCI_COMMAND] = PCI_COMMAND_IO | PCI_COMMAND_MEMORY; + pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; + pci_config_set_interrupt_pin(pci_conf, 1); + + s->mm_dev_size [0] = s->mm_dev_size_0; + s->mm_dev_vma_ptr[0] = s->mm_dev_vma_ptr_0; + s->mm_dev_size [1] = s->mm_dev_size_1; + s->mm_dev_vma_ptr[1] = s->mm_dev_vma_ptr_1; + s->mm_dev_size [2] = s->mm_dev_size_2; + s->mm_dev_vma_ptr[2] = s->mm_dev_vma_ptr_2; + s->mm_dev_size [3] = s->mm_dev_size_3; + s->mm_dev_vma_ptr[3] = s->mm_dev_vma_ptr_3; + + s->vectors = s->backend_events_n; + + VNPLUGDEV_DEBUG_PRINTF("setting up %d guest eventdfds\n", s->guest_events_n); + + s->guest_eventfds = g_malloc0(s->guest_events_n * sizeof(int)); + for (i=0;i<s->guest_events_n;i++){ + if ((s->guest_eventfds[i] = eventfd(0, 0)) < 0) { + fprintf(stderr, "[vNPlugDev] failed to create eventfd\n"); + exit(-1); + } + } + + VNPLUGDEV_DEBUG_PRINTF("setting up %d backend eventdfds\n", s->vectors); + + s->backend_eventfds = g_malloc0(s->vectors * sizeof(int)); + for (i=0;i<s->vectors;i++){ + if ((s->backend_eventfds[i] = eventfd(0, 0)) < 0) { + fprintf(stderr, "[vNPlugDev] failed to create eventfd\n"); + exit(-1); + } + } + + VNPLUGDEV_DEBUG_PRINTF("setting mmio read/write handlers for device %u [ passing opaque (struct vNPlugDev *) = %p ]\n", s->dev_id, s); + + memory_region_init_io(&s->mmio, &vnplug_dev_mmio_ops, s, "vnplug-dev-mmio", VNPLUGDEV_REG_BAR_SIZE); + + /* setup guest to host events via ioeventfd */ + + setup_ioeventfds(s, 1); + + /* region for registers */ + pci_register_bar(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->mmio); + + /* setup host to guest events via MSI */ + + VNPLUGDEV_DEBUG_PRINTF("setting up %d MSI-X vectors\n", s->vectors); + + /* region for msi and msix initialization */ + vnplug_dev_setup_msix(s); + + VNPLUGDEV_DEBUG_PRINTF("setting up the irqfd support\n"); + + setup_irqfds(s, 1); + + for (i=0; i<VNPLUGDEV_MAX_MM_BARS; i++) + if (s->mm_dev_size[i] && s->mm_dev_vma_ptr[i]){ + + /* Checking size (it must be power of two) */ + if ((s->mm_dev_size[i] & (s->mm_dev_size[i] - 1)) != 0){ + fprintf(stderr, "[vNPlugDev] device memory %d size is not power of 2\n", i); + exit(-1); + } + + /* ram block with mmapped memory to share */ + snprintf(ram_block_name, 32, "vnplug-dev-%u.bar%d", s->dev_id, VNPLUGDEV_BASE_MM_BAR+i); + + memory_region_init_ram_ptr(&s->mm[i], ram_block_name, s->mm_dev_size[i], (void *) s->mm_dev_vma_ptr[i]); + + vmstate_register_ram(&s->mm[i], &s->dev.qdev); + + VNPLUGDEV_DEBUG_PRINTF("ram block %d allocated from ptr %" PRIu64 " and size %u at ram addr %" PRIu64 "\n", + i, s->mm_dev_vma_ptr[i], s->mm_dev_size[i], s->mm[i].ram_addr); + + /* region for shared memory */ + pci_register_bar(&s->dev, VNPLUGDEV_BASE_MM_BAR+i, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->mm[i]); + } + + if (!s->dev_client || !(client->set_init_data_handler)){ + fprintf(stderr, "[vNPlugDev] client or client handlers undefined\n"); + exit(-1); + } + + s->dev.config_write = vnplug_dev_write_config; + + /* setting dev id and eventfds on client */ + client->set_init_data_handler(client, s->dev_id, s->backend_events_n, s->backend_eventfds, s->guest_events_n, s->guest_eventfds); + + return 0; +} + +/* ******************************************************************************************* */ + +static int pci_vnplug_dev_uninit(PCIDevice *dev) +{ + int i; + struct vNPlugDev *s = DO_UPCAST(struct vNPlugDev, dev, dev); + struct vNPlugDevClientInfo *client = (struct vNPlugDevClientInfo *) s->dev_client; + + if (client && client->pre_unplug_handler) + client->pre_unplug_handler(client); + + migrate_del_blocker(s->migration_blocker); + error_free(s->migration_blocker); + + setup_irqfds(s, 0); + + setup_ioeventfds(s, 0); + + for (i=0; i<VNPLUGDEV_MAX_MM_BARS; i++) { + if (s->mm_dev_size[i] && s->mm_dev_vma_ptr[i]){ + vmstate_unregister_ram(&s->mm[i], &s->dev.qdev); + memory_region_destroy(&s->mm[i]); + VNPLUGDEV_DEBUG_PRINTF("BAR%d unmapped\n", VNPLUGDEV_BASE_MM_BAR+i); + } + } + + msix_unuse_all_vectors(dev); + msix_uninit(dev, &s->msix_bar); + memory_region_destroy(&s->msix_bar); + + VNPLUGDEV_DEBUG_PRINTF("BAR1 (MSIX) uninitialized and unmapped\n"); + + memory_region_destroy(&s->mmio); + + VNPLUGDEV_DEBUG_PRINTF("BAR0 (registers) unmapped\n"); + + for (i = 0; i < s->vectors; i++) + close(s->backend_eventfds[i]); + + VNPLUGDEV_DEBUG_PRINTF("backend eventfds closed\n"); + + for (i = 0; i < s->guest_events_n; i++) + close(s->guest_eventfds[i]); + + VNPLUGDEV_DEBUG_PRINTF("guest eventfds closed\n"); + + g_free(s->backend_eventfds); + g_free(s->guest_eventfds); + + vmstate_unregister(&dev->qdev, &vmstate_vnplug_device, s); + + if (client && client->post_unplug_handler) + client->post_unplug_handler(client); + + VNPLUGDEV_DEBUG_PRINTF("uninitalization done\n"); + + return 0; +} + +/* ******************************************************************************************* */ + +static Property vnplug_dev_properties[] = { + + /* Note: + * - generated in pci_vnplug_dev_init: DEFINE_PROP_UINT32("dev_id", struct vNPlugDev, dev_id, 0), + * - ptrs changed to uint64: DEFINE_PROP_PTR("vma_ptr", struct vNPlugDev, mm_dev_vma_ptr), + */ + + DEFINE_PROP_UINT32("backend_events_n", struct vNPlugDev, backend_events_n, 1), + DEFINE_PROP_UINT32("guest_events_n", struct vNPlugDev, guest_events_n, 1), + + DEFINE_PROP_UINT32("vma_size", struct vNPlugDev, mm_dev_size_0, 0), + DEFINE_PROP_UINT64("vma_ptr", struct vNPlugDev, mm_dev_vma_ptr_0, 0), + + DEFINE_PROP_UINT32("vma_size_1", struct vNPlugDev, mm_dev_size_1, 0), + DEFINE_PROP_UINT64("vma_ptr_1", struct vNPlugDev, mm_dev_vma_ptr_1, 0), + + DEFINE_PROP_UINT32("vma_size_2", struct vNPlugDev, mm_dev_size_2, 0), + DEFINE_PROP_UINT64("vma_ptr_2", struct vNPlugDev, mm_dev_vma_ptr_2, 0), + + DEFINE_PROP_UINT32("vma_size_3", struct vNPlugDev, mm_dev_size_3, 0), + DEFINE_PROP_UINT64("vma_ptr_3", struct vNPlugDev, mm_dev_vma_ptr_3, 0), + + DEFINE_PROP_UINT64("client_info_ptr", struct vNPlugDev, dev_client, 0), + DEFINE_PROP_END_OF_LIST(), +}; + +static void vnplug_dev_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); + + k->init = pci_vnplug_dev_init; + k->exit = pci_vnplug_dev_uninit; + k->vendor_id = PCI_VENDOR_ID_SILICOM; + k->device_id = PCI_DEVICE_ID_VNPLUG_DEV; + k->class_id = PCI_CLASS_MEMORY_RAM; + dc->reset = vnplug_dev_reset; + dc->props = vnplug_dev_properties; +} + +static TypeInfo vnplug_dev_info = { + .name = "vnplug-dev", + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(struct vNPlugDev), + .class_init = vnplug_dev_class_init, +}; + +static void vnplug_dev_register_types(void) +{ + type_register_static(&vnplug_dev_info); +} + +type_init(vnplug_dev_register_types) + | ||
[-] [+] | Added | PF_RING-5.5.2-svn.tar.bz2/vPF_RING/host/qemu-kvm-1.1.1-vpfring-diff/hw/vnplug-dev.h ^ |
@@ -0,0 +1,61 @@ +#ifndef VNPLUG_DEV_H +#define VNPLUG_DEV_H + +#define PCI_VENDOR_ID_SILICOM 0x1374 +#define PCI_DEVICE_ID_VNPLUG_DEV 0x00ff + +#define VNPLUGDEV_REG_BAR_SIZE TARGET_PAGE_SIZE + +#define VNPLUGDEV_REG_OFF_ID 0x00 +#define VNPLUGDEV_REG_OFF_DOORBELL 0x04 +#define VNPLUGDEV_REG_OFF_BASE_MM_SIZE 0x08 + +#define VNPLUGDEV_BASE_MM_BAR 2 +#define VNPLUGDEV_MAX_MM_BARS 4 + +struct EventfdEntry { + PCIDevice *pdev; + int32_t vector; +}; + +struct vNPlugDev { + PCIDevice dev; + + Error *migration_blocker; + + uint32_t dev_id; + uint32_t doorbell; + + uint32_t mm_dev_size[VNPLUGDEV_MAX_MM_BARS]; + uint64_t /* void* */ mm_dev_vma_ptr[VNPLUGDEV_MAX_MM_BARS]; + + /* close your eyes (qdev properties) */ + uint32_t mm_dev_size_0; + uint64_t mm_dev_vma_ptr_0; + + uint32_t mm_dev_size_1; + uint64_t mm_dev_vma_ptr_1; + + uint32_t mm_dev_size_2; + uint64_t mm_dev_vma_ptr_2; + + uint32_t mm_dev_size_3; + uint64_t mm_dev_vma_ptr_3; + /* reopen your eyes */ + + MemoryRegion mmio; + MemoryRegion msix_bar; + MemoryRegion mm[VNPLUGDEV_MAX_MM_BARS]; + + uint32_t vectors; + + uint32_t backend_events_n; + int *backend_eventfds; + + uint32_t guest_events_n; + int *guest_eventfds; + + uint64_t /* struct vNPlugDevClientInfo* */ dev_client; +}; + +#endif /* VNPLUG_DEV_H */ | ||
[-] [+] | Added | PF_RING-5.5.2-svn.tar.bz2/vPF_RING/host/qemu-kvm-1.1.1-vpfring-diff/hw/vnplug.h ^ |
@@ -0,0 +1,40 @@ +#ifndef VNPLUG_H +#define VNPLUG_H + +/* CTRL */ + +struct vNPlugCTRLClientInfo { + int id; + const char *name; + int (*msg_handler)(void *message, uint32_t size, void *ret_message, uint32_t ret_size); + + QLIST_ENTRY(vNPlugCTRLClientInfo) list; +}; + + + +int vnplug_ctrl_register_client (struct vNPlugCTRLClientInfo *client); +void vnplug_ctrl_unregister_client(struct vNPlugCTRLClientInfo *client); + +/* DEVICE */ + +struct vNPlugDevClientInfo { + void *priv; + void ( *set_init_data_handler)( + struct vNPlugDevClientInfo *client, uint32_t dev_id, + uint32_t backend_eventfds_n, int *backend_eventfds, + uint32_t guest_eventfds_n, int *guest_eventfds); + void ( *pre_unplug_handler)( + struct vNPlugDevClientInfo *client); + void ( *post_unplug_handler)( + struct vNPlugDevClientInfo *client); + uint32_t (*io_readl_handler)( + struct vNPlugDevClientInfo *client, + target_phys_addr_t addr); + void (*io_writel_handler)( + struct vNPlugDevClientInfo *client, + target_phys_addr_t addr, + uint32_t val); +}; + +#endif | ||
[-] [+] | Added | PF_RING-5.5.2-svn.tar.bz2/vPF_RING/host/qemu-kvm-1.1.1-vpfring-diff/hw/vpfring.c ^ |
@@ -0,0 +1,705 @@ +/* + * vPFRing - a vNPlug client (Virtual PF_RING) + * + * Authors: + * + * Alfredo Cardigliano <cardigliano@ntop.org> + * + * This work is licensed under the terms of the GNU GPL version 2. + * + */ + +#include "vpfring.h" + +//#define VPFRING_DEBUG + +#ifdef VPFRING_DEBUG +#define VPFRING_DEBUG_PRINTF(fmt, ...) do {printf("[vPFRing] " fmt, ## __VA_ARGS__); } while (0) +#else +#define VPFRING_DEBUG_PRINTF(fmt, ...) +#endif + +static QLIST_HEAD(vpfring_devices_head, vPFRingInfo) vpfring_devices = + QLIST_HEAD_INITIALIZER(vpfring_devices); + +static struct vPFRingInfo *vpfring_device_by_id(uint32_t device_id) +{ + struct vPFRingInfo *i; + + QLIST_FOREACH(i, &vpfring_devices, list) { + if (i->dev_id == device_id){ + VPFRING_DEBUG_PRINTF("vPFRing device %d found\n", device_id); + return i; + } + } + + VPFRING_DEBUG_PRINTF("error: vPFRing device %d not found!\n", device_id); + return NULL; +} + +/* ******************************************************************************************* */ + +uint32_t vpfring_io_readl(struct vNPlugDevClientInfo *client, target_phys_addr_t addr) +{ + //struct vPFRingInfo *vpfri = client->priv; + //VPFRING_DEBUG_PRINTF("io_readl handler call for dev with id=%d\n", vpfri->dev_id); + return 0; +} + +/* ******************************************************************************************* */ + +void vpfring_io_writel(struct vNPlugDevClientInfo *client, target_phys_addr_t addr, uint32_t val) +{ + //struct vPFRingInfo *vpfri = client->priv; + //VPFRING_DEBUG_PRINTF("io_readl handler call for dev with id=%d\n", vpfri->dev_id); +} + +/* ******************************************************************************************* */ + +static int vpfring_ring_add(struct vPFRingAddMsg *amsg, void *ret_message, uint32_t ret_size) +{ + struct vPFRingInfo *vpfri; + struct vNPlugDevClientInfo *client; + char tmpstr[32]; + int ret = -1; + + vpfri = g_malloc0(sizeof(*vpfri)); + if (!vpfri) + goto exit; + + client = g_malloc0(sizeof(*client)); + if (!client) + goto free_vpfri; + + client->set_init_data_handler = vpfring_set_init_data; + client->pre_unplug_handler = vpfring_stop; + client->post_unplug_handler = vpfring_close_and_free; + client->io_readl_handler = vpfring_io_readl; + client->io_writel_handler = vpfring_io_writel; + client->priv = vpfri; + vpfri->vnplug_client = client; + + VPFRING_DEBUG_PRINTF("opening ring\n"); + + vpfri->ring = pfring_open( + amsg->device_name, + amsg->caplen, + amsg->flags); + + if (vpfri->ring == NULL) + goto free_client; + + /* the dev_id will be set in the init_data handler, called from qdev_device_add */ + vpfri->dev_id = 0xffffffff; + + VPFRING_DEBUG_PRINTF("registering vPFRing device\n"); + + QLIST_INSERT_HEAD(&vpfring_devices, vpfri, list); + + VPFRING_DEBUG_PRINTF("creating vNPlug device\n"); + + QemuOpts *opts; + opts = qemu_opts_create(qemu_find_opts("device"), NULL, 0); + /* it's ugly but there is no other clean way.. */ + qemu_opt_set(opts, "driver", "vnplug-dev"); + qemu_opt_set(opts, "backend_events_n", "1"); + qemu_opt_set(opts, "guest_events_n", "1"); + + snprintf(tmpstr, 32, "%u", vpfri->ring->slots_info->tot_mem); + qemu_opt_set(opts, "vma_size", tmpstr); + snprintf(tmpstr, 32, "%" PRIu64, (uint64_t) vpfri->ring->buffer); + qemu_opt_set(opts, "vma_ptr", tmpstr); + + snprintf(tmpstr, 32, "%" PRIu64, (uint64_t) client); + qemu_opt_set(opts, "client_info_ptr", tmpstr); + + vpfri->qdev = qdev_device_add(opts); + + if (vpfri->qdev == NULL) + goto close_ring; + + /* after qdev_device_add returns, dev_id should be updated to the correct value */ + if (vpfri->dev_id != 0xffffffff){ + VPFRING_DEBUG_PRINTF("vNPlug device created successfully [ id=%u, state=%d ]\n", vpfri->dev_id, vpfri->qdev->state); + } else { + fprintf(stderr, "[vPFRing] Error occurs while creating the vNPlug device: ID not set.\n"); + goto unregister; + } + + return vpfri->dev_id; + +unregister: + QLIST_REMOVE(vpfri, list); +close_ring: + pfring_close(vpfri->ring); +free_client: + g_free(client); +free_vpfri: + g_free(vpfri); +exit: + return ret; +} + +/* ******************************************************************************************* */ + +static void vpfring_ring_del(struct vPFRingInfo *vpfri) +{ + Error *errp; + + if (vpfri == NULL){ + VPFRING_DEBUG_PRINTF("error deleting device (null)"); + return; + } + + VPFRING_DEBUG_PRINTF("deleting vPFRing device %d\n", vpfri->dev_id); + + VPFRING_DEBUG_PRINTF("unplugging vNPlug device\n"); + qdev_unplug(vpfri->qdev, &errp); + + /* Note: this is called by qdev_unplug */ + //qdev_free(vpfri->qdev); + + /* Note: stop -> pre_unplug_handler + * close and free -> post_unplug_handler */ +} + +/* ******************************************************************************************* */ + +int vpfring_ctrl_message_rcv(void *message, uint32_t size, void *ret_message, uint32_t ret_size) +{ + struct vPFRingMsg *msg = (struct vPFRingMsg *) message; + struct vPFRingInfo *vpfri = NULL; + int ret_val; + + if (size != (sizeof(*msg) + msg->payload_len)){ + VPFRING_DEBUG_PRINTF("vpfring_ctrl_message_rcv: wrong message size=%u. expected size=%lu!\n", size, sizeof(*msg) + msg->payload_len); + return -1; + } + + if (msg->type != VPFRING_CTRL_MSG_DEVICE_ADD) { + if (!(vpfri = vpfring_device_by_id(msg->device_id))) { + fprintf(stderr, "[vPFRing] Error: vpfring_ctrl_message_rcv: Wrong device id=%u, device not found!\n", msg->device_id); + return -1; + } + } + + switch (msg->type) + { + + case VPFRING_CTRL_MSG_SET_DIRECTION: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_SET_DIRECTION received\n"); + + if (msg->payload_len != sizeof(struct vPFRingSetDirectionMsg)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingSetClusterMsg with wrong size\n"); + return -1; + } + + return pfring_set_direction(vpfri->ring, + ((struct vPFRingSetDirectionMsg *) msg->payload)->direction); + + case VPFRING_CTRL_MSG_SET_SOCKET_MODE: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_SET_SOCKET_MODE received\n"); + + if (msg->payload_len != sizeof(struct vPFRingSetSocketModeMsg)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingSetSocketModeMsg with wrong size\n"); + return -1; + } + + return pfring_set_socket_mode(vpfri->ring, + ((struct vPFRingSetSocketModeMsg *) msg->payload)->mode); + + case VPFRING_CTRL_MSG_SET_CLUSTER: + { + struct vPFRingSetClusterMsg *cmsg; + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_SET_CLUSTER received\n"); + + if (msg->payload_len != sizeof(struct vPFRingSetClusterMsg)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingSetClusterMsg with wrong size\n"); + return -1; + } + + cmsg = (struct vPFRingSetClusterMsg *) msg->payload; + + return pfring_set_cluster(vpfri->ring, cmsg->cluster_id, cmsg->cluster_type); + } + + case VPFRING_CTRL_MSG_SET_MASTER_ID: + { + struct vPFRingSetMasterIdMsg *midmsg; + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_SET_MASTER_ID received\n"); + + if (msg->payload_len != sizeof(struct vPFRingSetMasterIdMsg)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingSetMasterIdMsg with wrong size\n"); + return -1; + } + + midmsg = (struct vPFRingSetMasterIdMsg *) msg->payload; + + return pfring_set_master_id(vpfri->ring, midmsg->master_id); + } + + case VPFRING_CTRL_MSG_SET_CHANNEL_MASK: + { + struct vPFRingSetChannelMaskMsg *cidmsg; + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_SET_CHANNEL_ID received\n"); + + if (msg->payload_len != sizeof(struct vPFRingSetChannelMaskMsg)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingSetChannelMaskMsg with wrong size\n"); + return -1; + } + + cidmsg = (struct vPFRingSetChannelMaskMsg *) msg->payload; + + return pfring_set_channel_mask(vpfri->ring, cidmsg->channel_mask); + } + + case VPFRING_CTRL_MSG_ADD_HW_RULE: + { + struct vPFRingAddHwRuleMsg *hwrmsg; + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_ADD_HW_RULE received\n"); + + if (msg->payload_len != sizeof(struct vPFRingAddHwRuleMsg)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingAddHwRuleMsg with wrong size\n"); + return -1; + } + + hwrmsg = (struct vPFRingAddHwRuleMsg *) msg->payload; + + return pfring_add_hw_rule(vpfri->ring, &hwrmsg->rule); + } + + case VPFRING_CTRL_MSG_REMOVE_HW_RULE: + { + struct vPFRingRemoveHwRuleMsg *hwrmsg; + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_REMOVE_HW_RULE received\n"); + + if (msg->payload_len != sizeof(struct vPFRingRemoveHwRuleMsg)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingRemoveHwRuleMsg with wrong size\n"); + return -1; + } + + hwrmsg = (struct vPFRingRemoveHwRuleMsg *) msg->payload; + + return pfring_remove_hw_rule(vpfri->ring, hwrmsg->rule_id); + } + + + case VPFRING_CTRL_MSG_REMOVE_FROM_CLUSTER: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_REMOVE_FROM_CLUSTER received\n"); + + return pfring_remove_from_cluster(vpfri->ring); + + case VPFRING_CTRL_MSG_PURGE_IDLE_HASH_RULES: + { + struct vPFRingPurgeIdleHashRulesMsg *pisrmsg; + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_PURGE_IDLE_HASH_RULES received\n"); + + if (msg->payload_len != sizeof(struct vPFRingPurgeIdleHashRulesMsg)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingPurgeIdleHashRulesMsg with wrong size\n"); + return -1; + } + + pisrmsg = (struct vPFRingPurgeIdleHashRulesMsg *) msg->payload; + + return pfring_purge_idle_hash_rules(vpfri->ring, pisrmsg->inactivity_sec); + } + + case VPFRING_CTRL_MSG_PURGE_IDLE_RULES: + { + struct vPFRingPurgeIdleRulesMsg *pisrmsg; + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_PURGE_IDLE_RULES received\n"); + + if (msg->payload_len != sizeof(struct vPFRingPurgeIdleRulesMsg)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingPurgeIdleRulesMsg with wrong size\n"); + return -1; + } + + pisrmsg = (struct vPFRingPurgeIdleRulesMsg *) msg->payload; + + return pfring_purge_idle_hash_rules(vpfri->ring, pisrmsg->inactivity_sec); + } + + case VPFRING_CTRL_MSG_SET_APPLICATION_NAME: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_SET_APPLICATION_NAME received\n"); + + if (msg->payload_len != sizeof(struct vPFRingSetApplicationNameMsg)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingSetApplicationNameMsg with wrong size\n"); + return -1; + } + + return pfring_set_application_name( + vpfri->ring, + ((struct vPFRingSetApplicationNameMsg *) msg->payload)->name); + + case VPFRING_CTRL_MSG_DEVICE_ADD: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_DEVICE_ADD received\n"); + + if (msg->payload_len < sizeof(struct vPFRingAddMsg)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingAddMsg with wrong size\n"); + return -1; + } + + return vpfring_ring_add((struct vPFRingAddMsg *) msg->payload, ret_message, ret_size); + + case VPFRING_CTRL_MSG_BIND: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_BIND received\n"); + + if (msg->payload_len != sizeof(struct vPFRingBindMsg)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingBindMsg with wrong size\n"); + return -1; + } + + return pfring_bind( + vpfri->ring, + ((struct vPFRingBindMsg *) msg->payload)->device_name); + + case VPFRING_CTRL_MSG_SET_POLL_WATERMARK: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_SET_POLL_WATERMARK received\n"); + + if (msg->payload_len != sizeof(struct vPFRingSetPollWatermarkMsg)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingSetPollWatermarkMsg with wrong size\n"); + return -1; + } + + return pfring_set_poll_watermark( + vpfri->ring, + ((struct vPFRingSetPollWatermarkMsg *) msg->payload)->watermark); + + case VPFRING_CTRL_MSG_DEVICE_DEL: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_DEVICE_DEL received\n"); + + vpfring_ring_del(vpfri); + break; + + case VPFRING_CTRL_MSG_GET_FILTERING_RULE_STATS: + { + struct vPFRingGetFilteringRuleStatsMsg *gfrsmsg; + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_VERSION received\n"); + + if (msg->payload_len != sizeof(struct vPFRingGetFilteringRuleStatsMsg)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingGetFilteringRuleStatsMsg with wrong size\n"); + return -1; + } + + if (ret_message == NULL || ret_size <= 0){ + VPFRING_DEBUG_PRINTF("skipping! return buffer not found or empty\n"); + return -1; + } + + gfrsmsg = (struct vPFRingGetFilteringRuleStatsMsg *) msg->payload; + + if (gfrsmsg->stats_len != ret_size){ + VPFRING_DEBUG_PRINTF("skipping! something wrong..\n"); + return -1; + } + + return pfring_get_filtering_rule_stats(vpfri->ring, + gfrsmsg->rule_id, + ret_message, + &gfrsmsg->stats_len); + } + + case VPFRING_CTRL_MSG_GET_NUM_RX_CHANNELS: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_GET_NUM_RX_CHANNELS received\n"); + + return pfring_get_num_rx_channels(vpfri->ring); + + case VPFRING_CTRL_MSG_GET_RING_ID: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_GET_RING_ID received\n"); + + return pfring_get_ring_id(vpfri->ring); + + case VPFRING_CTRL_MSG_GET_PACKET_CONSUMER_MODE: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_GET_PACKET_CONSUMER_MODE received\n"); + + return pfring_get_packet_consumer_mode(vpfri->ring); + + case VPFRING_CTRL_MSG_SET_PACKET_CONSUMER_MODE: + { + struct vPFRingSetPacketConsumerModeMsg *pcmmsg; + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_SET_PACKET_CONSUMER_MODE received\n"); + + if (msg->payload_len < sizeof(struct vPFRingSetPacketConsumerModeMsg)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingSetPacketConsumerModeMsg with wrong size\n"); + return -1; + } + + pcmmsg = (struct vPFRingSetPacketConsumerModeMsg *) msg->payload; + + return pfring_set_packet_consumer_mode(vpfri->ring, pcmmsg->plugin_id, pcmmsg->plugin_data, pcmmsg->plugin_data_len); + } + + case VPFRING_CTRL_MSG_SET_VIRTUAL_DEVICE: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_SET_VIRTUAL_DEVICE received\n"); + + if (msg->payload_len != sizeof(virtual_filtering_device_info)){ + VPFRING_DEBUG_PRINTF("skipping! payload with wrong size\n"); + return -1; + } + + return pfring_set_virtual_device(vpfri->ring, (virtual_filtering_device_info *) msg->payload); + + case VPFRING_CTRL_MSG_GET_HASH_FILTERING_RULE_STATS: + { + struct vPFRingGetHashFilteringRuleStatsMsg *hfrsmsg; + uint32_t stats_len_c; + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_GET_HASH_FILTERING_RULE_STATS received\n"); + + if (msg->payload_len != sizeof(struct vPFRingGetHashFilteringRuleStatsMsg)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingGetHashFilteringRuleStatsMsg with wrong size\n"); + return -1; + } + + hfrsmsg = (struct vPFRingGetHashFilteringRuleStatsMsg *) msg->payload; + + if (ret_message == NULL || ret_size != hfrsmsg->stats_len ){ + VPFRING_DEBUG_PRINTF("skipping! return buffer with wrong size\n"); + return -1; + } + + stats_len_c = hfrsmsg->stats_len; + + return pfring_get_hash_filtering_rule_stats(vpfri->ring, &hfrsmsg->rule, (char *) ret_message, &stats_len_c); + } + + case VPFRING_CTRL_MSG_ADD_FILTERING_RULE: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_ADD_FILTERING_RULE received\n"); + + if (msg->payload_len != sizeof(filtering_rule)){ + VPFRING_DEBUG_PRINTF("skipping! payload with wrong size\n"); + return -1; + } + + return pfring_add_filtering_rule(vpfri->ring, (filtering_rule *) msg->payload); + + case VPFRING_CTRL_MSG_HANDLE_HASH_FILTERING_RULE: + { + struct vPFRingHandleHashFilteringRuleMsg *hfrmsg; + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_HANDLE_HASH_FILTERING_RULE received\n"); + + if (msg->payload_len != sizeof(struct vPFRingHandleHashFilteringRuleMsg)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingHandleHashFilteringRuleMsg with wrong size\n"); + return -1; + } + + hfrmsg = (struct vPFRingHandleHashFilteringRuleMsg *) msg->payload; + + return pfring_handle_hash_filtering_rule(vpfri->ring, &hfrmsg->rule_to_add, hfrmsg->add_rule); + } + + case VPFRING_CTRL_MSG_ENABLE_RING: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_ENABLE_RING received\n"); + + return pfring_enable_ring(vpfri->ring); + + case VPFRING_CTRL_MSG_DISABLE_RING: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_DISABLE_RING received\n"); + + return pfring_disable_ring(vpfri->ring); + + case VPFRING_CTRL_MSG_REMOVE_FILTERING_RULE: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_REMOVE_FILTERING_RULE received\n"); + + if (msg->payload_len != sizeof(struct vPFRingRemoveFilteringRuleMsg)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingRemoveFilteringRuleMsg with wrong size\n"); + return -1; + } + + return pfring_remove_filtering_rule( + vpfri->ring, + ((struct vPFRingRemoveFilteringRuleMsg *) msg->payload)->rule_id); + + case VPFRING_CTRL_MSG_TOGGLE_FILTERING_POLICY: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_TOGGLE_FILTERING_POLICY received\n"); + + if (msg->payload_len != sizeof(struct vPFRingToggleFilteringPolicyMsg)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingToggleFilteringPolicyMsg with wrong size\n"); + return -1; + } + + return pfring_toggle_filtering_policy( + vpfri->ring, + ((struct vPFRingToggleFilteringPolicyMsg *) msg->payload)->rules_default_accept_policy); + + case VPFRING_CTRL_MSG_VERSION: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_VERSION received\n"); + + if (ret_message == NULL || ret_size != sizeof(u_int32_t)){ + VPFRING_DEBUG_PRINTF("skipping! return buffer with wrong size\n"); + return -1; + } + + ret_val = pfring_version(vpfri->ring, (u_int32_t *) ret_message); + VPFRING_DEBUG_PRINTF("PF_RING version is v.%d.%d.%d\n", + (*((u_int32_t *) ret_message) & 0xFFFF0000) >> 16, + (*((u_int32_t *) ret_message) & 0x0000FF00) >> 8, + *((u_int32_t *) ret_message) & 0x000000FF); + return ret_val; + + case VPFRING_CTRL_MSG_SET_SAMPLING_RATE: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_SET_SAMPLING_RATE received\n"); + + if (msg->payload_len != sizeof(struct vPFRingSetSamplingRateMsg)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingSetSamplingRateMsg with wrong size\n"); + return -1; + } + + return pfring_set_sampling_rate( + vpfri->ring, + ((struct vPFRingSetSamplingRateMsg *) msg->payload)->rate); + + case VPFRING_CTRL_MSG_GET_BOUND_DEVICE_ADDRESS: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_GET_BOUND_DEVICE_ADDRESS received\n"); + + if (msg->payload_len != sizeof(u_char) * 6){ + VPFRING_DEBUG_PRINTF("skipping! device address with wrong size\n"); + return -1; + } + + if (ret_message == NULL || ret_size != (sizeof(u_char) * 6)){ + VPFRING_DEBUG_PRINTF("skipping! return buffer with wrong size\n"); + return -1; + } + + memcpy(ret_message, msg->payload, sizeof(u_char) * 6); + + ret_val = pfring_get_bound_device_address(vpfri->ring, (u_char *) ret_message); + + return ret_val; + + case VPFRING_CTRL_MSG_GET_SLOT_HEADER_LEN: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_GET_SLOT_HEADER_LEN received\n"); + + return pfring_get_slot_header_len(vpfri->ring); + + case VPFRING_CTRL_MSG_GET_NUM_QUEUED_PKTS: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_GET_NUM_QUEUED_PKTS received\n"); + + return pfring_get_num_queued_pkts(vpfri->ring); + + case VPFRING_CTRL_MSG_ENABLE_RSS_REHASH: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_ENABLE_RSS_REHASH received\n"); + + return pfring_enable_rss_rehash(vpfri->ring); + + case VPFRING_CTRL_MSG_SET_BPF_FILTER: + { + struct vPFRingSetBPFFilter *sbfmsg; + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_SET_BPF_FILTER received\n"); + + if (msg->payload_len < sizeof(struct vPFRingSetBPFFilter)){ + VPFRING_DEBUG_PRINTF("skipping! vPFRingSetBPFFilter with wrong size\n"); + return -1; + } + + sbfmsg = (struct vPFRingSetBPFFilter *) msg->payload; + + return pfring_set_bpf_filter(vpfri->ring, sbfmsg->filter_buffer); + } + + case VPFRING_CTRL_MSG_REMOVE_BPF_FILTER: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_REMOVE_BPF_FILTER received\n"); + + return pfring_remove_bpf_filter(vpfri->ring); + + case VPFRING_CTRL_MSG_SHUTDOWN: + VPFRING_DEBUG_PRINTF("message VPFRING_CTRL_MSG_SHUTDOWN received\n"); + + pfring_shutdown(vpfri->ring); + break; + + default: + VPFRING_DEBUG_PRINTF("vpfring_ctrl_message_rcv: unrecognized msessage type!\n"); + return -1; + } + + return 0; //success (non negative value) +} + +/* ******************************************************************************************* */ + +void vpfring_set_init_data(struct vNPlugDevClientInfo *client, uint32_t dev_id, uint32_t backend_eventfds_n, int *backend_eventfds, uint32_t guest_eventfds_n, int *guest_eventfds) +{ + struct vPFRingInfo *vpfri = client->priv; + struct vpfring_eventfd_info eventfd_i; + + /* setting the device id */ + vpfri->dev_id = dev_id; + + VPFRING_DEBUG_PRINTF("setting eventfds for vNPlug device with id=%d\n", vpfri->dev_id); + + /* we are using just one eventfd, maybe later we can need more.. */ + if (backend_eventfds_n>=1){ + eventfd_i.fd = backend_eventfds[0]; + eventfd_i.id = VPFRING_HOST_EVENT_RX_INT; + setsockopt(vpfri->ring->fd, 0, SO_SET_VPFRING_HOST_EVENTFD, &eventfd_i, sizeof(eventfd_i)); + } else + fprintf(stderr, "[vPFRing] error: backend eventfd missing!\n"); + + /* setting guest eventfd for guest notifications (unused, present in the experimental version) */ + //if (guest_eventfds_n>=1){ + // eventfd_i.fd = guest_eventfds[0]; + // eventfd_i.id = VPFRING_GUEST_EVENT_REQ_RX_INT; + // setsockopt(vpfri->ring->fd, 0, SO_SET_VPFRING_GUEST_EVENTFD, &eventfd_i, sizeof(eventfd_i)); + //} else + //fprintf(stderr, "[vPFRing] error: backend eventfd missing!\n"); +} + +/* ******************************************************************************************* */ + +void vpfring_stop(struct vNPlugDevClientInfo *client) +{ + struct vPFRingInfo *vpfri = client->priv; + + if (vpfri == NULL){ + VPFRING_DEBUG_PRINTF("error stopping ring (null)"); + return; + } + + VPFRING_DEBUG_PRINTF("stopping ring [device=%d]\n", vpfri->dev_id); + + /* stopping eventfd signals from backend */ + setsockopt(vpfri->ring->fd, 0, SO_SET_VPFRING_CLEAN_EVENTFDS, NULL, 0); + + QLIST_REMOVE(vpfri, list); +} + +/* ******************************************************************************************* */ + +void vpfring_close_and_free(struct vNPlugDevClientInfo *client) +{ + struct vPFRingInfo *vpfri = client->priv; + + if (vpfri == NULL){ + VPFRING_DEBUG_PRINTF("error closing ring (null)"); + return; + } + + VPFRING_DEBUG_PRINTF("closing ring [device=%d]\n", vpfri->dev_id); + + pfring_close(vpfri->ring); + + VPFRING_DEBUG_PRINTF("freeing memory\n"); + + g_free(vpfri->vnplug_client); + g_free(vpfri); +} + +/* ******************************************************************************************* */ + +static struct vNPlugCTRLClientInfo vpfring_client_info = { + .id = VNPLUG_CLIENT_ID_VPFRING, + .name = "vpfring", + .msg_handler = vpfring_ctrl_message_rcv, +}; + +static void vpfring_register(void) +{ + QLIST_INIT(&vpfring_devices); + + VPFRING_DEBUG_PRINTF("registering to vnplug..\n"); + vnplug_ctrl_register_client(&vpfring_client_info); +} + +type_init(vpfring_register); + | ||
[-] [+] | Added | PF_RING-5.5.2-svn.tar.bz2/vPF_RING/host/qemu-kvm-1.1.1-vpfring-diff/hw/vpfring.h ^ |
@@ -0,0 +1,216 @@ +#ifndef VPFRING_H +#define VPFRING + +#include <sys/mman.h> +#include <sys/types.h> +#include <sys/eventfd.h> + +#include <stdio.h> +#include <stdarg.h> +#include <sys/types.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/mman.h> +#include <errno.h> +#include <sys/poll.h> +#include <sys/socket.h> +#include <linux/if.h> +#include <linux/sockios.h> +#include <linux/if_packet.h> +#include <arpa/inet.h> +#include <sys/ioctl.h> +#include <sys/un.h> +#include <sys/time.h> +#include <time.h> +#include <pthread.h> +#include <linux/if_ether.h> + +#include "iov.h" +#include "pci.h" + +#include <linux/pf_ring.h> +#include <pfring.h> + +#include "vnplug.h" + +#define VNPLUG_CLIENT_ID_VPFRING 85 + +struct vPFRingInfo{ + pfring *ring; + uint32_t dev_id; + DeviceState *qdev; + struct vNPlugDevClientInfo *vnplug_client; + + QLIST_ENTRY(vPFRingInfo) list; +}; + + +/* vPFRing control messages (structures defined both here and in vPFRing lib) */ + + +/* vPFRingMsg types */ +#define VPFRING_CTRL_MSG_SET_DIRECTION 0 /* payload: vPFRingSetDirectionMsg */ +#define VPFRING_CTRL_MSG_SET_CLUSTER 1 /* payload: vPFRingSetClusterMsg */ +#define VPFRING_CTRL_MSG_SET_MASTER_ID 2 /* payload: vPFRingSetMasterIdMsg */ +#define VPFRING_CTRL_MSG_SET_CHANNEL_MASK 3 /* payload: vPFRingSetChannelMaskMsg */ +#define VPFRING_CTRL_MSG_ADD_HW_RULE 4 /* payload: vPFRingAddHwRuleMsg */ +#define VPFRING_CTRL_MSG_REMOVE_HW_RULE 5 /* payload: vPFRingRemoveHwRuleMsg */ +#define VPFRING_CTRL_MSG_REMOVE_FROM_CLUSTER 6 +#define VPFRING_CTRL_MSG_PURGE_IDLE_HASH_RULES 7 /* payload: vPFRingPurgeIdleHashRulesMsg */ +#define VPFRING_CTRL_MSG_SET_APPLICATION_NAME 8 /* payload: vPFRingSetApplicationNameMsg */ +#define VPFRING_CTRL_MSG_DEVICE_ADD 9 /* payload: vPFRingAddMsg */ +#define VPFRING_CTRL_MSG_BIND 10 /* payload: vPFRingBindMsg */ +#define VPFRING_CTRL_MSG_SET_POLL_WATERMARK 11 /* payload: vPFRingPollWatermarkMsg */ +#define VPFRING_CTRL_MSG_DEVICE_DEL 12 +#define VPFRING_CTRL_MSG_GET_FILTERING_RULE_STATS 13 /* payload: vPFRingGetFilteringRuleStatsMsg */ +#define VPFRING_CTRL_MSG_GET_NUM_RX_CHANNELS 14 +#define VPFRING_CTRL_MSG_GET_RING_ID 15 +#define VPFRING_CTRL_MSG_GET_PACKET_CONSUMER_MODE 16 +#define VPFRING_CTRL_MSG_SET_PACKET_CONSUMER_MODE 17 /* payload: vPFRingSetPacketConsumerModeMsg */ +#define VPFRING_CTRL_MSG_SET_VIRTUAL_DEVICE 18 /* payload: virtual_filtering_device_info */ +#define VPFRING_CTRL_MSG_GET_HASH_FILTERING_RULE_STATS 19 /* payload: vPFRingGetHashFilteringRuleStatsMsg */ +#define VPFRING_CTRL_MSG_ADD_FILTERING_RULE 20 /* payload: filtering_rule */ +#define VPFRING_CTRL_MSG_HANDLE_HASH_FILTERING_RULE 21 /* payload: vPFRingHandleHashFilteringRule */ +#define VPFRING_CTRL_MSG_ENABLE_RING 22 +#define VPFRING_CTRL_MSG_DISABLE_RING 23 +#define VPFRING_CTRL_MSG_REMOVE_FILTERING_RULE 24 /* payload: vPFRingRemoveFilteringRuleMsg */ +#define VPFRING_CTRL_MSG_TOGGLE_FILTERING_POLICY 25 /* payload: vPFRingToggleFilteringPolicyMsg */ +#define VPFRING_CTRL_MSG_VERSION 26 +#define VPFRING_CTRL_MSG_SET_SAMPLING_RATE 27 /* payload: vPFRingSetSamplingRateMsg */ +#define VPFRING_CTRL_MSG_GET_BOUND_DEVICE_ADDRESS 28 +#define VPFRING_CTRL_MSG_GET_SLOT_HEADER_LEN 29 +#define VPFRING_CTRL_MSG_GET_NUM_QUEUED_PKTS 30 +#define VPFRING_CTRL_MSG_ENABLE_RSS_REHASH 31 +#define VPFRING_CTRL_MSG_SET_SOCKET_MODE 32 /* payload: vPFRingSetSocketModeMsg */ +#define VPFRING_CTRL_MSG_PURGE_IDLE_RULES 33 /* payload: vPFRingPurgeIdleRulesMsg */ +#define VPFRING_CTRL_MSG_SET_BPF_FILTER 34 /* payload: vPFRingSetBPFFilter */ +#define VPFRING_CTRL_MSG_REMOVE_BPF_FILTER 35 +#define VPFRING_CTRL_MSG_SHUTDOWN 36 + + +#define VPFRING_CTRL_MAX_DEV_NAME 64 + + +struct vPFRingMsg { + uint32_t type; + uint32_t device_id; + uint32_t payload_len; + char payload[0]; +}; + + +struct vPFRingSetDirectionMsg { + uint32_t direction; +}; + +struct vPFRingSetClusterMsg { + uint32_t cluster_id; + uint32_t cluster_type; +}; + +struct vPFRingSetMasterIdMsg { + uint32_t master_id; +}; + +struct vPFRingSetChannelMaskMsg { + int32_t channel_mask; +}; + +struct vPFRingAddHwRuleMsg{ + hw_filtering_rule rule; +}; + +struct vPFRingRemoveHwRuleMsg{ + uint16_t rule_id; + uint16_t __padding; +}; + +struct vPFRingPurgeIdleHashRulesMsg{ + uint16_t inactivity_sec; + uint16_t __padding; +}; + +struct vPFRingSetApplicationNameMsg { + char name[VPFRING_CTRL_MAX_DEV_NAME]; +}; + +struct vPFRingAddMsg /* PLUG + open_consumer */ { + char device_name[VPFRING_CTRL_MAX_DEV_NAME]; + uint32_t caplen; + uint32_t flags; +}; + +struct vPFRingBindMsg { + char device_name[VPFRING_CTRL_MAX_DEV_NAME]; +}; + +struct vPFRingSetPollWatermarkMsg{ + uint16_t watermark; + uint16_t __padding; +}; + +struct vPFRingGetFilteringRuleStatsMsg{ + uint16_t rule_id; + uint16_t __padding; + uint32_t stats_len; +}; + +struct vPFRingSetPacketConsumerModeMsg{ + uint8_t plugin_id; + char __padding[3]; + uint32_t plugin_data_len; + char plugin_data[0]; +}; + +struct vPFRingGetHashFilteringRuleStatsMsg{ + uint32_t stats_len; + hash_filtering_rule rule; +}; + +struct vPFRingHandleHashFilteringRuleMsg{ + uint8_t add_rule; + char __padding[3]; + hash_filtering_rule rule_to_add; +}; + +struct vPFRingRemoveFilteringRuleMsg{ + uint16_t rule_id; + uint16_t __padding; +}; + +struct vPFRingToggleFilteringPolicyMsg{ + uint8_t rules_default_accept_policy; + char __padding[3]; +}; + +struct vPFRingSetSamplingRateMsg{ + uint32_t rate; +}; + +struct vPFRingSetSocketModeMsg{ + uint32_t mode; +}; + +struct vPFRingPurgeIdleRulesMsg{ + uint16_t inactivity_sec; + uint16_t __padding; +}; + +struct vPFRingSetBPFFilter{ + uint32_t filter_buffer_len; + char filter_buffer[0]; +}; + +/* END vPFRing control messages */ + + +/* private prototypes */ +void vpfring_set_init_data (struct vNPlugDevClientInfo *client, uint32_t dev_id, uint32_t backend_eventfds_n, int *backend_eventfds, uint32_t guest_eventfds_n, int *guest_eventfds); +void vpfring_stop (struct vNPlugDevClientInfo *client); +void vpfring_close_and_free (struct vNPlugDevClientInfo *client); +uint32_t vpfring_io_readl (struct vNPlugDevClientInfo *client, target_phys_addr_t addr); +void vpfring_io_writel (struct vNPlugDevClientInfo *client, target_phys_addr_t addr, uint32_t val); +int vpfring_ctrl_message_rcv(void *message, uint32_t size, void *ret_message, uint32_t ret_size); + +#endif | ||
[-] [+] | Added | PF_RING-5.5.2-svn.tar.bz2/vPF_RING/host/qemu-kvm-1.1.1-vpfring-diff/virtio-pci.c.patch ^ |
@@ -0,0 +1,81 @@ +--- qemu-kvm-1.1.1/hw/virtio-pci.c 2012-07-16 09:52:03.000000000 +0200 ++++ qemu-kvm-1.1.1-vpfring-diff/virtio-pci.c 2012-09-04 01:13:24.000000000 +0200 +@@ -21,6 +21,7 @@ + #include "virtio-blk.h" + #include "virtio-net.h" + #include "virtio-serial.h" ++#include "vnplug-ctrl.h" + #include "virtio-scsi.h" + #include "pci.h" + #include "qemu-error.h" +@@ -886,6 +887,27 @@ + return virtio_exit_pci(pci_dev); + } + ++static int vnplug_ctrl_init_pci(PCIDevice *pci_dev) ++{ ++ VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); ++ VirtIODevice *vdev; ++ ++ vdev = vnplug_ctrl_init(&pci_dev->qdev); ++ ++ virtio_init_pci(proxy, vdev); ++ ++ proxy->nvectors = vdev->nvectors; ++ return 0; ++} ++ ++static int vnplug_ctrl_exit_pci(PCIDevice *pci_dev) ++{ ++ VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); ++ ++ vnplug_ctrl_exit(proxy->vdev); ++ return virtio_exit_pci(pci_dev); ++} ++ + static Property virtio_blk_properties[] = { + DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0), + DEFINE_BLOCK_PROPERTIES(VirtIOPCIProxy, blk.conf), +@@ -1014,6 +1036,34 @@ + .class_init = virtio_balloon_class_init, + }; + ++static Property vnplug_ctrl_properties[] = { ++ DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features), ++ DEFINE_PROP_END_OF_LIST(), ++}; ++ ++static void vnplug_ctrl_class_init(ObjectClass *klass, void *data) ++{ ++ DeviceClass *dc = DEVICE_CLASS(klass); ++ PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); ++ ++ k->init = vnplug_ctrl_init_pci; ++ k->exit = vnplug_ctrl_exit_pci; ++ //k->romfile = "pxe-vnplug.rom"; ++ k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET; ++ k->device_id = PCI_DEVICE_ID_VNPLUG_CTRL; ++ k->revision = VIRTIO_PCI_ABI_VERSION; ++ k->class_id = PCI_CLASS_NETWORK_ETHERNET; ++ dc->reset = virtio_pci_reset; ++ dc->props = vnplug_ctrl_properties; ++} ++ ++static TypeInfo vnplug_ctrl_info = { ++ .name = "vnplug", ++ .parent = TYPE_PCI_DEVICE, ++ .instance_size = sizeof(VirtIOPCIProxy), ++ .class_init = vnplug_ctrl_class_init, ++}; ++ + static int virtio_scsi_init_pci(PCIDevice *pci_dev) + { + VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); +@@ -1075,6 +1125,7 @@ + type_register_static(&virtio_serial_info); + type_register_static(&virtio_balloon_info); + type_register_static(&virtio_scsi_info); ++ type_register_static(&vnplug_ctrl_info); + } + + type_init(virtio_pci_register_types) | ||
[-] [+] | Changed | nDPI.tar.bz2/Makefile.in ^ |
@@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -16,6 +16,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -60,6 +77,11 @@ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -304,8 +326,11 @@ -rm -f libtool config.lt install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) - test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -490,13 +515,10 @@ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ @@ -582,7 +604,7 @@ *.zip*) \ unzip $(distdir).zip ;;\ esac - chmod -R a-w $(distdir); chmod a+w $(distdir) + chmod -R a-w $(distdir); chmod u+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) | ||
[-] [+] | Changed | nDPI.tar.bz2/aclocal.m4 ^ |
@@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.11.3 -*- Autoconf -*- +# generated automatically by aclocal 1.11.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, @@ -14,8 +14,8 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, -[m4_warning([this file was generated for autoconf 2.68. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) @@ -38,7 +38,7 @@ [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.11.3], [], +m4_if([$1], [1.11.6], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -54,7 +54,7 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.11.3])dnl +[AM_AUTOMAKE_VERSION([1.11.6])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) | ||
[-] [+] | Changed | nDPI.tar.bz2/configure ^ |
@@ -1,11 +1,9 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for nDPI 1.4.0. +# Generated by GNU Autoconf 2.69 for nDPI 1.4.0. # # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -134,6 +132,31 @@ # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -167,7 +190,8 @@ else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1" +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && @@ -220,21 +244,25 @@ if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi if test x$as_have_required = xno; then : @@ -336,6 +364,14 @@ } # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take @@ -457,6 +493,10 @@ chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -491,16 +531,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -512,28 +552,8 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -1197,8 +1217,6 @@ if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1456,9 +1474,9 @@ if $ac_init_version; then cat <<\_ACEOF nDPI configure 1.4.0 -generated by GNU Autoconf 2.68 +generated by GNU Autoconf 2.69 -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1534,7 +1552,7 @@ test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext + test -x conftest$ac_exeext }; then : ac_retval=0 else @@ -1821,7 +1839,7 @@ running configure, to aid debugging if configure makes a mistake. It was created by nDPI $as_me 1.4.0, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2238,7 +2256,7 @@ # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -2407,7 +2425,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2447,7 +2465,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2498,7 +2516,7 @@ test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ @@ -2551,7 +2569,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2928,7 +2946,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2968,7 +2986,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3021,7 +3039,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3062,7 +3080,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -3120,7 +3138,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3164,7 +3182,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3610,8 +3628,7 @@ /* end confdefs.h. */ #include <stdarg.h> #include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -3846,7 +3863,7 @@ for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue + as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in @@ -3922,7 +3939,7 @@ for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in @@ -3988,7 +4005,7 @@ for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in @@ -4055,7 +4072,7 @@ for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue + as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in @@ -4311,7 +4328,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4355,7 +4372,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4779,7 +4796,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4819,7 +4836,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5125,7 +5142,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5165,7 +5182,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5269,7 +5286,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5313,7 +5330,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5438,7 +5455,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5478,7 +5495,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5537,7 +5554,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5577,7 +5594,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6226,7 +6243,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6266,7 +6283,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6346,7 +6363,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6386,7 +6403,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6438,7 +6455,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6478,7 +6495,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6530,7 +6547,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6570,7 +6587,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6622,7 +6639,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6662,7 +6679,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6714,7 +6731,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6754,7 +6771,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -11280,7 +11297,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -11320,7 +11337,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -11373,7 +11390,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -11414,7 +11431,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -11472,7 +11489,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -11516,7 +11533,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -11712,8 +11729,7 @@ /* end confdefs.h. */ #include <stdarg.h> #include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -12409,16 +12425,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -12478,28 +12494,16 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -12521,7 +12525,7 @@ # values after options handling. ac_log=" This file was extended by nDPI $as_me 1.4.0, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -12578,10 +12582,10 @@ ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ nDPI config.status 1.4.0 -configured by $0, generated by GNU Autoconf 2.68, +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -12661,7 +12665,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' | ||
[-] [+] | Changed | nDPI.tar.bz2/example/pcapReader.c ^ |
@@ -46,17 +46,12 @@ static int _pcap_datalink_type = 0; static u_int8_t enable_protocol_guess = 1, verbose = 0; static u_int32_t guessed_flow_protocols = 0; +static u_int16_t decode_tunnels = 0; // detection static struct ndpi_detection_module_struct *ndpi_struct = NULL; static u_int32_t detection_tick_resolution = 1000; -#ifdef NDPI_ENABLE_DEBUG_MESSAGES -static char *prot_short_str[] = { NDPI_PROTOCOL_SHORT_STRING }; - -static NDPI_PROTOCOL_BITMASK debug_messages_bitmask; -#endif - // results static u_int64_t raw_packet_count = 0; static u_int64_t ip_packet_count = 0; @@ -65,6 +60,9 @@ static u_int64_t protocol_counter_bytes[NDPI_MAX_SUPPORTED_PROTOCOLS + 1]; static u_int32_t protocol_flows[NDPI_MAX_SUPPORTED_PROTOCOLS] = { 0 }; + +#define GTP_U_V1_PORT 2152 + // id tracking typedef struct osdpi_id { u_int8_t ip[4]; @@ -72,9 +70,6 @@ } osdpi_id_t; static u_int32_t size_id_struct = 0; -#define MAX_OSDPI_IDS 50000 -static struct osdpi_id *osdpi_ids; -static u_int32_t osdpi_id_count = 0; #ifndef ETH_P_IP #define ETH_P_IP 0x0800 @@ -92,6 +87,8 @@ u_int16_t packets, bytes; // result only, not used for flow identification u_int32_t detected_protocol; + + void *src_id, *dst_id; } osdpi_flow_t; static u_int32_t size_flow_struct = 0; @@ -99,57 +96,23 @@ static struct osdpi_flow *osdpi_flows_root = NULL; static u_int32_t osdpi_flow_count = 0; -#ifdef NDPI_ENABLE_DEBUG_MESSAGES -static int string_to_detection_bitmask(char *str, NDPI_PROTOCOL_BITMASK * dbm) -{ - u_int32_t a; - u_int32_t oldptr = 0; - u_int32_t ptr = 0; - NDPI_BITMASK_RESET(*dbm); - - printf("Protocol parameter given: %s\n", str); - - if (strcmp(str, "all") == 0) { - printf("Protocol parameter all parsed\n"); - NDPI_BITMASK_SET_ALL(*dbm); - printf("Bitmask is: " NDPI_BITMASK_DEBUG_OUTPUT_BITMASK_STRING " \n", - NDPI_BITMASK_DEBUG_OUTPUT_BITMASK_VALUE(*dbm)); - return 0; - } - // parse bitmask - while (1) { - if (str[ptr] == 0 || str[ptr] == ' ') { - printf("Protocol parameter: parsed: %.*s,\n", ptr - oldptr, &str[oldptr]); - for (a = 1; a <= NDPI_MAX_SUPPORTED_PROTOCOLS; a++) { - if (strlen(prot_short_str[a]) == (ptr - oldptr) && - (memcmp(&str[oldptr], prot_short_str[a], ptr - oldptr) == 0)) { - NDPI_ADD_PROTOCOL_TO_BITMASK(*dbm, a); - printf("Protocol parameter detected as protocol %s\n", - ndpi_get_proto_name(ndpi_struct, a)); - } - } - oldptr = ptr + 1; - if (str[ptr] == 0) - break; - } - ptr++; - } - return 0; -} -#endif -static void help() { - printf("pcapReader -f <file>.pcap [-p <protos>][-d][-h][-v]\n\n" +static void help(u_int long_help) { + printf("pcapReader -f <file>.pcap [-p <protos>][-d][-h][-t][-v]\n\n" "Usage:\n" " -f <file>.pcap | Specify a pcap file to read packets from\n" " -p <file>.protos | Specify a protocol file (eg. protos.txt)\n" " -d | Disable protocol guess and use only DPI\n" + " -t | Dissect GTP tunnels\n" " -h | This help\n" " -v | Verbose 'unknown protocol' packet print\n"); - printf("\n\nSupported protocols:\n"); - setupDetection(); - ndpi_dump_protocols(ndpi_struct); + if(long_help) { + printf("\n\nSupported protocols:\n"); + setupDetection(); + ndpi_dump_protocols(ndpi_struct); + } + exit(-1); } @@ -157,11 +120,7 @@ { int opt; -#ifdef NDPI_ENABLE_DEBUG_MESSAGES - NDPI_BITMASK_SET_ALL(debug_messages_bitmask); -#endif - - while ((opt = getopt(argc, argv, "df:e:hp:v")) != EOF) { + while ((opt = getopt(argc, argv, "df:hp:tv")) != EOF) { switch (opt) { case 'd': enable_protocol_guess = 0; @@ -172,23 +131,10 @@ case 'p': _protoFilePath = optarg; - break; - - case 'e': -#ifdef NDPI_ENABLE_DEBUG_MESSAGES - // set debug logging bitmask to all protocols - if (string_to_detection_bitmask(optarg, &debug_messages_bitmask) != 0) { - printf("ERROR option -e needs a valid list of protocols"); - exit(-1); - } - - printf("debug messages Bitmask is: " NDPI_BITMASK_DEBUG_OUTPUT_BITMASK_STRING "\n", - NDPI_BITMASK_DEBUG_OUTPUT_BITMASK_VALUE(debug_messages_bitmask)); + break; -#else - printf("ERROR: option -e : DEBUG MESSAGES DEACTIVATED\n"); - exit(-1); -#endif + case 't': + decode_tunnels = 1; break; case 'v': @@ -196,38 +142,24 @@ break; case 'h': + help(1); + break; + default: - help(); + help(0); + break; } } // check parameters if (_pcap_file == NULL || strcmp(_pcap_file, "") == 0) { - help(); + help(0); } } -static void debug_printf(u_int32_t protocol, void *id_struct, ndpi_log_level_t log_level, const char *format, ...) -{ -#ifdef NDPI_ENABLE_DEBUG_MESSAGES - if (NDPI_COMPARE_PROTOCOL_TO_BITMASK(debug_messages_bitmask, protocol) != 0) { - const char *protocol_string; - const char *file; - const char *func; - u_int32_t line; - va_list ap; - va_start(ap, format); - - protocol_string = prot_short_str[protocol]; - - ndpi_debug_get_last_log_function_line(ndpi_struct, &file, &func, &line); - - printf("\nDEBUG: %s:%s:%u Prot: %s, level: %u packet: %llu :", file, func, line, protocol_string, - log_level, raw_packet_count); - vprintf(format, ap); - va_end(ap); - } -#endif +static void debug_printf(u_int32_t protocol, void *id_struct, + ndpi_log_level_t log_level, + const char *format, ...) { } static void *malloc_wrapper(unsigned long size) @@ -240,27 +172,6 @@ free(freeable); } -static void *get_id(const u_int8_t * ip) -{ - u_int32_t i; - for (i = 0; i < osdpi_id_count; i++) { - if (memcmp(osdpi_ids[i].ip, ip, sizeof(u_int8_t) * 4) == 0) { - return osdpi_ids[i].ndpi_id; - } - } - if (osdpi_id_count == MAX_OSDPI_IDS) { - printf("ERROR: maximum unique id count (%u) has been exceeded\n", MAX_OSDPI_IDS); - exit(-1); - } else { - struct ndpi_id_struct *ndpi_id; - memcpy(osdpi_ids[osdpi_id_count].ip, ip, sizeof(u_int8_t) * 4); - ndpi_id = osdpi_ids[osdpi_id_count].ndpi_id; - - osdpi_id_count += 1; - return ndpi_id; - } -} - static char* ipProto2Name(u_short proto_id) { static char proto[8]; @@ -330,7 +241,7 @@ flow->packets, flow->bytes); } -static void node_print_unknown_proto_walker(const void *node, const VISIT which, const int depth) { +static void node_print_unknown_proto_walker(const void *node, ndpi_VISIT which, int depth) { struct osdpi_flow *flow = *(struct osdpi_flow**)node; if (flow->detected_protocol != 0 /* UNKNOWN */) return; @@ -339,7 +250,7 @@ printFlow(flow); } -static void node_proto_guess_walker(const void *node, const VISIT which, const int depth) { +static void node_proto_guess_walker(const void *node, ndpi_VISIT which, int depth) { struct osdpi_flow *flow = *(struct osdpi_flow**)node; char buf1[32], buf2[32]; @@ -401,7 +312,7 @@ u_int16_t lower_port; u_int16_t upper_port; struct osdpi_flow flow; - const void *ret; + void *ret; if (ipsize < 20) return NULL; @@ -452,7 +363,7 @@ flow.lower_port = lower_port; flow.upper_port = upper_port; - ret = tfind(&flow, (void*)&osdpi_flows_root, node_cmp); + ret = ndpi_tfind(&flow, (void*)&osdpi_flows_root, node_cmp); if(ret == NULL) { if (osdpi_flow_count == MAX_OSDPI_FLOWS) { @@ -476,7 +387,17 @@ return(NULL); } - tsearch(newflow, (void*)&osdpi_flows_root, node_cmp); /* Add */ + if((newflow->src_id = calloc(1, size_id_struct)) == NULL) { + printf("[NDPI] %s(3): not enough memory\n", __FUNCTION__); + return(NULL); + } + + if((newflow->dst_id = calloc(1, size_id_struct)) == NULL) { + printf("[NDPI] %s(4): not enough memory\n", __FUNCTION__); + return(NULL); + } + + ndpi_tsearch(newflow, (void*)&osdpi_flows_root, node_cmp); /* Add */ osdpi_flow_count += 1; @@ -493,7 +414,7 @@ NDPI_PROTOCOL_BITMASK all; // init global detection structure - ndpi_struct = ndpi_init_detection_module(detection_tick_resolution, malloc_wrapper, debug_printf); + ndpi_struct = ndpi_init_detection_module(detection_tick_resolution, malloc_wrapper, free_wrapper, debug_printf); if (ndpi_struct == NULL) { printf("ERROR: global structure initialization failed\n"); exit(-1); @@ -506,20 +427,6 @@ size_id_struct = ndpi_detection_get_sizeof_ndpi_id_struct(); size_flow_struct = ndpi_detection_get_sizeof_ndpi_flow_struct(); - osdpi_ids = malloc(MAX_OSDPI_IDS * sizeof(struct osdpi_id)); - if (osdpi_ids == NULL) { - printf("ERROR: malloc for osdpi_ids failed\n"); - exit(-1); - } - for (i = 0; i < MAX_OSDPI_IDS; i++) { - memset(&osdpi_ids[i], 0, sizeof(struct osdpi_id)); - osdpi_ids[i].ndpi_id = calloc(1, size_id_struct); - if (osdpi_ids[i].ndpi_id == NULL) { - printf("ERROR: malloc for ndpi_id_struct failed\n"); - exit(-1); - } - } - // clear memory for results memset(protocol_counter, 0, (NDPI_MAX_SUPPORTED_PROTOCOLS + 1) * sizeof(u_int64_t)); memset(protocol_counter_bytes, 0, (NDPI_MAX_SUPPORTED_PROTOCOLS + 1) * sizeof(u_int64_t)); @@ -528,58 +435,53 @@ ndpi_load_protocols_file(ndpi_struct, _protoFilePath); } -static void terminateDetection(void) -{ - u_int32_t i; - - ndpi_exit_detection_module(ndpi_struct, free_wrapper); +static void free_osdpi_flow(struct osdpi_flow *flow) { + ndpi_free(flow->ndpi_flow); + ndpi_free(flow->src_id); + ndpi_free(flow->dst_id); +} - for (i = 0; i < MAX_OSDPI_IDS; i++) { - free(osdpi_ids[i].ndpi_id); - } - free(osdpi_ids); +static void osdpi_flow_freer(void *node) { + struct osdpi_flow *flow = (struct osdpi_flow*)node; + free_osdpi_flow(flow); + ndpi_free(flow); +} - /* Free flows (TODO) */ +static void terminateDetection(void) +{ + ndpi_tdestroy(osdpi_flows_root, osdpi_flow_freer); + ndpi_exit_detection_module(ndpi_struct, free_wrapper); } -static unsigned int packet_processing(const uint64_t time, const struct ndpi_iphdr *iph, uint16_t ipsize, uint16_t rawsize) +static unsigned int packet_processing(const u_int64_t time, const struct ndpi_iphdr *iph, + uint16_t ipsize, uint16_t rawsize) { - struct ndpi_id_struct *src = NULL; - struct ndpi_id_struct *dst = NULL; - struct osdpi_flow *flow = NULL; + struct ndpi_id_struct *src, *dst; + struct osdpi_flow *flow; struct ndpi_flow_struct *ndpi_flow = NULL; u_int32_t protocol = 0; - - src = get_id((u_int8_t *) & iph->saddr); - dst = get_id((u_int8_t *) & iph->daddr); + u_int16_t frag_off = ntohs(iph->frag_off); flow = get_osdpi_flow(iph, ipsize); if (flow != NULL) { ndpi_flow = flow->ndpi_flow; flow->packets++, flow->bytes += rawsize; + src = flow->src_id, dst = flow->dst_id; } ip_packet_count++; total_bytes += rawsize; -#ifndef NDPI_ENABLE_DEBUG_MESSAGES - if (ip_packet_count % 499 == 0) { - printf("\rip packets scanned: \x1b[33m%-10llu\x1b[0m ip bytes scanned: \x1b[34m%-10llu\x1b[0m", - (long long unsigned int)ip_packet_count, - (long long unsigned int)total_bytes); - } -#endif - // only handle unfragmented packets - if ((iph->frag_off & htons(0x1FFF)) == 0) { + if ((frag_off & 0x3FFF) == 0) { // here the actual detection is performed protocol = ndpi_detection_process_packet(ndpi_struct, ndpi_flow, (uint8_t *) iph, ipsize, time, src, dst); } else { static u_int8_t frag_warning_used = 0; + if (frag_warning_used == 0) { printf("\n\nWARNING: fragmented ip packets are not supported and will be skipped \n\n"); - sleep(2); frag_warning_used = 1; } return 0; @@ -597,8 +499,13 @@ } #endif - if (flow != NULL) + if (flow != NULL) { flow->detected_protocol = protocol; +#if 0 + if(ndpi_flow->l4.tcp.host_server_name[0] != '\0') + printf("%s\n", ndpi_flow->l4.tcp.host_server_name); +#endif + } return 0; } @@ -614,13 +521,12 @@ (long long unsigned int)raw_packet_count); printf("\tip bytes: \x1b[34m%-13llu\x1b[0m\n", (long long unsigned int)total_bytes); - printf("\tunique ids: \x1b[35m%-13u\x1b[0m\n", osdpi_id_count); printf("\tunique flows: \x1b[36m%-13u\x1b[0m\n", osdpi_flow_count); - twalk(osdpi_flows_root, node_proto_guess_walker); - if(enable_protocol_guess) + ndpi_twalk(osdpi_flows_root, node_proto_guess_walker); + if(enable_protocol_guess) printf("\tguessed flow protocols: \x1b[35m%-13u\x1b[0m\n", guessed_flow_protocols); - + printf("\n\ndetected protocols:\n"); for (i = 0; i <= NDPI_MAX_SUPPORTED_PROTOCOLS; i++) { @@ -635,7 +541,7 @@ if(verbose && (protocol_counter[0] > 0)) { printf("\n\nundetected flows:\n"); - twalk(osdpi_flows_root, node_print_unknown_proto_walker); + ndpi_twalk(osdpi_flows_root, node_print_unknown_proto_walker); } printf("\n\n"); @@ -666,7 +572,7 @@ struct ndpi_iphdr *iph = (struct ndpi_iphdr *) &packet[sizeof(struct ndpi_ethhdr)]; u_int64_t time; static u_int64_t lasttime = 0; - u_int16_t type; + u_int16_t type, ip_offset; raw_packet_count++; @@ -684,37 +590,75 @@ // just work on Ethernet packets that contain IP if (_pcap_datalink_type == DLT_EN10MB && type == htons(ETH_P_IP) && header->caplen >= sizeof(struct ndpi_ethhdr)) { + u_int16_t frag_off = ntohs(iph->frag_off); - if (header->caplen < header->len) { + if(header->caplen < header->len) { static u_int8_t cap_warning_used = 0; if (cap_warning_used == 0) { - printf - ("\n\nWARNING: packet capture size is smaller than packet size, DETECTION MIGHT NOT WORK CORRECTLY OR EVEN CRASH\n\n"); - sleep(2); + printf("\n\nWARNING: packet capture size is smaller than packet size, DETECTION MIGHT NOT WORK CORRECTLY\n\n"); cap_warning_used = 1; } } if (iph->version != 4) { static u_int8_t ipv4_warning_used = 0; + + v4_warning: if (ipv4_warning_used == 0) { - printf("\n\nWARNING: only IPv4 packets are supported, all other packets will be discarded\n\n"); - sleep(2); + printf("\n\nWARNING: only IPv4 packets are supported in this demo (nDPI supports both IPv4 and IPv6), all other packets will be discarded\n\n"); ipv4_warning_used = 1; } return; } + + ip_offset = sizeof(struct ndpi_ethhdr); + if(decode_tunnels && (iph->protocol == IPPROTO_UDP) && ((frag_off & 0x3FFF) == 0)) { + u_short ip_len = ((u_short)iph->ihl * 4); + struct ndpi_udphdr *udp = (struct ndpi_udphdr *)&packet[sizeof(struct ndpi_ethhdr)+ip_len]; + u_int16_t sport = ntohs(udp->source), dport = ntohs(udp->dest); + + if((sport == GTP_U_V1_PORT) || (dport == GTP_U_V1_PORT)) { + /* Check if it's GTPv1 */ + u_int offset = sizeof(struct ndpi_ethhdr)+ip_len+sizeof(struct ndpi_udphdr); + u_int8_t flags = packet[offset]; + u_int8_t message_type = packet[offset+1]; + + if((((flags & 0xE0) >> 5) == 1 /* GTPv1 */) && (message_type == 0xFF /* T-PDU */)) { + ip_offset = sizeof(struct ndpi_ethhdr)+ip_len+sizeof(struct ndpi_udphdr)+8 /* GTPv1 header len */; + + if(flags & 0x04) ip_offset += 1; /* next_ext_header is present */ + if(flags & 0x02) ip_offset += 4; /* sequence_number is present (it also includes next_ext_header and pdu_number) */ + if(flags & 0x01) ip_offset += 1; /* pdu_number is present */ + + iph = (struct ndpi_iphdr *) &packet[ip_offset]; + + if (iph->version != 4) { + // printf("WARNING: not good (packet_id=%u)!\n", (unsigned int)raw_packet_count); + goto v4_warning; + } + } + } + + } + // process the packet - packet_processing(time, iph, header->len - sizeof(struct ndpi_ethhdr), header->len); + packet_processing(time, iph, header->len - ip_offset, header->len); } } static void runPcapLoop(void) { - if (_pcap_handle != NULL) { + + printf("\n-----------------------------------------------------------\n" + "* NOTE: This is demo app to show *some* nDPI features.\n" + "* In this demo we have implemented only some basic features\n" + "* just to show you what you can do with the library. Feel \n" + "* free to extend it and send us the patches for inclusion\n" + "------------------------------------------------------------\n\n"); + + if (_pcap_handle != NULL) pcap_loop(_pcap_handle, -1, &pcap_packet_callback, NULL); - } } int main(int argc, char **argv) | ||
[-] [+] | Changed | nDPI.tar.bz2/example/protos.txt ^ |
@@ -2,5 +2,7 @@ # <tcp|udp>:<port>,<tcp|udp>:<port>,.....@<proto> tcp:81,tcp:8181@HTTP -udp:5061@SIP +udp:5061-5062@SIP +tcp:860,udp:860,tcp:3260,udp:3260@iSCSI +tcp:3000@ntop | ||
[-] [+] | Changed | nDPI.tar.bz2/src/include/Makefile.in ^ |
@@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -16,6 +16,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -49,6 +66,11 @@ CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -243,8 +265,11 @@ -rm -rf .libs _libs install-library_includeHEADERS: $(library_include_HEADERS) @$(NORMAL_INSTALL) - test -z "$(library_includedir)" || $(MKDIR_P) "$(DESTDIR)$(library_includedir)" @list='$(library_include_HEADERS)'; test -n "$(library_includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(library_includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(library_includedir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ | ||
[-] [+] | Changed | nDPI.tar.bz2/src/include/linux_compat.h ^ |
@@ -108,7 +108,7 @@ #define s6_addr16 __u6_addr.__u6_addr16 #define s6_addr32 __u6_addr.__u6_addr32 #else -#ifndef OPENDPI_NETFILTER_MODULE +#ifndef __KERNEL__ #include <arpa/inet.h> #endif #endif | ||
[-] [+] | Changed | nDPI.tar.bz2/src/include/ndpi_macros.h ^ |
@@ -29,8 +29,6 @@ #ifdef __cplusplus extern "C" { #endif - - typedef struct ndpi_protocol_bitmask_struct { u_int64_t bitmask[3]; } ndpi_protocol_bitmask_struct_t; @@ -76,6 +74,8 @@ #define NDPI_BITMASK_IS_ZERO(a) ( (a).bitmask[0] == 0 && (a).bitmask[1] == 0 && (a).bitmask[2] == 0) #define NDPI_BITMASK_CONTAINS_NEGATED_BITMASK(a,b) ((((a).bitmask[0] & ~(b).bitmask[0]) == ~(b).bitmask[0]) && (((a).bitmask[1] & ~(b).bitmask[1]) == ~(b).bitmask[1]) && (((a).bitmask[2] & ~(b).bitmask[2]) == ~(b).bitmask[2])) +#define ndpi_min(a,b) ((a < b) ? a : b) +#define ndpi_max(a,b) ((a > b) ? a : b) #define NDPI_PARSE_PACKET_LINE_INFO(ndpi_struct,flow,packet) \ if (packet->packet_lines_parsed_complete != 1) { \ | ||
[-] [+] | Changed | nDPI.tar.bz2/src/include/ndpi_main.h ^ |
@@ -26,17 +26,18 @@ #ifndef __NDPI_MAIN_INCLUDE_FILE__ #define __NDPI_MAIN_INCLUDE_FILE__ -#ifndef OPENDPI_NETFILTER_MODULE +#ifndef __KERNEL__ #include <stdint.h> #include <stdio.h> #include <stdarg.h> #include <string.h> +#include <sys/time.h> #endif #ifndef WIN32 #if 1 && !defined __APPLE__ && !defined __FreeBSD__ -#ifndef OPENDPI_NETFILTER_MODULE +#ifndef __KERNEL__ # include <endian.h> # include <byteswap.h> #else @@ -47,7 +48,7 @@ /* default includes */ -#ifndef OPENDPI_NETFILTER_MODULE +#ifndef __KERNEL__ #include <sys/param.h> #include <limits.h> #endif @@ -73,7 +74,7 @@ #endif #ifndef WIN32 -#ifndef OPENDPI_NETFILTER_MODULE +#ifndef __KERNEL__ # include <netinet/ip.h> # include <netinet/tcp.h> # include <netinet/udp.h> @@ -88,6 +89,27 @@ #include "ndpi_macros.h" #include "ndpi_protocols_osdpi.h" +typedef enum { + ndpi_preorder, + ndpi_postorder, + ndpi_endorder, + ndpi_leaf +} ndpi_VISIT; + +void *ndpi_tdelete(const void * __restrict, void ** __restrict, + int (*)(const void *, const void *)); +void *ndpi_tfind(const void *, void * const *, int (*)(const void *, const void *)); +void *ndpi_tsearch(const void *, void **, int (*)(const void *, const void *)); +void ndpi_twalk(const void *, void (*)(const void *, ndpi_VISIT, int)); +void ndpi_tdestroy(void *vrootp, void (*freefct)(void *)); + + +typedef struct node_t { + char *key; + struct node_t *left, *right; +} ndpi_node; + + u_int16_t ntohs_ndpi_bytestream_to_number(const u_int8_t * str, u_int16_t max_chars_to_read, u_int16_t * bytes_read); u_int32_t ndpi_bytestream_to_number(const u_int8_t * str, u_int16_t max_chars_to_read, u_int16_t * bytes_read); @@ -125,5 +147,6 @@ extern char *ndpi_get_ip_string(struct ndpi_detection_module_struct *ndpi_struct, const ndpi_ip_addr_t * ip); extern char *ndpi_get_packet_src_ip_string(struct ndpi_detection_module_struct *ndpi_struct, const struct ndpi_packet_struct *packet); +extern char* ndpi_get_proto_by_id(struct ndpi_detection_module_struct *ndpi_mod, u_int id); #endif /* __NDPI_MAIN_INCLUDE_FILE__ */ | ||
[-] [+] | Changed | nDPI.tar.bz2/src/include/ndpi_protocols.h ^ |
@@ -43,7 +43,7 @@ #define get_l32(X,O) get_u_int32_t(X,O) #elif defined(__BIG_ENDIAN__) /* convert the bytes from big to little endian */ -#ifndef OPENDPI_NETFILTER_MODULE +#ifndef __KERNEL__ # define get_l16(X,O) bswap_16(get_u_int16_t(X,O)) # define get_l32(X,O) bswap_32(get_u_int32_t(X,O)) #else | ||
[-] [+] | Changed | nDPI.tar.bz2/src/include/ndpi_protocols_osdpi.h ^ |
@@ -207,6 +207,7 @@ #define NDPI_LAST_IMPLEMENTED_PROTOCOL 155 #define NDPI_MAX_SUPPORTED_PROTOCOLS (NDPI_LAST_IMPLEMENTED_PROTOCOL + 1) +#define NDPI_MAX_NUM_CUSTOM_PROTOCOLS 32 #ifdef __cplusplus } #endif | ||
[-] [+] | Changed | nDPI.tar.bz2/src/include/ndpi_public_functions.h ^ |
@@ -128,6 +128,11 @@ u_int32_t ndpi_detection_get_sizeof_ndpi_id_struct(void); + /* Public malloc/free */ + void* ndpi_malloc(unsigned long size); + void ndpi_free(void *ptr); + + /** * This function returns a new initialized detection module. * @param ticks_per_second the timestamp resolution per second (like 1000 for millisecond resolution) @@ -135,10 +140,9 @@ * @param ndpi_debug_printf a function pointer to a debug output function, use NULL in productive envionments * @return the initialized detection module */ - struct ndpi_detection_module_struct *ndpi_init_detection_module(u_int32_t ticks_per_second, void - *(*ndpi_malloc) - (unsigned - long size), + struct ndpi_detection_module_struct *ndpi_init_detection_module(u_int32_t ticks_per_second, + void* (*__ndpi_malloc)(unsigned long size), + void (*__ndpi_free)(void *ptr), ndpi_debug_function_ptr ndpi_debug_printf); /** * This function destroys the detection module @@ -242,6 +246,7 @@ int ndpi_load_protocols_file(struct ndpi_detection_module_struct *ndpi_mod, char* path); + u_int ndpi_get_num_supported_protocols(void); #ifdef __cplusplus } #endif | ||
[-] [+] | Changed | nDPI.tar.bz2/src/include/ndpi_structs.h ^ |
@@ -212,6 +212,9 @@ u_int32_t pplive_last_packet_time_set:1; #endif } ndpi_id_struct; + +/* ************************************************** */ + struct ndpi_flow_tcp_struct { #ifdef NDPI_PROTOCOL_FLASH u_int16_t flash_bytes; @@ -280,6 +283,7 @@ u_int32_t http_stage:2; u_int32_t http_empty_line_seen:1; u_int32_t http_wait_for_retransmission:1; + u_char host_server_name[64]; #endif // NDPI_PROTOCOL_HTTP #ifdef NDPI_PROTOCOL_FLASH u_int32_t flash_stage:3; @@ -365,7 +369,9 @@ #ifdef NDPI_PROTOCOL_TEAMVIEWER u_int8_t teamviewer_stage; #endif -} +} + +/* ************************************************** */ #if !defined(WIN32) __attribute__ ((__packed__)) @@ -414,6 +420,8 @@ #endif } +/* ************************************************** */ + #if !defined(WIN32) __attribute__ ((__packed__)) #endif @@ -506,6 +514,10 @@ #define MAX_DEFAULT_PORTS 5 +typedef struct { + u_int16_t port_low, port_high; +} ndpi_port_range; + /* ntop extensions */ typedef struct ndpi_proto_defaults { char *protoName; @@ -537,11 +549,9 @@ struct ndpi_call_function_struct callback_buffer_tcp_payload[NDPI_MAX_SUPPORTED_PROTOCOLS + 1]; u_int32_t callback_buffer_size_tcp_payload; - struct ndpi_call_function_struct callback_buffer_udp[NDPI_MAX_SUPPORTED_PROTOCOLS + 1]; u_int32_t callback_buffer_size_udp; - struct ndpi_call_function_struct callback_buffer_non_tcp_udp[NDPI_MAX_SUPPORTED_PROTOCOLS + 1]; u_int32_t callback_buffer_size_non_tcp_udp; @@ -595,7 +605,7 @@ u_int8_t ip_version_limit; /* ********************* */ - ndpi_proto_defaults_t proto_defaults[NDPI_MAX_SUPPORTED_PROTOCOLS]; + ndpi_proto_defaults_t proto_defaults[NDPI_MAX_SUPPORTED_PROTOCOLS+NDPI_MAX_NUM_CUSTOM_PROTOCOLS]; } ndpi_detection_module_struct_t; typedef struct ndpi_flow_struct { | ||
[-] [+] | Changed | nDPI.tar.bz2/src/include/ndpi_utils.h ^ |
@@ -29,6 +29,7 @@ #include "ndpi_protocols.h" + extern char* ndpi_strnstr(const char *s, const char *find, size_t slen); #endif /* _NDPI_UTILS_H_ */ | ||
[-] [+] | Changed | nDPI.tar.bz2/src/lib/Makefile.in ^ |
@@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -17,6 +17,23 @@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -145,6 +162,11 @@ $(LDFLAGS) -o $@ SOURCES = $(libndpi_la_SOURCES) DIST_SOURCES = $(libndpi_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags @@ -428,7 +450,6 @@ $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ @@ -436,6 +457,8 @@ else :; fi; \ done; \ test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } | ||
[-] [+] | Changed | nDPI.tar.bz2/src/lib/ndpi_main.c ^ |
@@ -22,163 +22,199 @@ * */ + +#ifndef __KERNEL__ #include <stdlib.h> #include <errno.h> -#include <search.h> +#endif + #include "ndpi_main.h" #include "ndpi_protocols.h" #include "ndpi_utils.h" +#ifdef __KERNEL__ +#define printf printk +#endif + +static u_int _ndpi_num_supported_protocols = NDPI_MAX_SUPPORTED_PROTOCOLS; +#ifndef __KERNEL__ +static u_int _ndpi_num_custom_protocols = 0; +#endif + #ifdef WIN32 /* http://social.msdn.microsoft.com/Forums/uk/vcgeneral/thread/963aac07-da1a-4612-be4a-faac3f1d65ca */ #define strtok_r strtok +#endif /* ftp://ftp.cc.uoc.gr/mirrors/OpenBSD/src/lib/libc/stdlib/tsearch.c */ -typedef enum { - preorder, - postorder, - endorder, - leaf -} VISIT; - -void *tdelete(const void * __restrict, void ** __restrict, - int (*)(const void *, const void *)); -void *tfind(const void *, void * const *, - int (*)(const void *, const void *)); -void *tsearch(const void *, void **, int (*)(const void *, const void *)); -void twalk(const void *, void (*)(const void *, VISIT, int)); - -typedef struct node_t { - char *key; - struct node_t *left, *right; -} node; - -/* find or insert datum into search tree */ -void * -tsearch(const void *vkey, void **vrootp, - int (*compar)(const void *, const void *)) -{ - node *q; - char *key = (char *)vkey; - node **rootp = (node **)vrootp; - - if (rootp == (struct node_t **)0) - return ((void *)0); - while (*rootp != (struct node_t *)0) { /* Knuth's T1: */ - int r; - - if ((r = (*compar)(key, (*rootp)->key)) == 0) /* T2: */ - return ((void *)*rootp); /* we found it! */ - rootp = (r < 0) ? - &(*rootp)->left : /* T3: follow left branch */ - &(*rootp)->right; /* T4: follow right branch */ - } - q = (node *) malloc(sizeof(node)); /* T5: key not found */ - if (q != (struct node_t *)0) { /* make new node */ - *rootp = q; /* link new node to old */ - q->key = key; /* initialize new node */ - q->left = q->right = (struct node_t *)0; - } - return ((void *)q); -} - -/* delete node with given key */ -void * -tdelete(const void *vkey, void **vrootp, - int (*compar)(const void *, const void *)) -{ - node **rootp = (node **)vrootp; - char *key = (char *)vkey; - node *p = (node *)1; - node *q; - node *r; - int cmp; - - if (rootp == (struct node_t **)0 || *rootp == (struct node_t *)0) - return ((struct node_t *)0); - while ((cmp = (*compar)(key, (*rootp)->key)) != 0) { - p = *rootp; - rootp = (cmp < 0) ? - &(*rootp)->left : /* follow left branch */ - &(*rootp)->right; /* follow right branch */ - if (*rootp == (struct node_t *)0) - return ((void *)0); /* key not found */ - } - r = (*rootp)->right; /* D1: */ - if ((q = (*rootp)->left) == (struct node_t *)0) /* Left (struct node_t *)0? */ - q = r; - else if (r != (struct node_t *)0) { /* Right link is null? */ - if (r->left == (struct node_t *)0) { /* D2: Find successor */ - r->left = q; - q = r; - } else { /* D3: Find (struct node_t *)0 link */ - for (q = r->left; q->left != (struct node_t *)0; q = r->left) - r = q; - r->left = q->right; - q->left = (*rootp)->left; - q->right = (*rootp)->right; - } - } - free((struct node_t *) *rootp); /* D4: Free node */ - *rootp = q; /* link parent to new node */ - return(p); -} - -/* Walk the nodes of a tree */ -static void -trecurse(node *root, void (*action)(const void *, VISIT, int), int level) -{ - if (root->left == (struct node_t *)0 && root->right == (struct node_t *)0) - (*action)(root, leaf, level); - else { - (*action)(root, preorder, level); - if (root->left != (struct node_t *)0) - trecurse(root->left, action, level + 1); - (*action)(root, postorder, level); - if (root->right != (struct node_t *)0) - trecurse(root->right, action, level + 1); - (*action)(root, endorder, level); - } -} - -/* Walk the nodes of a tree */ -void -twalk(const void *vroot, void (*action)(const void *, VISIT, int)) -{ - node *root = (node *)vroot; - - if (root != (node *)0 && action != (void (*)(const void *, VISIT, int))0) - trecurse(root, action, 0); -} - -/* find a node, or return 0 */ -void * -tfind(const void *vkey, void * const *vrootp, - int (*compar)(const void *, const void *)) -{ - char *key = (char *)vkey; - node **rootp = (node **)vrootp; - - if (rootp == (struct node_t **)0) - return ((struct node_t *)0); - while (*rootp != (struct node_t *)0) { /* T1: */ - int r; - if ((r = (*compar)(key, (*rootp)->key)) == 0) /* T2: */ - return (*rootp); /* key found */ - rootp = (r < 0) ? - &(*rootp)->left : /* T3: follow left branch */ - &(*rootp)->right; /* T4: follow right branch */ - } - return (node *)0; +/* find or insert datum into search tree */ +void * +ndpi_tsearch(const void *vkey, void **vrootp, + int (*compar)(const void *, const void *)) +{ + ndpi_node *q; + char *key = (char *)vkey; + ndpi_node **rootp = (ndpi_node **)vrootp; + + if (rootp == (ndpi_node **)0) + return ((void *)0); + while (*rootp != (ndpi_node *)0) { /* Knuth's T1: */ + int r; + + if ((r = (*compar)(key, (*rootp)->key)) == 0) /* T2: */ + return ((void *)*rootp); /* we found it! */ + rootp = (r < 0) ? + &(*rootp)->left : /* T3: follow left branch */ + &(*rootp)->right; /* T4: follow right branch */ + } + q = (ndpi_node *) ndpi_malloc(sizeof(ndpi_node)); /* T5: key not found */ + if (q != (ndpi_node *)0) { /* make new node */ + *rootp = q; /* link new node to old */ + q->key = key; /* initialize new node */ + q->left = q->right = (ndpi_node *)0; + } + return ((void *)q); +} + +/* delete node with given key */ +void * +ndpi_tdelete(const void *vkey, void **vrootp, + int (*compar)(const void *, const void *)) +{ + ndpi_node **rootp = (ndpi_node **)vrootp; + char *key = (char *)vkey; + ndpi_node *p = (ndpi_node *)1; + ndpi_node *q; + ndpi_node *r; + int cmp; + + if (rootp == (ndpi_node **)0 || *rootp == (ndpi_node *)0) + return ((ndpi_node *)0); + while ((cmp = (*compar)(key, (*rootp)->key)) != 0) { + p = *rootp; + rootp = (cmp < 0) ? + &(*rootp)->left : /* follow left branch */ + &(*rootp)->right; /* follow right branch */ + if (*rootp == (ndpi_node *)0) + return ((void *)0); /* key not found */ + } + r = (*rootp)->right; /* D1: */ + if ((q = (*rootp)->left) == (ndpi_node *)0) /* Left (ndpi_node *)0? */ + q = r; + else if (r != (ndpi_node *)0) { /* Right link is null? */ + if (r->left == (ndpi_node *)0) { /* D2: Find successor */ + r->left = q; + q = r; + } else { /* D3: Find (ndpi_node *)0 link */ + for (q = r->left; q->left != (ndpi_node *)0; q = r->left) + r = q; + r->left = q->right; + q->left = (*rootp)->left; + q->right = (*rootp)->right; + } + } + ndpi_free((ndpi_node *) *rootp); /* D4: Free node */ + *rootp = q; /* link parent to new node */ + return(p); +} + +/* Walk the nodes of a tree */ +static void +trecurse(ndpi_node *root, void (*action)(const void *, ndpi_VISIT, int), int level) +{ + if (root->left == (ndpi_node *)0 && root->right == (ndpi_node *)0) + (*action)(root, ndpi_leaf, level); + else { + (*action)(root, ndpi_preorder, level); + if (root->left != (ndpi_node *)0) + trecurse(root->left, action, level + 1); + (*action)(root, ndpi_postorder, level); + if (root->right != (ndpi_node *)0) + trecurse(root->right, action, level + 1); + (*action)(root, ndpi_endorder, level); + } +} + +/* Walk the nodes of a tree */ +void +ndpi_twalk(const void *vroot, void (*action)(const void *, ndpi_VISIT, int)) +{ + ndpi_node *root = (ndpi_node *)vroot; + + if (root != (ndpi_node *)0 && action != (void (*)(const void *, ndpi_VISIT, int))0) + trecurse(root, action, 0); } -#endif +/* find a node, or return 0 */ +void * +ndpi_tfind(const void *vkey, void * const *vrootp, + int (*compar)(const void *, const void *)) +{ + char *key = (char *)vkey; + ndpi_node **rootp = (ndpi_node **)vrootp; + + if (rootp == (ndpi_node **)0) + return ((ndpi_node *)0); + while (*rootp != (ndpi_node *)0) { /* T1: */ + int r; + if ((r = (*compar)(key, (*rootp)->key)) == 0) /* T2: */ + return (*rootp); /* key found */ + rootp = (r < 0) ? + &(*rootp)->left : /* T3: follow left branch */ + &(*rootp)->right; /* T4: follow right branch */ + } + return (ndpi_node *)0; +} + +/* ****************************************** */ + +/* Walk the nodes of a tree */ +static void ndpi_tdestroy_recurse(ndpi_node* root, void (*free_action)(void *)) { + if (root->left != NULL) + ndpi_tdestroy_recurse(root->left, free_action); + if (root->right != NULL) + ndpi_tdestroy_recurse(root->right, free_action); + + (*free_action) ((void *) root->key); + ndpi_free(root); +} + +void ndpi_tdestroy(void *vrootp, void (*freefct)(void *)) { + ndpi_node *root = (ndpi_node *) vrootp; + + if (root != NULL) + ndpi_tdestroy_recurse(root, freefct); +} + +/* ****************************************** */ + +static void *(*_ndpi_malloc)(unsigned long size); +static void (*_ndpi_free)(void *ptr); + +/* ****************************************** */ static ndpi_default_ports_tree_node_t *tcpRoot = NULL, *udpRoot = NULL; /* Forward */ -static void addDefaultPort(u_int16_t port, ndpi_proto_defaults_t *def, ndpi_default_ports_tree_node_t **root); +static void addDefaultPort(ndpi_port_range *range, + ndpi_proto_defaults_t *def, ndpi_default_ports_tree_node_t **root); + + +void* ndpi_malloc(unsigned long size) { return(_ndpi_malloc(size)); } +void ndpi_free(void *ptr) { _ndpi_free(ptr); } + +char *ndpi_strdup(const char *s) { + int len = strlen(s); + char *m = ndpi_malloc(len+1); + + if(m) { + memcpy(m, s, len); + m[len] = '\0'; + } + + return(m); +} u_int32_t ndpi_detection_get_sizeof_ndpi_flow_struct(void) { @@ -191,13 +227,16 @@ } -struct ndpi_detection_module_struct *ndpi_init_detection_module(u_int32_t ticks_per_second, void - *(*ndpi_malloc) - (unsigned - long size), +struct ndpi_detection_module_struct *ndpi_init_detection_module(u_int32_t ticks_per_second, + void* (*__ndpi_malloc)(unsigned long size), + void (*__ndpi_free)(void *ptr), ndpi_debug_function_ptr ndpi_debug_printf) { struct ndpi_detection_module_struct *ndpi_str; + + _ndpi_malloc = __ndpi_malloc; + _ndpi_free = __ndpi_free; + ndpi_str = ndpi_malloc(sizeof(struct ndpi_detection_module_struct)); if (ndpi_str == NULL) { @@ -250,27 +289,58 @@ if(ndpi_struct != NULL) { int i; - for(i=0; i<NDPI_MAX_SUPPORTED_PROTOCOLS; i++) { + for(i=0; i<_ndpi_num_supported_protocols; i++) { if(ndpi_struct->proto_defaults[i].protoName) - free(ndpi_struct->proto_defaults[i].protoName); + ndpi_free(ndpi_struct->proto_defaults[i].protoName); } + ndpi_tdestroy(udpRoot, ndpi_free); + ndpi_tdestroy(tcpRoot, ndpi_free); + ndpi_free(ndpi_struct); } } /* ******************************************************************** */ -u_int16_t* ndpi_build_default_ports(u_int16_t *ports, - u_int16_t portA, u_int16_t portB, u_int16_t portC, - u_int16_t portD, u_int16_t portE) { +char* ndpi_get_proto_by_id(struct ndpi_detection_module_struct *ndpi_mod, u_int id) { + return((id >= _ndpi_num_supported_protocols) ? NULL : ndpi_mod->proto_defaults[id].protoName); +} + +/* ******************************************************************** */ + +ndpi_port_range* ndpi_build_default_ports_range(ndpi_port_range *ports, + u_int16_t portA_low, u_int16_t portA_high, + u_int16_t portB_low, u_int16_t portB_high, + u_int16_t portC_low, u_int16_t portC_high, + u_int16_t portD_low, u_int16_t portD_high, + u_int16_t portE_low, u_int16_t portE_high) { + int i = 0; + + ports[i].port_low = portA_low, ports[i].port_high = portA_high; i++; + ports[i].port_low = portB_low, ports[i].port_high = portB_high; i++; + ports[i].port_low = portC_low, ports[i].port_high = portC_high; i++; + ports[i].port_low = portD_low, ports[i].port_high = portD_high; i++; + ports[i].port_low = portE_low, ports[i].port_high = portE_high; i++; + + return(ports); +} + +/* ******************************************************************** */ + +ndpi_port_range* ndpi_build_default_ports(ndpi_port_range *ports, + u_int16_t portA, + u_int16_t portB, + u_int16_t portC, + u_int16_t portD, + u_int16_t portE) { int i = 0; - ports[i++] = portA; - ports[i++] = portB; - ports[i++] = portC; - ports[i++] = portD; - ports[i++] = portE; + ports[i].port_low = portA, ports[i].port_high = portA; i++; + ports[i].port_low = portB, ports[i].port_high = portB; i++; + ports[i].port_low = portC, ports[i].port_high = portC; i++; + ports[i].port_low = portD, ports[i].port_high = portD; i++; + ports[i].port_low = portE, ports[i].port_high = portE; i++; return(ports); } @@ -279,11 +349,11 @@ static void ndpi_set_proto_defaults(struct ndpi_detection_module_struct *ndpi_mod, u_int16_t protoId, char *protoName, - u_int16_t *tcpDefPorts, u_int16_t *udpDefPorts) { - char *name = strdup(protoName); + ndpi_port_range *tcpDefPorts, ndpi_port_range *udpDefPorts) { + char *name = ndpi_strdup(protoName); int j; - if(protoId >= NDPI_MAX_SUPPORTED_PROTOCOLS) { + if(protoId >= NDPI_MAX_SUPPORTED_PROTOCOLS+NDPI_MAX_NUM_CUSTOM_PROTOCOLS) { printf("[NDPI] %s(protoId=%d): INTERNAL ERROR\n", __FUNCTION__, protoId); return; } @@ -292,8 +362,8 @@ ndpi_mod->proto_defaults[protoId].protoId = protoId; for(j=0; j<MAX_DEFAULT_PORTS; j++) { - if(udpDefPorts[j] != 0) addDefaultPort(udpDefPorts[j], &ndpi_mod->proto_defaults[protoId], &udpRoot); - if(tcpDefPorts[j] != 0) addDefaultPort(tcpDefPorts[j], &ndpi_mod->proto_defaults[protoId], &tcpRoot); + if(udpDefPorts[j].port_low != 0) addDefaultPort(&udpDefPorts[j], &ndpi_mod->proto_defaults[protoId], &udpRoot); + if(tcpDefPorts[j].port_low != 0) addDefaultPort(&tcpDefPorts[j], &ndpi_mod->proto_defaults[protoId], &tcpRoot); } #if 0 @@ -319,23 +389,24 @@ /* ******************************************************************** */ -void ndpi_default_ports_tree_node_t_walker(const void *node, const VISIT which, const int depth) { +void ndpi_default_ports_tree_node_t_walker(const void *node, const ndpi_VISIT which, const int depth) { ndpi_default_ports_tree_node_t *f = *(ndpi_default_ports_tree_node_t **)node; printf("<%d>Walk on node %s (%u)\n", depth, - which == preorder?"preorder": - which == postorder?"postorder": - which == endorder?"endorder": - which == leaf?"leaf": "unknown", + which == ndpi_preorder?"ndpi_preorder": + which == ndpi_postorder?"ndpi_postorder": + which == ndpi_endorder?"ndpi_endorder": + which == ndpi_leaf?"ndpi_leaf": "unknown", f->default_port); } /* ******************************************************************** */ -static void addDefaultPort(u_int16_t port, ndpi_proto_defaults_t *def, ndpi_default_ports_tree_node_t **root) { - ndpi_default_ports_tree_node_t *node = (ndpi_default_ports_tree_node_t*)malloc(sizeof(ndpi_default_ports_tree_node_t)); +static void addDefaultPort(ndpi_port_range *range, + ndpi_proto_defaults_t *def, ndpi_default_ports_tree_node_t **root) { + ndpi_default_ports_tree_node_t *node = (ndpi_default_ports_tree_node_t*)ndpi_malloc(sizeof(ndpi_default_ports_tree_node_t)); // printf("[NDPI] %s(%d)\n", __FUNCTION__, port); @@ -343,13 +414,17 @@ printf("[NDPI] %s(): not enough memory\n", __FUNCTION__); } else { ndpi_default_ports_tree_node_t *ret; + u_int16_t port; - node->proto = def, node->default_port = port; - ret = *(ndpi_default_ports_tree_node_t**)tsearch(node, (void*)root, ndpi_default_ports_tree_node_t_cmp); /* Add it to the tree */ - - if(ret != node) { - printf("[NDPI] %s(): found duplicate for port %u\n", __FUNCTION__, port); - free(node); + for(port=range->port_low; port<=range->port_high; port++) { + node->proto = def, node->default_port = port; + ret = *(ndpi_default_ports_tree_node_t**)ndpi_tsearch(node, (void*)root, ndpi_default_ports_tree_node_t_cmp); /* Add it to the tree */ + + if(ret != node) { + printf("[NDPI] %s(): found duplicate for port %u\n", __FUNCTION__, port); + ndpi_free(node); + break; + } } } } @@ -361,171 +436,483 @@ */ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndpi_mod) { int i; - u_int16_t ports_a[MAX_DEFAULT_PORTS] , ports_b[MAX_DEFAULT_PORTS]; + ndpi_port_range ports_a[MAX_DEFAULT_PORTS], ports_b[MAX_DEFAULT_PORTS]; /* Reset all settings */ memset(ndpi_mod->proto_defaults, 0, sizeof(ndpi_mod->proto_defaults)); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_UNKNOWN, "UNKNOWN", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FTP, "FTP", ndpi_build_default_ports(ports_a, 20, 21, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MAIL_POP, "MAIL_POP", ndpi_build_default_ports(ports_a, 110, 995, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MAIL_SMTP, "MAIL_SMTP", ndpi_build_default_ports(ports_a, 25, 465, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MAIL_IMAP, "MAIL_IMAP", ndpi_build_default_ports(ports_a, 143, 993, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_DNS, "DNS", ndpi_build_default_ports(ports_a, 53, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 53, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_IPP, "IPP", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_HTTP, "HTTP", ndpi_build_default_ports(ports_a, 80, 3000 /* ntop */, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MDNS, "MDNS", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 5353, 5354, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_NTP, "NTP", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 123, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_NETBIOS, "NETBIOS", ndpi_build_default_ports(ports_a, 139, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 137, 138, 139, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_NFS, "NFS", ndpi_build_default_ports(ports_a, 2049, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 2049, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SSDP, "SSDP", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_BGP, "BGP", ndpi_build_default_ports(ports_a, 2605, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SNMP, "SNMP", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 161, 162, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_XDMCP, "XDMCP", ndpi_build_default_ports(ports_a, 177, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 177, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SMB, "SMB", ndpi_build_default_ports(ports_a, 445, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SYSLOG, "SYSLOG", ndpi_build_default_ports(ports_a, 514, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 514, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_DHCP, "DHCP", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 67, 68, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_POSTGRES, "POSTGRES", ndpi_build_default_ports(ports_a, 5432, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MYSQL, "MYSQL", ndpi_build_default_ports(ports_a, 3306, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_TDS, "TDS", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK, "DIRECT_DOWNLOAD_LINK", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_I23V5, "I23V5", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_APPLEJUICE, "APPLEJUICE", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_DIRECTCONNECT, "DIRECTCONNECT", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SOCRATES, "SOCRATES", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_WINMX, "WINMX", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MANOLITO, "MANOLITO", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_PANDO, "PANDO", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FILETOPIA, "FILETOPIA", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_IMESH, "IMESH", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_KONTIKI, "KONTIKI", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_OPENFT, "OPENFT", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FASTTRACK, "FASTTRACK", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_GNUTELLA, "GNUTELLA", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_EDONKEY, "EDONKEY", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_BITTORRENT, "BITTORRENT", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_OFF, "OFF", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_AVI, "AVI", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FLASH, "FLASH", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_OGG, "OGG", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MPEG, "MPEG", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_QUICKTIME, "QUICKTIME", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_REALMEDIA, "REALMEDIA", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_WINDOWSMEDIA, "WINDOWSMEDIA", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MMS, "MMS", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_XBOX, "XBOX", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_QQ, "QQ", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MOVE, "MOVE", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_RTSP, "RTSP", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 554, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FEIDIAN, "FEIDIAN", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_ICECAST, "ICECAST", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_PPLIVE, "PPLIVE", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_PPSTREAM, "PPSTREAM", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_ZATTOO, "ZATTOO", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SHOUTCAST, "SHOUTCAST", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SOPCAST, "SOPCAST", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_TVANTS, "TVANTS", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_TVUPLAYER, "TVUPLAYER", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_HTTP_APPLICATION_VEOHTV, "HTTP_APPLICATION_VEOHTV", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_QQLIVE, "QQLIVE", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_THUNDER, "THUNDER", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SOULSEEK, "SOULSEEK", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_GADUGADU, "GADUGADU", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_IRC, "IRC", ndpi_build_default_ports(ports_a, 194, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 194, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_POPO, "POPO", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_UNENCRYPED_JABBER, "UNENCRYPED_JABBER", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MSN, "MSN", ndpi_build_default_ports(ports_a, 1863, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_OSCAR, "OSCAR", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_YAHOO, "YAHOO", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_BATTLEFIELD, "BATTLEFIELD", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_QUAKE, "QUAKE", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SECONDLIFE, "SECONDLIFE", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_STEAM, "STEAM", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_HALFLIFE2, "HALFLIFE2", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_WORLDOFWARCRAFT, "WORLDOFWARCRAFT", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_TELNET, "TELNET", ndpi_build_default_ports(ports_a, 23, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_STUN, "STUN", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_IPSEC, "IPSEC", ndpi_build_default_ports(ports_a, 500, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 500, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_GRE, "GRE", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_ICMP, "ICMP", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_IGMP, "IGMP", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_EGP, "EGP", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SCTP, "SCTP", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_OSPF, "OSPF", ndpi_build_default_ports(ports_a, 2604, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_IP_IN_IP, "IP_IN_IP", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_RTP, "RTP", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_RDP, "RDP", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_VNC, "VNC", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_PCANYWHERE, "PCANYWHERE", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SSL, "SSL", ndpi_build_default_ports(ports_a, 443, 3001 /* ntop */, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SSH, "SSH", ndpi_build_default_ports(ports_a, 22, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_USENET, "USENET", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MGCP, "MGCP", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_IAX, "IAX", ndpi_build_default_ports(ports_a, 4569, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 4569, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_TFTP, "TFTP", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_AFP, "AFP", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_STEALTHNET, "STEALTHNET", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_AIMINI, "AIMINI", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SIP, "SIP", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 5060, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_TRUPHONE, "TRUPHONE", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_ICMPV6, "ICMPV6", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_DHCPV6, "DHCPV6", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_ARMAGETRON, "ARMAGETRON", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_CROSSFIRE, "CROSSFIRE", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_DOFUS, "DOFUS", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FIESTA, "FIESTA", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FLORENSIA, "FLORENSIA", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_GUILDWARS, "GUILDWARS", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_HTTP_APPLICATION_ACTIVESYNC, "HTTP_APPLICATION_ACTIVESYNC", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_KERBEROS, "KERBEROS", ndpi_build_default_ports(ports_a, 88, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 88, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_LDAP, "LDAP", ndpi_build_default_ports(ports_a, 389, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MAPLESTORY, "MAPLESTORY", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MSSQL, "MSSQL", ndpi_build_default_ports(ports_a, 1433, 1434, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_PPTP, "PPTP", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_WARCRAFT3, "WARCRAFT3", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_WORLD_OF_KUNG_FU, "WORLD_OF_KUNG_FU", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MEEBO, "MEEBO", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FACEBOOK, "FACEBOOK", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_TWITTER, "TWITTER", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_DROPBOX, "DROPBOX", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 17500 /* LanSync */, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_GMAIL, "GMAIL", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_GOOGLE_MAPS, "GOOGLE_MAPS", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_YOUTUBE, "YOUTUBE", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SKYPE, "SKYPE", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_GOOGLE, "GOOGLE", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_DCERPC, "DCERPC", ndpi_build_default_ports(ports_a, 135, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_NETFLOW, "NETFLOW", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 2055, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SFLOW, "SFLOW", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 6343, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_HTTP_CONNECT, "HTTP_CONNECT", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_HTTP_PROXY, "HTTP_PROXY", ndpi_build_default_ports(ports_a, 8080, 3128, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_CITRIX, "CITRIX", ndpi_build_default_ports(ports_a, 1494, 2598, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_NETFLIX, "NETFLIX", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_LASTFM, "LASTFM", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_GROOVESHARK, "GROOVESHARK", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SKYFILE_PREPAID, "SKYFILE_PREPAID", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SKYFILE_RUDICS, "SKYFILE_RUDICS", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SKYFILE_POSTPAID, "SKYFILE_POSTPAID", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_CITRIX_ONLINE, "CITRIX_ONLINE", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_APPLE, "APPLE", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_WEBEX, "WEBEX", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_WHATSAPP, "WHATSAPP", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_APPLE_ICLOUD, "APPLE_ICLOUD", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_VIBER, "VIBER", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_APPLE_ITUNES, "APPLE_ITUNES", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_RADIUS, "RADIUS", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_WINDOWS_UPDATE, "WINDOWS_UPDATE", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_TEAMVIEWER, "TEAMVIEWER", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_TUENTI, "TUENTI", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_LOTUS_NOTES, "LotusNotes", ndpi_build_default_ports(ports_a, 1352, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SAP, "SAP", ndpi_build_default_ports(ports_a, 3201, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); /* Missing dissector: port based only */ - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_GTP, "GTP", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 2152, 2123, 0, 0, 0) /* UDP */); - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_UPNP, "UPnP", ndpi_build_default_ports(ports_a, 1780, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 1900, 0, 0, 0, 0) /* UDP */); /* Missing dissector: port based only */ + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_UNKNOWN, "UNKNOWN", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FTP, "FTP", + ndpi_build_default_ports(ports_a, 20, 21, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MAIL_POP, "MAIL_POP", + ndpi_build_default_ports(ports_a, 110, 995, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MAIL_SMTP, "MAIL_SMTP", + ndpi_build_default_ports(ports_a, 25, 465, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MAIL_IMAP, "MAIL_IMAP", + ndpi_build_default_ports(ports_a, 143, 993, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_DNS, "DNS", + ndpi_build_default_ports(ports_a, 53, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 53, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_IPP, "IPP", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_HTTP, "HTTP", + ndpi_build_default_ports(ports_a, 80, 3000 /* ntop */, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MDNS, "MDNS", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 5353, 5354, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_NTP, "NTP", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 123, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_NETBIOS, "NETBIOS", + ndpi_build_default_ports(ports_a, 139, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 137, 138, 139, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_NFS, "NFS", + ndpi_build_default_ports(ports_a, 2049, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 2049, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SSDP, "SSDP", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_BGP, "BGP", + ndpi_build_default_ports(ports_a, 2605, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SNMP, "SNMP", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 161, 162, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_XDMCP, "XDMCP", + ndpi_build_default_ports(ports_a, 177, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 177, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SMB, "SMB", + ndpi_build_default_ports(ports_a, 445, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SYSLOG, "SYSLOG", + ndpi_build_default_ports(ports_a, 514, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 514, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_DHCP, "DHCP", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 67, 68, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_POSTGRES, "POSTGRES", + ndpi_build_default_ports(ports_a, 5432, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MYSQL, "MYSQL", + ndpi_build_default_ports(ports_a, 3306, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_TDS, "TDS", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK, "DIRECT_DOWNLOAD_LINK", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_I23V5, "I23V5", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_APPLEJUICE, "APPLEJUICE", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_DIRECTCONNECT, "DIRECTCONNECT", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SOCRATES, "SOCRATES", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_WINMX, "WINMX", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MANOLITO, "MANOLITO", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_PANDO, "PANDO", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FILETOPIA, "FILETOPIA", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_IMESH, "IMESH", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_KONTIKI, "KONTIKI", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_OPENFT, "OPENFT", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FASTTRACK, "FASTTRACK", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_GNUTELLA, "GNUTELLA", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_EDONKEY, "EDONKEY", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_BITTORRENT, "BITTORRENT", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_OFF, "OFF", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_AVI, "AVI", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FLASH, "FLASH", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_OGG, "OGG", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MPEG, "MPEG", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_QUICKTIME, "QUICKTIME", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_REALMEDIA, "REALMEDIA", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_WINDOWSMEDIA, "WINDOWSMEDIA", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MMS, "MMS", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_XBOX, "XBOX", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_QQ, "QQ", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MOVE, "MOVE", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_RTSP, "RTSP", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 554, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FEIDIAN, "FEIDIAN", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_ICECAST, "ICECAST", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_PPLIVE, "PPLIVE", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_PPSTREAM, "PPSTREAM", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_ZATTOO, "ZATTOO", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SHOUTCAST, "SHOUTCAST", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SOPCAST, "SOPCAST", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_TVANTS, "TVANTS", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_TVUPLAYER, "TVUPLAYER", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_HTTP_APPLICATION_VEOHTV, "HTTP_APPLICATION_VEOHTV", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_QQLIVE, "QQLIVE", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_THUNDER, "THUNDER", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SOULSEEK, "SOULSEEK", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_GADUGADU, "GADUGADU", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_IRC, "IRC", + ndpi_build_default_ports(ports_a, 194, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 194, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_POPO, "POPO", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_UNENCRYPED_JABBER, "UNENCRYPED_JABBER", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MSN, "MSN", + ndpi_build_default_ports(ports_a, 1863, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_OSCAR, "OSCAR", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_YAHOO, "YAHOO", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_BATTLEFIELD, "BATTLEFIELD", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_QUAKE, "QUAKE", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SECONDLIFE, "SECONDLIFE", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_STEAM, "STEAM", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_HALFLIFE2, "HALFLIFE2", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_WORLDOFWARCRAFT, "WORLDOFWARCRAFT", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_TELNET, "TELNET", + ndpi_build_default_ports(ports_a, 23, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_STUN, "STUN", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_IPSEC, "IPSEC", + ndpi_build_default_ports(ports_a, 500, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 500, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_GRE, "GRE", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_ICMP, "ICMP", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_IGMP, "IGMP", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_EGP, "EGP", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SCTP, "SCTP", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_OSPF, "OSPF", + ndpi_build_default_ports(ports_a, 2604, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_IP_IN_IP, "IP_IN_IP", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_RTP, "RTP", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_RDP, "RDP", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_VNC, "VNC", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_PCANYWHERE, "PCANYWHERE", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SSL, "SSL", + ndpi_build_default_ports(ports_a, 443, 3001 /* ntop */, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SSH, "SSH", + ndpi_build_default_ports(ports_a, 22, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_USENET, "USENET", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MGCP, "MGCP", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_IAX, "IAX", + ndpi_build_default_ports(ports_a, 4569, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 4569, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_TFTP, "TFTP", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_AFP, "AFP", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_STEALTHNET, "STEALTHNET", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_AIMINI, "AIMINI", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SIP, "SIP", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 5060, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_TRUPHONE, "TRUPHONE", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_ICMPV6, "ICMPV6", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_DHCPV6, "DHCPV6", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_ARMAGETRON, "ARMAGETRON", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_CROSSFIRE, "CROSSFIRE", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_DOFUS, "DOFUS", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FIESTA, "FIESTA", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FLORENSIA, "FLORENSIA", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_GUILDWARS, "GUILDWARS", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_HTTP_APPLICATION_ACTIVESYNC, "HTTP_APPLICATION_ACTIVESYNC", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_KERBEROS, "KERBEROS", + ndpi_build_default_ports(ports_a, 88, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 88, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_LDAP, "LDAP", + ndpi_build_default_ports(ports_a, 389, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MAPLESTORY, "MAPLESTORY", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MSSQL, "MSSQL", + ndpi_build_default_ports(ports_a, 1433, 1434, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_PPTP, "PPTP", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_WARCRAFT3, "WARCRAFT3", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_WORLD_OF_KUNG_FU, "WORLD_OF_KUNG_FU", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_MEEBO, "MEEBO", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FACEBOOK, "FACEBOOK", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_TWITTER, "TWITTER", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_DROPBOX, "DROPBOX", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 17500 /* LanSync */, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_GMAIL, "GMAIL", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_GOOGLE_MAPS, "GOOGLE_MAPS", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_YOUTUBE, "YOUTUBE", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SKYPE, "SKYPE", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_GOOGLE, "GOOGLE", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_DCERPC, "DCERPC", + ndpi_build_default_ports(ports_a, 135, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_NETFLOW, "NETFLOW", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 2055, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SFLOW, "SFLOW", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 6343, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_HTTP_CONNECT, "HTTP_CONNECT", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_HTTP_PROXY, "HTTP_PROXY", + ndpi_build_default_ports(ports_a, 8080, 3128, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_CITRIX, "CITRIX", + ndpi_build_default_ports(ports_a, 1494, 2598, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_NETFLIX, "NETFLIX", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_LASTFM, "LASTFM", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_GROOVESHARK, "GROOVESHARK", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SKYFILE_PREPAID, "SKYFILE_PREPAID", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SKYFILE_RUDICS, "SKYFILE_RUDICS", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SKYFILE_POSTPAID, "SKYFILE_POSTPAID", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_CITRIX_ONLINE, "CITRIX_ONLINE", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_APPLE, "APPLE", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_WEBEX, "WEBEX", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_WHATSAPP, "WHATSAPP", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_APPLE_ICLOUD, "APPLE_ICLOUD", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_VIBER, "VIBER", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_APPLE_ITUNES, "APPLE_ITUNES", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_RADIUS, "RADIUS", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_WINDOWS_UPDATE, "WINDOWS_UPDATE", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_TEAMVIEWER, "TEAMVIEWER", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_TUENTI, "TUENTI", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_LOTUS_NOTES, "LotusNotes", + ndpi_build_default_ports(ports_a, 1352, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_SAP, "SAP", + ndpi_build_default_ports(ports_a, 3201, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); /* Missing dissector: port based only */ + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_GTP, "GTP", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 2152, 2123, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_UPNP, "UPnP", + ndpi_build_default_ports(ports_a, 1780, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 1900, 0, 0, 0, 0) /* UDP */); /* Missing dissector: port based only */ /* http://en.wikipedia.org/wiki/Link-local_Multicast_Name_Resolution */ - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_LLMNR, "LLMNR", ndpi_build_default_ports(ports_a, 5355, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 5355, 0, 0, 0, 0) /* UDP */); /* Missing dissector: port based only */ - ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_REMOTE_SCAN, "RemoteScan", ndpi_build_default_ports(ports_a, 6077, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 6078, 0, 0, 0, 0) /* UDP */); /* Missing dissector: port based only */ + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_LLMNR, "LLMNR", + ndpi_build_default_ports(ports_a, 5355, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 5355, 0, 0, 0, 0) /* UDP */); /* Missing dissector: port based only */ + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_REMOTE_SCAN, "RemoteScan", + ndpi_build_default_ports(ports_a, 6077, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 6078, 0, 0, 0, 0) /* UDP */); /* Missing dissector: port based only */ - for(i=0; i<NDPI_MAX_SUPPORTED_PROTOCOLS; i++) { + for(i=0; i<_ndpi_num_supported_protocols; i++) { if(ndpi_mod->proto_defaults[i].protoName == NULL) { printf("[NDPI] %s(missing protoId=%d) INTERNAL ERROR: not all protocols have been initialized\n", __FUNCTION__, i); } @@ -534,11 +921,16 @@ /* ******************************************************************** */ -static int add_proto_default_port(u_int16_t **ports, u_int16_t new_port, ndpi_proto_defaults_t *def, ndpi_default_ports_tree_node_t *root) { +#ifndef __KERNEL__ +static int add_proto_default_port(u_int16_t **ports, u_int16_t new_port, + ndpi_proto_defaults_t *def, + ndpi_default_ports_tree_node_t *root) { u_int num_ports, i; if(*ports == NULL) { - addDefaultPort(new_port, def, &root); + ndpi_port_range range = { new_port, new_port }; + + addDefaultPort(&range, def, &root); return(0); } @@ -549,7 +941,8 @@ printf("Too many ports defined: ignored port %d\n", new_port); return(-1); } else { - u_int16_t *new_ports = (u_int16_t*)malloc(num_ports+1); + u_int16_t *new_ports = (u_int16_t*)ndpi_malloc(num_ports+1); + ndpi_port_range range; if(new_ports == NULL) { printf("Not enough memory\n"); @@ -562,13 +955,21 @@ new_ports[i++] = new_port; new_ports[i++] = 0; - free(*ports); + ndpi_free(*ports); *ports = new_ports; - addDefaultPort(new_port, def, &root); + range.port_low = range.port_high = new_port; + addDefaultPort(&range, def, &root); return(0); } } +#endif + +/* ******************************************************************** */ + +u_int ndpi_get_num_supported_protocols() { + return(_ndpi_num_supported_protocols); +} /* ******************************************************************** */ @@ -580,8 +981,11 @@ tcp:80,tcp:3128@HTTP udp:139@NETBIOS - */ +*/ int ndpi_load_protocols_file(struct ndpi_detection_module_struct *ndpi_mod, char* path) { +#ifdef __KERNEL__ + return(0); +#else FILE *fd = fopen(path, "r"); if(fd == NULL) { @@ -609,7 +1013,7 @@ } else at[0] = 0, proto = &at[1]; - for(i=0, def = NULL; i<NDPI_MAX_SUPPORTED_PROTOCOLS; i++) { + for(i=0, def = NULL; i<_ndpi_num_supported_protocols; i++) { if(strcmp(ndpi_mod->proto_defaults[i].protoName, proto) == 0) { def = &ndpi_mod->proto_defaults[i]; break; @@ -617,13 +1021,25 @@ } if(def == NULL) { - printf("Skipping unknown protocol '%s'\n", proto); - continue; + ndpi_port_range ports_a[MAX_DEFAULT_PORTS] , ports_b[MAX_DEFAULT_PORTS]; + + if(_ndpi_num_custom_protocols >= (NDPI_MAX_NUM_CUSTOM_PROTOCOLS-1)) { + printf("Too many protocols defined (%u): skipping protocol %s\n", + _ndpi_num_custom_protocols, proto); + continue; + } + + ndpi_set_proto_defaults(ndpi_mod, _ndpi_num_supported_protocols, ndpi_strdup(proto), + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + def = &ndpi_mod->proto_defaults[_ndpi_num_supported_protocols]; + _ndpi_num_supported_protocols++, _ndpi_num_custom_protocols++; } elem = strtok_r(line, ",", &holder); while(elem != NULL) { char *port; + ndpi_port_range range; if((elem[0] != 't') && (elem[0] != 'u')) { printf("Invalid protocol definition (tcp or udp) %s", elem); @@ -635,8 +1051,11 @@ continue; } - port = &elem[4]; - addDefaultPort(atoi(port), def, (elem[0] == 't' /* TCP */) ? &tcpRoot : &udpRoot); + if(sscanf(&elem[4], "%u-%u", (unsigned int *)&range.port_low, + (unsigned int *)&range.port_high) != 2) + range.port_low = range.port_high = atoi(&elem[4]); + + addDefaultPort(&range, def, (elem[0] == 't' /* TCP */) ? &tcpRoot : &udpRoot); elem = strtok_r(NULL, ",", &holder); } } @@ -645,10 +1064,13 @@ #if 0 printf("\nTCP:\n"); - twalk(tcpRoot, ndpi_default_ports_tree_node_t_walker); + ndpi_twalk(tcpRoot, ndpi_default_ports_tree_node_t_walker); printf("\nUDP:\n"); - twalk(udpRoot, ndpi_default_ports_tree_node_t_walker); + ndpi_twalk(udpRoot, ndpi_default_ports_tree_node_t_walker); #endif +#endif + + return(0); } /* ******************************************************************** */ @@ -658,7 +1080,6 @@ { NDPI_PROTOCOL_BITMASK detection_bitmask_local; NDPI_PROTOCOL_BITMASK *detection_bitmask = &detection_bitmask_local; - u_int16_t *tcpPorts, *udpPorts; u_int32_t a = 0; ndpi_init_protocol_defaults(ndpi_struct); @@ -3357,7 +3778,7 @@ } if (packet->line[packet->parsed_lines].len > 13 - && memcmp(packet->line[packet->parsed_lines].ptr, "content-type:", 13) == 0) { + && memcmp(packet->line[packet->parsed_lines].ptr, "Content-type:", 13) == 0) { packet->content_line.ptr = &packet->line[packet->parsed_lines].ptr[13]; packet->content_line.len = packet->line[packet->parsed_lines].len - 13; } @@ -3434,7 +3855,7 @@ if (packet->parsed_lines >= 1) { packet->line[packet->parsed_lines].len = (u_int16_t)(((unsigned long) &packet->payload[packet->payload_packet_len]) - - ((unsigned long) packet->line[packet->parsed_lines].ptr)); + ((unsigned long) packet->line[packet->parsed_lines].ptr)); packet->parsed_lines++; } } @@ -3462,8 +3883,8 @@ for (a = 0; a < end; a++) { if (packet->payload[a] == 0x0a) { packet->unix_line[packet->parsed_unix_lines].len = (u_int16_t)( - ((unsigned long) &packet->payload[a]) - - ((unsigned long) packet->unix_line[packet->parsed_unix_lines].ptr)); + ((unsigned long) &packet->payload[a]) - + ((unsigned long) packet->unix_line[packet->parsed_unix_lines].ptr)); if (packet->parsed_unix_lines >= (NDPI_MAX_PARSE_LINES_PER_PACKET - 1)) { break; @@ -4078,8 +4499,7 @@ #endif snprintf(ndpi_struct->ip_string, NDPI_IP_STRING_SIZE, "%u.%u.%u.%u", a[0], a[1], a[2], a[3]); return ndpi_struct->ip_string; - char *ndpi_get_packet_dst_ip_string(struct ndpi_detection_module_struct *ndpi_struct, - const struct ndpi_packet_struct *packet)} +} /* get the string representation of the source ip address from packet */ @@ -4111,9 +4531,11 @@ /* ****************************************************** */ +#ifndef __KERNEL__ static u_int is_port(u_int16_t sport, u_int16_t dport, u_int16_t match_port) { return(((match_port == sport) || (match_port == dport)) ? 1 : 0); } +#endif /* ****************************************************** */ @@ -4142,11 +4564,11 @@ ndpi_default_ports_tree_node_t node; node.default_port = sport; - ret = tfind(&node, (proto == IPPROTO_TCP) ? (void*)&tcpRoot : (void*)&udpRoot, ndpi_default_ports_tree_node_t_cmp); + ret = ndpi_tfind(&node, (proto == IPPROTO_TCP) ? (void*)&tcpRoot : (void*)&udpRoot, ndpi_default_ports_tree_node_t_cmp); if(ret == NULL) { node.default_port = dport; - ret = tfind(&node, (proto == IPPROTO_TCP) ? (void*)&tcpRoot : (void*)&udpRoot, ndpi_default_ports_tree_node_t_cmp); + ret = ndpi_tfind(&node, (proto == IPPROTO_TCP) ? (void*)&tcpRoot : (void*)&udpRoot, ndpi_default_ports_tree_node_t_cmp); } if(ret != NULL) { @@ -4161,7 +4583,7 @@ char* ndpi_get_proto_name(struct ndpi_detection_module_struct *mod, u_int16_t proto_id) { - if(proto_id > NDPI_LAST_IMPLEMENTED_PROTOCOL) proto_id = NDPI_PROTOCOL_UNKNOWN; + if(proto_id > _ndpi_num_supported_protocols) proto_id = NDPI_PROTOCOL_UNKNOWN; return(mod->proto_defaults[proto_id].protoName); } @@ -4170,6 +4592,6 @@ void ndpi_dump_protocols(struct ndpi_detection_module_struct *mod) { int i; - for(i=0; i<NDPI_MAX_SUPPORTED_PROTOCOLS; i++) + for(i=0; i<_ndpi_num_supported_protocols; i++) printf("[%3d] %s\n", i, mod->proto_defaults[i].protoName); } | ||
[-] [+] | Changed | nDPI.tar.bz2/src/lib/protocols/citrix.c ^ |
@@ -31,8 +31,6 @@ static void ndpi_check_citrix(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { struct ndpi_packet_struct *packet = &flow->packet; - - const u_int8_t *packet_payload = packet->payload; u_int32_t payload_len = packet->payload_packet_len; #if 0 | ||
[-] [+] | Changed | nDPI.tar.bz2/src/lib/protocols/dns.c ^ |
@@ -47,10 +47,10 @@ NDPI_LOG(NDPI_PROTOCOL_DNS, ndpi_struct, NDPI_LOG_DEBUG, "calculated dport over tcp.\n"); } - if((dport == 53) || (sport == 53) + if(((dport == 53) || (sport == 53)) && (packet->payload_packet_len > sizeof(struct dns_packet_header))) { struct dns_packet_header header, *dns = (struct dns_packet_header*)&packet->payload[packet->tcp ? 2 : 0]; - u_int8_t is_query, ret_code, standard_query, is_dns = 0; + u_int8_t is_query, ret_code, is_dns = 0; header.flags = ntohs(dns->flags); header.transaction_id = ntohs(dns->transaction_id); | ||
[-] [+] | Changed | nDPI.tar.bz2/src/lib/protocols/dropbox.c ^ |
@@ -38,7 +38,7 @@ static void ndpi_check_dropbox(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { struct ndpi_packet_struct *packet = &flow->packet; - const u_int8_t *packet_payload = packet->payload; + // const u_int8_t *packet_payload = packet->payload; u_int32_t payload_len = packet->payload_packet_len; if(packet->udp != NULL) { | ||
[-] [+] | Changed | nDPI.tar.bz2/src/lib/protocols/gtp.c ^ |
@@ -32,8 +32,7 @@ static void ndpi_check_gtp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { struct ndpi_packet_struct *packet = &flow->packet; - - const u_int8_t *packet_payload = packet->payload; + // const u_int8_t *packet_payload = packet->payload; u_int32_t payload_len = packet->payload_packet_len; #if 0 | ||
[-] [+] | Changed | nDPI.tar.bz2/src/lib/protocols/http.c ^ |
@@ -505,11 +505,28 @@ { NULL, 0 } }; -int matchStringProtocol(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, - char *string_to_match, u_int string_to_match_len) { - int i = 0; +int matchStringProtocol(struct ndpi_detection_module_struct *ndpi_struct, + struct ndpi_flow_struct *flow, + char *string_to_match, + u_int string_to_match_len) { + int i = 0, end = string_to_match_len-1, num_found = 0; struct ndpi_packet_struct *packet = &flow->packet; + while(end > 0) { + if(string_to_match[end] == '.') { + num_found++; + if(num_found == 2) { + end++; + break; + } + } + end--; + } + + strncpy(flow->l4.tcp.host_server_name, + &string_to_match[end], + ndpi_min(sizeof(flow->l4.tcp.host_server_name)-1, string_to_match_len-end)); + while(host_match[i].string_to_match != NULL) { if(ndpi_strnstr(string_to_match, host_match[i].string_to_match, @@ -529,7 +546,7 @@ } static void parseHttpSubprotocol(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { - int i = 0; + // int i = 0; struct ndpi_packet_struct *packet = &flow->packet; if(packet->iph /* IPv4 only */) { @@ -701,6 +718,10 @@ { struct ndpi_packet_struct *packet = &flow->packet; + NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG, "====>>>> HTTP: %c%c%c%c [len: %u]\n", + packet->payload[0], packet->payload[1], packet->payload[2], packet->payload[3], + packet->payload_packet_len); + /* FIRST PAYLOAD PACKET FROM CLIENT */ /* check if the packet starts with POST or GET */ if (packet->payload_packet_len >= 4 && memcmp(packet->payload, "GET ", 4) == 0) { @@ -813,6 +834,12 @@ if (flow->l4.tcp.http_stage == 0) { filename_start = http_request_url_offset(ndpi_struct, flow); if (filename_start == 0) { + if (packet->payload_packet_len >= 7 && memcmp(packet->payload, "HTTP/1.", 7) == 0) { + NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG, "HTTP response found (truncated flow ?)\n"); + ndpi_int_http_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_HTTP); + return; + } + NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG, "filename not found, exclude\n"); http_bitmask_exclude(flow); return; @@ -823,6 +850,9 @@ if (packet->parsed_lines <= 1) { /* parse one more packet .. */ NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG, "just one line, search next packet\n"); + + packet->http_method.ptr = packet->line[0].ptr; + packet->http_method.len = filename_start - 1; flow->l4.tcp.http_stage = 1; return; } @@ -859,7 +889,6 @@ ndpi_parse_packet_line_info(ndpi_struct, flow); if (packet->parsed_lines <= 1) { - /* wait some packets in case request is split over more than 2 packets */ if (flow->packet_counter < 5) { NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG, @@ -885,7 +914,19 @@ return; } } + } else { + /* We have received a response for a previously identified partial HTTP request */ + + if((packet->parsed_lines == 1) && (packet->packet_direction == 1 /* server -> client */)) { + /* + In apache if you do "GET /\n\n" the response comes without any header so we can assume that + this can be the case + */ + ndpi_int_http_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_HTTP); + return; + } } + NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG, "HTTP: REQUEST NOT HTTP CONFORM\n"); http_bitmask_exclude(flow); return; | ||
[-] [+] | Changed | nDPI.tar.bz2/src/lib/protocols/lotus_notes.c ^ |
@@ -28,9 +28,8 @@ static void ndpi_check_lotus_notes(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { - struct ndpi_packet_struct *packet = &flow->packet; - - const u_int8_t *packet_payload = packet->payload; + struct ndpi_packet_struct *packet = &flow->packet; + // const u_int8_t *packet_payload = packet->payload; u_int32_t payload_len = packet->payload_packet_len; if(packet->tcp != NULL) { | ||
[-] [+] | Changed | nDPI.tar.bz2/src/lib/protocols/netflow.c ^ |
@@ -23,13 +23,17 @@ #ifdef NDPI_PROTOCOL_NETFLOW +#ifndef __KERNEL__ +#define do_gettimeofday(a) gettimeofday(a, NULL) +#endif + static void ndpi_check_netflow(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { struct ndpi_packet_struct *packet = &flow->packet; - - const u_int8_t *packet_payload = packet->payload; + // const u_int8_t *packet_payload = packet->payload; u_int32_t payload_len = packet->payload_packet_len; time_t now; + struct timeval now_tv; if((packet->udp != NULL) && (payload_len >= 24) @@ -44,13 +48,8 @@ when = ntohl(*_when); -#ifndef OPENDPI_NETFILTER_MODULE - now = time(NULL); -#else - struct timeval now_tv; do_gettimeofday(&now_tv); now = now_tv.tv_sec; -#endif if((when >= 946684800 /* 1/1/2000 */) && (when <= now)) { NDPI_LOG(NDPI_PROTOCOL_NETFLOW, ndpi_struct, NDPI_LOG_DEBUG, "Found netflow.\n"); | ||
[-] [+] | Changed | nDPI.tar.bz2/src/lib/protocols/radius.c ^ |
@@ -31,9 +31,8 @@ static void ndpi_check_radius(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { - struct ndpi_packet_struct *packet = &flow->packet; - - const u_int8_t *packet_payload = packet->payload; + struct ndpi_packet_struct *packet = &flow->packet; + // const u_int8_t *packet_payload = packet->payload; u_int32_t payload_len = packet->payload_packet_len; #if 0 | ||
[-] [+] | Changed | nDPI.tar.bz2/src/lib/protocols/sflow.c ^ |
@@ -25,9 +25,8 @@ static void ndpi_check_sflow(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { - struct ndpi_packet_struct *packet = &flow->packet; - - const u_int8_t *packet_payload = packet->payload; + struct ndpi_packet_struct *packet = &flow->packet; + // const u_int8_t *packet_payload = packet->payload; u_int32_t payload_len = packet->payload_packet_len; if((packet->udp != NULL) | ||
[-] [+] | Changed | nDPI.tar.bz2/src/lib/protocols/skype.c ^ |
@@ -23,6 +23,7 @@ #ifdef NDPI_PROTOCOL_SKYPE +#if 0 static u_int is_private_addr(u_int32_t addr) { addr = ntohl(addr); @@ -35,12 +36,12 @@ else return(0); } +#endif static void ndpi_check_skype(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { - struct ndpi_packet_struct *packet = &flow->packet; - - const u_int8_t *packet_payload = packet->payload; + struct ndpi_packet_struct *packet = &flow->packet; + // const u_int8_t *packet_payload = packet->payload; u_int32_t payload_len = packet->payload_packet_len; #if 0 | ||
[-] [+] | Changed | nDPI.tar.bz2/src/lib/protocols/ssl.c ^ |
@@ -39,23 +39,16 @@ } } -#ifndef WIN32 -#ifndef OPENDPI_NETFILTER_MODULE -inline int min(int a, int b) { return(a < b ? a : b); } -#endif -#endif - -#ifdef OPENDPI_NETFILTER_MODULE /* Can't call libc functions from kernel space, define some stub instead */ -#define isalpha(ch) (((ch) >= 'a' && (ch) <= 'z') || ((ch) >= 'A' && (ch) <= 'Z')) -#define isdigit(ch) ((ch) >= '0' && (ch) <= '9') -#define isspace(ch) (((ch) >= '\t' && (ch) <= '\r') || ((ch) == ' ')) -#define isprint(ch) ((ch) >= 0x20 && (ch) <= 0x7e) -#define ispunct(ch) (((ch) >= '!' && (ch) <= '/') || \ + +#define ndpi_isalpha(ch) (((ch) >= 'a' && (ch) <= 'z') || ((ch) >= 'A' && (ch) <= 'Z')) +#define ndpi_isdigit(ch) ((ch) >= '0' && (ch) <= '9') +#define ndpi_isspace(ch) (((ch) >= '\t' && (ch) <= '\r') || ((ch) == ' ')) +#define ndpi_isprint(ch) ((ch) >= 0x20 && (ch) <= 0x7e) +#define ndpi_ispunct(ch) (((ch) >= '!' && (ch) <= '/') || \ ((ch) >= ':' && (ch) <= '@') || \ ((ch) >= '[' && (ch) <= '`') || \ ((ch) >= '{' && (ch) <= '~')) -#endif static void stripCertificateTrailer(char *buffer, int buffer_len) { int i; @@ -63,8 +56,8 @@ for(i=0; i<buffer_len; i++) { if((buffer[i] != '.') && (buffer[i] != '-') - && (!isalpha(buffer[i])) - && (!isdigit(buffer[i]))) + && (!ndpi_isalpha(buffer[i])) + && (!ndpi_isdigit(buffer[i]))) buffer[i] = '\0'; break; } @@ -95,19 +88,19 @@ u_int8_t begin = 0, len, j, num_dots; while(begin < server_len) { - if(!isprint(server_name[begin])) + if(!ndpi_isprint(server_name[begin])) begin++; else break; } - len = min(server_len-begin, buffer_len-1); + len = ndpi_min(server_len-begin, buffer_len-1); strncpy(buffer, &server_name[begin], len); buffer[len] = '\0'; /* We now have to check if this looks like an IP address or host name */ for(j=0, num_dots = 0; j<len; j++) { - if(!isprint((buffer[j]))) { + if(!ndpi_isprint((buffer[j]))) { num_dots = 0; /* This is not what we look for */ break; } else if(buffer[j] == '.') { @@ -159,15 +152,15 @@ char *server_name = (char*)&packet->payload[offset+extension_offset]; while(begin < extension_len) { - if((!isprint(server_name[begin])) - || ispunct(server_name[begin]) - || isspace(server_name[begin])) + if((!ndpi_isprint(server_name[begin])) + || ndpi_ispunct(server_name[begin]) + || ndpi_isspace(server_name[begin])) begin++; else break; } - len = min(extension_len-begin, buffer_len-1); + len = ndpi_min(extension_len-begin, buffer_len-1); strncpy(buffer, &server_name[begin], len); buffer[len] = '\0'; stripCertificateTrailer(buffer, buffer_len); @@ -190,7 +183,7 @@ int sslDetectProtocolFromCertificate(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { struct ndpi_packet_struct *packet = &flow->packet; - if(!packet->iph /* IPv4 */) return; + if(!packet->iph /* IPv4 */) return(-1); if((packet->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) || (packet->detected_protocol_stack[0] == NDPI_PROTOCOL_SSL)) { | ||
Added | nprobe_6.11.130207_svn3155_proplugins.tgz ^ | |
Added | nprobe_6.11.130209_svn3198_proplugins.tgz ^ |