]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netat/ddp_r_zip.c
xnu-344.49.tar.gz
[apple/xnu.git] / bsd / netat / ddp_r_zip.c
index 573fda9e56382092b02d638665edb308b47e1341..1169c8f4072f3aedb39ba158351def36c42fc512 100644 (file)
@@ -3,19 +3,22 @@
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License").  You may not use this file except in compliance with the
- * License.  Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
  * 
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
@@ -68,6 +71,8 @@
 #include <netat/routing_tables.h>
 #include <netat/debug.h>
 
+#include <sys/kern_event.h>
+
 static void zip_reply_to_getmyzone();
 extern int at_reg_mcast(), at_unreg_mcast();
 
@@ -723,6 +728,10 @@ void zip_router_input (m, ifID)
                        bcopy((caddr_t)new_zone, (caddr_t)&ifID->ifZoneName, 
                              new_zone_len+1);
 
+                       /* Send network zone change event and new zone for this interface. */
+                       atalk_post_msg(ifID->aa_ifp, KEV_ATALK_ZONEUPDATED, 0, &(ifID->ifZoneName));
+                       atalk_post_msg(ifID->aa_ifp, KEV_ATALK_ZONELISTCHANGED, 0, 0);
+                       
                        /* add the new zone to the list of local zones */
                        if (!MULTIPORT_MODE && !DEFAULT_ZONE(&ifID->ifZoneName))
                                (void)setLocalZones(&ifID->ifZoneName, 
@@ -864,8 +873,10 @@ static void zip_netinfo_reply (netinfo, ifID)
         * to us.
         */
        /* *** Do we really need to check this? *** */
-       if (!zonename_equal((at_nvestr_t *)netinfo->data, &ifID->ifZoneName))
+       if (!zonename_equal((at_nvestr_t *)netinfo->data, &ifID->ifZoneName)) {
+               dPrintf(D_M_ZIP, D_L_INFO, ("zip_netinfo_reply, !zonename_equal!!!"));
                return;
+       }
 
        ifID->ifThisCableStart = NET_VALUE(netinfo->cable_range_start);
        ifID->ifThisCableEnd = NET_VALUE(netinfo->cable_range_end);
@@ -932,6 +943,12 @@ static void zip_netinfo_reply (netinfo, ifID)
                ZIPwakeup(ifID, ZIP_RE_AARP);
                return;
        }
+       
+       if (!ifID->startup_inprogress) {
+               /* Send event with zone info. This covers case where we get zone info
+                       after startup. During startup this event is sent from ZIPwakeup. */
+               atalk_post_msg(ifID->aa_ifp, KEV_ATALK_ZONEUPDATED, 0, &(ifID->ifZoneName));
+       }
 
        ZIPwakeup(ifID, 0); /* no error */
        return;
@@ -963,6 +980,10 @@ int zip_control (ifID, control)
                ifID->ifZoneName.len = 1;
                ifID->ifZoneName.str[0] = '*';
                ifID->ifZoneName.str[1] = '\0';
+
+               /* Send event with zone info. */
+               atalk_post_msg(ifID->aa_ifp, KEV_ATALK_ZONEUPDATED, 0, &(ifID->ifZoneName));
+
                break;
        default :
                break;