* copy secpolicy struct to sadb_x_policy structure indicated. */
| 1754 | * copy secpolicy struct to sadb_x_policy structure indicated. |
| 1755 | */ |
| 1756 | static struct mbuf * |
| 1757 | key_sp2mbuf(struct secpolicy *sp) |
| 1758 | { |
| 1759 | struct mbuf *m; |
| 1760 | size_t tlen; |
| 1761 | |
| 1762 | tlen = key_getspreqmsglen(sp); |
| 1763 | m = m_get2(tlen, M_NOWAIT, MT_DATA, 0); |
| 1764 | if (m == NULL) |
| 1765 | return (NULL); |
| 1766 | m_align(m, tlen); |
| 1767 | m->m_len = tlen; |
| 1768 | if (key_sp2msg(sp, m->m_data, &tlen) != 0) { |
| 1769 | m_freem(m); |
| 1770 | return (NULL); |
| 1771 | } |
| 1772 | return (m); |
| 1773 | } |
| 1774 | |
| 1775 | int |
| 1776 | key_sp2msg(struct secpolicy *sp, void *request, size_t *len) |
no test coverage detected