Changeset 1734 for trunk/src/tcpreplay.c

Show
Ignore:
Timestamp:
03/20/07 22:20:18 (22 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

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • 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