Lines Matching refs:dsmp

95     const char *param_name, dhcp_smach_t *dsmp)  in parse_param_list()  argument
117 param_name, dsmp->dsm_name); in parse_param_list()
139 (dsmp->dsm_isv6 ? ITAB_CAT_V6 : 0), in parse_param_list()
144 dsmp->dsm_name); in parse_param_list()
174 dhcp_smach_t *dsmp, *alt_primary; in insert_smach() local
178 if ((dsmp = calloc(1, sizeof (*dsmp))) == NULL) { in insert_smach()
186 dsmp->dsm_name = lif->lif_name; in insert_smach()
187 dsmp->dsm_lif = lif; in insert_smach()
188 dsmp->dsm_hold_count = 1; in insert_smach()
189 dsmp->dsm_state = INIT; in insert_smach()
190 dsmp->dsm_dflags = DHCP_IF_REMOVED; /* until added to list */ in insert_smach()
216 dsmp->dsm_dflags |= DHCP_IF_V6; in insert_smach()
217 dsmp->dsm_server = ipv6_all_dhcp_relay_and_servers; in insert_smach()
226 &dsmp->dsm_server); in insert_smach()
235 release_smach(dsmp); in insert_smach()
241 script_init(dsmp); in insert_smach()
242 ipc_action_init(&dsmp->dsm_ia); in insert_smach()
244 dsmp->dsm_neg_hrtime = gethrtime(); in insert_smach()
245 dsmp->dsm_offer_timer = -1; in insert_smach()
246 dsmp->dsm_start_timer = -1; in insert_smach()
247 dsmp->dsm_retrans_timer = -1; in insert_smach()
252 plist = df_get_string(dsmp->dsm_name, isv6, DF_PARAM_REQUEST_LIST); in insert_smach()
253 dsmp->dsm_prl = parse_param_list(plist, &dsmp->dsm_prllen, "request", in insert_smach()
254 dsmp); in insert_smach()
255 plist = df_get_string(dsmp->dsm_name, isv6, DF_PARAM_IGNORE_LIST); in insert_smach()
256 dsmp->dsm_pil = parse_param_list(plist, &dsmp->dsm_pillen, "ignore", in insert_smach()
257 dsmp); in insert_smach()
259 dsmp->dsm_offer_wait = df_get_int(dsmp->dsm_name, isv6, in insert_smach()
272 dsmp->dsm_name, isv6 ? 6 : 4); in insert_smach()
273 dsmp->dsm_dflags |= DHCP_IF_PRIMARY; in insert_smach()
285 dsmp->dsm_dflags &= ~DHCP_IF_REMOVED; in insert_smach()
286 insque(dsmp, &lif->lif_smachs); in insert_smach()
288 dhcpmsg(MSG_DEBUG2, "insert_smach: inserted %s", dsmp->dsm_name); in insert_smach()
290 return (dsmp); in insert_smach()
301 hold_smach(dhcp_smach_t *dsmp) in hold_smach() argument
303 dsmp->dsm_hold_count++; in hold_smach()
306 dsmp->dsm_name, dsmp->dsm_hold_count); in hold_smach()
317 free_smach(dhcp_smach_t *dsmp) in free_smach() argument
320 dsmp->dsm_name); in free_smach()
322 deprecate_leases(dsmp); in free_smach()
323 remove_lif(dsmp->dsm_lif); in free_smach()
324 release_lif(dsmp->dsm_lif); in free_smach()
325 free_pkt_list(&dsmp->dsm_recv_pkt_list); in free_smach()
326 if (dsmp->dsm_ack != dsmp->dsm_orig_ack) in free_smach()
327 free_pkt_entry(dsmp->dsm_orig_ack); in free_smach()
328 free_pkt_entry(dsmp->dsm_ack); in free_smach()
329 free(dsmp->dsm_send_pkt.pkt); in free_smach()
330 free(dsmp->dsm_cid); in free_smach()
331 free(dsmp->dsm_prl); in free_smach()
332 free(dsmp->dsm_pil); in free_smach()
333 free(dsmp->dsm_routers); in free_smach()
334 free(dsmp->dsm_reqhost); in free_smach()
335 free(dsmp); in free_smach()
353 release_smach(dhcp_smach_t *dsmp) in release_smach() argument
355 if (dsmp->dsm_hold_count == 0) { in release_smach()
360 if (dsmp->dsm_hold_count == 1 && in release_smach()
361 !(dsmp->dsm_dflags & DHCP_IF_REMOVED)) { in release_smach()
366 if (--dsmp->dsm_hold_count == 0) { in release_smach()
367 free_smach(dsmp); in release_smach()
370 dsmp->dsm_name, dsmp->dsm_hold_count); in release_smach()
383 next_smach(dhcp_smach_t *dsmp, boolean_t isv6) in next_smach() argument
388 if (dsmp != NULL) { in next_smach()
389 if (dsmp->dsm_next != NULL) in next_smach()
390 return (dsmp->dsm_next); in next_smach()
392 if ((lif = dsmp->dsm_lif) != NULL) in next_smach()
399 if ((pif = dsmp->dsm_lif->lif_pif) != NULL) in next_smach()
424 dhcp_smach_t *dsmp; in primary_smach() local
426 for (dsmp = next_smach(NULL, isv6); dsmp != NULL; in primary_smach()
427 dsmp = next_smach(dsmp, isv6)) { in primary_smach()
428 if (dsmp->dsm_dflags & DHCP_IF_PRIMARY) in primary_smach()
431 return (dsmp); in primary_smach()
447 dhcp_smach_t *dsmp; in info_primary_smach() local
449 for (dsmp = next_smach(NULL, isv6); dsmp != NULL; in info_primary_smach()
450 dsmp = next_smach(dsmp, isv6)) { in info_primary_smach()
457 if (dsmp->dsm_dflags & DHCP_IF_PRIMARY) in info_primary_smach()
461 if (dsmp->dsm_ack == NULL) in info_primary_smach()
469 strcmp(dsmp->dsm_name, bestdsm->dsm_name) < 0) in info_primary_smach()
470 bestdsm = dsmp; in info_primary_smach()
487 make_primary(dhcp_smach_t *dsmp) in make_primary() argument
492 if ((old_primary = primary_smach(dsmp->dsm_isv6)) != NULL) in make_primary()
494 dsmp->dsm_dflags |= DHCP_IF_PRIMARY; in make_primary()
499 alt_primary = primary_smach(!dsmp->dsm_isv6); in make_primary()
507 dsmp->dsm_lif->lif_pif->pif_name) == 0) in make_primary()
517 if ((pif = lookup_pif_by_name(dsmp->dsm_lif->lif_pif->pif_name, in make_primary()
518 !dsmp->dsm_isv6)) != NULL) { in make_primary()
535 dhcp_smach_t *dsmp; in lookup_smach() local
537 for (dsmp = next_smach(NULL, isv6); dsmp != NULL; in lookup_smach()
538 dsmp = next_smach(dsmp, isv6)) { in lookup_smach()
539 if (strcmp(dsmp->dsm_name, smname) == 0) in lookup_smach()
542 return (dsmp); in lookup_smach()
556 lookup_smach_by_uindex(uint16_t ifindex, dhcp_smach_t *dsmp, boolean_t isv6) in lookup_smach_by_uindex() argument
566 if (dsmp != NULL) { in lookup_smach_by_uindex()
567 pif = dsmp->dsm_lif->lif_pif; in lookup_smach_by_uindex()
568 if ((dsmp = next_smach(dsmp, isv6)) == NULL) in lookup_smach_by_uindex()
570 if (pif == dsmp->dsm_lif->lif_pif) in lookup_smach_by_uindex()
571 return (dsmp); in lookup_smach_by_uindex()
587 if ((dsmp = lif->lif_smachs) != NULL) in lookup_smach_by_uindex()
590 } while (dsmp == NULL); in lookup_smach_by_uindex()
591 return (dsmp); in lookup_smach_by_uindex()
605 lookup_smach_by_xid(uint32_t xid, dhcp_smach_t *dsmp, boolean_t isv6) in lookup_smach_by_xid() argument
607 for (dsmp = next_smach(dsmp, isv6); dsmp != NULL; in lookup_smach_by_xid()
608 dsmp = next_smach(dsmp, isv6)) { in lookup_smach_by_xid()
610 pkt_get_xid(dsmp->dsm_send_pkt.pkt, isv6) == xid) in lookup_smach_by_xid()
614 return (dsmp); in lookup_smach_by_xid()
628 dhcp_smach_t *dsmp; in lookup_smach_by_event() local
632 for (dsmp = next_smach(NULL, isv6); dsmp != NULL; in lookup_smach_by_event()
633 dsmp = next_smach(dsmp, isv6)) { in lookup_smach_by_event()
634 if ((dsmp->dsm_dflags & DHCP_IF_BUSY) && in lookup_smach_by_event()
635 eid == dsmp->dsm_ia.ia_eid) in lookup_smach_by_event()
636 return (dsmp); in lookup_smach_by_event()
643 return (dsmp); in lookup_smach_by_event()
654 cancel_offer_timer(dhcp_smach_t *dsmp) in cancel_offer_timer() argument
658 if (dsmp->dsm_offer_timer != -1) { in cancel_offer_timer()
659 retval = iu_cancel_timer(tq, dsmp->dsm_offer_timer, NULL); in cancel_offer_timer()
660 dsmp->dsm_offer_timer = -1; in cancel_offer_timer()
662 release_smach(dsmp); in cancel_offer_timer()
677 cancel_smach_timers(dhcp_smach_t *dsmp) in cancel_smach_timers() argument
683 for (dlp = dsmp->dsm_leases; dlp != NULL; dlp = dlp->dl_next) { in cancel_smach_timers()
691 cancel_offer_timer(dsmp); in cancel_smach_timers()
692 stop_pkt_retransmission(dsmp); in cancel_smach_timers()
693 if (dsmp->dsm_start_timer != -1) { in cancel_smach_timers()
694 (void) iu_cancel_timer(tq, dsmp->dsm_start_timer, NULL); in cancel_smach_timers()
695 dsmp->dsm_start_timer = -1; in cancel_smach_timers()
696 release_smach(dsmp); in cancel_smach_timers()
709 remove_smach(dhcp_smach_t *dsmp) in remove_smach() argument
711 if (dsmp->dsm_dflags & DHCP_IF_REMOVED) in remove_smach()
714 dhcpmsg(MSG_DEBUG2, "remove_smach: removing %s", dsmp->dsm_name); in remove_smach()
715 dsmp->dsm_dflags |= DHCP_IF_REMOVED; in remove_smach()
716 remque(dsmp); in remove_smach()
723 cancel_smach_timers(dsmp); in remove_smach()
726 release_smach(dsmp); in remove_smach()
741 finished_smach(dhcp_smach_t *dsmp, int error) in finished_smach() argument
743 hold_smach(dsmp); in finished_smach()
744 remove_smach(dsmp); in finished_smach()
745 if (dsmp->dsm_ia.ia_fd != -1) in finished_smach()
746 ipc_action_finish(dsmp, error); in finished_smach()
748 (void) async_cancel(dsmp); in finished_smach()
749 release_smach(dsmp); in finished_smach()
775 set_smach_state(dhcp_smach_t *dsmp, DHCPSTATE state) in set_smach_state() argument
777 dhcp_lif_t *lif = dsmp->dsm_lif; in set_smach_state()
779 if (dsmp->dsm_state != state) { in set_smach_state()
782 dhcp_state_to_string(dsmp->dsm_state), in set_smach_state()
783 dhcp_state_to_string(state), dsmp->dsm_name); in set_smach_state()
790 if (!dsmp->dsm_isv6) { in set_smach_state()
791 if (is_bound_state(dsmp->dsm_state)) { in set_smach_state()
808 dsmp->dsm_state = state; in set_smach_state()
843 get_smach_cid(dhcp_smach_t *dsmp) in get_smach_cid() argument
847 dhcp_lif_t *lif = dsmp->dsm_lif; in get_smach_cid()
858 "property on %s", dsmp->dsm_name); in get_smach_cid()
859 value = df_get_string(dsmp->dsm_name, pif->pif_isv6, DF_CLIENT_ID); in get_smach_cid()
921 dsmp->dsm_cid = (uchar_t *)dllt; in get_smach_cid()
934 dsmp->dsm_cid = (uchar_t *)dll; in get_smach_cid()
982 dsmp->dsm_cid = (uchar_t *)den; in get_smach_cid()
999 dsmp->dsm_cid = (uchar_t *)cp; in get_smach_cid()
1002 dsmp->dsm_cidlen = client_id_len; in get_smach_cid()
1004 (void) memmove(dsmp->dsm_cid + 5, in get_smach_cid()
1005 dsmp->dsm_cid, client_id_len - 5); in get_smach_cid()
1006 dsmp->dsm_cid[0] = 255; in get_smach_cid()
1007 dsmp->dsm_cid[1] = lif->lif_iaid >> 24; in get_smach_cid()
1008 dsmp->dsm_cid[2] = lif->lif_iaid >> 16; in get_smach_cid()
1009 dsmp->dsm_cid[3] = lif->lif_iaid >> 8; in get_smach_cid()
1010 dsmp->dsm_cid[4] = lif->lif_iaid; in get_smach_cid()
1018 dsmp->dsm_name, value); in get_smach_cid()
1025 dsmp->dsm_cid = malloc(client_id_len); in get_smach_cid()
1026 if (dsmp->dsm_cid == NULL) in get_smach_cid()
1028 if (hexascii_to_octet(value, slen, dsmp->dsm_cid, in get_smach_cid()
1030 dsmp->dsm_cidlen = client_id_len; in get_smach_cid()
1034 "hex value for Client ID on %s", dsmp->dsm_name); in get_smach_cid()
1037 dsmp->dsm_cid = malloc(client_id_len); in get_smach_cid()
1038 if (dsmp->dsm_cid == NULL) in get_smach_cid()
1040 dsmp->dsm_cidlen = client_id_len; in get_smach_cid()
1041 (void) memcpy(dsmp->dsm_cid, value, client_id_len); in get_smach_cid()
1059 strchr(dsmp->dsm_name, ':') == NULL) { in get_smach_cid()
1075 dsmp->dsm_cidlen = 1 + 4 + 16; in get_smach_cid()
1076 dsmp->dsm_cid = client_id = malloc(dsmp->dsm_cidlen); in get_smach_cid()
1077 if (dsmp->dsm_cid == NULL) in get_smach_cid()
1108 dsmp->dsm_cid = malloc(global_duidlen); in get_smach_cid()
1109 if (dsmp->dsm_cid == NULL) in get_smach_cid()
1111 (void) memcpy(dsmp->dsm_cid, global_duid, global_duidlen); in get_smach_cid()
1112 dsmp->dsm_cidlen = global_duidlen; in get_smach_cid()
1114 dsmp->dsm_cid = malloc(5 + global_duidlen); in get_smach_cid()
1115 if (dsmp->dsm_cid == NULL) in get_smach_cid()
1117 dsmp->dsm_cid[0] = 255; in get_smach_cid()
1118 dsmp->dsm_cid[1] = lif->lif_iaid >> 24; in get_smach_cid()
1119 dsmp->dsm_cid[2] = lif->lif_iaid >> 16; in get_smach_cid()
1120 dsmp->dsm_cid[3] = lif->lif_iaid >> 8; in get_smach_cid()
1121 dsmp->dsm_cid[4] = lif->lif_iaid; in get_smach_cid()
1122 (void) memcpy(dsmp->dsm_cid + 5, global_duid, global_duidlen); in get_smach_cid()
1123 dsmp->dsm_cidlen = 5 + global_duidlen; in get_smach_cid()
1130 dsmp->dsm_name); in get_smach_cid()
1156 discard_default_routes(dhcp_smach_t *dsmp) in discard_default_routes() argument
1158 free(dsmp->dsm_routers); in discard_default_routes()
1159 dsmp->dsm_routers = NULL; in discard_default_routes()
1160 dsmp->dsm_nrouters = 0; in discard_default_routes()
1173 remove_default_routes(dhcp_smach_t *dsmp) in remove_default_routes() argument
1178 if (dsmp->dsm_routers != NULL) { in remove_default_routes()
1179 ifindex = dsmp->dsm_lif->lif_pif->pif_index; in remove_default_routes()
1180 for (idx = dsmp->dsm_nrouters - 1; idx >= 0; idx--) { in remove_default_routes()
1182 &dsmp->dsm_routers[idx])) { in remove_default_routes()
1185 inet_ntoa(dsmp->dsm_routers[idx]), in remove_default_routes()
1186 dsmp->dsm_name); in remove_default_routes()
1190 inet_ntoa(dsmp->dsm_routers[idx]), in remove_default_routes()
1191 dsmp->dsm_name); in remove_default_routes()
1194 discard_default_routes(dsmp); in remove_default_routes()
1206 reset_smach(dhcp_smach_t *dsmp) in reset_smach() argument
1208 dsmp->dsm_dflags &= ~DHCP_IF_FAILED; in reset_smach()
1210 remove_default_routes(dsmp); in reset_smach()
1212 free_pkt_list(&dsmp->dsm_recv_pkt_list); in reset_smach()
1213 free_pkt_entry(dsmp->dsm_ack); in reset_smach()
1214 if (dsmp->dsm_orig_ack != dsmp->dsm_ack) in reset_smach()
1215 free_pkt_entry(dsmp->dsm_orig_ack); in reset_smach()
1216 dsmp->dsm_ack = dsmp->dsm_orig_ack = NULL; in reset_smach()
1218 free(dsmp->dsm_reqhost); in reset_smach()
1219 dsmp->dsm_reqhost = NULL; in reset_smach()
1221 cancel_smach_timers(dsmp); in reset_smach()
1223 (void) set_smach_state(dsmp, INIT); in reset_smach()
1224 if (dsmp->dsm_isv6) { in reset_smach()
1225 dsmp->dsm_server = ipv6_all_dhcp_relay_and_servers; in reset_smach()
1228 &dsmp->dsm_server); in reset_smach()
1230 dsmp->dsm_neg_hrtime = gethrtime(); in reset_smach()
1236 assert(dsmp->dsm_script_pid == -1); in reset_smach()
1248 refresh_smach(dhcp_smach_t *dsmp) in refresh_smach() argument
1250 if (dsmp->dsm_state == BOUND || dsmp->dsm_state == RENEWING || in refresh_smach()
1251 dsmp->dsm_state == REBINDING || dsmp->dsm_state == INFORMATION) { in refresh_smach()
1252 dhcpmsg(MSG_WARNING, "refreshing state on %s", dsmp->dsm_name); in refresh_smach()
1253 cancel_smach_timers(dsmp); in refresh_smach()
1254 if (dsmp->dsm_state == INFORMATION) in refresh_smach()
1255 dhcp_inform(dsmp); in refresh_smach()
1257 dhcp_init_reboot(dsmp); in refresh_smach()
1275 dhcp_smach_t *dsmp; in refresh_smachs() local
1278 for (dsmp = next_smach(NULL, isv6); dsmp != NULL; in refresh_smachs()
1279 dsmp = next_smach(dsmp, isv6)) { in refresh_smachs()
1280 refresh_smach(dsmp); in refresh_smachs()
1300 dhcp_smach_t *dsmp, *dsmp_next; in nuke_smach_list() local
1303 for (dsmp = next_smach(NULL, isv6); dsmp != NULL; in nuke_smach_list()
1304 dsmp = dsmp_next) { in nuke_smach_list()
1307 dsmp_next = next_smach(dsmp, isv6); in nuke_smach_list()
1310 if (dsmp->dsm_droprelease) in nuke_smach_list()
1312 dsmp->dsm_droprelease = B_TRUE; in nuke_smach_list()
1314 cancel_smach_timers(dsmp); in nuke_smach_list()
1321 if (df_get_bool(dsmp->dsm_name, isv6, in nuke_smach_list()
1323 df_get_bool(dsmp->dsm_name, isv6, in nuke_smach_list()
1325 if (script_start(dsmp, isv6 ? EVENT_RELEASE6 : in nuke_smach_list()
1333 (void) script_start(dsmp, isv6 ? EVENT_DROP6 : in nuke_smach_list()
1351 insert_lease(dhcp_smach_t *dsmp) in insert_lease() argument
1357 dlp->dl_smach = dsmp; in insert_lease()
1361 insque(dlp, &dsmp->dsm_leases); in insert_lease()
1362 dhcpmsg(MSG_DEBUG2, "insert_lease: new lease for %s", dsmp->dsm_name); in insert_lease()
1527 deprecate_leases(dhcp_smach_t *dsmp) in deprecate_leases() argument
1536 remove_default_routes(dsmp); in deprecate_leases()
1538 while ((dlp = dsmp->dsm_leases) != NULL) in deprecate_leases()
1555 verify_smach(dhcp_smach_t *dsmp) in verify_smach() argument
1559 if (dsmp->dsm_dflags & DHCP_IF_REMOVED) { in verify_smach()
1560 release_smach(dsmp); in verify_smach()
1564 if (!dsmp->dsm_isv6) { in verify_smach()
1568 if (!verify_lif(dsmp->dsm_lif)) in verify_smach()
1576 if (dsmp->dsm_state != BOUND && in verify_smach()
1577 dsmp->dsm_state != RENEWING && in verify_smach()
1578 dsmp->dsm_state != REBINDING) { in verify_smach()
1579 release_smach(dsmp); in verify_smach()
1583 for (dlp = dsmp->dsm_leases; dlp != NULL; dlp = dlpn) { in verify_smach()
1608 if (dsmp->dsm_leases != NULL) { in verify_smach()
1609 release_smach(dsmp); in verify_smach()
1614 finished_smach(dsmp, DHCP_IPC_E_INVIF); in verify_smach()
1615 release_smach(dsmp); in verify_smach()