confile: cleanup get_config_net_ipv6_gateway()

parent a6ad2ac5
......@@ -5647,14 +5647,15 @@ static int get_config_net_ipv6_gateway(const char *key, char *retv, int inlen,
memset(retv, 0, inlen);
if (!netdev)
return -1;
return ret_errno(EINVAL);
if (netdev->ipv6_gateway_auto) {
strprint(retv, inlen, "auto");
} else if (netdev->ipv6_gateway_dev) {
strprint(retv, inlen, "dev");
} else if (netdev->ipv6_gateway) {
inet_ntop(AF_INET6, netdev->ipv6_gateway, buf, sizeof(buf));
if (!inet_ntop(AF_INET6, netdev->ipv6_gateway, buf, sizeof(buf)))
return -errno;
strprint(retv, inlen, "%s", buf);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment