mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
Fix map access syntax in examples/xdp_pass
This commit is contained in:
@ -23,14 +23,14 @@ def count() -> HashMap:
|
|||||||
def hello_world(ctx: c_void_p) -> c_int64:
|
def hello_world(ctx: c_void_p) -> c_int64:
|
||||||
key = 0
|
key = 0
|
||||||
one = 1
|
one = 1
|
||||||
prev = count().lookup(key)
|
prev = count.lookup(key)
|
||||||
if prev:
|
if prev:
|
||||||
prevval = prev + 1
|
prevval = prev + 1
|
||||||
print(f"count: {prevval}")
|
print(f"count: {prevval}")
|
||||||
count().update(key, prevval)
|
count.update(key, prevval)
|
||||||
return XDP_PASS
|
return XDP_PASS
|
||||||
else:
|
else:
|
||||||
count().update(key, one)
|
count.update(key, one)
|
||||||
|
|
||||||
return XDP_PASS
|
return XDP_PASS
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user