Commit cecd0da5 authored by 4ast's avatar 4ast

Merge pull request #20 from plumgrid/small_test_fix

Fix for 2 tests
parents 19109565 05045995
......@@ -169,7 +169,7 @@ class BPF(object):
ifindex = int(f.read())
if not isinstance(fn, BPF.Function):
raise Exception("arg 1 must be of type BPF.Function")
res = lib.bpf_attach_filter(fn.fd, fn.name, ifindex, prio, classid)
res = lib.bpf_attach_filter(fn.fd, fn.name.encode("ascii"), ifindex, prio, classid)
if res < 0:
raise Exception("Failed to filter with BPF")
......
......@@ -32,7 +32,7 @@ class TestBPFSocket(TestCase):
key = Key(IPAddress("172.16.1.1").value, IPAddress("172.16.1.2").value)
leaf = Leaf(IPAddress("192.168.1.1").value, IPAddress("192.168.1.2").value, 0)
self.xlate.put(key, leaf)
udp = socket(AF_INET, SOCK_DGRAM)
with socket(AF_INET, SOCK_DGRAM) as udp:
udp.sendto(b"a" * 10, ("172.16.1.1", 5000))
leaf = self.xlate.get(key)
self.assertGreater(leaf.xlated_pkts, 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment