Deleted Added
full compact
if_loop.c (108041) if_loop.c (108466)
1/*
2 * Copyright (c) 1982, 1986, 1993
3 * The Regents of the University of California. 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

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

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)if_loop.c 8.2 (Berkeley) 1/9/95
1/*
2 * Copyright (c) 1982, 1986, 1993
3 * The Regents of the University of California. 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

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

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)if_loop.c 8.2 (Berkeley) 1/9/95
34 * $FreeBSD: head/sys/net/if_loop.c 108041 2002-12-18 15:34:17Z rwatson $
34 * $FreeBSD: head/sys/net/if_loop.c 108466 2002-12-30 20:22:40Z sam $
35 */
36
37/*
38 * Loopback interface driver for protocol testing and timing.
39 */
40
41#include "opt_atalk.h"
42#include "opt_inet.h"

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

209 * KAME requires that the packet to be contiguous on the
210 * mbuf. We need to make that sure.
211 * this kind of code should be avoided.
212 * XXX: fails to join if interface MTU > MCLBYTES. jumbogram?
213 */
214 if (m && m->m_next != NULL && m->m_pkthdr.len < MCLBYTES) {
215 struct mbuf *n;
216
35 */
36
37/*
38 * Loopback interface driver for protocol testing and timing.
39 */
40
41#include "opt_atalk.h"
42#include "opt_inet.h"

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

209 * KAME requires that the packet to be contiguous on the
210 * mbuf. We need to make that sure.
211 * this kind of code should be avoided.
212 * XXX: fails to join if interface MTU > MCLBYTES. jumbogram?
213 */
214 if (m && m->m_next != NULL && m->m_pkthdr.len < MCLBYTES) {
215 struct mbuf *n;
216
217 /* XXX MT_HEADER should be m->m_type */
217 MGETHDR(n, M_DONTWAIT, MT_HEADER);
218 if (!n)
219 goto contiguousfail;
218 MGETHDR(n, M_DONTWAIT, MT_HEADER);
219 if (!n)
220 goto contiguousfail;
220 MCLGET(n, M_DONTWAIT);
221 if (! (n->m_flags & M_EXT)) {
222 m_freem(n);
223 goto contiguousfail;
224 }
225
226 m_copydata(m, 0, m->m_pkthdr.len, mtod(n, caddr_t));
227 n->m_pkthdr = m->m_pkthdr;
228 n->m_len = m->m_pkthdr.len;
229 SLIST_INIT(&m->m_pkthdr.tags);
221 M_MOVE_PKTHDR(n, m);
230#ifdef MAC
231 /*
232 * XXXMAC: Once we put labels in tags and proper
233 * primitives are used for relocating mbuf header
234 * data, this will no longer be required.
235 */
236 m->m_pkthdr.label.l_flags &= ~MAC_FLAG_INITIALIZED;
237#endif
222#ifdef MAC
223 /*
224 * XXXMAC: Once we put labels in tags and proper
225 * primitives are used for relocating mbuf header
226 * data, this will no longer be required.
227 */
228 m->m_pkthdr.label.l_flags &= ~MAC_FLAG_INITIALIZED;
229#endif
230 MCLGET(n, M_DONTWAIT);
231 if (! (n->m_flags & M_EXT)) {
232 m_freem(n);
233 goto contiguousfail;
234 }
235
236 m_copydata(m, 0, m->m_pkthdr.len, mtod(n, caddr_t));
237 n->m_len = m->m_pkthdr.len;
238 m_freem(m);
239 m = n;
240 }
241 if (0) {
242contiguousfail:
243 printf("looutput: mbuf allocation failed\n");
244 }
245

--- 213 unchanged lines hidden ---
238 m_freem(m);
239 m = n;
240 }
241 if (0) {
242contiguousfail:
243 printf("looutput: mbuf allocation failed\n");
244 }
245

--- 213 unchanged lines hidden ---