ng_atmllc.c (227132) | ng_atmllc.c (243882) |
---|---|
1/*- 2 * Copyright (c) 2003-2004 Benno Rice <benno@eloquent.com.au> 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) 2003-2004 Benno Rice <benno@eloquent.com.au> 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/netgraph/ng_atmllc.c 227132 2011-11-06 05:24:54Z fjoe $ | 26 * $FreeBSD: head/sys/netgraph/ng_atmllc.c 243882 2012-12-05 08:04:20Z glebius $ |
27 */ 28 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/kernel.h> 32#include <sys/malloc.h> 33#include <sys/mbuf.h> 34#include <sys/socket.h> --- 162 unchanged lines hidden (view full) --- 197 printf("ng_atmllc: unknown type: %x\n", 198 ATM_LLC_TYPE(hdr)); 199 } 200 201 /* Remove the LLC header and any padding*/ 202 m_adj(m, sizeof(struct atmllc) + padding); 203 } else if (hook == priv->ether) { 204 /* Add the LLC header */ | 27 */ 28 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/kernel.h> 32#include <sys/malloc.h> 33#include <sys/mbuf.h> 34#include <sys/socket.h> --- 162 unchanged lines hidden (view full) --- 197 printf("ng_atmllc: unknown type: %x\n", 198 ATM_LLC_TYPE(hdr)); 199 } 200 201 /* Remove the LLC header and any padding*/ 202 m_adj(m, sizeof(struct atmllc) + padding); 203 } else if (hook == priv->ether) { 204 /* Add the LLC header */ |
205 M_PREPEND(m, NG_ATMLLC_HEADER_LEN + 2, M_DONTWAIT); | 205 M_PREPEND(m, NG_ATMLLC_HEADER_LEN + 2, M_NOWAIT); |
206 if (m == NULL) { 207 printf("ng_atmllc: M_PREPEND failed\n"); 208 NG_FREE_ITEM(item); 209 return (ENOMEM); 210 } 211 hdr = mtod(m, struct atmllc *); 212 bzero((void *)hdr, sizeof(struct atmllc) + 2); 213 bcopy(NG_ATMLLC_HEADER, hdr->llchdr, 6); 214 if ((m->m_flags & M_HASFCS) != 0) { 215 ATM_LLC_SETTYPE(hdr, NG_ATMLLC_TYPE_ETHERNET_FCS); 216 } else { 217 ATM_LLC_SETTYPE(hdr, NG_ATMLLC_TYPE_ETHERNET_NOFCS); 218 } 219 outhook = priv->atm; 220 } else if (hook == priv->fddi) { 221 /* Add the LLC header */ | 206 if (m == NULL) { 207 printf("ng_atmllc: M_PREPEND failed\n"); 208 NG_FREE_ITEM(item); 209 return (ENOMEM); 210 } 211 hdr = mtod(m, struct atmllc *); 212 bzero((void *)hdr, sizeof(struct atmllc) + 2); 213 bcopy(NG_ATMLLC_HEADER, hdr->llchdr, 6); 214 if ((m->m_flags & M_HASFCS) != 0) { 215 ATM_LLC_SETTYPE(hdr, NG_ATMLLC_TYPE_ETHERNET_FCS); 216 } else { 217 ATM_LLC_SETTYPE(hdr, NG_ATMLLC_TYPE_ETHERNET_NOFCS); 218 } 219 outhook = priv->atm; 220 } else if (hook == priv->fddi) { 221 /* Add the LLC header */ |
222 M_PREPEND(m, NG_ATMLLC_HEADER_LEN + 3, M_DONTWAIT); | 222 M_PREPEND(m, NG_ATMLLC_HEADER_LEN + 3, M_NOWAIT); |
223 if (m == NULL) { 224 printf("ng_atmllc: M_PREPEND failed\n"); 225 NG_FREE_ITEM(item); 226 return (ENOMEM); 227 } 228 hdr = mtod(m, struct atmllc *); 229 bzero((void *)hdr, sizeof(struct atmllc) + 3); 230 bcopy(NG_ATMLLC_HEADER, hdr->llchdr, 6); --- 41 unchanged lines hidden --- | 223 if (m == NULL) { 224 printf("ng_atmllc: M_PREPEND failed\n"); 225 NG_FREE_ITEM(item); 226 return (ENOMEM); 227 } 228 hdr = mtod(m, struct atmllc *); 229 bzero((void *)hdr, sizeof(struct atmllc) + 3); 230 bcopy(NG_ATMLLC_HEADER, hdr->llchdr, 6); --- 41 unchanged lines hidden --- |