Deleted Added
full compact
ipsec_mbuf.c (181803) ipsec_mbuf.c (183550)
1/*-
2 * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/netipsec/ipsec_mbuf.c 181803 2008-08-17 23:27:27Z bz $
26 * $FreeBSD: head/sys/netipsec/ipsec_mbuf.c 183550 2008-10-02 15:37:58Z zec $
27 */
28
29/*
30 * IPsec-specific mbuf routines.
31 */
32
33#include "opt_param.h"
34

--- 14 unchanged lines hidden (view full) ---

49 * when absolutely necessary. The mbuf where the new header
50 * is to go is returned together with an offset into the mbuf.
51 * If NULL is returned then the mbuf chain may have been modified;
52 * the caller is assumed to always free the chain.
53 */
54struct mbuf *
55m_makespace(struct mbuf *m0, int skip, int hlen, int *off)
56{
27 */
28
29/*
30 * IPsec-specific mbuf routines.
31 */
32
33#include "opt_param.h"
34

--- 14 unchanged lines hidden (view full) ---

49 * when absolutely necessary. The mbuf where the new header
50 * is to go is returned together with an offset into the mbuf.
51 * If NULL is returned then the mbuf chain may have been modified;
52 * the caller is assumed to always free the chain.
53 */
54struct mbuf *
55m_makespace(struct mbuf *m0, int skip, int hlen, int *off)
56{
57 INIT_VNET_IPSEC(curvnet);
57 struct mbuf *m;
58 unsigned remain;
59
60 IPSEC_ASSERT(m0 != NULL, ("null mbuf"));
61 IPSEC_ASSERT(hlen < MHLEN, ("hlen too big: %u", hlen));
62
63 for (m = m0; m && skip > m->m_len; m = m->m_next)
64 skip -= m->m_len;

--- 86 unchanged lines hidden (view full) ---

151/*
152 * m_pad(m, n) pads <m> with <n> bytes at the end. The packet header
153 * length is updated, and a pointer to the first byte of the padding
154 * (which is guaranteed to be all in one mbuf) is returned.
155 */
156caddr_t
157m_pad(struct mbuf *m, int n)
158{
58 struct mbuf *m;
59 unsigned remain;
60
61 IPSEC_ASSERT(m0 != NULL, ("null mbuf"));
62 IPSEC_ASSERT(hlen < MHLEN, ("hlen too big: %u", hlen));
63
64 for (m = m0; m && skip > m->m_len; m = m->m_next)
65 skip -= m->m_len;

--- 86 unchanged lines hidden (view full) ---

152/*
153 * m_pad(m, n) pads <m> with <n> bytes at the end. The packet header
154 * length is updated, and a pointer to the first byte of the padding
155 * (which is guaranteed to be all in one mbuf) is returned.
156 */
157caddr_t
158m_pad(struct mbuf *m, int n)
159{
160 INIT_VNET_IPSEC(curvnet);
159 register struct mbuf *m0, *m1;
160 register int len, pad;
161 caddr_t retval;
162
163 if (n <= 0) { /* No stupid arguments. */
164 DPRINTF(("%s: pad length invalid (%d)\n", __func__, n));
165 m_freem(m);
166 return NULL;

--- 56 unchanged lines hidden (view full) ---

223/*
224 * Remove hlen data at offset skip in the packet. This is used by
225 * the protocols strip protocol headers and associated data (e.g. IV,
226 * authenticator) on input.
227 */
228int
229m_striphdr(struct mbuf *m, int skip, int hlen)
230{
161 register struct mbuf *m0, *m1;
162 register int len, pad;
163 caddr_t retval;
164
165 if (n <= 0) { /* No stupid arguments. */
166 DPRINTF(("%s: pad length invalid (%d)\n", __func__, n));
167 m_freem(m);
168 return NULL;

--- 56 unchanged lines hidden (view full) ---

225/*
226 * Remove hlen data at offset skip in the packet. This is used by
227 * the protocols strip protocol headers and associated data (e.g. IV,
228 * authenticator) on input.
229 */
230int
231m_striphdr(struct mbuf *m, int skip, int hlen)
232{
233 INIT_VNET_IPSEC(curvnet);
231 struct mbuf *m1;
232 int roff;
233
234 /* Find beginning of header */
235 m1 = m_getptr(m, skip, &roff);
236 if (m1 == NULL)
237 return (EINVAL);
238

--- 87 unchanged lines hidden ---
234 struct mbuf *m1;
235 int roff;
236
237 /* Find beginning of header */
238 m1 = m_getptr(m, skip, &roff);
239 if (m1 == NULL)
240 return (EINVAL);
241

--- 87 unchanged lines hidden ---