/titanic_41/usr/src/cmd/cmd-inet/sbin/dhcpagent/ |
H A D | states.c | 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() [all …]
|
H A D | request.c | 62 send_v6_request(dhcp_smach_t *dsmp) in send_v6_request() argument 67 dpkt = init_pkt(dsmp, DHCPV6_MSG_REQUEST); in send_v6_request() 68 (void) add_pkt_opt(dpkt, DHCPV6_OPT_SERVERID, dsmp->dsm_serverid, in send_v6_request() 69 dsmp->dsm_serveridlen); in send_v6_request() 72 d6in.d6in_iaid = htonl(dsmp->dsm_lif->lif_iaid); in send_v6_request() 80 (void) add_pkt_prl(dpkt, dsmp); in send_v6_request() 82 (void) send_pkt_v6(dsmp, dpkt, dsmp->dsm_server, stop_requesting, in send_v6_request() 86 (void) set_smach_state(dsmp, REQUESTING); in send_v6_request() 100 server_unicast_option(dhcp_smach_t *dsmp, PKT_LIST *plp) in server_unicast_option() argument 110 } else if (olen != sizeof (dsmp->dsm_server)) { in server_unicast_option() [all …]
|
H A D | renew.c | 83 dhcp_smach_t *dsmp = dlp->dl_smach; in dhcp_renew() local 87 dsmp->dsm_name); in dhcp_renew() 91 if (dsmp->dsm_state == RENEWING || dsmp->dsm_state == REBINDING) { in dhcp_renew() 102 t2 = dsmp->dsm_curstart_monosec + dlp->dl_t2.dt_start; in dhcp_renew() 105 monosec() > t2 ? "" : "almost ", dsmp->dsm_name); in dhcp_renew() 115 if (!async_cancel(dsmp) || !async_start(dsmp, DHCP_EXTEND, B_FALSE) || in dhcp_renew() 116 !dhcp_extending(dsmp)) { in dhcp_renew() 123 (void) set_smach_state(dsmp, BOUND); in dhcp_renew() 129 dsmp->dsm_name); in dhcp_renew() 133 "wait for rebind", dsmp->dsm_name); in dhcp_renew() [all …]
|
H A D | select.c | 64 dhcp_smach_t *dsmp = arg; in dhcp_start() local 66 dsmp->dsm_start_timer = -1; in dhcp_start() 67 (void) set_smach_state(dsmp, INIT); in dhcp_start() 68 if (verify_smach(dsmp)) { in dhcp_start() 69 dhcpmsg(MSG_VERBOSE, "starting DHCP on %s", dsmp->dsm_name); in dhcp_start() 70 dhcp_selecting(dsmp); in dhcp_start() 82 set_start_timer(dhcp_smach_t *dsmp) in set_start_timer() argument 84 if (dsmp->dsm_start_timer != -1) in set_start_timer() 87 dsmp->dsm_start_timer = iu_schedule_timer_ms(tq, in set_start_timer() 88 lrand48() % DHCP_SELECT_WAIT, dhcp_start, dsmp); in set_start_timer() [all …]
|
H A D | release.c | 55 send_declines(dhcp_smach_t *dsmp) in send_declines() argument 67 if (dsmp->dsm_isv6) { in send_declines() 68 if ((dpkt = init_pkt(dsmp, DHCPV6_MSG_DECLINE)) == NULL) in send_declines() 71 dsmp->dsm_serverid, dsmp->dsm_serveridlen); in send_declines() 80 if (dsmp->dsm_ack->opts[CD_DHCP_TYPE] == NULL) in send_declines() 83 if ((dpkt = init_pkt(dsmp, DECLINE)) == NULL) in send_declines() 85 IN6_V4MAPPED_TO_IPADDR(&dsmp->dsm_server, serverip); in send_declines() 95 for (dlp = dsmp->dsm_leases; dlp != NULL; dlp = dlpn) { in send_declines() 114 (void) set_smach_state(dsmp, DECLINING); in send_declines() 116 if (dsmp->dsm_isv6) { in send_declines() [all …]
|
H A D | init_reboot.c | 58 dhcp_init_reboot_v4(dhcp_smach_t *dsmp) in dhcp_init_reboot_v4() argument 70 dpkt = init_pkt(dsmp, REQUEST); in dhcp_init_reboot_v4() 72 dsmp->dsm_ack->pkt->yiaddr.s_addr); in dhcp_init_reboot_v4() 76 htons(dsmp->dsm_lif->lif_pif->pif_max - sizeof (struct udpiphdr))); in dhcp_init_reboot_v4() 80 (void) add_pkt_prl(dpkt, dsmp); in dhcp_init_reboot_v4() 86 if (df_get_bool(dsmp->dsm_name, dsmp->dsm_isv6, DF_REQUEST_HOSTNAME)) { in dhcp_init_reboot_v4() 88 dsmp->dsm_name); in dhcp_init_reboot_v4() 92 if ((dsmp->dsm_reqhost = strdup(reqhost)) != NULL) in dhcp_init_reboot_v4() 94 dsmp->dsm_reqhost, in dhcp_init_reboot_v4() 95 strlen(dsmp->dsm_reqhost)); in dhcp_init_reboot_v4() [all …]
|
H A D | script_handler.c | 120 run_script(dhcp_smach_t *dsmp, const char *event, int fd) in run_script() argument 145 (void) execl(path, name, dsmp->dsm_name, event, NULL); in run_script() 196 script_init(dhcp_smach_t *dsmp) in script_init() argument 198 dsmp->dsm_script_pid = -1; in script_init() 199 dsmp->dsm_script_helper_pid = -1; in script_init() 200 dsmp->dsm_script_event_id = -1; in script_init() 201 dsmp->dsm_script_fd = -1; in script_init() 202 dsmp->dsm_script_callback = NULL; in script_init() 203 dsmp->dsm_script_event = NULL; in script_init() 204 dsmp->dsm_callback_arg = NULL; in script_init() [all …]
|
H A D | bound.c | 72 bound_event_cb(dhcp_smach_t *dsmp, void *arg) in bound_event_cb() argument 74 if (dsmp->dsm_ia.ia_fd != -1) in bound_event_cb() 75 ipc_action_finish(dsmp, DHCP_IPC_SUCCESS); in bound_event_cb() 77 async_finish(dsmp); in bound_event_cb() 93 dhcp_bound(dhcp_smach_t *dsmp, PKT_LIST *ack) in dhcp_bound() argument 103 if (dsmp->dsm_ack != dsmp->dsm_orig_ack) in dhcp_bound() 104 free_pkt_entry(dsmp->dsm_ack); in dhcp_bound() 105 dsmp->dsm_ack = ack; in dhcp_bound() 107 if (dsmp->dsm_orig_ack == NULL) in dhcp_bound() 108 dsmp->dsm_orig_ack = ack; in dhcp_bound() [all …]
|
H A D | packet.c | 155 init_pkt(dhcp_smach_t *dsmp, uchar_t type) in init_pkt() argument 157 dhcp_pkt_t *dpkt = &dsmp->dsm_send_pkt; in init_pkt() 158 dhcp_lif_t *lif = dsmp->dsm_lif; in init_pkt() 206 if (dsmp->dsm_cidlen > 0 && in init_pkt() 207 add_pkt_opt(dpkt, DHCPV6_OPT_CLIENTID, dsmp->dsm_cid, in init_pkt() 208 dsmp->dsm_cidlen) == NULL) { in init_pkt() 215 dsmp->dsm_neg_hrtime = gethrtime(); in init_pkt() 216 dsmp->dsm_newstart_monosec = monosec(); in init_pkt() 254 !is_bound_state(dsmp->dsm_state))) in init_pkt() 268 if (dsmp->dsm_cidlen > 0 && in init_pkt() [all …]
|
H A D | ipc_action.c | 68 ipc_action_start(dhcp_smach_t *dsmp, ipc_action_t *iareq) in ipc_action_start() argument 70 struct ipc_action *ia = &dsmp->dsm_ia; in ipc_action_start() 74 dsmp->dsm_name); in ipc_action_start() 78 if (!async_cancel(dsmp)) { in ipc_action_start() 80 "action on %s", dsmp->dsm_name); in ipc_action_start() 91 iareq->ia_request->timeout, ipc_action_timeout, dsmp); in ipc_action_start() 97 dsmp->dsm_name); in ipc_action_start() 101 hold_smach(dsmp); in ipc_action_start() 110 dhcp_ipc_type_to_string(ia->ia_cmd), ia->ia_cmd, dsmp->dsm_name); in ipc_action_start() 112 dsmp->dsm_dflags |= DHCP_IF_BUSY; in ipc_action_start() [all …]
|
H A D | inform.c | 56 dhcp_inform(dhcp_smach_t *dsmp) in dhcp_inform() argument 60 if (!set_smach_state(dsmp, INFORM_SENT)) in dhcp_inform() 63 if (dsmp->dsm_isv6) { in dhcp_inform() 64 dpkt = init_pkt(dsmp, DHCPV6_MSG_INFO_REQ); in dhcp_inform() 67 (void) add_pkt_prl(dpkt, dsmp); in dhcp_inform() 68 dsmp->dsm_server = ipv6_all_dhcp_relay_and_servers; in dhcp_inform() 69 (void) send_pkt_v6(dsmp, dpkt, dsmp->dsm_server, in dhcp_inform() 83 dpkt = init_pkt(dsmp, INFORM); in dhcp_inform() 84 IN6_V4MAPPED_TO_INADDR(&dsmp->dsm_lif->lif_v6addr, in dhcp_inform() 88 htons(dsmp->dsm_lif->lif_pif->pif_max - in dhcp_inform() [all …]
|
H A D | agent.c | 445 dhcp_smach_t *dsmp; in ipc_event() local 462 if ((dsmp = lookup_smach_by_event(id)) != NULL) { in ipc_event() 463 ipc_action_finish(dsmp, error); in ipc_event() 508 dsmp = primary_smach(isv6); in ipc_event() 510 dsmp = lookup_smach(ifname, isv6); in ipc_event() 512 if (dsmp != NULL) { in ipc_event() 514 hold_smach(dsmp); in ipc_event() 515 if (!verify_smach(dsmp)) in ipc_event() 516 dsmp = NULL; in ipc_event() 519 if (dsmp == NULL) { in ipc_event() [all …]
|
H A D | async.c | 49 async_start(dhcp_smach_t *dsmp, dhcp_ipc_type_t cmd, boolean_t user) in async_start() argument 51 if (dsmp->dsm_async.as_present) { in async_start() 54 dsmp->dsm_async.as_cmd = cmd; in async_start() 55 dsmp->dsm_async.as_user = user; in async_start() 56 dsmp->dsm_async.as_present = B_TRUE; in async_start() 71 async_finish(dhcp_smach_t *dsmp) in async_finish() argument 79 if (dsmp->dsm_script_pid != -1) in async_finish() 80 script_stop(dsmp); in async_finish() 81 dsmp->dsm_async.as_present = B_FALSE; in async_finish() 92 async_cancel(dhcp_smach_t *dsmp) in async_cancel() argument [all …]
|
H A D | adopt.c | 76 dhcp_smach_t *dsmp = NULL; in dhcp_adopt() local 130 if ((dsmp = insert_smach(lif, &retval)) == NULL) { in dhcp_adopt() 144 if (!get_prom_prop("chosen", "client-id", &dsmp->dsm_cid, in dhcp_adopt() 152 dsmp->dsm_name); in dhcp_adopt() 154 } else if (dsmp->dsm_hwtype == ARPHRD_IB && dsmp->dsm_cid == NULL) { in dhcp_adopt() 162 dsmp->dsm_name); in dhcp_adopt() 166 dsmp->dsm_cidlen = client_id_len; in dhcp_adopt() 171 if (!set_smach_state(dsmp, ADOPTING)) in dhcp_adopt() 173 dsmp->dsm_dflags = DHCP_IF_PRIMARY; in dhcp_adopt() 180 if (!dhcp_bound(dsmp, plp)) { in dhcp_adopt() [all …]
|
H A D | util.c | 180 print_server_msg(dhcp_smach_t *dsmp, const char *msg, uint_t msglen) in print_server_msg() argument 184 dsmp->dsm_name, msglen, msg); in print_server_msg() 688 write_lease_to_hostconf(dhcp_smach_t *dsmp) in write_lease_to_hostconf() argument 693 hcfile = ifname_to_hostconf(dsmp->dsm_name, dsmp->dsm_isv6); in write_lease_to_hostconf() 694 plp[0] = dsmp->dsm_ack; in write_lease_to_hostconf() 695 plp[1] = dsmp->dsm_orig_ack; in write_lease_to_hostconf() 696 if (write_hostconf(dsmp->dsm_name, plp, 2, in write_lease_to_hostconf() 697 monosec_to_time(dsmp->dsm_curstart_monosec), in write_lease_to_hostconf() 698 dsmp->dsm_isv6) != -1) { in write_lease_to_hostconf()
|
H A D | interface.c | 365 dhcp_smach_t *dsmp; in pif_status() local 371 for (dsmp = lif->lif_smachs; dsmp != NULL; in pif_status() 372 dsmp = dsmp->dsm_next) { in pif_status() 374 refresh_smach(dsmp); in pif_status() 376 remove_default_routes(dsmp); in pif_status() 1646 expired_lif_state(dhcp_smach_t *dsmp) in expired_lif_state() argument 1655 for (dlp = dsmp->dsm_leases; dlp != NULL; dlp = dlp->dl_next) { in expired_lif_state() 1682 find_expired_lif(dhcp_smach_t *dsmp) in find_expired_lif() argument 1688 for (dlp = dsmp->dsm_leases; dlp != NULL; dlp = dlp->dl_next) { in find_expired_lif()
|