1/*-
2 * Copyright (c) 1999, 2000 Boris Popov
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/net/if_ef.c 154518 2006-01-18 14:24:39Z andre $
27 */
28
29#include "opt_inet.h"
30#include "opt_ipx.h"
31#include "opt_ef.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
--- 375 unchanged lines hidden (view full) ---
410#else
411 return EPFNOSUPPORT;
412#endif
413 break;
414 case ETHER_FT_8023:
415 type = htons(m->m_pkthdr.len);
416 break;
417 case ETHER_FT_8022:
418 M_PREPEND(m, ETHER_HDR_LEN + 3, M_TRYWAIT);
419 if (m == NULL) {
420 *mp = NULL;
421 return ENOBUFS;
422 }
423 /*
424 * Ensure that ethernet header and next three bytes
425 * will fit into single mbuf
426 */
427 m = m_pullup(m, ETHER_HDR_LEN + 3);
428 if (m == NULL) {
429 *mp = NULL;
430 return ENOBUFS;
431 }
432 m_adj(m, ETHER_HDR_LEN);
433 type = htons(m->m_pkthdr.len);
434 cp = mtod(m, u_char *);
435 *cp++ = 0xE0;
436 *cp++ = 0xE0;
437 *cp++ = 0x03;
438 *hlen += 3;
439 break;
440 case ETHER_FT_SNAP:
441 M_PREPEND(m, 8, M_TRYWAIT);
442 if (m == NULL) {
443 *mp = NULL;
444 return ENOBUFS;
445 }
446 type = htons(m->m_pkthdr.len);
447 cp = mtod(m, u_char *);
448 bcopy("\xAA\xAA\x03\x00\x00\x00\x81\x37", cp, 8);
449 *hlen += 8;
450 break;
451 default:
452 return EPFNOSUPPORT;
453 }
--- 144 unchanged lines hidden ---
2 * Copyright (c) 1999, 2000 Boris Popov
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/net/if_ef.c 154518 2006-01-18 14:24:39Z andre $
27 */
28
29#include "opt_inet.h"
30#include "opt_ipx.h"
31#include "opt_ef.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
--- 375 unchanged lines hidden (view full) ---
410#else
411 return EPFNOSUPPORT;
412#endif
413 break;
414 case ETHER_FT_8023:
415 type = htons(m->m_pkthdr.len);
416 break;
417 case ETHER_FT_8022:
418 M_PREPEND(m, ETHER_HDR_LEN + 3, M_TRYWAIT);
419 if (m == NULL) {
420 *mp = NULL;
421 return ENOBUFS;
422 }
423 /*
424 * Ensure that ethernet header and next three bytes
425 * will fit into single mbuf
426 */
427 m = m_pullup(m, ETHER_HDR_LEN + 3);
428 if (m == NULL) {
429 *mp = NULL;
430 return ENOBUFS;
431 }
432 m_adj(m, ETHER_HDR_LEN);
433 type = htons(m->m_pkthdr.len);
434 cp = mtod(m, u_char *);
435 *cp++ = 0xE0;
436 *cp++ = 0xE0;
437 *cp++ = 0x03;
438 *hlen += 3;
439 break;
440 case ETHER_FT_SNAP:
441 M_PREPEND(m, 8, M_TRYWAIT);
442 if (m == NULL) {
443 *mp = NULL;
444 return ENOBUFS;
445 }
446 type = htons(m->m_pkthdr.len);
447 cp = mtod(m, u_char *);
448 bcopy("\xAA\xAA\x03\x00\x00\x00\x81\x37", cp, 8);
449 *hlen += 8;
450 break;
451 default:
452 return EPFNOSUPPORT;
453 }
--- 144 unchanged lines hidden ---