Commit 4f84171d authored by Tycho Andersen's avatar Tycho Andersen Committed by Pavel Emelyanov

net: allow dumping of gre0 and gretap0

These devices are injected into every network namespace when the ip_gre
module is loaded. They cannot be configured as usable tunnels, so let's
just ignore them.
Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 1700a9bf
...@@ -281,6 +281,21 @@ static int dump_one_ethernet(struct ifinfomsg *ifi, char *kind, ...@@ -281,6 +281,21 @@ static int dump_one_ethernet(struct ifinfomsg *ifi, char *kind,
return dump_one_netdev(ND_TYPE__TUN, ifi, tb, fds, dump_tun_link); return dump_one_netdev(ND_TYPE__TUN, ifi, tb, fds, dump_tun_link);
if (!strcmp(kind, "bridge")) if (!strcmp(kind, "bridge"))
return dump_one_netdev(ND_TYPE__BRIDGE, ifi, tb, fds, dump_bridge); return dump_one_netdev(ND_TYPE__BRIDGE, ifi, tb, fds, dump_bridge);
if (!strcmp(kind, "gretap")) {
char *name = (char *)RTA_DATA(tb[IFLA_IFNAME]);
if (!name) {
pr_err("gretap %d has no name\n", ifi->ifi_index);
return -1;
}
if (!strcmp(name, "gretap0")) {
pr_info("found %s, ignoring\n", name);
return 0;
}
pr_warn("GRE tap device %s not supported natively\n", name);
}
return dump_unknown_device(ifi, kind, tb, fds); return dump_unknown_device(ifi, kind, tb, fds);
} }
...@@ -303,6 +318,27 @@ static int dump_one_voiddev(struct ifinfomsg *ifi, char *kind, ...@@ -303,6 +318,27 @@ static int dump_one_voiddev(struct ifinfomsg *ifi, char *kind,
return dump_unknown_device(ifi, kind, tb, fds); return dump_unknown_device(ifi, kind, tb, fds);
} }
static int dump_one_gre(struct ifinfomsg *ifi, char *kind,
struct nlattr **tb, struct cr_imgset *fds)
{
if (!strcmp(kind, "gre")) {
char *name = (char *)RTA_DATA(tb[IFLA_IFNAME]);
if (!name) {
pr_err("gre device %d has no name\n", ifi->ifi_index);
return -1;
}
if (!strcmp(name, "gre0")) {
pr_info("found %s, ignoring\n", name);
return 0;
}
pr_warn("GRE tunnel device %s not supported natively\n", name);
}
return dump_unknown_device(ifi, kind, tb, fds);
}
static int dump_one_link(struct nlmsghdr *hdr, void *arg) static int dump_one_link(struct nlmsghdr *hdr, void *arg)
{ {
struct cr_imgset *fds = arg; struct cr_imgset *fds = arg;
...@@ -338,6 +374,9 @@ static int dump_one_link(struct nlmsghdr *hdr, void *arg) ...@@ -338,6 +374,9 @@ static int dump_one_link(struct nlmsghdr *hdr, void *arg)
case ARPHRD_VOID: case ARPHRD_VOID:
ret = dump_one_voiddev(ifi, kind, tb, fds); ret = dump_one_voiddev(ifi, kind, tb, fds);
break; break;
case ARPHRD_IPGRE:
ret = dump_one_gre(ifi, kind, tb, fds);
break;
default: default:
unk: unk:
ret = dump_unknown_device(ifi, kind, tb, fds); ret = dump_unknown_device(ifi, kind, tb, fds);
......
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