if_ef.c (108172) | if_ef.c (109623) |
---|---|
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 108172 2002-12-22 05:35:03Z hsu $ | 26 * $FreeBSD: head/sys/net/if_ef.c 109623 2003-01-21 08:56:16Z alfred $ |
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> --- 390 unchanged lines hidden (view full) --- 425#else 426 return EPFNOSUPPORT; 427#endif 428 break; 429 case ETHER_FT_8023: 430 type = htons(m->m_pkthdr.len); 431 break; 432 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> --- 390 unchanged lines hidden (view full) --- 425#else 426 return EPFNOSUPPORT; 427#endif 428 break; 429 case ETHER_FT_8023: 430 type = htons(m->m_pkthdr.len); 431 break; 432 case ETHER_FT_8022: |
433 M_PREPEND(m, ETHER_HDR_LEN + 3, M_TRYWAIT); | 433 M_PREPEND(m, ETHER_HDR_LEN + 3, 0); |
434 if (m == NULL) { 435 *mp = NULL; 436 return ENOBUFS; 437 } 438 /* 439 * Ensure that ethernet header and next three bytes 440 * will fit into single mbuf 441 */ --- 6 unchanged lines hidden (view full) --- 448 type = htons(m->m_pkthdr.len); 449 cp = mtod(m, u_char *); 450 *cp++ = 0xE0; 451 *cp++ = 0xE0; 452 *cp++ = 0x03; 453 *hlen += 3; 454 break; 455 case ETHER_FT_SNAP: | 434 if (m == NULL) { 435 *mp = NULL; 436 return ENOBUFS; 437 } 438 /* 439 * Ensure that ethernet header and next three bytes 440 * will fit into single mbuf 441 */ --- 6 unchanged lines hidden (view full) --- 448 type = htons(m->m_pkthdr.len); 449 cp = mtod(m, u_char *); 450 *cp++ = 0xE0; 451 *cp++ = 0xE0; 452 *cp++ = 0x03; 453 *hlen += 3; 454 break; 455 case ETHER_FT_SNAP: |
456 M_PREPEND(m, 8, M_TRYWAIT); | 456 M_PREPEND(m, 8, 0); |
457 if (m == NULL) { 458 *mp = NULL; 459 return ENOBUFS; 460 } 461 type = htons(m->m_pkthdr.len); 462 cp = mtod(m, u_char *); 463 bcopy("\xAA\xAA\x03\x00\x00\x00\x81\x37", cp, 8); 464 *hlen += 8; --- 14 unchanged lines hidden (view full) --- 479{ 480 struct efnet *efp; 481 struct ifnet *eifp; 482 struct ifnet *ifp = efl->el_ifp; 483 char cbuf[IFNAMSIZ], *ifname; 484 int ifnlen; 485 486 efp = (struct efnet*)malloc(sizeof(struct efnet), M_IFADDR, | 457 if (m == NULL) { 458 *mp = NULL; 459 return ENOBUFS; 460 } 461 type = htons(m->m_pkthdr.len); 462 cp = mtod(m, u_char *); 463 bcopy("\xAA\xAA\x03\x00\x00\x00\x81\x37", cp, 8); 464 *hlen += 8; --- 14 unchanged lines hidden (view full) --- 479{ 480 struct efnet *efp; 481 struct ifnet *eifp; 482 struct ifnet *ifp = efl->el_ifp; 483 char cbuf[IFNAMSIZ], *ifname; 484 int ifnlen; 485 486 efp = (struct efnet*)malloc(sizeof(struct efnet), M_IFADDR, |
487 M_WAITOK | M_ZERO); | 487 M_ZERO); |
488 if (efp == NULL) 489 return ENOMEM; 490 efp->ef_ifp = ifp; 491 eifp = &efp->ef_ac.ac_if; 492 ifnlen = 1 + snprintf(cbuf, sizeof(cbuf), "%s%df", ifp->if_name, 493 ifp->if_unit); | 488 if (efp == NULL) 489 return ENOMEM; 490 efp->ef_ifp = ifp; 491 eifp = &efp->ef_ac.ac_if; 492 ifnlen = 1 + snprintf(cbuf, sizeof(cbuf), "%s%df", ifp->if_name, 493 ifp->if_unit); |
494 ifname = (char*)malloc(ifnlen, M_IFADDR, M_WAITOK); | 494 ifname = (char*)malloc(ifnlen, M_IFADDR, 0); |
495 eifp->if_name = strcpy(ifname, cbuf); 496 eifp->if_unit = ft; 497 eifp->if_softc = efp; 498 if (ifp->if_ioctl) 499 eifp->if_ioctl = ef_ioctl; 500 efl->el_units[ft] = efp; 501 return 0; 502} --- 6 unchanged lines hidden (view full) --- 509 struct ef_link *efl = NULL; 510 int error = 0, d; 511 512 IFNET_RLOCK(); 513 TAILQ_FOREACH(ifp, &ifnet, if_link) { 514 if (ifp->if_type != IFT_ETHER) continue; 515 EFDEBUG("Found interface %s%d\n", ifp->if_name, ifp->if_unit); 516 efl = (struct ef_link*)malloc(sizeof(struct ef_link), | 495 eifp->if_name = strcpy(ifname, cbuf); 496 eifp->if_unit = ft; 497 eifp->if_softc = efp; 498 if (ifp->if_ioctl) 499 eifp->if_ioctl = ef_ioctl; 500 efl->el_units[ft] = efp; 501 return 0; 502} --- 6 unchanged lines hidden (view full) --- 509 struct ef_link *efl = NULL; 510 int error = 0, d; 511 512 IFNET_RLOCK(); 513 TAILQ_FOREACH(ifp, &ifnet, if_link) { 514 if (ifp->if_type != IFT_ETHER) continue; 515 EFDEBUG("Found interface %s%d\n", ifp->if_name, ifp->if_unit); 516 efl = (struct ef_link*)malloc(sizeof(struct ef_link), |
517 M_IFADDR, M_WAITOK | M_ZERO); | 517 M_IFADDR, M_ZERO); |
518 if (efl == NULL) { 519 error = ENOMEM; 520 break; 521 } 522 523 efl->el_ifp = ifp; 524#ifdef ETHER_II 525 error = ef_clone(efl, ETHER_FT_EII); --- 82 unchanged lines hidden --- | 518 if (efl == NULL) { 519 error = ENOMEM; 520 break; 521 } 522 523 efl->el_ifp = ifp; 524#ifdef ETHER_II 525 error = ef_clone(efl, ETHER_FT_EII); --- 82 unchanged lines hidden --- |