Lines Matching refs:ia
150 struct in_ifaddr *ia;
154 for (ia = in_ifaddrhead.tqh_first; ia;
155 ia = ia->ia_link.tqe_next)
156 if ((i & ia->ia_netmask) == ia->ia_net) {
163 for (ia = in_ifaddrhead.tqh_first; ia;
164 ia = ia->ia_link.tqe_next)
165 if ((i & ia->ia_subnetmask) == ia->ia_subnet) {
279 struct in_ifaddr *ia = NULL, *iap;
314 ia = iap;
316 } else if (ia == NULL) {
317 ia = iap;
322 /* take a reference on ia before releasing mutex */
323 if (ia != NULL) {
324 ifaref(&ia->ia_ifa);
350 for (oia = ia; ia; ia = ia->ia_link.tqe_next) {
351 if (ia->ia_ifp == ifp &&
352 ia->ia_addr.sin_addr.s_addr ==
356 /* take a reference on ia before releasing mutex */
357 if (ia != NULL && ia != oia) {
358 ifaref(&ia->ia_ifa);
361 if (oia != NULL && oia != ia) {
376 if (cmd == SIOCDIFADDR && ia == 0) {
397 if (ia == (struct in_ifaddr *)0) {
398 ia = (struct in_ifaddr *)
399 _MALLOC(sizeof *ia, M_IFADDR, M_WAITOK);
400 if (ia == (struct in_ifaddr *)NULL) {
404 bzero((caddr_t)ia, sizeof *ia);
410 ifa = &ia->ia_ifa;
412 ia->ia_addr.sin_family = AF_INET;
413 ia->ia_addr.sin_len = sizeof (ia->ia_addr);
414 ifa->ifa_addr = (struct sockaddr *)&ia->ia_addr;
415 ifa->ifa_dstaddr = (struct sockaddr *)&ia->ia_dstaddr;
416 ifa->ifa_netmask = (struct sockaddr *)&ia->ia_sockmask;
417 ia->ia_sockmask.sin_len = 8;
420 ia->ia_broadaddr.sin_len = sizeof(ia->ia_addr);
421 ia->ia_broadaddr.sin_family = AF_INET;
423 ia->ia_ifp = ifp;
430 ifaref(&ia->ia_ifa);
431 TAILQ_INSERT_TAIL(&in_ifaddrhead, ia, ia_link);
475 if (ia == (struct in_ifaddr *)0) {
502 *((struct sockaddr_in *)&ifr->ifr_addr) = ia->ia_addr;
510 *((struct sockaddr_in *)&ifr->ifr_dstaddr) = ia->ia_broadaddr;
518 *((struct sockaddr_in *)&ifr->ifr_dstaddr) = ia->ia_dstaddr;
522 *((struct sockaddr_in *)&ifr->ifr_addr) = ia->ia_sockmask;
530 oldaddr = ia->ia_dstaddr;
531 ia->ia_dstaddr = *(struct sockaddr_in *)&ifr->ifr_dstaddr;
532 error = ifnet_ioctl(ifp, PF_INET, SIOCSIFDSTADDR, ia);
537 ia->ia_dstaddr = oldaddr;
547 if (ia->ia_ifa.ifa_dstaddr)
549 ((struct sockaddr_in *)ia->ia_ifa.ifa_dstaddr)->sin_addr;
553 in_event_data.ia_addr = ia->ia_addr.sin_addr;
554 in_event_data.ia_net = ia->ia_net;
555 in_event_data.ia_netmask = ia->ia_netmask;
556 in_event_data.ia_subnet = ia->ia_subnet;
557 in_event_data.ia_subnetmask = ia->ia_subnetmask;
558 in_event_data.ia_netbroadcast = ia->ia_netbroadcast;
570 if (ia->ia_flags & IFA_ROUTE) {
571 ia->ia_ifa.ifa_dstaddr = (struct sockaddr *)&oldaddr;
572 rtinit(&(ia->ia_ifa), (int)RTM_DELETE, RTF_HOST);
573 ia->ia_ifa.ifa_dstaddr =
574 (struct sockaddr *)&ia->ia_dstaddr;
575 rtinit(&(ia->ia_ifa), (int)RTM_ADD, RTF_HOST|RTF_UP);
584 ia->ia_broadaddr = *(struct sockaddr_in *)&ifr->ifr_broadaddr;
592 if (ia->ia_ifa.ifa_dstaddr)
594 ((struct sockaddr_in *)ia->ia_ifa.ifa_dstaddr)->sin_addr;
598 in_event_data.ia_addr = ia->ia_addr.sin_addr;
599 in_event_data.ia_net = ia->ia_net;
600 in_event_data.ia_netmask = ia->ia_netmask;
601 in_event_data.ia_subnet = ia->ia_subnet;
602 in_event_data.ia_subnetmask = ia->ia_subnetmask;
603 in_event_data.ia_netbroadcast = ia->ia_netbroadcast;
617 error = in_ifinit(ifp, ia, (struct sockaddr_in *) &ifr->ifr_addr, 1);
644 ia->ia_subnetmask = ntohl(ia->ia_sockmask.sin_addr.s_addr = i);
651 if (ia->ia_ifa.ifa_dstaddr)
653 ((struct sockaddr_in *)ia->ia_ifa.ifa_dstaddr)->sin_addr;
657 in_event_data.ia_addr = ia->ia_addr.sin_addr;
658 in_event_data.ia_net = ia->ia_net;
659 in_event_data.ia_netmask = ia->ia_netmask;
660 in_event_data.ia_subnet = ia->ia_subnet;
661 in_event_data.ia_subnetmask = ia->ia_subnetmask;
662 in_event_data.ia_netbroadcast = ia->ia_netbroadcast;
679 if (ia->ia_addr.sin_family == AF_INET) {
681 ifra->ifra_addr = ia->ia_addr;
684 ia->ia_addr.sin_addr.s_addr)
688 in_ifscrub(ifp, ia, 0);
689 ia->ia_sockmask = ifra->ifra_mask;
690 ia->ia_subnetmask =
691 ntohl(ia->ia_sockmask.sin_addr.s_addr);
696 in_ifscrub(ifp, ia, 0);
697 ia->ia_dstaddr = ifra->ifra_dstaddr;
702 error = in_ifinit(ifp, ia, &ifra->ifra_addr, 0);
706 ia->ia_broadaddr = ifra->ifra_broadaddr;
722 if (ia->ia_ifa.ifa_dstaddr)
724 ((struct sockaddr_in *)ia->ia_ifa.ifa_dstaddr)->sin_addr;
728 in_event_data.ia_addr = ia->ia_addr.sin_addr;
729 in_event_data.ia_net = ia->ia_net;
730 in_event_data.ia_netmask = ia->ia_netmask;
731 in_event_data.ia_subnet = ia->ia_subnet;
732 in_event_data.ia_subnetmask = ia->ia_subnetmask;
733 in_event_data.ia_netbroadcast = ia->ia_netbroadcast;
747 error = ifnet_ioctl(ifp, PF_INET, SIOCDIFADDR, ia);
761 if (ia->ia_ifa.ifa_dstaddr)
763 ((struct sockaddr_in *)ia->ia_ifa.ifa_dstaddr)->sin_addr;
767 in_event_data.ia_addr = ia->ia_addr.sin_addr;
768 in_event_data.ia_net = ia->ia_net;
769 in_event_data.ia_netmask = ia->ia_netmask;
770 in_event_data.ia_subnet = ia->ia_subnet;
771 in_event_data.ia_subnetmask = ia->ia_subnetmask;
772 in_event_data.ia_netbroadcast = ia->ia_netbroadcast;
782 TAILQ_REMOVE(&in_ifaddrhead, ia, ia_link);
786 in_ifscrub(ifp, ia, 1);
787 ifa = &ia->ia_ifa;
927 if (ia != NULL) {
928 ifafree(&ia->ia_ifa);
1022 struct in_ifaddr *ia;
1070 ia = (struct in_ifaddr *)ifa;
1074 bcopy(&ia->ia_addr, &iflr->addr, ia->ia_addr.sin_len);
1077 bcopy(&ia->ia_dstaddr, &iflr->dstaddr,
1078 ia->ia_dstaddr.sin_len);
1083 in_mask2len(&ia->ia_sockmask.sin_addr);
1096 bcopy(&ia->ia_addr, &ifra.ifra_addr,
1097 ia->ia_addr.sin_len);
1099 bcopy(&ia->ia_dstaddr, &ifra.ifra_dstaddr,
1100 ia->ia_dstaddr.sin_len);
1102 bcopy(&ia->ia_sockmask, &ifra.ifra_dstaddr,
1103 ia->ia_sockmask.sin_len);
1120 struct in_ifaddr *ia,
1124 if ((ia->ia_flags & IFA_ROUTE) == 0)
1129 rtinit_locked(&(ia->ia_ifa), (int)RTM_DELETE, RTF_HOST);
1131 rtinit_locked(&(ia->ia_ifa), (int)RTM_DELETE, 0);
1132 ia->ia_flags &= ~IFA_ROUTE;
1144 struct in_ifaddr *ia,
1154 oldaddr = ia->ia_addr;
1155 ia->ia_addr = *sin;
1165 cmd = (&ia->ia_ifa == ifa0) ? SIOCSIFADDR : SIOCAIFADDR;
1166 error = ifnet_ioctl(ifp, PF_INET, cmd, ia);
1186 ia->ia_addr = oldaddr;
1190 ia->ia_ifa.ifa_addr = (struct sockaddr *)&oldaddr;
1191 in_ifscrub(ifp, ia, 0);
1192 ia->ia_ifa.ifa_addr = (struct sockaddr *)&ia->ia_addr;
1195 ia->ia_netmask = IN_CLASSA_NET;
1197 ia->ia_netmask = IN_CLASSB_NET;
1199 ia->ia_netmask = IN_CLASSC_NET;
1205 if (ia->ia_subnetmask == 0) {
1206 ia->ia_subnetmask = ia->ia_netmask;
1207 ia->ia_sockmask.sin_addr.s_addr = htonl(ia->ia_subnetmask);
1209 ia->ia_netmask &= ia->ia_subnetmask;
1210 ia->ia_net = i & ia->ia_netmask;
1211 ia->ia_subnet = i & ia->ia_subnetmask;
1212 in_socktrim(&ia->ia_sockmask);
1216 ia->ia_ifa.ifa_metric = ifp->if_metric;
1218 ia->ia_broadaddr.sin_addr.s_addr =
1219 htonl(ia->ia_subnet | ~ia->ia_subnetmask);
1220 ia->ia_netbroadcast.s_addr =
1221 htonl(ia->ia_net | ~ ia->ia_netmask);
1223 ia->ia_ifa.ifa_dstaddr = ia->ia_ifa.ifa_addr;
1226 if (ia->ia_dstaddr.sin_family != AF_INET)
1230 if ((error = rtinit(&(ia->ia_ifa), (int)RTM_ADD, flags)) == 0)
1231 ia->ia_flags |= IFA_ROUTE;
1276 #define ia ((struct in_ifaddr *)ifa)
1284 (in.s_addr == ia->ia_broadaddr.sin_addr.s_addr ||
1285 in.s_addr == ia->ia_netbroadcast.s_addr ||
1289 t == ia->ia_subnet || t == ia->ia_net) &&
1295 ia->ia_subnetmask != (u_long)0xffffffff) {
1302 #undef ia