source: npl/internetserver/poptop_ppp/patches/ppp-2.4.2-pcap.patch @ 5160d62

perl-5.22
Last change on this file since 5160d62 was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100644
File size: 1.9 KB
  • ppp-2.4.2/pppd/options.c

    old new  
    5656#endif
    5757#ifdef PPP_FILTER
    5858#include <pcap.h>
    59 #include <pcap-int.h>   /* XXX: To get struct pcap */
    6059#endif
    6160
    6261#include "pppd.h"
     
    122121#ifdef PPP_FILTER
    123122struct  bpf_program pass_filter;/* Filter program for packets to pass */
    124123struct  bpf_program active_filter; /* Filter program for link-active pkts */
    125 pcap_t  pc;                     /* Fake struct pcap so we can compile expr */
    126124#endif
    127125
    128126char *current_option;           /* the name of the option being parsed */
     
    14391437setpassfilter(argv)
    14401438    char **argv;
    14411439{
    1442     pc.linktype = DLT_PPP;
    1443     pc.snapshot = PPP_HDRLEN;
     1440    pcap_t* pc = pcap_open_dead (DLT_PPP, PPP_HDRLEN);
     1441    if (!pc) {
     1442        option_error("error in pass-filter expression: pcap_open_dead failed\n");
     1443        return 0;
     1444    }
    14441445 
    1445     if (pcap_compile(&pc, &pass_filter, *argv, 1, netmask) == 0)
     1446    if (pcap_compile(pc, &pass_filter, *argv, 1, netmask) == 0) {
     1447        pcap_close(pc);
    14461448        return 1;
    1447     option_error("error in pass-filter expression: %s\n", pcap_geterr(&pc));
     1449    }
     1450    option_error("error in pass-filter expression: %s\n", pcap_geterr(pc));
     1451    pcap_close(pc);
    14481452    return 0;
    14491453}
    14501454
     
    14551459setactivefilter(argv)
    14561460    char **argv;
    14571461{
    1458     pc.linktype = DLT_PPP;
    1459     pc.snapshot = PPP_HDRLEN;
     1462    pcap_t* pc = pcap_open_dead (DLT_PPP, PPP_HDRLEN);
     1463    if (!pc) {
     1464        option_error("error in pass-filter expression: pcap_open_dead failed\n");
     1465        return 0;
     1466    }
    14601467 
    1461     if (pcap_compile(&pc, &active_filter, *argv, 1, netmask) == 0)
     1468    if (pcap_compile(pc, &active_filter, *argv, 1, netmask) == 0) {
     1469        pcap_close(pc);
    14621470        return 1;
    1463     option_error("error in active-filter expression: %s\n", pcap_geterr(&pc));
     1471    }
     1472    option_error("error in active-filter expression: %s\n", pcap_geterr(pc));
     1473    pcap_close(pc);
    14641474    return 0;
    14651475}
    14661476#endif
Note: See TracBrowser for help on using the repository browser.