]> git.saurik.com Git - apple/xnu.git/blame_incremental - bsd/netat/at.c
xnu-1228.15.4.tar.gz
[apple/xnu.git] / bsd / netat / at.c
... / ...
CommitLineData
1/*
2 * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * Copyright (c) 1998 Apple Computer, Inc.
30 */
31
32/* at.c
33 */
34
35#include <sys/param.h>
36#include <sys/systm.h>
37#include <sys/ioctl.h>
38#include <sys/errno.h>
39#include <sys/malloc.h>
40#include <sys/socket.h>
41#include <sys/socketvar.h>
42#include <sys/file.h>
43#include <sys/kauth.h>
44
45#include <net/if.h>
46#include <net/if_dl.h>
47#include <net/if_types.h>
48#include <net/dlil.h>
49
50#include <netat/sysglue.h>
51#include <netat/appletalk.h>
52#include <netat/at_pcb.h>
53#include <netat/at_var.h>
54#include <netat/ddp.h>
55#include <netat/nbp.h>
56#include <netat/routing_tables.h>
57#include <netat/debug.h>
58
59#include <sys/kern_event.h>
60#include <net/kpi_protocol.h>
61
62int lap_online( at_ifaddr_t *, at_if_cfg_t *cfgp);
63
64extern int routerStart(at_kern_err_t *);
65extern void elap_offline(at_ifaddr_t *);
66extern at_ifaddr_t *find_ifID(char *);
67
68extern int xpatcnt;
69extern at_ifaddr_t at_interfaces[];
70extern at_ifaddr_t *ifID_home;
71extern TAILQ_HEAD(name_registry, _nve_) name_registry;
72extern int nve_lock;
73
74struct etalk_addr etalk_multicast_addr = {
75 {0x09, 0x00, 0x07, 0xff, 0xff, 0xff}};
76struct etalk_addr ttalk_multicast_addr = {
77 {0xC0, 0x00, 0x40, 0x00, 0x00, 0x00}};
78
79/* called only in router mode */
80static int set_zones(zone_usage_t *ifz)
81
82/* 1. adds zone to table
83 2. looks up each route entry from zone list
84 3. sets zone bit in each route entry
85
86 returns 0 if successful
87 errno if error occurred
88*/
89{
90 int i;
91 at_ifaddr_t *ifID;
92 short zno;
93 RT_entry *rte;
94
95 if (ifz->zone_name.len <= 0 || ifz->zone_name.len > NBP_NVE_STR_SIZE)
96 return(ENOSPC);
97
98 zno = zt_add_zone((char *)ifz->zone_name.str, ifz->zone_name.len);
99
100 if (zno == ZT_MAXEDOUT) {
101 dPrintf(D_M_ELAP, D_L_ERROR, ("set_zones: error: table full\n"));
102 return(ENOSPC);
103 }
104 if (ifz->zone_home) {
105 ifID_home->ifZoneName = ifz->zone_name;
106 ifID_home->ifDefZone = zno;
107 }
108
109 for (i=0; i<IF_TOTAL_MAX; i++) {
110 if (ifz->zone_iflist.at_if[i][0]) {
111 if ((ifID = find_ifID(ifz->zone_iflist.at_if[i]))) {
112 rte = rt_blookup(ifID->ifThisCableEnd);
113 if (!rte) {
114 dPrintf(D_M_ELAP, D_L_ERROR,
115 ("set_zones: error: can't find route\n"));
116 } else {
117 zt_set_zmap(zno, rte->ZoneBitMap);
118
119 /* if first zone for this I/F,
120 make default */
121 if (!ifID->ifDefZone)
122 ifID->ifDefZone = zno;
123 }
124 }
125 }
126 }
127
128 return(0);
129} /* set_zones */
130
131/*
132 * Generic internet control operations (ioctl's).
133 * ifp is 0 if not an interface-specific ioctl.
134 */
135
136int
137at_control(so, cmd, data, ifp)
138 struct socket *so;
139 u_long cmd;
140 caddr_t data;
141 struct ifnet *ifp;
142{
143 struct ifreq *ifr = (struct ifreq *)data;
144 int pat_id = 0, error = 0;
145 at_ifaddr_t *ifID = 0;
146 struct ifaddr *ifa;
147 struct sockaddr_dl *sdl;
148
149 if ((cmd & 0xffff) == 0xff99) {
150 u_long fixed_command;
151 /* *** this is a temporary hack to get at_send_to_dev() to
152 work with BSD-style sockets instead of the special purpose
153 system calls, ATsocket() and ATioctl().
154 *** */
155 fixed_command = _IOW(0, 0xff99, user_addr_t);
156 if ((error = at_ioctl((struct atpcb *)so->so_pcb, fixed_command, data, 0))) {
157 if (((struct atpcb *)so->so_pcb)->proto != ATPROTO_LAP) {
158 ((struct atpcb *)so->so_pcb)->proto = ATPROTO_LAP;
159 error = at_ioctl((struct atpcb *)so->so_pcb, fixed_command, data , 0);
160 }
161 }
162 return(error);
163
164 /* *** processing should be
165 return(EINVAL);
166 *** */
167 }
168 /*
169 * Find address for this interface, if it exists.
170 */
171 if (ifp)
172 for (pat_id = 0; pat_id < xpatcnt; pat_id++)
173 if (at_interfaces[pat_id].aa_ifp == ifp) {
174 ifID = &at_interfaces[pat_id];
175 break;
176 }
177
178 switch (cmd) {
179
180 case AIOCGETSTATE:
181 {
182 at_state_t *global_state = (at_state_t *)data;
183
184 *global_state = at_state;
185 return(0);
186 break;
187 }
188
189 case AIOCGETIFCFG:
190 {
191 at_if_cfg_t *cfgp = (at_if_cfg_t *)data;
192
193 ifID = 0;
194 if ((at_state.flags & AT_ST_STARTED) &&
195 ifID_home) {
196 if (strlen(cfgp->ifr_name)) {
197 TAILQ_FOREACH(ifID, &at_ifQueueHd, aa_link) {
198 if (!strncmp(ifID->ifName, cfgp->ifr_name,
199 strlen(ifID->ifName)))
200 break;
201 }
202 } else {
203 ifID = ifID_home;
204 strlcpy(cfgp->ifr_name, ifID->ifName,
205 sizeof(cfgp->ifr_name));
206 }
207 if (ifID && ifID->ifState != LAP_OFFLINE) {
208 cfgp->flags = ifID->ifFlags;
209 /* put the IF state into the low order
210 bits of flags */
211 cfgp->flags |= (ifID->ifState & LAP_STATE_MASK);
212 cfgp->node = ifID->ifThisNode;
213 cfgp->router = ifID->ifARouter;
214 cfgp->netStart = ifID->ifThisCableStart;
215 cfgp->netEnd = ifID->ifThisCableEnd;
216 cfgp->zonename = ifID->ifZoneName;
217 return(0);
218 } else
219 return(EINVAL);
220 } else
221 return(ENOTREADY);
222 break;
223 }
224
225 case AIOCSETDEFZONE:
226 {
227 at_def_zone_t *defzonep = (at_def_zone_t *)data;
228
229 /* check for root access */
230 if ((error = suser(kauth_cred_get(), 0)))
231 return(EACCES);
232
233 ifID = 0;
234 if ((at_state.flags & AT_ST_STARTED) && ifID_home) {
235 if (strlen(defzonep->ifr_name)) {
236 TAILQ_FOREACH(ifID, &at_ifQueueHd, aa_link) {
237 if (!strncmp(ifID->ifName, defzonep->ifr_name,
238 strlen(ifID->ifName)))
239 break;
240 }
241 } else {
242 ifID = ifID_home;
243 strlcpy(defzonep->ifr_name, ifID->ifName,
244 sizeof(defzonep->ifr_name));
245 }
246
247 /* In routing mode the default zone is only set for the
248 default interface. */
249 if (ROUTING_MODE && (ifID != ifID_home))
250 return(EINVAL);
251
252 if (ifID && ifID->ifState != LAP_OFFLINE) {
253 if (zonename_equal(&ifID->ifZoneName,
254 &defzonep->zonename))
255 return(0);
256 else {
257 /* check the zone name */
258 if (MULTIPORT_MODE) {
259 short zno;
260 at_ifnames_t ifs_in_zone;
261
262 if (!(zno = zt_find_zname(&defzonep->zonename)))
263 return(EINVAL);
264
265 getIfUsage(zno-1, &ifs_in_zone);
266 if (!ifs_in_zone.at_if[ifID->ifPort])
267 return(EINVAL);
268 ifID->ifDefZone = zno+1;
269 } else {
270 int i;
271 at_nvestr_t *zone;
272
273 for (i = 0, zone = getSPLocalZone(i);
274 zone;
275 i++, zone = getSPLocalZone(i)) {
276 if (zonename_equal(zone,
277 &defzonep->zonename))
278 break;
279 }
280 if (!zone)
281 return(EINVAL);
282 }
283 ifID->ifZoneName = defzonep->zonename;
284 (void)regDefaultZone(ifID);
285
286 /* AppleTalk zone was changed. Send event with zone info. */
287 atalk_post_msg(ifID->aa_ifp, KEV_ATALK_ZONEUPDATED, 0, &(ifID->ifZoneName));
288
289 return(0);
290 }
291 } else
292 return(EINVAL);
293 } else
294 return(ENOTREADY);
295 break;
296 }
297
298 case AIOCREGLOCALZN:
299 {
300 at_nvestr_t *zone = (at_nvestr_t *)data;
301
302 if (!(at_state.flags & AT_ST_STARTED) || !ifID_home)
303 return(ENOTREADY);
304
305 if (MULTIPORT_MODE)
306 return(EINVAL);
307
308 return(setLocalZones(zone, zone->len));
309
310 break;
311 }
312 case AIOCSETZNUSAGE:
313 if (!(at_state.flags & AT_ST_STARTED) || !ifID_home)
314 return(ENOTREADY);
315
316 if (!ROUTING_MODE)
317 return(EINVAL);
318
319 return(set_zones((zone_usage_t *)data));
320
321 break;
322
323 case AIOCGETZNUSAGE:
324 if (!(at_state.flags & AT_ST_STARTED) || !ifID_home)
325 return(ENOTREADY);
326
327 if (!MULTIPORT_MODE)
328 return(EINVAL);
329
330 if (getRTRLocalZone((zone_usage_t *)data))
331 return(0);
332 else
333 return(ENOENT);
334 break;
335
336 case AIOCNBPREG:
337 {
338 at_nbp_reg_t *nbpP = (at_nbp_reg_t *)data;
339 nve_entry_t nve;
340 int error2;
341
342 if (!(at_state.flags & AT_ST_STARTED) || !ifID_home)
343 return(ENOTREADY);
344
345 /* multihoming mode */
346 if (MULTIHOME_MODE) {
347 return(nbp_mh_reg(nbpP));
348 }
349
350 /* single port mode or router mode */
351 if (nbp_fillin_nve(&nbpP->name, &nve) != 0) {
352 /* bad tuple... */
353 return(EINVAL);
354 }
355
356 /* In routing mode when the zone is specified, we need to
357 find an interface on which the specified zone is seeded, so
358 that the zone multicast will be plausible. */
359 if (ROUTING_MODE && !(DEFAULT_ZONE(&nve.zone))) {
360 /* find first segment (interface) which is seeded for
361 this zone */
362 int finished = FALSE;
363 int zno;
364 at_ifnames_t ifs_in_zone;
365 if (!(zno = zt_find_zname(&nve.zone))) {
366 return(EINVAL);
367 }
368 getIfUsage(zno-1, &ifs_in_zone);
369
370 TAILQ_FOREACH(ifID, &at_ifQueueHd, aa_link) {
371 if (!ifs_in_zone.at_if[ifID->ifPort])
372 /* zone doesn't match */
373 continue;
374 else {
375 finished = TRUE;
376 break;
377 }
378 }
379 if (!finished)
380 return(EINVAL);
381 } else
382 ifID = ifID_home;
383
384 nve.address.net = ifID->ifThisNode.s_net;
385 nve.address.node = ifID->ifThisNode.s_node;
386 nve.address.socket = nbpP->addr.socket;
387 nve.ddptype = nbpP->ddptype;
388
389 if (nbp_find_nve(&nve))
390 return(EADDRNOTAVAIL);
391
392 /* Normal case; no tuple found for this name, so insert
393 * this tuple in the registry and return ok response.
394 */
395 if ((error2 = nbp_new_nve_entry(&nve, ifID)) == 0) {
396 nbpP->addr.net = ifID->ifThisNode.s_net;
397 nbpP->addr.node = ifID->ifThisNode.s_node;
398 nbpP->unique_nbp_id = nve.unique_nbp_id;
399 }
400
401 return(error2);
402 break;
403 }
404
405 case AIOCNBPREMOVE:
406 {
407 at_nbp_reg_t *nbpP = (at_nbp_reg_t *)data;
408 nve_entry_t *nve_entry, nve;
409
410 if (!(at_state.flags & AT_ST_STARTED))
411 return(ENOTREADY);
412
413 /* delete by id */
414 if (nbpP->unique_nbp_id) {
415 TAILQ_FOREACH(nve_entry, &name_registry, nve_link) {
416 if (nve_entry->unique_nbp_id == nbpP->unique_nbp_id) {
417 /* Found a match! */
418 nbp_delete_entry(nve_entry);
419 return(0);
420 }
421 }
422 return(EADDRNOTAVAIL);
423 }
424
425 /* delete by entity */
426 if (nbp_fillin_nve(&nbpP->name, &nve) != 0) {
427 /* bad tuple... */
428 return(EINVAL);
429 }
430
431 if (MULTIHOME_MODE && DEFAULT_ZONE(&nbpP->name.zone)) {
432 /* if mhome & *, remove nve from all default zones */
433 int found = FALSE; /* if any found & deleted */
434
435 TAILQ_FOREACH(ifID, &at_ifQueueHd, aa_link) {
436 nve.zone = ifID->ifZoneName;
437 nve.zone_hash = nbp_strhash(&nve.zone);
438 if ((nve_entry = nbp_find_nve(&nve)) == NULL)
439 continue;
440
441 nbp_delete_entry(nve_entry);
442 found = TRUE;
443 }
444 if (found)
445 return(0);
446 else
447 return(EADDRNOTAVAIL);
448 }
449
450 if ((nve_entry = nbp_find_nve(&nve)) == NULL)
451 /* Can't find the tuple we're looking for, send error*/
452 return(EADDRNOTAVAIL);
453
454 /* Normal case; tuple found for this name, so delete
455 * the entry from the registry and return ok response.
456 */
457 nbp_delete_entry(nve_entry);
458 return(0);
459
460 break;
461 }
462
463 case AIOCSETROUTER:
464 {
465 at_router_params_t *rt = (at_router_params_t *)data;
466
467 /* check for root access */
468 if ((error = suser(kauth_cred_get(), 0)))
469 return(EACCES);
470
471 /* when in routing/multihome mode the AIOCSETROUTER IOCTL
472 is done first */
473 if (at_state.flags & AT_ST_STARTED)
474 return(EALREADY);
475
476 /* Setup the routing & zip table size for the router */
477 if (rt->rtmp_table_sz >= RT_MIN && rt->rtmp_table_sz <= RT_MAX)
478 RT_maxentry = rt->rtmp_table_sz;
479 else
480 RT_maxentry = RT_DEFAULT;
481
482 if (rt->zone_table_sz >= ZT_MIN && rt->zone_table_sz <= ZT_MAX)
483 ZT_maxentry = rt->zone_table_sz;
484 else
485 ZT_maxentry = ZT_DEFAULT;
486
487 if (rt_table_init() == ENOBUFS)
488 return(ENOBUFS);
489
490 if (rt->router_mix)
491 RouterMix = (int)rt->router_mix;
492 else
493 RouterMix = RT_MIX_DEFAULT;
494
495 add_ddp_handler(RTMP_SOCKET, rtmp_router_input);
496
497 if (rt->multihome)
498 at_state.flags |= AT_ST_MULTIHOME;
499 else
500 at_state.flags |= AT_ST_ROUTER;
501 break;
502 }
503 case AIOCSTARTROUTER:
504 {
505 at_kern_err_t *keP = (at_kern_err_t *)data;
506
507 /* check for root access */
508 if (suser(kauth_cred_get(), 0))
509 return(EACCES);
510
511 if (!(at_state.flags & AT_ST_STARTED))
512 return(ENOTREADY);
513
514 bzero(keP, sizeof(at_kern_err_t));
515 error = routerStart(keP);
516
517 break;
518 }
519 case AIOCGETROUTER:
520 {
521 at_router_params_t *rt = (at_router_params_t *)data;
522
523 if (!(at_state.flags & AT_ST_STARTED))
524 return(ENOTREADY);
525
526 rt->multihome = (MULTIHOME_MODE)? 1: 0;
527 rt->rtmp_table_sz = RT_maxentry;
528 rt->zone_table_sz = ZT_maxentry;
529 rt->router_mix = RouterMix;
530
531 break;
532 }
533 case AIOCSTOPATALK:
534 {
535 int *count_only = (int *)data,
536 ret;
537
538 /* check for root access */
539 if ((error = suser(kauth_cred_get(), 0)))
540 return(EACCES);
541
542 ret = ddp_shutdown(*count_only);
543
544 if (*count_only != 0)
545 {
546 *count_only = ret;
547 return(0);
548 }
549 else
550 {
551 if (ret == 0)
552 {
553 /* AppleTalk was successfully shut down. Send event. */
554 atalk_post_msg(0, KEV_ATALK_DISABLED, 0, 0);
555 return 0;
556 }
557 else
558 return EBUSY;
559 }
560
561 break;
562 }
563
564 case SIOCSIFADDR:
565 /* check for root access */
566 if ((error = suser(kauth_cred_get(), 0)))
567 error = EACCES;
568 else if (ifID)
569 error = EEXIST;
570 else {
571 if (xpatcnt == 0) {
572 at_state.flags |= AT_ST_STARTING;
573 ddp_brt_init();
574 }
575
576 /* *** find an empty entry *** */
577 ifID = &at_interfaces[xpatcnt];
578 bzero((caddr_t)ifID, sizeof(at_ifaddr_t));
579 strlcpy(ifID->ifName, ifr->ifr_name, sizeof(ifID->ifName));
580
581 ifID->aa_ifp = ifp;
582 ifa = &ifID->aa_ifa;
583 error = proto_plumb(PF_APPLETALK, ifp);
584 if (error == EEXIST) {
585 ifID->at_was_attached = 1;
586 error = 0;
587 }
588 if (error != 0) {
589 break;
590 }
591 /* XXX ethernet-specific */
592 ifID->cable_multicast_addr = etalk_multicast_addr;
593 xpatcnt++;
594 ifnet_lock_exclusive(ifp);
595 TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link)
596 if ((sdl = (struct sockaddr_dl *)ifa->ifa_addr) &&
597 (sdl->sdl_family == AF_LINK)) {
598 bcopy(LLADDR(sdl), ifID->xaddr, sizeof(ifID->xaddr));
599#ifdef APPLETALK_DEBUG
600 kprintf("SIOCSIFADDR: local enet address is %x.%x.%x.%x.%x.%x\n",
601 ifID->xaddr[0], ifID->xaddr[1],
602 ifID->xaddr[2], ifID->xaddr[3],
603 ifID->xaddr[4], ifID->xaddr[5]);
604#endif
605 break;
606 }
607
608 /* attach the AppleTalk address to the ifnet structure */
609 ifa = &ifID->aa_ifa;
610 ifa->ifa_addr = (struct sockaddr *)&ifID->ifNodeAddress;
611 ifID->ifNodeAddress.sat_len = sizeof(struct sockaddr_at);
612 ifID->ifNodeAddress.sat_family = AF_APPLETALK;
613 /* the address itself will be filled in when ifThisNode
614 is set */
615 if_attach_ifa(ifp, ifa);
616 ifnet_lock_done(ifp);
617 }
618 break;
619
620 /* complete the initialization started in SIOCSIFADDR */
621 case AIOCSIFADDR:
622 {
623 at_if_cfg_t *cfgp = (at_if_cfg_t *)data;
624
625 if (!(at_state.flags & AT_ST_STARTING))
626 return(ENOTREADY);
627
628 if (!(ifID = find_ifID(cfgp->ifr_name)))
629 return(EINVAL);
630
631 return(lap_online(ifID, cfgp));
632 break;
633 }
634
635#ifdef NOT_YET
636 /* *** this can't be added until AT can handle dynamic addition and
637 deletion of interfaces *** */
638 case SIOCDIFADDR:
639 /* check for root access */
640 if (error = suser(kauth_cred_get(), 0))
641 error = EACCES;
642 else if (!ifID)
643 error = EINVAL;
644 else
645 elap_offline(ifID);
646 break;
647#endif
648
649 case SIOCSETOT: {
650 struct atpcb *at_pcb, *clonedat_pcb;
651 int cloned_fd = *(int *)data;
652
653 at_pcb = sotoatpcb(so);
654
655 /* let's make sure it's either -1 or a valid file descriptor */
656 if (cloned_fd != -1) {
657 struct socket *cloned_so;
658 error = file_socket(cloned_fd, &cloned_so);
659 if (error)
660 break;
661 clonedat_pcb = sotoatpcb(cloned_so);
662 } else {
663 clonedat_pcb = NULL;
664 }
665
666 if (clonedat_pcb == NULL) {
667 at_pcb->ddp_flags |= DDPFLG_STRIPHDR;
668 } else {
669 at_pcb->ddp_flags = clonedat_pcb->ddp_flags;
670 }
671 file_drop(cloned_fd);
672 break;
673 }
674
675 case SIOCPROTOATTACH:
676 /* check for root access */
677 if (suser(kauth_cred_get(), 0) != 0) {
678 error = EACCES;
679 break;
680 }
681 error = proto_plumb(PF_APPLETALK, ifp);
682 if (ifID != NULL
683 && (error == 0 || error == EEXIST)) {
684 ifID->at_was_attached = 1;
685 }
686 break;
687
688 case SIOCPROTODETACH:
689 /* check for root access */
690 if (suser(kauth_cred_get(), 0) != 0) {
691 error = EACCES;
692 break;
693 }
694 if (ifID != NULL) {
695 error = EBUSY;
696 break;
697 }
698 error = proto_unplumb(PF_APPLETALK, ifp);
699 break;
700
701 default:
702 if (ifp == 0 || ifp->if_ioctl == 0)
703 return (EOPNOTSUPP);
704 return ifnet_ioctl(ifp, 0, cmd, data);
705 }
706
707 return(error);
708}
709
710/* From dlil_post_msg() */
711void atalk_post_msg(struct ifnet *ifp, u_long event_code, struct at_addr *address, at_nvestr_t *zone)
712{
713 struct kev_atalk_data at_event_data;
714 struct kev_msg ev_msg;
715
716 ev_msg.vendor_code = KEV_VENDOR_APPLE;
717 ev_msg.kev_class = KEV_NETWORK_CLASS;
718 ev_msg.kev_subclass = KEV_ATALK_SUBCLASS;
719 ev_msg.event_code = event_code;
720
721 bzero(&at_event_data, sizeof(struct kev_atalk_data));
722
723 if (ifp != 0) {
724 strlcpy(&at_event_data.link_data.if_name[0], ifp->if_name, IFNAMSIZ);
725 at_event_data.link_data.if_family = ifp->if_family;
726 at_event_data.link_data.if_unit = (unsigned long) ifp->if_unit;
727 }
728
729 if (address != 0) {
730 at_event_data.node_data.address = *address;
731 }
732 else if (zone != 0) {
733 at_event_data.node_data.zone = *zone;
734 }
735
736 ev_msg.dv[0].data_length = sizeof(struct kev_atalk_data);
737 ev_msg.dv[0].data_ptr = &at_event_data;
738 ev_msg.dv[1].data_length = 0;
739
740 kev_post_msg(&ev_msg);
741}