Commit d5790de6 authored by Pavel Emelyanov's avatar Pavel Emelyanov

net: Move void devices dumping in a separate helper

To make it look symmetrical to over types dumping.
And for simpler further patching.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent c1fd8656
...@@ -143,13 +143,34 @@ unk: ...@@ -143,13 +143,34 @@ unk:
return -1; return -1;
} }
static int dump_one_voiddev(struct ifinfomsg *ifi,
struct rtattr **tb, struct cr_fdset *fds)
{
char *kind;
kind = link_kind(ifi, tb);
if (!kind)
goto unk;
if (!strcmp(kind, "venet"))
/*
* If we meet a link we know about, such as
* OpenVZ's venet, save general parameters of
* it as external link.
*/
return dump_one_netdev(ND_TYPE__EXTLINK, ifi, tb, fds, NULL);
unk:
pr_err("Unknown VOID kind %s link %d\n", kind, ifi->ifi_index);
return -1;
}
static int dump_one_link(struct nlmsghdr *hdr, void *arg) static int dump_one_link(struct nlmsghdr *hdr, void *arg)
{ {
struct cr_fdset *fds = arg; struct cr_fdset *fds = arg;
struct ifinfomsg *ifi; struct ifinfomsg *ifi;
int ret = 0, len = hdr->nlmsg_len - NLMSG_LENGTH(sizeof(*ifi)); int ret = 0, len = hdr->nlmsg_len - NLMSG_LENGTH(sizeof(*ifi));
struct rtattr *tb[IFLA_MAX + 1]; struct rtattr *tb[IFLA_MAX + 1];
char *kind;
ifi = NLMSG_DATA(hdr); ifi = NLMSG_DATA(hdr);
...@@ -173,17 +194,8 @@ static int dump_one_link(struct nlmsghdr *hdr, void *arg) ...@@ -173,17 +194,8 @@ static int dump_one_link(struct nlmsghdr *hdr, void *arg)
ret = dump_one_gendev(ifi, tb, fds); ret = dump_one_gendev(ifi, tb, fds);
break; break;
case ARPHRD_VOID: case ARPHRD_VOID:
/* ret = dump_one_voiddev(ifi, tb, fds);
* If we meet a link we know about, such as break;
* OpenVZ's venet, save general parameters of
* it as external link.
*/
kind = link_kind(ifi, tb);
if (kind && !strcmp(kind, "venet")) {
ret = dump_one_netdev(ND_TYPE__EXTLINK, ifi, tb, fds, NULL);
break;
}
/* Fall through otherwise! */
default: default:
pr_err("Unsupported link type %d, kind %s\n", pr_err("Unsupported link type %d, kind %s\n",
ifi->ifi_type, link_kind(ifi, tb)); ifi->ifi_type, link_kind(ifi, tb));
......
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