Lines Matching defs:dsmp

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