Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 99190 | Differences between
and this patch

Collapse All | Expand All

(-)ppp-2.4.2.org/pppd/demand.c (-1 / +2 lines)
Lines 50-57 Link Here
50
#include <sys/socket.h>
50
#include <sys/socket.h>
51
#ifdef PPP_FILTER
51
#ifdef PPP_FILTER
52
#include <net/if.h>
52
#include <net/if.h>
53
#include <net/bpf.h>
53
#include <pcap-bpf.h>
54
#include <pcap.h>
54
#include <pcap.h>
55
#include <linux/if_ether.h>
55
#endif
56
#endif
56
57
57
#include "pppd.h"
58
#include "pppd.h"
(-)ppp-2.4.2.org/pppd/options.c (-12 / +35 lines)
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
(-)ppp-2.4.2.org/pppd/sys-linux.c (-1 / +1 lines)
Lines 141-147 Link Here
141
#endif /* IPX_CHANGE */
141
#endif /* IPX_CHANGE */
142
142
143
#ifdef PPP_FILTER
143
#ifdef PPP_FILTER
144
#include <net/bpf.h>
144
#include <pcap-bpf.h>
145
#include <linux/filter.h>
145
#include <linux/filter.h>
146
#endif /* PPP_FILTER */
146
#endif /* PPP_FILTER */
(-)ppp-2.4.2.org/pppd/demand.c (+2 lines)
Lines 349-360 Link Here
349
	return 0;
349
	return 0;
350
    proto = PPP_PROTOCOL(p);
350
    proto = PPP_PROTOCOL(p);
351
#ifdef PPP_FILTER
351
#ifdef PPP_FILTER
352
    *p = 1; /* set outbound for the filter rule */
352
    if (pass_filter.bf_len != 0
353
    if (pass_filter.bf_len != 0
353
	&& bpf_filter(pass_filter.bf_insns, p, len, len) == 0)
354
	&& bpf_filter(pass_filter.bf_insns, p, len, len) == 0)
354
	return 0;
355
	return 0;
355
    if (active_filter.bf_len != 0
356
    if (active_filter.bf_len != 0
356
	&& bpf_filter(active_filter.bf_insns, p, len, len) == 0)
357
	&& bpf_filter(active_filter.bf_insns, p, len, len) == 0)
357
	return 0;
358
	return 0;
359
    *p = 0xff; /* restore original ppp header */
358
#endif
360
#endif
359
    for (i = 0; (protp = protocols[i]) != NULL; ++i) {
361
    for (i = 0; (protp = protocols[i]) != NULL; ++i) {
360
	if (protp->protocol < 0xC000 && (protp->protocol & ~0x8000) == proto) {
362
	if (protp->protocol < 0xC000 && (protp->protocol & ~0x8000) == proto) {

Return to bug 99190