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 177599 2008-03-25 09:39:02Z ru $
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_WAIT);
419 /*
420 * Ensure that ethernet header and next three bytes
421 * will fit into single mbuf
422 */
423 m = m_pullup(m, ETHER_HDR_LEN + 3);
424 if (m == NULL) {
425 *mp = NULL;
426 return ENOBUFS;
427 }
428 m_adj(m, ETHER_HDR_LEN);
429 type = htons(m->m_pkthdr.len);
430 cp = mtod(m, u_char *);
431 *cp++ = 0xE0;
432 *cp++ = 0xE0;
433 *cp++ = 0x03;
434 *hlen += 3;
435 break;
436 case ETHER_FT_SNAP:
437 M_PREPEND(m, 8, M_WAIT);
438 type = htons(m->m_pkthdr.len);
439 cp = mtod(m, u_char *);
440 bcopy("\xAA\xAA\x03\x00\x00\x00\x81\x37", cp, 8);
441 *hlen += 8;
442 break;
443 default:
444 return EPFNOSUPPORT;
445 }
--- 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 177599 2008-03-25 09:39:02Z ru $
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_WAIT);
419 /*
420 * Ensure that ethernet header and next three bytes
421 * will fit into single mbuf
422 */
423 m = m_pullup(m, ETHER_HDR_LEN + 3);
424 if (m == NULL) {
425 *mp = NULL;
426 return ENOBUFS;
427 }
428 m_adj(m, ETHER_HDR_LEN);
429 type = htons(m->m_pkthdr.len);
430 cp = mtod(m, u_char *);
431 *cp++ = 0xE0;
432 *cp++ = 0xE0;
433 *cp++ = 0x03;
434 *hlen += 3;
435 break;
436 case ETHER_FT_SNAP:
437 M_PREPEND(m, 8, M_WAIT);
438 type = htons(m->m_pkthdr.len);
439 cp = mtod(m, u_char *);
440 bcopy("\xAA\xAA\x03\x00\x00\x00\x81\x37", cp, 8);
441 *hlen += 8;
442 break;
443 default:
444 return EPFNOSUPPORT;
445 }
--- 144 unchanged lines hidden ---