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

Function key_setlifetime

freebsd/netipsec/key.c:8515–8542  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8513 */
8514
8515static struct mbuf *
8516key_setlifetime(struct seclifetime *src, uint16_t exttype)
8517{
8518 struct mbuf *m = NULL;
8519 struct sadb_lifetime *p;
8520 int len = PFKEY_ALIGN8(sizeof(struct sadb_lifetime));
8521
8522 if (src == NULL)
8523 return NULL;
8524
8525 m = m_get2(len, M_NOWAIT, MT_DATA, 0);
8526 if (m == NULL)
8527 return m;
8528 m_align(m, len);
8529 m->m_len = len;
8530 p = mtod(m, struct sadb_lifetime *);
8531
8532 bzero(p, len);
8533 p->sadb_lifetime_len = PFKEY_UNIT64(len);
8534 p->sadb_lifetime_exttype = exttype;
8535 p->sadb_lifetime_allocations = src->allocations;
8536 p->sadb_lifetime_bytes = src->bytes;
8537 p->sadb_lifetime_addtime = src->addtime;
8538 p->sadb_lifetime_usetime = src->usetime;
8539
8540 return m;
8541
8542}
8543
8544const struct enc_xform *
8545enc_algorithm_lookup(int alg)

Callers 2

key_setdumpspFunction · 0.85
key_setdumpsaFunction · 0.85

Calls 3

m_get2Function · 0.85
bzeroFunction · 0.85
m_alignFunction · 0.50

Tested by

no test coverage detected