if_loop.c (108825) | if_loop.c (109623) |
---|---|
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 108825 2003-01-06 21:33:54Z sam $ | 34 * $FreeBSD: head/sys/net/if_loop.c 109623 2003-01-21 08:56:16Z alfred $ |
35 */ 36 37/* 38 * Loopback interface driver for protocol testing and timing. 39 */ 40 41#include "opt_atalk.h" 42#include "opt_inet.h" --- 99 unchanged lines hidden (view full) --- 142 143int 144lo_clone_create(ifc, unit) 145 struct if_clone *ifc; 146 int unit; 147{ 148 struct lo_softc *sc; 149 | 35 */ 36 37/* 38 * Loopback interface driver for protocol testing and timing. 39 */ 40 41#include "opt_atalk.h" 42#include "opt_inet.h" --- 99 unchanged lines hidden (view full) --- 142 143int 144lo_clone_create(ifc, unit) 145 struct if_clone *ifc; 146 int unit; 147{ 148 struct lo_softc *sc; 149 |
150 MALLOC(sc, struct lo_softc *, sizeof(*sc), M_LO, M_WAITOK | M_ZERO); | 150 MALLOC(sc, struct lo_softc *, sizeof(*sc), M_LO, M_ZERO); |
151 152 sc->sc_if.if_name = LONAME; 153 sc->sc_if.if_unit = unit; 154 sc->sc_if.if_mtu = LOMTU; 155 sc->sc_if.if_flags = IFF_LOOPBACK | IFF_MULTICAST; 156 sc->sc_if.if_ioctl = loioctl; 157 sc->sc_if.if_output = looutput; 158 sc->sc_if.if_type = IFT_LOOP; --- 51 unchanged lines hidden (view full) --- 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 */ | 151 152 sc->sc_if.if_name = LONAME; 153 sc->sc_if.if_unit = unit; 154 sc->sc_if.if_mtu = LOMTU; 155 sc->sc_if.if_flags = IFF_LOOPBACK | IFF_MULTICAST; 156 sc->sc_if.if_ioctl = loioctl; 157 sc->sc_if.if_output = looutput; 158 sc->sc_if.if_type = IFT_LOOP; --- 51 unchanged lines hidden (view full) --- 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 */ |
218 MGETHDR(n, M_DONTWAIT, MT_HEADER); | 218 MGETHDR(n, M_NOWAIT, MT_HEADER); |
219 if (!n) 220 goto contiguousfail; 221 M_MOVE_PKTHDR(n, m); 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 | 219 if (!n) 220 goto contiguousfail; 221 M_MOVE_PKTHDR(n, m); 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); | 230 MCLGET(n, M_NOWAIT); |
231 if (! (n->m_flags & M_EXT)) { 232 m_freem(n); 233 goto contiguousfail; 234 } 235 236 m_copydata(m, 0, n->m_pkthdr.len, mtod(n, caddr_t)); 237 n->m_len = n->m_pkthdr.len; 238 m_freem(m); --- 220 unchanged lines hidden --- | 231 if (! (n->m_flags & M_EXT)) { 232 m_freem(n); 233 goto contiguousfail; 234 } 235 236 m_copydata(m, 0, n->m_pkthdr.len, mtod(n, caddr_t)); 237 n->m_len = n->m_pkthdr.len; 238 m_freem(m); --- 220 unchanged lines hidden --- |