| 408 | } |
| 409 | |
| 410 | static inline int |
| 411 | process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt, |
| 412 | const struct eh_event_link_info *ev_link, struct rte_event *ev) |
| 413 | { |
| 414 | struct ipsec_sa *sa = NULL; |
| 415 | struct rte_mbuf *pkt; |
| 416 | uint16_t port_id = 0; |
| 417 | enum pkt_type type; |
| 418 | uint32_t sa_idx; |
| 419 | uint8_t *nlp; |
| 420 | |
| 421 | /* Get pkt from event */ |
| 422 | pkt = ev->mbuf; |
| 423 | if (is_ip_reassembly_incomplete(pkt) > 0) { |
| 424 | free_reassembly_fail_pkt(pkt); |
| 425 | return PKT_DROPPED; |
| 426 | } |
| 427 | |
| 428 | /* Check the packet type */ |
| 429 | type = process_ipsec_get_pkt_type(pkt, &nlp); |
| 430 | |
| 431 | switch (type) { |
| 432 | case PKT_TYPE_PLAIN_IPV4: |
| 433 | if (pkt->ol_flags & RTE_MBUF_F_RX_SEC_OFFLOAD) { |
| 434 | if (unlikely(pkt->ol_flags & |
| 435 | RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED)) { |
| 436 | RTE_LOG(ERR, IPSEC, |
| 437 | "Inbound security offload failed\n"); |
| 438 | goto drop_pkt_and_exit; |
| 439 | } |
| 440 | sa = *(struct ipsec_sa **)rte_security_dynfield(pkt); |
| 441 | } |
| 442 | |
| 443 | /* Check if we have a match */ |
| 444 | if (check_sp(ctx->sp4_ctx, nlp, &sa_idx) == 0) { |
| 445 | /* No valid match */ |
| 446 | goto drop_pkt_and_exit; |
| 447 | } |
| 448 | break; |
| 449 | |
| 450 | case PKT_TYPE_PLAIN_IPV6: |
| 451 | if (pkt->ol_flags & RTE_MBUF_F_RX_SEC_OFFLOAD) { |
| 452 | if (unlikely(pkt->ol_flags & |
| 453 | RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED)) { |
| 454 | RTE_LOG(ERR, IPSEC, |
| 455 | "Inbound security offload failed\n"); |
| 456 | goto drop_pkt_and_exit; |
| 457 | } |
| 458 | sa = *(struct ipsec_sa **)rte_security_dynfield(pkt); |
| 459 | } |
| 460 | |
| 461 | /* Check if we have a match */ |
| 462 | if (check_sp(ctx->sp6_ctx, nlp, &sa_idx) == 0) { |
| 463 | /* No valid match */ |
| 464 | goto drop_pkt_and_exit; |
| 465 | } |
| 466 | break; |
| 467 | case PKT_TYPE_IPSEC_IPV4: |
no test coverage detected