Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
affansyed committed Sep 14, 2015
2 parents d96f6ca + 67337ad commit c3ad098
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/cc/test_xlate1.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,5 @@ int on_packet(struct __sk_buff *skb) {
}

EOP:
return 1;
return 0;
}
11 changes: 7 additions & 4 deletions tests/cc/test_xlate1.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from netaddr import IPAddress
from bcc import BPF
from pyroute2 import IPRoute
from pyroute2 import IPRoute, protocols
from socket import socket, AF_INET, SOCK_DGRAM
from subprocess import call
import sys
Expand All @@ -19,7 +19,7 @@
class TestBPFFilter(TestCase):
def setUp(self):
b = BPF(arg1, arg2, debug=0)
fn = b.load_func("on_packet", BPF.SCHED_CLS)
fn = b.load_func("on_packet", BPF.SCHED_ACT)
ip = IPRoute()
ifindex = ip.link_lookup(ifname="eth0")[0]
# set up a network to change the flow:
Expand All @@ -31,8 +31,11 @@ def setUp(self):
ip.tc("add", "ingress", ifindex, "ffff:")
ip.tc("add", "sfq", ifindex, "1:")
# add same program to both ingress/egress, so pkt is translated in both directions
ip.tc("add-filter", "bpf", ifindex, ":1", fd=fn.fd, name=fn.name, parent="ffff:", action="ok", classid=1)
ip.tc("add-filter", "bpf", ifindex, ":2", fd=fn.fd, name=fn.name, parent="1:", action="ok", classid=1)
action = {"kind": "bpf", "fd": fn.fd, "name": fn.name, "action": "ok"}
ip.tc("add-filter", "u32", ifindex, ":1", parent="ffff:", action=[action],
protocol=protocols.ETH_P_ALL, classid=1, target=0x10002, keys=['0x0/0x0+0'])
ip.tc("add-filter", "u32", ifindex, ":2", parent="1:", action=[action],
protocol=protocols.ETH_P_ALL, classid=1, target=0x10002, keys=['0x0/0x0+0'])
self.xlate = b.get_table("xlate")

def test_xlate(self):
Expand Down

0 comments on commit c3ad098

Please sign in to comment.