3 * ===================================
4 * HARP | Host ATM Research Platform
5 * ===================================
8 * This Host ATM Research Platform ("HARP") file (the "Software") is
9 * made available by Network Computing Services, Inc. ("NetworkCS")
10 * "AS IS". NetworkCS does not provide maintenance, improvements or
11 * support of any kind.
13 * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
14 * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
15 * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
16 * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
17 * In no event shall NetworkCS be responsible for any damages, including
18 * but not limited to consequential damages, arising from or relating to
19 * any use of the Software or related support.
21 * Copyright 1994-1998 Network Computing Services, Inc.
23 * Copies of this Software may be made, however, the above copyright
24 * notice must be reproduced on all copies.
26 * @(#) $FreeBSD: src/sys/netatm/uni/uniip.c,v 1.4 1999/08/28 00:49:03 peter Exp $
27 * @(#) $DragonFly: src/sys/netproto/atm/uni/uniip.c,v 1.6 2006/01/14 13:36:39 swildner Exp $
31 * ATM Forum UNI Support
32 * ---------------------
34 * UNI IP interface module
38 #include <netproto/atm/kern_include.h>
40 #include <netproto/atm/ipatm/ipatm_var.h>
41 #include <netproto/atm/ipatm/ipatm_serv.h>
42 #include "uniip_var.h"
47 static int uniip_ipact (struct ip_nif
*);
48 static int uniip_ipdact (struct ip_nif
*);
54 struct uniip
*uniip_head
= NULL
;
56 struct ip_serv uniip_ipserv
= {
66 { { ATM_AAL5
, ATM_ENC_LLC
} },
73 static struct sp_info uniip_pool
= {
74 "uni ip pool", /* si_name */
75 sizeof(struct uniip
), /* si_blksiz */
82 * Process module loading notification
84 * Called whenever the uni module is initializing.
90 * 0 initialization successful
91 * errno initialization failed - reason indicated
100 * Tell arp to initialize stuff
102 err
= uniarp_start();
109 * Process module unloading notification
111 * Called whenever the uni module is about to be unloaded. All signalling
112 * instances will have been previously detached. All uniip resources
119 * 0 shutdown was successful
120 * errno shutdown failed - reason indicated
128 * All IP interfaces should be gone
139 * Free our storage pools
141 atm_release_pool(&uniip_pool
);
148 * Process IP Network Interface Activation
150 * Called whenever an IP network interface becomes active.
155 * inp pointer to IP network interface
158 * 0 command successful
159 * errno command failed - reason indicated
163 uniip_ipact(struct ip_nif
*inp
)
168 * Make sure we don't already have this interface
170 for (uip
= uniip_head
; uip
; uip
= uip
->uip_next
) {
171 if (uip
->uip_ipnif
== inp
)
176 * Get a new interface control block
178 uip
= (struct uniip
*)atm_allocate(&uniip_pool
);
183 * Initialize and link up
185 uip
->uip_ipnif
= inp
;
186 LINK2TAIL(uip
, struct uniip
, uniip_head
, uip_next
);
191 inp
->inf_isintf
= (caddr_t
)uip
;
194 * Tell arp about new interface
203 * Process IP Network Interface Deactivation
205 * Called whenever an IP network interface becomes inactive.
210 * inp pointer to IP network interface
213 * 0 command successful
214 * errno command failed - reason indicated
218 uniip_ipdact(struct ip_nif
*inp
)
223 * Get the appropriate IP interface block
225 uip
= (struct uniip
*)inp
->inf_isintf
;
230 * Let arp know about this
235 * Free interface info
237 UNLINK(uip
, struct uniip
, uniip_head
, uip_next
);
238 if (uip
->uip_prefix
!= NULL
)
239 KM_FREE(uip
->uip_prefix
,
240 uip
->uip_nprefix
* sizeof(struct uniarp_prf
), M_DEVBUF
);
241 atm_free((caddr_t
)uip
);