source:
npl/internetserver/poptop_ppp/patches/ppp-2.4.2-pcap.patch
@
5160d62
Last change on this file since 5160d62 was c5c522c, checked in by , 8 years ago | |
---|---|
|
|
File size: 1.9 KB |
-
ppp-2.4.2/pppd/options.c
old new 56 56 #endif 57 57 #ifdef PPP_FILTER 58 58 #include <pcap.h> 59 #include <pcap-int.h> /* XXX: To get struct pcap */60 59 #endif 61 60 62 61 #include "pppd.h" … … 122 121 #ifdef PPP_FILTER 123 122 struct bpf_program pass_filter;/* Filter program for packets to pass */ 124 123 struct bpf_program active_filter; /* Filter program for link-active pkts */ 125 pcap_t pc; /* Fake struct pcap so we can compile expr */126 124 #endif 127 125 128 126 char *current_option; /* the name of the option being parsed */ … … 1439 1437 setpassfilter(argv) 1440 1438 char **argv; 1441 1439 { 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 } 1444 1445 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); 1446 1448 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); 1448 1452 return 0; 1449 1453 } 1450 1454 … … 1455 1459 setactivefilter(argv) 1456 1460 char **argv; 1457 1461 { 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 } 1460 1467 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); 1462 1470 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); 1464 1474 return 0; 1465 1475 } 1466 1476 #endif
Note: See TracBrowser
for help on using the repository browser.