Lines 56-62
Link Here
|
56 |
#endif |
56 |
#endif |
57 |
#ifdef PPP_FILTER |
57 |
#ifdef PPP_FILTER |
58 |
#include <pcap.h> |
58 |
#include <pcap.h> |
59 |
#include <pcap-int.h> /* XXX: To get struct pcap */ |
|
|
60 |
#endif |
59 |
#endif |
61 |
|
60 |
|
62 |
#include "pppd.h" |
61 |
#include "pppd.h" |
Lines 122-128
Link Here
|
122 |
#ifdef PPP_FILTER |
121 |
#ifdef PPP_FILTER |
123 |
struct bpf_program pass_filter;/* Filter program for packets to pass */ |
122 |
struct bpf_program pass_filter;/* Filter program for packets to pass */ |
124 |
struct bpf_program active_filter; /* Filter program for link-active pkts */ |
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 |
#endif |
124 |
#endif |
127 |
|
125 |
|
128 |
char *current_option; /* the name of the option being parsed */ |
126 |
char *current_option; /* the name of the option being parsed */ |
Lines 1439-1450
Link Here
|
1439 |
setpassfilter(argv) |
1437 |
setpassfilter(argv) |
1440 |
char **argv; |
1438 |
char **argv; |
1441 |
{ |
1439 |
{ |
1442 |
pc.linktype = DLT_PPP; |
1440 |
#ifdef DLT_PPP_WITHDIRECTION |
1443 |
pc.snapshot = PPP_HDRLEN; |
1441 |
pcap_t* pc = pcap_open_dead (DLT_PPP_WITHDIRECTION, PPP_HDRLEN); |
1444 |
|
1442 |
#else |
1445 |
if (pcap_compile(&pc, &pass_filter, *argv, 1, netmask) == 0) |
1443 |
#warning with libpcap 0.8... you are not able to use IN/OUT filters with DLT_PPP |
|
|
1444 |
pcap_t* pc = pcap_open_dead (DLT_PPP, PPP_HDRLEN); |
1445 |
#endif |
1446 |
if (!pc) { |
1447 |
option_error("error in pass-filter expression: pcap_open_dead failed\n"); |
1448 |
return 0; |
1449 |
} |
1450 |
|
1451 |
if (pcap_compile(pc, &pass_filter, *argv, 1, netmask) == 0) { |
1452 |
pcap_close (pc); |
1446 |
return 1; |
1453 |
return 1; |
1447 |
option_error("error in pass-filter expression: %s\n", pcap_geterr(&pc)); |
1454 |
} |
|
|
1455 |
|
1456 |
option_error("error in pass-filter expression: %s\n", pcap_geterr(pc)); |
1457 |
pcap_close (pc); |
1448 |
return 0; |
1458 |
return 0; |
1449 |
} |
1459 |
} |
1450 |
|
1460 |
|
Lines 1455-1466
Link Here
|
1455 |
setactivefilter(argv) |
1465 |
setactivefilter(argv) |
1456 |
char **argv; |
1466 |
char **argv; |
1457 |
{ |
1467 |
{ |
1458 |
pc.linktype = DLT_PPP; |
1468 |
#ifdef DLT_PPP_WITHDIRECTION |
1459 |
pc.snapshot = PPP_HDRLEN; |
1469 |
pcap_t* pc = pcap_open_dead (DLT_PPP_WITHDIRECTION, PPP_HDRLEN); |
1460 |
|
1470 |
#else |
1461 |
if (pcap_compile(&pc, &active_filter, *argv, 1, netmask) == 0) |
1471 |
#warning with libpcap 0.8... you are not able to use IN/OUT filters with DLT_PPP |
|
|
1472 |
pcap_t* pc = pcap_open_dead (DLT_PPP, PPP_HDRLEN); |
1473 |
#endif |
1474 |
|
1475 |
if (!pc) { |
1476 |
option_error("error in active-filter expression: pcap_open_dead failed\n"); |
1477 |
return 0; |
1478 |
} |
1479 |
|
1480 |
if (pcap_compile(pc, &active_filter, *argv, 1, netmask) == 0) { |
1481 |
pcap_close (pc); |
1462 |
return 1; |
1482 |
return 1; |
1463 |
option_error("error in active-filter expression: %s\n", pcap_geterr(&pc)); |
1483 |
} |
|
|
1484 |
|
1485 |
option_error("error in active-filter expression: %s\n", pcap_geterr(pc)); |
1486 |
pcap_close (pc); |
1464 |
return 0; |
1487 |
return 0; |
1465 |
} |
1488 |
} |
1466 |
#endif |
1489 |
#endif |