* XXX no way to pass mode (transport/tunnel) to userland * XXX replay checking? * XXX sysctl interface to ipsec_{ah,esp}_keymin */
| 6478 | * XXX sysctl interface to ipsec_{ah,esp}_keymin |
| 6479 | */ |
| 6480 | static struct mbuf * |
| 6481 | key_getprop(const struct secasindex *saidx) |
| 6482 | { |
| 6483 | struct sadb_prop *prop; |
| 6484 | struct mbuf *m, *n; |
| 6485 | const int l = PFKEY_ALIGN8(sizeof(struct sadb_prop)); |
| 6486 | int totlen; |
| 6487 | |
| 6488 | switch (saidx->proto) { |
| 6489 | case IPPROTO_ESP: |
| 6490 | m = key_getcomb_ealg(); |
| 6491 | break; |
| 6492 | case IPPROTO_AH: |
| 6493 | m = key_getcomb_ah(); |
| 6494 | break; |
| 6495 | case IPPROTO_IPCOMP: |
| 6496 | m = key_getcomb_ipcomp(); |
| 6497 | break; |
| 6498 | default: |
| 6499 | return NULL; |
| 6500 | } |
| 6501 | |
| 6502 | if (!m) |
| 6503 | return NULL; |
| 6504 | M_PREPEND(m, l, M_NOWAIT); |
| 6505 | if (!m) |
| 6506 | return NULL; |
| 6507 | |
| 6508 | totlen = 0; |
| 6509 | for (n = m; n; n = n->m_next) |
| 6510 | totlen += n->m_len; |
| 6511 | |
| 6512 | prop = mtod(m, struct sadb_prop *); |
| 6513 | bzero(prop, sizeof(*prop)); |
| 6514 | prop->sadb_prop_len = PFKEY_UNIT64(totlen); |
| 6515 | prop->sadb_prop_exttype = SADB_EXT_PROPOSAL; |
| 6516 | prop->sadb_prop_replay = 32; /* XXX */ |
| 6517 | |
| 6518 | return m; |
| 6519 | } |
| 6520 | |
| 6521 | /* |
| 6522 | * SADB_ACQUIRE processing called by key_checkrequest() and key_acquire2(). |
no test coverage detected