mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
Fix get_flags_val usage
This commit is contained in:
@ -806,7 +806,10 @@ def bpf_skb_store_bytes_emitter(
|
|||||||
flags_val = get_flags_val(call.args[3], builder, local_sym_tab)
|
flags_val = get_flags_val(call.args[3], builder, local_sym_tab)
|
||||||
else:
|
else:
|
||||||
flags_val = 0
|
flags_val = 0
|
||||||
flags = ir.Constant(ir.IntType(64), flags_val)
|
if isinstance(flags_val, int):
|
||||||
|
flags = ir.Constant(ir.IntType(64), flags_val)
|
||||||
|
else:
|
||||||
|
flags = flags_val
|
||||||
fn_type = ir.FunctionType(
|
fn_type = ir.FunctionType(
|
||||||
ir.IntType(64),
|
ir.IntType(64),
|
||||||
args_signature,
|
args_signature,
|
||||||
@ -922,8 +925,8 @@ def bpf_ringbuf_submit_emitter(
|
|||||||
)
|
)
|
||||||
|
|
||||||
flags_const = get_flags_val(flags_arg, builder, local_sym_tab)
|
flags_const = get_flags_val(flags_arg, builder, local_sym_tab)
|
||||||
if not flags_arg:
|
if isinstance(flags_const, int):
|
||||||
flags_const = ir.Constant(ir.IntType(64), 0)
|
flags_const = ir.Constant(ir.IntType(64), flags_const)
|
||||||
|
|
||||||
map_void_ptr = builder.bitcast(map_ptr, ir.PointerType())
|
map_void_ptr = builder.bitcast(map_ptr, ir.PointerType())
|
||||||
fn_type = ir.FunctionType(
|
fn_type = ir.FunctionType(
|
||||||
@ -962,11 +965,14 @@ def bpf_get_stack_emitter(
|
|||||||
)
|
)
|
||||||
ctx_ptr = func.args[0] # First argument to the function is ctx
|
ctx_ptr = func.args[0] # First argument to the function is ctx
|
||||||
buf_arg = call.args[0]
|
buf_arg = call.args[0]
|
||||||
flags_arg = call.args[1] if len(call.args) == 2 else 0
|
flags_arg = call.args[1] if len(call.args) == 2 else None
|
||||||
buf_ptr, buf_size = get_buffer_ptr_and_size(
|
buf_ptr, buf_size = get_buffer_ptr_and_size(
|
||||||
buf_arg, builder, local_sym_tab, struct_sym_tab
|
buf_arg, builder, local_sym_tab, struct_sym_tab
|
||||||
)
|
)
|
||||||
flags_val = get_flags_val(flags_arg, builder, local_sym_tab)
|
flags_val = get_flags_val(flags_arg, builder, local_sym_tab)
|
||||||
|
if isinstance(flags_val, int):
|
||||||
|
flags_val = ir.Constant(ir.IntType(64), flags_val)
|
||||||
|
|
||||||
buf_void_ptr = builder.bitcast(buf_ptr, ir.PointerType())
|
buf_void_ptr = builder.bitcast(buf_ptr, ir.PointerType())
|
||||||
fn_type = ir.FunctionType(
|
fn_type = ir.FunctionType(
|
||||||
ir.IntType(64),
|
ir.IntType(64),
|
||||||
|
|||||||
Reference in New Issue
Block a user