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

Function route6_pkt

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

TODO: To be tested */

Source from the content-addressed store, hash-verified

296
297/* TODO: To be tested */
298static inline uint16_t
299route6_pkt(struct rte_mbuf *pkt, struct rt_ctx *rt_ctx)
300{
301 uint8_t dst_ip[16];
302 uint8_t *ip6_dst;
303 uint16_t offset;
304 uint32_t hop;
305 int ret;
306
307 offset = RTE_ETHER_HDR_LEN + offsetof(struct ip6_hdr, ip6_dst);
308 ip6_dst = rte_pktmbuf_mtod_offset(pkt, uint8_t *, offset);
309 memcpy(&dst_ip[0], ip6_dst, 16);
310
311 ret = rte_lpm6_lookup((struct rte_lpm6 *)rt_ctx, dst_ip, &hop);
312
313 if (ret == 0) {
314 /* We have a hit */
315 return hop;
316 }
317
318 /* else */
319 return RTE_MAX_ETHPORTS;
320}
321
322static inline uint16_t
323get_route(struct rte_mbuf *pkt, struct route_table *rt, enum pkt_type type)

Callers 3

get_routeFunction · 0.85
ipsec_ev_route_ip_pktsFunction · 0.85

Calls 2

memcpyFunction · 0.50
rte_lpm6_lookupFunction · 0.50

Tested by

no test coverage detected