MOD aaa-12 解决ipv6掩码获取失败的问题 SOL 解决ipv6掩码获取失败的问题 修改人:zhangliang 检视人:zhangliang
This commit is contained in:
parent
f185ac8efc
commit
9348a62d03
|
@ -91,7 +91,7 @@ typedef struct _if_v4addr_str v4addr_str;
|
||||||
|
|
||||||
struct _if_v6addr_str {
|
struct _if_v6addr_str {
|
||||||
char addr[DOT_IPV6_STR];
|
char addr[DOT_IPV6_STR];
|
||||||
int prefixlen;
|
char prefixlen[IF_INFO_STR];
|
||||||
};
|
};
|
||||||
typedef struct _if_v6addr_str v6addr_str;
|
typedef struct _if_v6addr_str v6addr_str;
|
||||||
|
|
||||||
|
|
|
@ -134,13 +134,13 @@ ret_code if_get_v4proto(if_info_t *if_info)
|
||||||
|
|
||||||
if_conf_file_get(if_info->ifname, iface, protostr);
|
if_conf_file_get(if_info->ifname, iface, protostr);
|
||||||
|
|
||||||
if(strstr(protostr, "static"))
|
if(strstr(protostr, "dhcp"))
|
||||||
{
|
{
|
||||||
strcpy(if_info->v4protocol, "static");
|
strcpy(if_info->v4protocol, "dhcp");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(if_info->v4protocol, "dhcp");
|
strcpy(if_info->v4protocol, "static");
|
||||||
}
|
}
|
||||||
|
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
|
@ -156,13 +156,13 @@ ret_code if_get_v6proto(if_info_t *if_info)
|
||||||
|
|
||||||
if_conf_file_get(if_info->ifname, iface, protostr);
|
if_conf_file_get(if_info->ifname, iface, protostr);
|
||||||
|
|
||||||
if(strstr(protostr, "static"))
|
if(strstr(protostr, "dhcp"))
|
||||||
{
|
{
|
||||||
strcpy(if_info->v6protocol, "static");
|
strcpy(if_info->v6protocol, "dhcp");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(if_info->v6protocol, "dhcp");
|
strcpy(if_info->v6protocol, "static");
|
||||||
}
|
}
|
||||||
|
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
|
@ -401,7 +401,8 @@ ret_code if_del_oldin6(char *name, struct in6_ifreq *ifr6)
|
||||||
|
|
||||||
for(i = 0; i < addr_cnt; i++)
|
for(i = 0; i < addr_cnt; i++)
|
||||||
{
|
{
|
||||||
if(IPV6_ADDR_CMP(&(ifr6->ifr6_addr), &(ipv6_arr[i].addr)) == 0)
|
if(IPV6_ADDR_CMP(&(ifr6->ifr6_addr), &(ipv6_arr[i].addr)) == 0
|
||||||
|
&& ifr6->ifr6_prefixlen == ipv6_arr[i].prefixlen)
|
||||||
{
|
{
|
||||||
ret = RET_EXIST;
|
ret = RET_EXIST;
|
||||||
continue;
|
continue;
|
||||||
|
@ -508,11 +509,11 @@ int if_get_prefix6(if_info_t *if_conf)
|
||||||
|
|
||||||
for(i = 0; i < addr_cnt && i < IPV6_ADDR_NUM; i++)
|
for(i = 0; i < addr_cnt && i < IPV6_ADDR_NUM; i++)
|
||||||
{
|
{
|
||||||
inet_ntop(AF_INET6, &ipv6_arr[i].addr, if_conf->ipv6[addr_cnt].addr, DOT_IPV6_STR);
|
inet_ntop(AF_INET6, &ipv6_arr[i].addr, if_conf->ipv6[i].addr, DOT_IPV6_STR);
|
||||||
if_conf->ipv6[addr_cnt].prefixlen = ipv6_arr[i].prefixlen;
|
snprintf(if_conf->ipv6[i].prefixlen, IF_INFO_STR, "%d", ipv6_arr[i].prefixlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
return addr_cnt;
|
return i;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ cJSON *ipv6_format_json(if_info_t *config_buff, int v6_cnt)
|
||||||
s2j_create_json_obj(json_ipv6);
|
s2j_create_json_obj(json_ipv6);
|
||||||
|
|
||||||
s2j_json_set_basic_element(json_ipv6, if_ipv6, string, addr);
|
s2j_json_set_basic_element(json_ipv6, if_ipv6, string, addr);
|
||||||
s2j_json_set_basic_element(json_ipv6, if_ipv6, int, prefixlen);
|
s2j_json_set_basic_element(json_ipv6, if_ipv6, string, prefixlen);
|
||||||
|
|
||||||
cJSON_AddItemToArray(json_array, json_ipv6);
|
cJSON_AddItemToArray(json_array, json_ipv6);
|
||||||
}
|
}
|
||||||
|
@ -249,35 +249,33 @@ ret_code if_get_info(if_info_t *if_info, int *v6_cnt)
|
||||||
ret_code ret = RET_OK;
|
ret_code ret = RET_OK;
|
||||||
|
|
||||||
ret = if_get_ipenable(if_info);
|
ret = if_get_ipenable(if_info);
|
||||||
ASSERT_RET(ret);
|
ASSERT_RET_NO(ret);
|
||||||
|
|
||||||
ret = if_get_v4proto(if_info);
|
ret = if_get_v4proto(if_info);
|
||||||
ASSERT_RET(ret);
|
ASSERT_RET_NO(ret);
|
||||||
|
|
||||||
ret = if_get_v6proto(if_info);
|
ret = if_get_v6proto(if_info);
|
||||||
ASSERT_RET(ret);
|
ASSERT_RET_NO(ret);
|
||||||
|
|
||||||
ret = if_get_hwaddr(if_info);
|
ret = if_get_hwaddr(if_info);
|
||||||
ASSERT_RET(ret);
|
ASSERT_RET_NO(ret);
|
||||||
|
|
||||||
ret = if_get_maxspeed(if_info);
|
if_get_maxspeed(if_info);
|
||||||
//ASSERT_RET(ret);
|
|
||||||
|
|
||||||
ret = if_get_linkstat(if_info);
|
ret = if_get_linkstat(if_info);
|
||||||
ASSERT_RET(ret);
|
ASSERT_RET_NO(ret);
|
||||||
|
|
||||||
ret = if_get_prefix(if_info);
|
ret = if_get_prefix(if_info);
|
||||||
ASSERT_RET(ret);
|
ASSERT_RET_NO(ret);
|
||||||
|
|
||||||
ret = if_read_stats_file(if_info);
|
ret = if_read_stats_file(if_info);
|
||||||
ASSERT_RET(ret);
|
ASSERT_RET_NO(ret);
|
||||||
|
|
||||||
*v6_cnt = if_get_prefix6(if_info);
|
*v6_cnt = if_get_prefix6(if_info);
|
||||||
|
|
||||||
return ret;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ret_code ip_config_v4chk(uint config_type, ip_config_t *ip_conf)
|
ret_code ip_config_v4chk(uint config_type, ip_config_t *ip_conf)
|
||||||
{
|
{
|
||||||
ret_code ret = RET_OK;
|
ret_code ret = RET_OK;
|
||||||
|
@ -547,6 +545,10 @@ ret_code ip_config_get_all(uint source, pointer output, int *output_len)
|
||||||
|
|
||||||
for(i = 0; i < if_count; i++)
|
for(i = 0; i < if_count; i++)
|
||||||
{
|
{
|
||||||
|
if(strcmp(ifreq[i].ifr_name, "lo") == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
rpc_log_info("get interface %s info\n", ifreq[i].ifr_name);
|
rpc_log_info("get interface %s info\n", ifreq[i].ifr_name);
|
||||||
strncpy(if_info[i].ifname, ifreq[i].ifr_name, INTERFACE_NAMSIZ - 1);
|
strncpy(if_info[i].ifname, ifreq[i].ifr_name, INTERFACE_NAMSIZ - 1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue