diff --git a/backends/tc/ebpfCodeGen.cpp b/backends/tc/ebpfCodeGen.cpp index caf624e1e52..d2feac2f605 100644 --- a/backends/tc/ebpfCodeGen.cpp +++ b/backends/tc/ebpfCodeGen.cpp @@ -514,6 +514,24 @@ void EBPFPnaParser::emit(EBPF::CodeBuilder *builder) { builder->blockEnd(true); } +void EBPFPnaParser::emitRejectState(EBPF::CodeBuilder *builder) { + builder->emitIndent(); + builder->appendFormat("if (%s == 0) ", program->errorVar.c_str()); + builder->blockStart(); + builder->target->emitTraceMessage( + builder, "Parser: Explicit transition to reject state, dropping packet.."); + builder->emitIndent(); + builder->appendFormat("return %s", builder->target->abortReturnCode().c_str()); + builder->endOfStatement(true); + builder->blockEnd(true); + builder->emitIndent(); + builder->appendFormat("compiler_meta__->parser_error = %s", program->errorVar.c_str()); + builder->endOfStatement(true); + builder->emitIndent(); + builder->appendFormat("goto %s", IR::ParserState::accept.c_str()); + builder->endOfStatement(true); +} + // This code is similar to compileExtractField function in PsaStateTranslationVisitor. // Handled TC "macaddr" annotation. void PnaStateTranslationVisitor::compileExtractField(const IR::Expression *expr, @@ -1330,6 +1348,9 @@ bool ControlBodyTranslatorPNA::preorder(const IR::Member *m) { if (m->member.name == "input_port") { builder->append("skb->ifindex"); return false; + } else if (m->member.name == "parser_error") { + builder->append("compiler_meta__->parser_error"); + return false; } else { ::error(ErrorType::ERR_UNSUPPORTED_ON_TARGET, "%1%: this metadata field is not supported", m); diff --git a/backends/tc/ebpfCodeGen.h b/backends/tc/ebpfCodeGen.h index b5a9cc95a43..3b48a52704a 100644 --- a/backends/tc/ebpfCodeGen.h +++ b/backends/tc/ebpfCodeGen.h @@ -130,6 +130,7 @@ class EBPFPnaParser : public EBPF::EBPFPsaParser { EBPFPnaParser(const EBPF::EBPFProgram *program, const IR::ParserBlock *block, const P4::TypeMap *typeMap); void emit(EBPF::CodeBuilder *builder) override; + void emitRejectState(EBPF::CodeBuilder *) override; DECLARE_TYPEINFO(EBPFPnaParser, EBPF::EBPFPsaParser); }; diff --git a/backends/tc/runtime/pna.h b/backends/tc/runtime/pna.h index 51b2545cda4..cb89b3a4c76 100644 --- a/backends/tc/runtime/pna.h +++ b/backends/tc/runtime/pna.h @@ -78,6 +78,7 @@ struct pna_global_metadata { PortId_t egress_port; enum MirrorType mirror_type; MirrorSlotId_t mirror_slot_id; + ParserError_t parser_error; MirrorSessionId_t mirror_session_id; __u8 mark; bool pass_to_kernel; // internal metadata, forces sending packet up to kernel stack diff --git a/testdata/p4tc_samples_outputs/calculator_control_blocks.c b/testdata/p4tc_samples_outputs/calculator_control_blocks.c index c8ee1fbfac7..f80f5913d0d 100644 --- a/testdata/p4tc_samples_outputs/calculator_control_blocks.c +++ b/testdata/p4tc_samples_outputs/calculator_control_blocks.c @@ -92,7 +92,7 @@ if (/* hdr->p4calc.isValid() */ tmp_5 = hdr->ethernet.dstAddr; hdr->ethernet.dstAddr = hdr->ethernet.srcAddr; hdr->ethernet.srcAddr = tmp_5; - /* send_to_port(istd.input_port) */ + /* send_to_port(skb->ifindex) */ compiler_meta__->drop = false; send_to_port(skb->ifindex); } @@ -103,7 +103,7 @@ if (/* hdr->p4calc.isValid() */ tmp_5 = hdr->ethernet.dstAddr; hdr->ethernet.dstAddr = hdr->ethernet.srcAddr; hdr->ethernet.srcAddr = tmp_5; - /* send_to_port(istd.input_port) */ + /* send_to_port(skb->ifindex) */ compiler_meta__->drop = false; send_to_port(skb->ifindex); } @@ -114,7 +114,7 @@ if (/* hdr->p4calc.isValid() */ tmp_5 = hdr->ethernet.dstAddr; hdr->ethernet.dstAddr = hdr->ethernet.srcAddr; hdr->ethernet.srcAddr = tmp_5; - /* send_to_port(istd.input_port) */ + /* send_to_port(skb->ifindex) */ compiler_meta__->drop = false; send_to_port(skb->ifindex); } @@ -125,7 +125,7 @@ if (/* hdr->p4calc.isValid() */ tmp_5 = hdr->ethernet.dstAddr; hdr->ethernet.dstAddr = hdr->ethernet.srcAddr; hdr->ethernet.srcAddr = tmp_5; - /* send_to_port(istd.input_port) */ + /* send_to_port(skb->ifindex) */ compiler_meta__->drop = false; send_to_port(skb->ifindex); } @@ -136,7 +136,7 @@ if (/* hdr->p4calc.isValid() */ tmp_5 = hdr->ethernet.dstAddr; hdr->ethernet.dstAddr = hdr->ethernet.srcAddr; hdr->ethernet.srcAddr = tmp_5; - /* send_to_port(istd.input_port) */ + /* send_to_port(skb->ifindex) */ compiler_meta__->drop = false; send_to_port(skb->ifindex); } diff --git a/testdata/p4tc_samples_outputs/calculator_parser.c b/testdata/p4tc_samples_outputs/calculator_parser.c index 1cbf8ba5e9b..e839bf5ed24 100644 --- a/testdata/p4tc_samples_outputs/calculator_parser.c +++ b/testdata/p4tc_samples_outputs/calculator_parser.c @@ -205,6 +205,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/checksum_parser.c b/testdata/p4tc_samples_outputs/checksum_parser.c index 4c24bbb4301..3f7efa603d0 100644 --- a/testdata/p4tc_samples_outputs/checksum_parser.c +++ b/testdata/p4tc_samples_outputs/checksum_parser.c @@ -144,6 +144,7 @@ ck_0_state; goto accept; if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/const_entries_range_mask_parser.c b/testdata/p4tc_samples_outputs/const_entries_range_mask_parser.c index 62f87670ae4..6006749c1db 100644 --- a/testdata/p4tc_samples_outputs/const_entries_range_mask_parser.c +++ b/testdata/p4tc_samples_outputs/const_entries_range_mask_parser.c @@ -60,6 +60,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct Header_t *h, if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/default_action_example_parser.c b/testdata/p4tc_samples_outputs/default_action_example_parser.c index 9ddfa9cd4bd..f9d8e7f7632 100644 --- a/testdata/p4tc_samples_outputs/default_action_example_parser.c +++ b/testdata/p4tc_samples_outputs/default_action_example_parser.c @@ -108,6 +108,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/default_hit_const_example_parser.c b/testdata/p4tc_samples_outputs/default_hit_const_example_parser.c index f8947ae9c96..68fe734a931 100644 --- a/testdata/p4tc_samples_outputs/default_hit_const_example_parser.c +++ b/testdata/p4tc_samples_outputs/default_hit_const_example_parser.c @@ -156,6 +156,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/drop_packet_example_parser.c b/testdata/p4tc_samples_outputs/drop_packet_example_parser.c index b37fb820be6..cd3e32d46b6 100644 --- a/testdata/p4tc_samples_outputs/drop_packet_example_parser.c +++ b/testdata/p4tc_samples_outputs/drop_packet_example_parser.c @@ -108,6 +108,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/global_action_example_01_parser.c b/testdata/p4tc_samples_outputs/global_action_example_01_parser.c index 2874b52a513..4515b8da67d 100644 --- a/testdata/p4tc_samples_outputs/global_action_example_01_parser.c +++ b/testdata/p4tc_samples_outputs/global_action_example_01_parser.c @@ -108,6 +108,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct my_ingress_h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/global_action_example_02_parser.c b/testdata/p4tc_samples_outputs/global_action_example_02_parser.c index a0cc59e0ef8..8b63e9eb534 100644 --- a/testdata/p4tc_samples_outputs/global_action_example_02_parser.c +++ b/testdata/p4tc_samples_outputs/global_action_example_02_parser.c @@ -108,6 +108,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct my_ingress_h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/hash1_parser.c b/testdata/p4tc_samples_outputs/hash1_parser.c index 3ebcb483ea6..5302a7c0c0f 100644 --- a/testdata/p4tc_samples_outputs/hash1_parser.c +++ b/testdata/p4tc_samples_outputs/hash1_parser.c @@ -87,6 +87,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct my_ingress_h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/ipip_parser.c b/testdata/p4tc_samples_outputs/ipip_parser.c index 0f6d72cac39..fbdc779b239 100644 --- a/testdata/p4tc_samples_outputs/ipip_parser.c +++ b/testdata/p4tc_samples_outputs/ipip_parser.c @@ -162,6 +162,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/matchtype_parser.c b/testdata/p4tc_samples_outputs/matchtype_parser.c index 5321d5ec130..0eed1c5bf40 100644 --- a/testdata/p4tc_samples_outputs/matchtype_parser.c +++ b/testdata/p4tc_samples_outputs/matchtype_parser.c @@ -108,6 +108,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/mix_matchtype_example_parser.c b/testdata/p4tc_samples_outputs/mix_matchtype_example_parser.c index 6e66c6ef732..be8f972143d 100644 --- a/testdata/p4tc_samples_outputs/mix_matchtype_example_parser.c +++ b/testdata/p4tc_samples_outputs/mix_matchtype_example_parser.c @@ -108,6 +108,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/multiple_tables_example_01_parser.c b/testdata/p4tc_samples_outputs/multiple_tables_example_01_parser.c index ea377c03422..750eebea21c 100644 --- a/testdata/p4tc_samples_outputs/multiple_tables_example_01_parser.c +++ b/testdata/p4tc_samples_outputs/multiple_tables_example_01_parser.c @@ -156,6 +156,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/multiple_tables_example_02_control_blocks.c b/testdata/p4tc_samples_outputs/multiple_tables_example_02_control_blocks.c index 31509f10df9..4d0bf4cf09f 100644 --- a/testdata/p4tc_samples_outputs/multiple_tables_example_02_control_blocks.c +++ b/testdata/p4tc_samples_outputs/multiple_tables_example_02_control_blocks.c @@ -324,7 +324,7 @@ if (hdr->ipv4.protocol == 6 || ((hdr->ipv4.version > 1) && (hdr->ipv4.ihl <= 2)) switch (value->action) { case MAINCONTROLIMPL_IPV4_TBL_3_ACT_MAINCONTROLIMPL_SENDTOPORT: { -/* send_to_port(istd.input_port) */ +/* send_to_port(skb->ifindex) */ compiler_meta__->drop = false; send_to_port(skb->ifindex); } @@ -377,7 +377,7 @@ if (hdr->ipv4.protocol == 6 || ((hdr->ipv4.version > 1) && (hdr->ipv4.ihl <= 2)) switch (value->action) { case MAINCONTROLIMPL_IPV4_TBL_4_ACT_MAINCONTROLIMPL_SENDTOPORT: { -/* send_to_port(istd.input_port) */ +/* send_to_port(skb->ifindex) */ compiler_meta__->drop = false; send_to_port(skb->ifindex); } @@ -539,7 +539,7 @@ if (hdr->ipv4.protocol != 6) { break; case MAINCONTROLIMPL_SET_ALL_OPTIONS_ACT_MAINCONTROLIMPL_SENDTOPORT: { -/* send_to_port(istd.input_port) */ +/* send_to_port(skb->ifindex) */ compiler_meta__->drop = false; send_to_port(skb->ifindex); } diff --git a/testdata/p4tc_samples_outputs/multiple_tables_example_02_parser.c b/testdata/p4tc_samples_outputs/multiple_tables_example_02_parser.c index 9c9808bf1ee..9b02f885526 100644 --- a/testdata/p4tc_samples_outputs/multiple_tables_example_02_parser.c +++ b/testdata/p4tc_samples_outputs/multiple_tables_example_02_parser.c @@ -156,6 +156,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/name_annotation_example_parser.c b/testdata/p4tc_samples_outputs/name_annotation_example_parser.c index 74fbc57d8a8..1cabee812b8 100644 --- a/testdata/p4tc_samples_outputs/name_annotation_example_parser.c +++ b/testdata/p4tc_samples_outputs/name_annotation_example_parser.c @@ -108,6 +108,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/no_table_example_control_blocks.c b/testdata/p4tc_samples_outputs/no_table_example_control_blocks.c index 0ee302cf1a3..2522339afa4 100644 --- a/testdata/p4tc_samples_outputs/no_table_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/no_table_example_control_blocks.c @@ -28,7 +28,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, { u8 hit; { -if ((u32)istd.input_port == 4) { +if ((u32)skb->ifindex == 4) { hdr->udp.src_port = (hdr->udp.src_port + 1); } } diff --git a/testdata/p4tc_samples_outputs/no_table_example_parser.c b/testdata/p4tc_samples_outputs/no_table_example_parser.c index 43afdc84662..e5a27847a09 100644 --- a/testdata/p4tc_samples_outputs/no_table_example_parser.c +++ b/testdata/p4tc_samples_outputs/no_table_example_parser.c @@ -131,6 +131,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/noaction_example_01_parser.c b/testdata/p4tc_samples_outputs/noaction_example_01_parser.c index 9ee97f1665c..4c143f24ecb 100644 --- a/testdata/p4tc_samples_outputs/noaction_example_01_parser.c +++ b/testdata/p4tc_samples_outputs/noaction_example_01_parser.c @@ -108,6 +108,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/noaction_example_02_parser.c b/testdata/p4tc_samples_outputs/noaction_example_02_parser.c index f73bea5d4cb..55e5ae113ac 100644 --- a/testdata/p4tc_samples_outputs/noaction_example_02_parser.c +++ b/testdata/p4tc_samples_outputs/noaction_example_02_parser.c @@ -108,6 +108,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/nummask_annotation_example_control_blocks.c b/testdata/p4tc_samples_outputs/nummask_annotation_example_control_blocks.c index a3324ef5498..a210796b0be 100644 --- a/testdata/p4tc_samples_outputs/nummask_annotation_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/nummask_annotation_example_control_blocks.c @@ -49,7 +49,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, { u8 hit; { -if (((u32)istd.input_port == 2 && /* hdr->ipv4.isValid() */ +if (((u32)skb->ifindex == 2 && /* hdr->ipv4.isValid() */ hdr->ipv4.ebpf_valid) && /* hdr->tcp.isValid() */ hdr->tcp.ebpf_valid) { /* set_ct_options_0.apply() */ diff --git a/testdata/p4tc_samples_outputs/nummask_annotation_example_parser.c b/testdata/p4tc_samples_outputs/nummask_annotation_example_parser.c index c8e58a75e2a..3c514e277c8 100644 --- a/testdata/p4tc_samples_outputs/nummask_annotation_example_parser.c +++ b/testdata/p4tc_samples_outputs/nummask_annotation_example_parser.c @@ -156,6 +156,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/send_to_port_example_parser.c b/testdata/p4tc_samples_outputs/send_to_port_example_parser.c index edf89cc1c2c..9348f03a0fb 100644 --- a/testdata/p4tc_samples_outputs/send_to_port_example_parser.c +++ b/testdata/p4tc_samples_outputs/send_to_port_example_parser.c @@ -108,6 +108,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/set_entry_timer_example_parser.c b/testdata/p4tc_samples_outputs/set_entry_timer_example_parser.c index 5fd74502987..0450b42c157 100644 --- a/testdata/p4tc_samples_outputs/set_entry_timer_example_parser.c +++ b/testdata/p4tc_samples_outputs/set_entry_timer_example_parser.c @@ -108,6 +108,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/simple_exact_example_parser.c b/testdata/p4tc_samples_outputs/simple_exact_example_parser.c index b6e987911e5..3efcec825f2 100644 --- a/testdata/p4tc_samples_outputs/simple_exact_example_parser.c +++ b/testdata/p4tc_samples_outputs/simple_exact_example_parser.c @@ -108,6 +108,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct my_ingress_h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/simple_lpm_example_parser.c b/testdata/p4tc_samples_outputs/simple_lpm_example_parser.c index e14de9b75af..cf57fd1eb3e 100644 --- a/testdata/p4tc_samples_outputs/simple_lpm_example_parser.c +++ b/testdata/p4tc_samples_outputs/simple_lpm_example_parser.c @@ -108,6 +108,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct my_ingress_h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/simple_ternary_example_parser.c b/testdata/p4tc_samples_outputs/simple_ternary_example_parser.c index 5fbf60a089b..01c7ad4a85b 100644 --- a/testdata/p4tc_samples_outputs/simple_ternary_example_parser.c +++ b/testdata/p4tc_samples_outputs/simple_ternary_example_parser.c @@ -108,6 +108,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct my_ingress_h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/size_param_example_parser.c b/testdata/p4tc_samples_outputs/size_param_example_parser.c index b75b872f4ea..0db7eaf560a 100644 --- a/testdata/p4tc_samples_outputs/size_param_example_parser.c +++ b/testdata/p4tc_samples_outputs/size_param_example_parser.c @@ -108,6 +108,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/tc_type_annotation_example_parser.c b/testdata/p4tc_samples_outputs/tc_type_annotation_example_parser.c index 9dedf296040..0b9f6a2c726 100644 --- a/testdata/p4tc_samples_outputs/tc_type_annotation_example_parser.c +++ b/testdata/p4tc_samples_outputs/tc_type_annotation_example_parser.c @@ -108,6 +108,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; } diff --git a/testdata/p4tc_samples_outputs/test_ipv6_example_parser.c b/testdata/p4tc_samples_outputs/test_ipv6_example_parser.c index c187515e8da..d6e9d8da4dc 100644 --- a/testdata/p4tc_samples_outputs/test_ipv6_example_parser.c +++ b/testdata/p4tc_samples_outputs/test_ipv6_example_parser.c @@ -126,6 +126,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h if (ebpf_errorCode == 0) { return TC_ACT_SHOT; } + compiler_meta__->parser_error = ebpf_errorCode; goto accept; }