10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*2958Sdr146992 * Common Development and Distribution License (the "License"). 6*2958Sdr146992 * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*2958Sdr146992 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate /* Copyright (c) 1990 Mentat Inc. */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 280Sstevel@tonic-gate 290Sstevel@tonic-gate #include <sys/types.h> 300Sstevel@tonic-gate #include <sys/conf.h> 310Sstevel@tonic-gate #include <sys/modctl.h> 32*2958Sdr146992 #include <sys/ksynch.h> 330Sstevel@tonic-gate #include <inet/common.h> 340Sstevel@tonic-gate #include <inet/ip.h> 35*2958Sdr146992 #include <inet/arp_impl.h> 360Sstevel@tonic-gate 370Sstevel@tonic-gate #define INET_NAME "arp" 380Sstevel@tonic-gate #define INET_MODDESC "ARP STREAMS module %I%" 390Sstevel@tonic-gate #define INET_DEVDESC "ARP STREAMS driver %I%" 400Sstevel@tonic-gate #define INET_DEVMINOR IPV4_MINOR 410Sstevel@tonic-gate #define INET_STRTAB arpinfo 420Sstevel@tonic-gate #define INET_DEVMTFLAGS IP_DEVMTFLAGS /* since as a driver we're ip */ 430Sstevel@tonic-gate #define INET_MODMTFLAGS (D_MP | D_MTPERMOD) 440Sstevel@tonic-gate 45*2958Sdr146992 static void arp_ddi_destroy(); 46*2958Sdr146992 static void arp_ddi_init(); 47*2958Sdr146992 480Sstevel@tonic-gate #include "../inetddi.c" 490Sstevel@tonic-gate 500Sstevel@tonic-gate int 510Sstevel@tonic-gate _init(void) 520Sstevel@tonic-gate { 53*2958Sdr146992 int error; 54*2958Sdr146992 55*2958Sdr146992 arp_ddi_init(); 560Sstevel@tonic-gate INET_BECOME_IP(); 57*2958Sdr146992 58*2958Sdr146992 error = mod_install(&modlinkage); 59*2958Sdr146992 if (error != 0) 60*2958Sdr146992 arp_ddi_destroy(); 61*2958Sdr146992 return error; 620Sstevel@tonic-gate } 630Sstevel@tonic-gate 640Sstevel@tonic-gate int 650Sstevel@tonic-gate _fini(void) 660Sstevel@tonic-gate { 67*2958Sdr146992 int error; 68*2958Sdr146992 69*2958Sdr146992 error = mod_remove(&modlinkage); 70*2958Sdr146992 if (error == 0) 71*2958Sdr146992 arp_ddi_destroy(); 72*2958Sdr146992 return error; 730Sstevel@tonic-gate } 740Sstevel@tonic-gate 750Sstevel@tonic-gate int 760Sstevel@tonic-gate _info(struct modinfo *modinfop) 770Sstevel@tonic-gate { 780Sstevel@tonic-gate return (mod_info(&modlinkage, modinfop)); 790Sstevel@tonic-gate } 80*2958Sdr146992 81*2958Sdr146992 82*2958Sdr146992 static void 83*2958Sdr146992 arp_ddi_init() 84*2958Sdr146992 { 85*2958Sdr146992 rw_init(&arl_g_lock, "ARP ARl lock", RW_DRIVER, NULL); 86*2958Sdr146992 arp_net_init(); 87*2958Sdr146992 arp_hook_init(); 88*2958Sdr146992 } 89*2958Sdr146992 90*2958Sdr146992 91*2958Sdr146992 static void 92*2958Sdr146992 arp_ddi_destroy() 93*2958Sdr146992 { 94*2958Sdr146992 arp_hook_destroy(); 95*2958Sdr146992 arp_net_destroy(); 96*2958Sdr146992 rw_destroy(&arl_g_lock); 97*2958Sdr146992 } 98