MCPcopy Create free account
hub / github.com/F-Stack/f-stack / process_ipsec_ev_inbound

Function process_ipsec_ev_inbound

dpdk/examples/ipsec-secgw/ipsec_worker.c:410–539  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

408}
409
410static inline int
411process_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:

Calls 14

free_reassembly_fail_pktFunction · 0.85
rte_security_dynfieldFunction · 0.85
check_spFunction · 0.85
rte_pktmbuf_adjFunction · 0.85
ipv4_pkt_l3_len_setFunction · 0.85
sad_lookupFunction · 0.85
ipsec_mask_saptrFunction · 0.85
event_crypto_enqueueFunction · 0.85
ipv6_pkt_l3_len_setFunction · 0.85
get_routeFunction · 0.85
ipsec_event_pre_forwardFunction · 0.85

Tested by

no test coverage detected