/illumos-gate/usr/src/cmd/cmd-inet/sbin/dhcpagent/ |
H A D | states.c | 96 const char *param_name, dhcp_smach_t *dsmp) in parse_param_list() argument 118 param_name, dsmp->dsm_name); in parse_param_list() 140 (dsmp->dsm_isv6 ? ITAB_CAT_V6 : 0), in parse_param_list() 145 dsmp->dsm_name); in parse_param_list() 175 dhcp_smach_t *dsmp, *alt_primary; in insert_smach() local 179 if ((dsmp = calloc(1, sizeof (*dsmp))) == NULL) { in insert_smach() 187 dsmp->dsm_name = lif->lif_name; in insert_smach() 188 dsmp->dsm_lif = lif; in insert_smach() 189 dsmp->dsm_hold_count = 1; in insert_smach() 190 dsmp->dsm_state = INIT; in insert_smach() [all …]
|
H A D | request.c | 63 send_v6_request(dhcp_smach_t *dsmp) in send_v6_request() argument 68 dpkt = init_pkt(dsmp, DHCPV6_MSG_REQUEST); in send_v6_request() 69 (void) add_pkt_opt(dpkt, DHCPV6_OPT_SERVERID, dsmp->dsm_serverid, in send_v6_request() 70 dsmp->dsm_serveridlen); in send_v6_request() 73 d6in.d6in_iaid = htonl(dsmp->dsm_lif->lif_iaid); in send_v6_request() 81 (void) add_pkt_prl(dpkt, dsmp); in send_v6_request() 83 (void) send_pkt_v6(dsmp, dpkt, dsmp->dsm_server, stop_requesting, in send_v6_request() 87 (void) set_smach_state(dsmp, REQUESTING); in send_v6_request() 101 server_unicast_option(dhcp_smach_t *dsmp, PKT_LIST *plp) in server_unicast_option() argument 111 } else if (olen != sizeof (dsmp->dsm_server)) { in server_unicast_option() [all …]
|
H A D | renew.c | 84 dhcp_smach_t *dsmp = dlp->dl_smach; in dhcp_renew() local 88 dsmp->dsm_name); in dhcp_renew() 92 if (dsmp->dsm_state == RENEWING || dsmp->dsm_state == REBINDING) { in dhcp_renew() 103 t2 = dsmp->dsm_curstart_monosec + dlp->dl_t2.dt_start; in dhcp_renew() 106 monosec() > t2 ? "" : "almost ", dsmp->dsm_name); in dhcp_renew() 116 if (!async_cancel(dsmp) || !async_start(dsmp, DHCP_EXTEND, B_FALSE) || in dhcp_renew() 117 !dhcp_extending(dsmp)) { in dhcp_renew() 124 (void) set_smach_state(dsmp, BOUND); in dhcp_renew() 130 dsmp->dsm_name); in dhcp_renew() 134 "wait for rebind", dsmp->dsm_name); in dhcp_renew() [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 | 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 | init_reboot.c | 58 dhcp_init_reboot_v4(dhcp_smach_t *dsmp) in dhcp_init_reboot_v4() argument 68 dpkt = init_pkt(dsmp, REQUEST); in dhcp_init_reboot_v4() 70 dsmp->dsm_ack->pkt->yiaddr.s_addr); in dhcp_init_reboot_v4() 74 htons(dsmp->dsm_lif->lif_pif->pif_max - sizeof (struct udpiphdr))); in dhcp_init_reboot_v4() 78 (void) add_pkt_prl(dpkt, dsmp); in dhcp_init_reboot_v4() 80 if (!dhcp_add_fqdn_opt(dpkt, dsmp)) in dhcp_init_reboot_v4() 81 (void) dhcp_add_hostname_opt(dpkt, dsmp); in dhcp_init_reboot_v4() 85 (void) send_pkt(dsmp, dpkt, htonl(INADDR_BROADCAST), stop_init_reboot); in dhcp_init_reboot_v4() 99 dhcp_init_reboot_v6(dhcp_smach_t *dsmp) in dhcp_init_reboot_v6() argument 112 dpkt = init_pkt(dsmp, DHCPV6_MSG_CONFIRM); in dhcp_init_reboot_v6() [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 | 73 bound_event_cb(dhcp_smach_t *dsmp, void *arg) in bound_event_cb() argument 75 if (dsmp->dsm_ia.ia_fd != -1) in bound_event_cb() 76 ipc_action_finish(dsmp, DHCP_IPC_SUCCESS); in bound_event_cb() 78 async_finish(dsmp); in bound_event_cb() 94 dhcp_bound(dhcp_smach_t *dsmp, PKT_LIST *ack) in dhcp_bound() argument 104 if (dsmp->dsm_ack != dsmp->dsm_orig_ack) in dhcp_bound() 105 free_pkt_entry(dsmp->dsm_ack); in dhcp_bound() 106 dsmp->dsm_ack = ack; in dhcp_bound() 108 if (dsmp->dsm_orig_ack == NULL) in dhcp_bound() 109 dsmp->dsm_orig_ack = ack; in dhcp_bound() [all …]
|
H A D | agent.c | 76 static void dhcp_smach_set_msg_reqhost(dhcp_smach_t *dsmp, 78 static DHCP_OPT * dhcp_get_ack_or_state(const dhcp_smach_t *dsmp, 452 dhcp_smach_t *dsmp; in ipc_event() local 469 if ((dsmp = lookup_smach_by_event(id)) != NULL) { in ipc_event() 470 ipc_action_finish(dsmp, error); in ipc_event() 515 dsmp = primary_smach(isv6); in ipc_event() 517 dsmp = lookup_smach(ifname, isv6); in ipc_event() 519 if (dsmp != NULL) { in ipc_event() 521 hold_smach(dsmp); in ipc_event() 522 if (!verify_smach(dsmp)) in ipc_event() [all …]
|
H A D | packet.c | 156 init_pkt(dhcp_smach_t *dsmp, uchar_t type) in init_pkt() argument 158 dhcp_pkt_t *dpkt = &dsmp->dsm_send_pkt; in init_pkt() 159 dhcp_lif_t *lif = dsmp->dsm_lif; in init_pkt() 207 if (dsmp->dsm_cidlen > 0 && in init_pkt() 208 add_pkt_opt(dpkt, DHCPV6_OPT_CLIENTID, dsmp->dsm_cid, in init_pkt() 209 dsmp->dsm_cidlen) == NULL) { in init_pkt() 216 dsmp->dsm_neg_hrtime = gethrtime(); in init_pkt() 217 dsmp->dsm_newstart_monosec = monosec(); in init_pkt() 255 !is_bound_state(dsmp->dsm_state))) in init_pkt() 269 if (dsmp->dsm_cidlen > 0 && in init_pkt() [all …]
|
H A D | ipc_action.c | 67 ipc_action_start(dhcp_smach_t *dsmp, ipc_action_t *iareq) in ipc_action_start() argument 69 struct ipc_action *ia = &dsmp->dsm_ia; in ipc_action_start() 73 dsmp->dsm_name); in ipc_action_start() 77 if (!async_cancel(dsmp)) { in ipc_action_start() 79 "action on %s", dsmp->dsm_name); in ipc_action_start() 90 iareq->ia_request->timeout, ipc_action_timeout, dsmp); in ipc_action_start() 96 dsmp->dsm_name); in ipc_action_start() 100 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() 113 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 | async.c | 47 async_start(dhcp_smach_t *dsmp, dhcp_ipc_type_t cmd, boolean_t user) in async_start() argument 49 if (dsmp->dsm_async.as_present) { in async_start() 52 dsmp->dsm_async.as_cmd = cmd; in async_start() 53 dsmp->dsm_async.as_user = user; in async_start() 54 dsmp->dsm_async.as_present = B_TRUE; in async_start() 69 async_finish(dhcp_smach_t *dsmp) in async_finish() argument 77 if (dsmp->dsm_script_pid != -1) in async_finish() 78 script_stop(dsmp); in async_finish() 79 dsmp->dsm_async.as_present = B_FALSE; in async_finish() 90 async_cancel(dhcp_smach_t *dsmp) in async_cancel() argument [all …]
|
H A D | util.c | 85 dhcp_smach_t *dsmp); 197 print_server_msg(dhcp_smach_t *dsmp, const char *msg, uint_t msglen) in print_server_msg() argument 201 dsmp->dsm_name, msglen, msg); in print_server_msg() 676 write_lease_to_hostconf(dhcp_smach_t *dsmp) in write_lease_to_hostconf() argument 681 hcfile = ifname_to_hostconf(dsmp->dsm_name, dsmp->dsm_isv6); in write_lease_to_hostconf() 682 plp[0] = dsmp->dsm_ack; in write_lease_to_hostconf() 683 plp[1] = dsmp->dsm_orig_ack; in write_lease_to_hostconf() 684 if (write_hostconf(dsmp->dsm_name, plp, 2, in write_lease_to_hostconf() 685 monosec_to_time(dsmp->dsm_curstart_monosec), in write_lease_to_hostconf() 686 dsmp->dsm_isv6) != -1) { in write_lease_to_hostconf() [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 | 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()
|