Deleted Added
full compact
if_ef.c (154518) if_ef.c (177599)
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 *
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 $
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:
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 }
418 M_PREPEND(m, ETHER_HDR_LEN + 3, M_WAIT);
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:
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:
441 M_PREPEND(m, 8, M_TRYWAIT);
442 if (m == NULL) {
443 *mp = NULL;
444 return ENOBUFS;
445 }
437 M_PREPEND(m, 8, M_WAIT);
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 ---
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 ---