Changeset 1734

Show
Ignore:
Timestamp:
03/20/07 22:20:18 (20 months ago)
Author:
aturner
Message:

tag things as rc1 refs #108
add support for pcap_snapshot_override() refs #130
check that dual nic mode both interfaces have the same dlt refs #125

Location:
trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/configure.in

    r1730 r1734  
    1313MAJOR_VERSION=3 
    1414MINOR_VERSION=0 
    15 MICRO_VERSION=beta13 
     15MICRO_VERSION=RC1 
    1616TCPREPLAY_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION 
    1717 
     
    495495              [Does libpcap have dlt_val_to_desc?]) 
    496496fi 
     497 
     498 
     499dnl Check to see if we've got pcap_snapshot_override() 
     500AC_MSG_CHECKING(for pcap_snapshot_override) 
     501AC_LINK_IFELSE(AC_LANG_PROGRAM([[ 
     502#include <stdio.h> 
     503#include <stdlib.h> 
     504#include <string.h> 
     505#include "$LPCAPINC" 
     506]],[[ 
     507        pcap_t *pcap; 
     508        pcap_snapshot_override(pcap, 1); 
     509        exit(0); 
     510]]),[ 
     511    have_pcap_snapshot_override=yes 
     512    AC_MSG_RESULT(yes) 
     513], [ 
     514    have_pcap_snapshot_override=no 
     515    AC_MSG_RESULT(no) 
     516]) 
     517 
     518if test $have_pcap_snapshot_override = yes ; then 
     519    AC_DEFINE([HAVE_PCAP_SNAPSHOT_OVERRIDE], [1],  
     520              [Does libpcap have pcap_snapshot_override()?]) 
     521fi 
     522 
    497523 
    498524dnl This message is placed here for continuity purposes 
  • trunk/src/tcpprep.c

    r1643 r1734  
    122122        errx(1, "Error opening file: %s", errbuf); 
    123123 
     124#ifdef HAVE_PCAP_SNAPSHOT_OVERRIDE 
     125    /* libpcap >= 0.9.6 have this which handles broken RedHat libpcap files */ 
     126    pcap_snapshot_override(pin, 65535); 
     127#endif 
     128 
    124129    /* make sure we support the DLT type */ 
    125130    switch(pcap_datalink(options.pcap)) { 
     
    307312#endif 
    308313     
     314    assert(pcap); 
     315     
    309316    while ((pktdata = pcap_next(pcap, &pkthdr)) != NULL) { 
    310317        packetnum++; 
     
    316323            if (options.xX.mode < xXExclude) { 
    317324                if (!check_list(options.xX.list, packetnum)) { 
    318                     add_cache(&options.cachedata, DONT_SEND, 0); 
     325                    add_cache(&(options.cachedata), DONT_SEND, 0); 
    319326                    continue; 
    320327                } 
    321328            } 
    322329            else if (check_list(options.xX.list, packetnum)) { 
    323                 add_cache(&options.cachedata, DONT_SEND, 0); 
     330                add_cache(&(options.cachedata), DONT_SEND, 0); 
    324331                continue; 
    325332            } 
  • trunk/src/tcpreplay.c

    r1700 r1734  
    118118    if (bytes_sent > 0) 
    119119        packet_stats(&begin, &end, bytes_sent, pkts_sent, failed); 
    120  
    121120    return 0; 
    122121}                               /* main() */ 
     
    131130    pcap_t *pcap = NULL; 
    132131    char ebuf[PCAP_ERRBUF_SIZE]; 
     132    int dlt; 
    133133 
    134134#ifdef HAVE_TCPDUMP 
     
    150150        errx(1, "Error opening pcap file: %s", ebuf); 
    151151 
     152#ifdef HAVE_PCAP_SNAPSHOT_OVERRIDE 
     153    /* libpcap >= 0.9.6 have this which handles broken RedHat libpcap files */ 
     154    pcap_snapshot_override(pcap, 65535); 
     155#endif 
     156 
     157    dlt = sendpacket_get_dlt(options.intf1); 
     158    if ((dlt > 0) && (dlt != pcap_datalink(pcap))) 
     159        warnx("%s DLT does not match that of the outbound interface: %s", path, options.intf1->device); 
     160         
    152161    send_packets(pcap); 
    153162    pcap_close(pcap); 
     
    198207    char *temp; 
    199208    char ebuf[SENDPACKET_ERRBUF_SIZE]; 
     209    int int1dlt, int2dlt; 
    200210     
    201211 
     
    252262        errx(1, "Can't open %s: %s", options.intf1_name, ebuf); 
    253263            
     264    int1dlt = sendpacket_get_dlt(options.intf1); 
     265     
    254266    if (HAVE_OPT(INTF2)) { 
    255267        options.intf2_name = (char *)safe_malloc(strlen(OPT_ARG(INTF2)) + 1); 
     
    259271        if ((options.intf2 = sendpacket_open(options.intf2_name, ebuf)) == NULL) 
    260272            errx(1, "Can't open %s: %s", options.intf2_name, ebuf); 
     273             
     274        int2dlt = sendpacket_get_dlt(options.intf2); 
     275        if (int2dlt != int1dlt) 
     276            errx(1, "DLT type missmatch for %s and %s", options.intf1_name, options.intf2_name); 
    261277    } 
    262278 
  • trunk/src/tcprewrite.c

    r1701 r1734  
    199199    pkthdr_ptr = &pkthdr; 
    200200 
     201#ifdef HAVE_PCAP_SNAPSHOT_OVERRIDE 
     202    /* libpcap >= 0.9.6 have this which handles broken RedHat libpcap files */ 
     203    pcap_snapshot_override(pin, 65535); 
     204#endif 
     205 
    201206    /* MAIN LOOP  
    202207     * Keep sending while we have packets or until