- ev_msg.vendor_code = KEV_VENDOR_APPLE;
- ev_msg.kev_class = KEV_NETWORK_CLASS;
- ev_msg.kev_subclass = KEV_INET_SUBCLASS;
-
- if (hostIsNew)
- ev_msg.event_code = KEV_INET_NEW_ADDR;
- else
- ev_msg.event_code = KEV_INET_CHANGED_ADDR;
-
- if (ia->ia_ifa.ifa_dstaddr)
- in_event_data.ia_dstaddr =
- ((struct sockaddr_in *)ia->ia_ifa.ifa_dstaddr)->sin_addr;
- else
- in_event_data.ia_dstaddr.s_addr = 0;
-
- in_event_data.ia_addr = ia->ia_addr.sin_addr;
- in_event_data.ia_net = ia->ia_net;
- in_event_data.ia_netmask = ia->ia_netmask;
- in_event_data.ia_subnet = ia->ia_subnet;
- in_event_data.ia_subnetmask = ia->ia_subnetmask;
- in_event_data.ia_netbroadcast = ia->ia_netbroadcast;
- IFA_UNLOCK(&ia->ia_ifa);
- strncpy(&in_event_data.link_data.if_name[0], ifp->if_name, IFNAMSIZ);
- in_event_data.link_data.if_family = ifp->if_family;
- in_event_data.link_data.if_unit = (u_int32_t) ifp->if_unit;
-
- ev_msg.dv[0].data_ptr = &in_event_data;
- ev_msg.dv[0].data_length = sizeof(struct kev_in_data);
- ev_msg.dv[1].data_length = 0;
-
- kev_post_msg(&ev_msg);
+ ev_msg.vendor_code = KEV_VENDOR_APPLE;
+ ev_msg.kev_class = KEV_NETWORK_CLASS;
+ ev_msg.kev_subclass = KEV_INET_SUBCLASS;
+
+ if (hostIsNew)
+ ev_msg.event_code = KEV_INET_NEW_ADDR;
+ else
+ ev_msg.event_code = KEV_INET_CHANGED_ADDR;
+
+ if (ia->ia_ifa.ifa_dstaddr) {
+ in_event_data.ia_dstaddr =
+ ((struct sockaddr_in *)(void *)ia->
+ ia_ifa.ifa_dstaddr)->sin_addr;
+ } else {
+ in_event_data.ia_dstaddr.s_addr = INADDR_ANY;
+ }
+ in_event_data.ia_addr = ia->ia_addr.sin_addr;
+ in_event_data.ia_net = ia->ia_net;
+ in_event_data.ia_netmask = ia->ia_netmask;
+ in_event_data.ia_subnet = ia->ia_subnet;
+ in_event_data.ia_subnetmask = ia->ia_subnetmask;
+ in_event_data.ia_netbroadcast = ia->ia_netbroadcast;
+ IFA_UNLOCK(&ia->ia_ifa);
+ (void) strncpy(&in_event_data.link_data.if_name[0],
+ ifp->if_name, IFNAMSIZ);
+ in_event_data.link_data.if_family = ifp->if_family;
+ in_event_data.link_data.if_unit = ifp->if_unit;
+
+ ev_msg.dv[0].data_ptr = &in_event_data;
+ ev_msg.dv[0].data_length = sizeof (struct kev_in_data);
+ ev_msg.dv[1].data_length = 0;
+
+ kev_post_msg(&ev_msg);