diff options
author | Harish Zunjarrao <harish.zunjarrao@qlogic.com> | 2013-10-18 09:29:24 -0400 |
---|---|---|
committer | Mike Christie <michaelc@cs.wisc.edu> | 2013-12-22 23:12:06 -0600 |
commit | 66d9f120e26d49329667e4b9f5a84076c4f66a6e (patch) | |
tree | 95b2be24ff23111be5ffc8ece9b90a4bb2b25b09 /usr/iface.c | |
parent | da404f2137daa4e5cf06d69e4d7b6a0bff8c13b5 (diff) | |
download | open-iscsi-66d9f120e26d49329667e4b9f5a84076c4f66a6e.tar.gz |
iscsi tools: Additional parameters for network settings
Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Diffstat (limited to 'usr/iface.c')
-rw-r--r-- | usr/iface.c | 823 |
1 files changed, 746 insertions, 77 deletions
diff --git a/usr/iface.c b/usr/iface.c index 55b0dd4..87ac875 100644 --- a/usr/iface.c +++ b/usr/iface.c @@ -601,6 +601,105 @@ void iface_copy(struct iface_rec *dst, struct iface_rec *src) dst->mtu = src->mtu; if (src->port) dst->port = src->port; + if (strlen(src->delayed_ack)) + strcpy(dst->delayed_ack, src->delayed_ack); + if (strlen(src->nagle)) + strcpy(dst->nagle, src->nagle); + if (strlen(src->tcp_wsf_state)) + strcpy(dst->tcp_wsf_state, src->tcp_wsf_state); + if (src->tcp_wsf) + dst->tcp_wsf = src->tcp_wsf; + if (src->tcp_timer_scale) + dst->tcp_timer_scale = src->tcp_timer_scale; + if (strlen(src->tcp_timestamp)) + strcpy(dst->tcp_timestamp, src->tcp_timestamp); + if (strlen(src->dhcp_dns)) + strcpy(dst->dhcp_dns, src->dhcp_dns); + if (strlen(src->dhcp_slp_da)) + strcpy(dst->dhcp_slp_da, src->dhcp_slp_da); + if (strlen(src->tos_state)) + strcpy(dst->tos_state, src->tos_state); + if (src->tos) + dst->tos = src->tos; + if (strlen(src->gratuitous_arp)) + strcpy(dst->gratuitous_arp, src->gratuitous_arp); + if (strlen(src->dhcp_alt_client_id_state)) + strcpy(dst->dhcp_alt_client_id_state, + src->dhcp_alt_client_id_state); + if (strlen(src->dhcp_alt_client_id)) + strcpy(dst->dhcp_alt_client_id, src->dhcp_alt_client_id); + if (strlen(src->dhcp_req_vendor_id_state)) + strcpy(dst->dhcp_req_vendor_id_state, + src->dhcp_req_vendor_id_state); + if (strlen(src->dhcp_vendor_id_state)) + strcpy(dst->dhcp_vendor_id_state, src->dhcp_vendor_id_state); + if (strlen(src->dhcp_vendor_id)) + strcpy(dst->dhcp_vendor_id, src->dhcp_vendor_id); + if (strlen(src->dhcp_learn_iqn)) + strcpy(dst->dhcp_learn_iqn, src->dhcp_learn_iqn); + if (strlen(src->fragmentation)) + strcpy(dst->fragmentation, src->fragmentation); + if (strlen(src->incoming_forwarding)) + strcpy(dst->incoming_forwarding, src->incoming_forwarding); + if (src->ttl) + dst->ttl = src->ttl; + if (strlen(src->gratuitous_neighbor_adv)) + strcpy(dst->gratuitous_neighbor_adv, + src->gratuitous_neighbor_adv); + if (strlen(src->redirect)) + strcpy(dst->redirect, src->redirect); + if (strlen(src->mld)) + strcpy(dst->mld, src->mld); + if (src->flow_label) + dst->flow_label = src->flow_label; + if (src->traffic_class) + dst->traffic_class = src->traffic_class; + if (src->hop_limit) + dst->hop_limit = src->hop_limit; + if (src->nd_reachable_tmo) + dst->nd_reachable_tmo = src->nd_reachable_tmo; + if (src->nd_rexmit_time) + dst->nd_rexmit_time = src->nd_rexmit_time; + if (src->nd_stale_tmo) + dst->nd_stale_tmo = src->nd_stale_tmo; + if (src->dup_addr_detect_cnt) + dst->dup_addr_detect_cnt = src->dup_addr_detect_cnt; + if (src->router_adv_link_mtu) + dst->router_adv_link_mtu = src->router_adv_link_mtu; + if (src->def_task_mgmt_tmo) + dst->def_task_mgmt_tmo = src->def_task_mgmt_tmo; + if (strlen(src->header_digest)) + strcpy(dst->header_digest, src->header_digest); + if (strlen(src->data_digest)) + strcpy(dst->data_digest, src->data_digest); + if (strlen(src->immediate_data)) + strcpy(dst->immediate_data, src->immediate_data); + if (strlen(src->initial_r2t)) + strcpy(dst->initial_r2t, src->initial_r2t); + if (strlen(src->data_seq_inorder)) + strcpy(dst->data_seq_inorder, src->data_seq_inorder); + if (strlen(src->data_pdu_inorder)) + strcpy(dst->data_pdu_inorder, src->data_pdu_inorder); + if (src->erl) + dst->erl = src->erl; + if (src->max_recv_dlength) + dst->max_recv_dlength = src->max_recv_dlength; + if (src->first_burst_len) + dst->first_burst_len = src->first_burst_len; + if (src->max_out_r2t) + dst->max_out_r2t = src->max_out_r2t; + if (src->max_burst_len) + dst->max_burst_len = src->max_burst_len; + if (strlen(src->chap_auth)) + strcpy(dst->chap_auth, src->chap_auth); + if (strlen(src->bidi_chap)) + strcpy(dst->bidi_chap, src->bidi_chap); + if (strlen(src->strict_login_comp)) + strcpy(dst->strict_login_comp, src->strict_login_comp); + if (strlen(src->discovery_auth)) + strcpy(dst->discovery_auth, src->discovery_auth); + if (strlen(src->discovery_logout)) + strcpy(dst->discovery_logout, src->discovery_logout); if (strlen(src->hwaddress)) strcpy(dst->hwaddress, src->hwaddress); if (strlen(src->transport_name)) @@ -1026,6 +1125,79 @@ struct iface_param_count { int count; }; +#define IFACE_NET_PARAM_EN_CNT(param_val, cnt) { \ + if (!strcmp(param_val, "disable") || \ + !strcmp(param_val, "enable")) \ + (*cnt)++; \ +} + +/** + * iface_get_common_param_count - Gets common parameters count for given iface + * @iface: iface to setup + * @count: number of parameters to set + */ +static void iface_get_common_param_count(struct iface_rec *iface, int *count) +{ + if (strcmp(iface->vlan_state, "disable")) { + /* vlan_state enabled */ + (*count)++; + + if (iface->vlan_id) + /* For vlan value */ + (*count)++; + } else { + /* vlan_state disabled */ + (*count)++; + } + + if (iface->mtu) + (*count)++; + + if (iface->port) + (*count)++; + + IFACE_NET_PARAM_EN_CNT(iface->delayed_ack, count); + IFACE_NET_PARAM_EN_CNT(iface->nagle, count); + IFACE_NET_PARAM_EN_CNT(iface->tcp_wsf_state, count); + IFACE_NET_PARAM_EN_CNT(iface->tcp_timestamp, count); + IFACE_NET_PARAM_EN_CNT(iface->redirect, count); + IFACE_NET_PARAM_EN_CNT(iface->header_digest, count); + IFACE_NET_PARAM_EN_CNT(iface->data_digest, count); + IFACE_NET_PARAM_EN_CNT(iface->immediate_data, count); + IFACE_NET_PARAM_EN_CNT(iface->initial_r2t, count); + IFACE_NET_PARAM_EN_CNT(iface->data_seq_inorder, count); + IFACE_NET_PARAM_EN_CNT(iface->data_pdu_inorder, count); + IFACE_NET_PARAM_EN_CNT(iface->chap_auth, count); + IFACE_NET_PARAM_EN_CNT(iface->bidi_chap, count); + IFACE_NET_PARAM_EN_CNT(iface->strict_login_comp, count); + IFACE_NET_PARAM_EN_CNT(iface->discovery_auth, count); + IFACE_NET_PARAM_EN_CNT(iface->discovery_logout, count); + + if (iface->tcp_wsf) + (*count)++; + + if (iface->tcp_timer_scale) + (*count)++; + + if (iface->def_task_mgmt_tmo) + (*count)++; + + if (iface->erl) + (*count)++; + + if (iface->max_recv_dlength) + (*count)++; + + if (iface->first_burst_len) + (*count)++; + + if (iface->max_burst_len) + (*count)++; + + if (iface->max_out_r2t) + (*count)++; +} + /** * __iface_get_param_count - Gets netconfig parameter count for given iface * @data: iface_param_count structure @@ -1044,10 +1216,10 @@ static int __iface_get_param_count(void *data, struct iface_rec *iface) if (iptype == ISCSI_IFACE_TYPE_IPV4) { if (strcmp(iface->state, "disable")) { - if (strstr(iface->bootproto, "dhcp")) + if (strstr(iface->bootproto, "dhcp")) { /* DHCP enabled */ count++; - else { + } else { /* DHCP disabled */ count++; @@ -1062,12 +1234,13 @@ static int __iface_get_param_count(void *data, struct iface_rec *iface) if (strstr(iface->gateway, ".")) /* User configured Gateway */ count++; - } else + } else { /* * IPv4 Address not valid, decrement * count of DHCP */ count--; + } } /* @@ -1078,37 +1251,68 @@ static int __iface_get_param_count(void *data, struct iface_rec *iface) /* iface state */ count++; - if (strcmp(iface->vlan_state, "disable")) { - /* vlan_state enabled */ + IFACE_NET_PARAM_EN_CNT(iface->dhcp_dns, + &count); + + IFACE_NET_PARAM_EN_CNT(iface->dhcp_slp_da, + &count); + + IFACE_NET_PARAM_EN_CNT(iface->tos_state, + &count); + + IFACE_NET_PARAM_EN_CNT(iface->gratuitous_arp, + &count); + + IFACE_NET_PARAM_EN_CNT( + iface->dhcp_alt_client_id_state, + &count); + + if (iface->dhcp_alt_client_id[0]) count++; - if (iface->vlan_id) - /* For vlan value */ - count++; - } else - /* vlan_state disabled */ + IFACE_NET_PARAM_EN_CNT( + iface->dhcp_req_vendor_id_state, + &count); + + IFACE_NET_PARAM_EN_CNT( + iface->dhcp_vendor_id_state, + &count); + + if (iface->dhcp_vendor_id[0]) count++; - if (iface->mtu) + IFACE_NET_PARAM_EN_CNT(iface->dhcp_learn_iqn, + &count); + + IFACE_NET_PARAM_EN_CNT(iface->fragmentation, + &count); + + IFACE_NET_PARAM_EN_CNT( + iface->incoming_forwarding, + &count); + + if (iface->tos) count++; - if (iface->port) + if (iface->ttl) count++; + + iface_get_common_param_count(iface, &count); } - } else + } else { /* IPv4 is disabled, iface state */ count++; - + } } else if (iptype == ISCSI_IFACE_TYPE_IPV6) { if (strcmp(iface->state, "disable")) { /* IPv6 Address */ if (strstr(iface->ipv6_autocfg, "nd") || - strstr(iface->ipv6_autocfg, "dhcpv6")) + strstr(iface->ipv6_autocfg, "dhcpv6")) { /* Autocfg enabled */ count++; - else { + } else { /* Autocfg disabled */ count++; @@ -1169,26 +1373,42 @@ static int __iface_get_param_count(void *data, struct iface_rec *iface) /* iface state */ count++; - if (strcmp(iface->vlan_state, "disable")) { - /* vlan_state enabled */ + IFACE_NET_PARAM_EN_CNT( + iface->gratuitous_neighbor_adv, + &count); + + IFACE_NET_PARAM_EN_CNT(iface->mld, &count); + + if (iface->flow_label) count++; - if (iface->vlan_id) - /* For vlan value */ - count++; - } else - /* vlan_state disabled */ + if (iface->traffic_class) + count++; + + if (iface->hop_limit) + count++; + + if (iface->nd_reachable_tmo) + count++; + + if (iface->nd_rexmit_time) + count++; + + if (iface->nd_stale_tmo) count++; - if (iface->mtu) + if (iface->dup_addr_detect_cnt) count++; - if (iface->port) + if (iface->router_adv_link_mtu) count++; + + iface_get_common_param_count(iface, &count); } - } else + } else { /* IPv6 is disabled, iface state */ count++; + } } iface_params->count += count; @@ -1578,6 +1798,44 @@ free: } \ } +/* write string parameter value */ +static int iface_fill_str_param_val(struct iovec *iov, uint32_t iface_num, + uint8_t iface_type, uint16_t param, + uint32_t param_len, char *param_val) +{ + int len; + struct iscsi_iface_param_info *net_param; + struct nlattr *attr; + + if (!param_val[0]) + return 1; + + len = sizeof(struct iscsi_iface_param_info) + param_len; + iov->iov_base = iscsi_nla_alloc(param, len); + if (!(iov->iov_base)) + return 1; + + attr = iov->iov_base; + iov->iov_len = NLA_ALIGN(attr->nla_len); + net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr); + net_param->iface_num = iface_num; + net_param->len = param_len; + net_param->param = param; + net_param->iface_type = iface_type; + net_param->param_type = ISCSI_NET_PARAM; + memcpy(net_param->value, param_val, param_len); + return 0; +} + +#define IFACE_SET_NET_PARAM_STRVAL(iov, inum, itype, param, plen, \ + ival, gcnt, lcnt) { \ + if (!iface_fill_str_param_val(iov, inum, itype, param, plen, \ + ival)) { \ + (*gcnt)++; \ + (*lcnt)++; \ + } \ +} + struct iface_net_config { struct iface_rec *primary; struct iovec *iovs; @@ -1597,8 +1855,12 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface) /* start at 2, because 0 is for nlmsghdr and 1 for event */ iov = net_config->iovs + 2; + if (!iface->port) + iface->port = 3260; + iptype = iface_get_iptype(iface); - if (iptype == ISCSI_IFACE_TYPE_IPV4) { + switch (iptype) { + case ISCSI_IFACE_TYPE_IPV4: if (!strcmp(iface->state, "disable")) { IFACE_SET_PARAM_STATE(&iov[net_config->count], iface->iface_num, @@ -1652,53 +1914,136 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface) */ if (count) { IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + ISCSI_IFACE_TYPE_IPV4, + ISCSI_NET_PARAM_IPV4_DHCP_DNS_ADDR_EN, + ISCSI_NET_PARAM, + iface->dhcp_dns, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + ISCSI_IFACE_TYPE_IPV4, + ISCSI_NET_PARAM_IPV4_DHCP_SLP_DA_EN, + ISCSI_NET_PARAM, + iface->dhcp_slp_da, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], iface->iface_num, ISCSI_IFACE_TYPE_IPV4, - ISCSI_NET_PARAM_IFACE_ENABLE, + ISCSI_NET_PARAM_IPV4_TOS_EN, ISCSI_NET_PARAM, - iface->state, + iface->tos_state, + &net_config->count, + &count); + + IFACE_SET_PARAM_INTVAL(&iov[net_config->count], + iface->iface_num, + ISCSI_IFACE_TYPE_IPV4, + ISCSI_NET_PARAM_IPV4_TOS, + ISCSI_NET_PARAM, + 1, + iface->tos, &net_config->count, &count); IFACE_SET_PARAM_STATE(&iov[net_config->count], iface->iface_num, ISCSI_IFACE_TYPE_IPV4, - ISCSI_NET_PARAM_VLAN_ENABLED, + ISCSI_NET_PARAM_IPV4_GRAT_ARP_EN, ISCSI_NET_PARAM, - iface->vlan_state, + iface->gratuitous_arp, &net_config->count, &count); - if (strcmp(iface->vlan_state, "disable") && - iface->vlan_id) { - if (!iface_fill_vlan_id(&iov[net_config->count], - iface, ISCSI_IFACE_TYPE_IPV4)) { - net_config->count++; - count++; - } - } + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + ISCSI_IFACE_TYPE_IPV4, + ISCSI_NET_PARAM_IPV4_DHCP_ALT_CLIENT_ID_EN, + ISCSI_NET_PARAM, + iface->dhcp_alt_client_id_state, + &net_config->count, + &count); + + IFACE_SET_NET_PARAM_STRVAL(&iov[net_config->count], + iface->iface_num, + ISCSI_IFACE_TYPE_IPV4, + ISCSI_NET_PARAM_IPV4_DHCP_ALT_CLIENT_ID, + strlen(iface->dhcp_alt_client_id), + iface->dhcp_alt_client_id, + &net_config->count, + &count); - IFACE_SET_PARAM_INTVAL(&iov[net_config->count], - iface->iface_num, - ISCSI_IFACE_TYPE_IPV4, - ISCSI_NET_PARAM_MTU, - ISCSI_NET_PARAM, - 2, - iface->mtu, - &net_config->count, - &count); + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + ISCSI_IFACE_TYPE_IPV4, + ISCSI_NET_PARAM_IPV4_DHCP_REQ_VENDOR_ID_EN, + ISCSI_NET_PARAM, + iface->dhcp_req_vendor_id_state, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + ISCSI_IFACE_TYPE_IPV4, + ISCSI_NET_PARAM_IPV4_DHCP_USE_VENDOR_ID_EN, + ISCSI_NET_PARAM, + iface->dhcp_vendor_id_state, + &net_config->count, + &count); + + IFACE_SET_NET_PARAM_STRVAL(&iov[net_config->count], + iface->iface_num, + ISCSI_IFACE_TYPE_IPV4, + ISCSI_NET_PARAM_IPV4_DHCP_VENDOR_ID, + strlen(iface->dhcp_vendor_id), + iface->dhcp_vendor_id, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + ISCSI_IFACE_TYPE_IPV4, + ISCSI_NET_PARAM_IPV4_DHCP_LEARN_IQN_EN, + ISCSI_NET_PARAM, + iface->dhcp_learn_iqn, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + ISCSI_IFACE_TYPE_IPV4, + ISCSI_NET_PARAM_IPV4_FRAGMENT_DISABLE, + ISCSI_NET_PARAM, + iface->fragmentation, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + ISCSI_IFACE_TYPE_IPV4, + ISCSI_NET_PARAM_IPV4_IN_FORWARD_EN, + ISCSI_NET_PARAM, + iface->incoming_forwarding, + &net_config->count, + &count); IFACE_SET_PARAM_INTVAL(&iov[net_config->count], iface->iface_num, ISCSI_IFACE_TYPE_IPV4, - ISCSI_NET_PARAM_PORT, + ISCSI_NET_PARAM_IPV4_TTL, ISCSI_NET_PARAM, - 2, - iface->port, + 1, + iface->ttl, &net_config->count, &count); } - } else if (iptype == ISCSI_IFACE_TYPE_IPV6) { + break; + + case ISCSI_IFACE_TYPE_IPV6: if (!strcmp(iface->state, "disable")) { IFACE_SET_PARAM_STATE(&iov[net_config->count], iface->iface_num, @@ -1786,53 +2131,377 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface) */ if (count) { IFACE_SET_PARAM_STATE(&iov[net_config->count], - iface->iface_num, - ISCSI_IFACE_TYPE_IPV6, - ISCSI_NET_PARAM_IFACE_ENABLE, - ISCSI_NET_PARAM, - iface->state, - &net_config->count, - &count); + iface->iface_num, + ISCSI_IFACE_TYPE_IPV6, + ISCSI_NET_PARAM_IPV6_GRAT_NEIGHBOR_ADV_EN, + ISCSI_NET_PARAM, + iface->gratuitous_neighbor_adv, + &net_config->count, + &count); IFACE_SET_PARAM_STATE(&iov[net_config->count], iface->iface_num, ISCSI_IFACE_TYPE_IPV6, - ISCSI_NET_PARAM_VLAN_ENABLED, + ISCSI_NET_PARAM_IPV6_MLD_EN, ISCSI_NET_PARAM, - iface->vlan_state, + iface->mld, &net_config->count, &count); - if (strcmp(iface->vlan_state, "disable") && - iface->vlan_id) { - if (!iface_fill_vlan_id(&iov[net_config->count], - iface, - ISCSI_IFACE_TYPE_IPV6)) { - net_config->count++; - count++; - } - } - IFACE_SET_PARAM_INTVAL(&iov[net_config->count], iface->iface_num, ISCSI_IFACE_TYPE_IPV6, - ISCSI_NET_PARAM_MTU, + ISCSI_NET_PARAM_IPV6_FLOW_LABEL, ISCSI_NET_PARAM, - 2, - iface->mtu, + 4, + iface->flow_label, &net_config->count, &count); IFACE_SET_PARAM_INTVAL(&iov[net_config->count], + iface->iface_num, + ISCSI_IFACE_TYPE_IPV6, + ISCSI_NET_PARAM_IPV6_TRAFFIC_CLASS, + ISCSI_NET_PARAM, + 1, + iface->traffic_class, + &net_config->count, + &count); + + IFACE_SET_PARAM_INTVAL(&iov[net_config->count], iface->iface_num, ISCSI_IFACE_TYPE_IPV6, - ISCSI_NET_PARAM_PORT, + ISCSI_NET_PARAM_IPV6_HOP_LIMIT, ISCSI_NET_PARAM, - 2, - iface->port, + 1, + iface->hop_limit, &net_config->count, &count); + + IFACE_SET_PARAM_INTVAL(&iov[net_config->count], + iface->iface_num, + ISCSI_IFACE_TYPE_IPV6, + ISCSI_NET_PARAM_IPV6_ND_REACHABLE_TMO, + ISCSI_NET_PARAM, + 4, + iface->nd_reachable_tmo, + &net_config->count, + &count); + + IFACE_SET_PARAM_INTVAL(&iov[net_config->count], + iface->iface_num, + ISCSI_IFACE_TYPE_IPV6, + ISCSI_NET_PARAM_IPV6_ND_REXMIT_TIME, + ISCSI_NET_PARAM, + 4, + iface->nd_rexmit_time, + &net_config->count, + &count); + + IFACE_SET_PARAM_INTVAL(&iov[net_config->count], + iface->iface_num, + ISCSI_IFACE_TYPE_IPV6, + ISCSI_NET_PARAM_IPV6_ND_STALE_TMO, + ISCSI_NET_PARAM, + 4, + iface->nd_stale_tmo, + &net_config->count, + &count); + + IFACE_SET_PARAM_INTVAL(&iov[net_config->count], + iface->iface_num, + ISCSI_IFACE_TYPE_IPV6, + ISCSI_NET_PARAM_IPV6_DUP_ADDR_DETECT_CNT, + ISCSI_NET_PARAM, + 1, + iface->dup_addr_detect_cnt, + &net_config->count, + &count); + + IFACE_SET_PARAM_INTVAL(&iov[net_config->count], + iface->iface_num, + ISCSI_IFACE_TYPE_IPV6, + ISCSI_NET_PARAM_IPV6_RTR_ADV_LINK_MTU, + ISCSI_NET_PARAM, + 4, + iface->router_adv_link_mtu, + &net_config->count, + &count); + } + break; + } + + /* Fill parameters common to IPv4 and IPv6 ifaces */ + if (count) { + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_NET_PARAM_IFACE_ENABLE, + ISCSI_NET_PARAM, + iface->state, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_NET_PARAM_VLAN_ENABLED, + ISCSI_NET_PARAM, + iface->vlan_state, + &net_config->count, + &count); + + if (strcmp(iface->vlan_state, "disable") && iface->vlan_id) { + if (!iface_fill_vlan_id(&iov[net_config->count], iface, + iptype)) { + net_config->count++; + count++; + } } + + IFACE_SET_PARAM_INTVAL(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_NET_PARAM_MTU, + ISCSI_NET_PARAM, + 2, + iface->mtu, + &net_config->count, + &count); + + IFACE_SET_PARAM_INTVAL(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_NET_PARAM_PORT, + ISCSI_NET_PARAM, + 2, + iface->port, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_NET_PARAM_DELAYED_ACK_EN, + ISCSI_NET_PARAM, + iface->delayed_ack, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_NET_PARAM_TCP_NAGLE_DISABLE, + ISCSI_NET_PARAM, + iface->nagle, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_NET_PARAM_TCP_WSF_DISABLE, + ISCSI_NET_PARAM, + iface->tcp_wsf_state, + &net_config->count, + &count); + + IFACE_SET_PARAM_INTVAL(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_NET_PARAM_TCP_WSF, + ISCSI_NET_PARAM, + 1, + iface->tcp_wsf, + &net_config->count, + &count); + + IFACE_SET_PARAM_INTVAL(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_NET_PARAM_TCP_TIMER_SCALE, + ISCSI_NET_PARAM, + 1, + iface->tcp_timer_scale, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_NET_PARAM_TCP_TIMESTAMP_EN, + ISCSI_NET_PARAM, + iface->tcp_timestamp, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_NET_PARAM_REDIRECT_EN, + ISCSI_NET_PARAM, + iface->redirect, + &net_config->count, + &count); + + IFACE_SET_PARAM_INTVAL(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO, + ISCSI_IFACE_PARAM, + 2, + iface->def_task_mgmt_tmo, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_IFACE_PARAM_HDRDGST_EN, + ISCSI_IFACE_PARAM, + iface->header_digest, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_IFACE_PARAM_DATADGST_EN, + ISCSI_IFACE_PARAM, + iface->data_digest, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_IFACE_PARAM_IMM_DATA_EN, + ISCSI_IFACE_PARAM, + iface->immediate_data, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_IFACE_PARAM_INITIAL_R2T_EN, + ISCSI_IFACE_PARAM, + iface->initial_r2t, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_IFACE_PARAM_DATASEQ_INORDER_EN, + ISCSI_IFACE_PARAM, + iface->data_seq_inorder, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_IFACE_PARAM_PDU_INORDER_EN, + ISCSI_IFACE_PARAM, + iface->data_pdu_inorder, + &net_config->count, + &count); + + IFACE_SET_PARAM_INTVAL(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_IFACE_PARAM_ERL, + ISCSI_IFACE_PARAM, + 1, + iface->erl, + &net_config->count, + &count); + + IFACE_SET_PARAM_INTVAL(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_IFACE_PARAM_MAX_RECV_DLENGTH, + ISCSI_IFACE_PARAM, + 4, + iface->max_recv_dlength, + &net_config->count, + &count); + + IFACE_SET_PARAM_INTVAL(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_IFACE_PARAM_FIRST_BURST, + ISCSI_IFACE_PARAM, + 4, + iface->first_burst_len, + &net_config->count, + &count); + + IFACE_SET_PARAM_INTVAL(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_IFACE_PARAM_MAX_R2T, + ISCSI_IFACE_PARAM, + 2, + iface->max_out_r2t, + &net_config->count, + &count); + + IFACE_SET_PARAM_INTVAL(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_IFACE_PARAM_MAX_BURST, + ISCSI_IFACE_PARAM, + 4, + iface->max_burst_len, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_IFACE_PARAM_CHAP_AUTH_EN, + ISCSI_IFACE_PARAM, + iface->chap_auth, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_IFACE_PARAM_BIDI_CHAP_EN, + ISCSI_IFACE_PARAM, + iface->bidi_chap, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN, + ISCSI_IFACE_PARAM, + iface->strict_login_comp, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_IFACE_PARAM_DISCOVERY_AUTH_OPTIONAL, + ISCSI_IFACE_PARAM, + iface->discovery_auth, + &net_config->count, + &count); + + IFACE_SET_PARAM_STATE(&iov[net_config->count], + iface->iface_num, + iptype, + ISCSI_IFACE_PARAM_DISCOVERY_LOGOUT_EN, + ISCSI_IFACE_PARAM, + iface->discovery_logout, + &net_config->count, + &count); } return 0; } |