1 2/* 3 * ng_pppoe.c 4 * 5 * Copyright (c) 1996-1999 Whistle Communications, Inc. 6 * All rights reserved. 7 * 8 * Subject to the following obligations and disclaimer of warranty, use and --- 22 unchanged lines hidden (view full) --- 31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY 32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 35 * OF SUCH DAMAGE. 36 * 37 * Author: Julian Elischer <julian@freebsd.org> 38 * |
39 * $FreeBSD: head/sys/netgraph/ng_pppoe.c 68876 2000-11-18 15:17:43Z dwmalone $ |
40 * $Whistle: ng_pppoe.c,v 1.10 1999/11/01 09:24:52 julian Exp $ 41 */ 42#if 0 43#define AAA printf("pppoe: %s\n", __FUNCTION__ ); 44#define BBB printf("-%d-", __LINE__ ); 45#else 46#define AAA 47#define BBB --- 484 unchanged lines hidden (view full) --- 532static int 533ng_pppoe_constructor(node_p *nodep) 534{ 535 priv_p privdata; 536 int error; 537 538AAA 539 /* Initialize private descriptor */ |
540 MALLOC(privdata, priv_p, sizeof(*privdata), M_NETGRAPH, 541 M_NOWAIT | M_ZERO); |
542 if (privdata == NULL) 543 return (ENOMEM); |
544 545 /* Call the 'generic' (ie, superclass) node constructor */ 546 if ((error = ng_make_node_common(&typestruct, nodep))) { 547 FREE(privdata, M_NETGRAPH); 548 return (error); 549 } 550 551 /* Link structs together; this counts as our one reference to *nodep */ --- 24 unchanged lines hidden (view full) --- 576 privp->debug_hook = hook; 577 hook->private = &privp->debug_hook; 578 } else { 579 /* 580 * Any other unique name is OK. 581 * The infrastructure has already checked that it's unique, 582 * so just allocate it and hook it in. 583 */ |
584 MALLOC(sp, sessp, sizeof(*sp), M_NETGRAPH, M_NOWAIT | M_ZERO); |
585 if (sp == NULL) { 586 return (ENOMEM); 587 } |
588 589 hook->private = sp; 590 sp->hook = hook; 591 } 592 return(0); 593} 594 595/* --- 60 unchanged lines hidden (view full) --- 656 if (sp->state |= PPPOE_SNONE) { 657 printf("pppoe: Session already active\n"); 658 LEAVE(EISCONN); 659 } 660 661 /* 662 * set up prototype header 663 */ |
664 MALLOC(neg, negp, sizeof(*neg), M_NETGRAPH, 665 M_NOWAIT | M_ZERO); |
666 667 if (neg == NULL) { 668 printf("pppoe: Session out of memory\n"); 669 LEAVE(ENOMEM); 670 } |
671 MGETHDR(neg->m, M_DONTWAIT, MT_DATA); 672 if(neg->m == NULL) { 673 printf("pppoe: Session out of mbufs\n"); 674 FREE(neg, M_NETGRAPH); 675 LEAVE(ENOBUFS); 676 } 677 neg->m->m_pkthdr.rcvif = NULL; 678 MCLGET(neg->m, M_DONTWAIT); --- 912 unchanged lines hidden --- |