2
0
mirror of git://github.com/lxc/lxc synced 2025-08-31 04:09:36 +00:00

network: non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner
2017-09-01 12:54:43 +02:00
parent de4855a8bc
commit 535e88591d
2 changed files with 11 additions and 8 deletions

View File

@@ -1914,6 +1914,9 @@ char *lxc_mkifname(const char *template)
FILE *urandom;
struct ifaddrs *ifa, *ifaddr;
if (strlen(template) >= IFNAMSIZ)
return NULL;
/* Get all the network interfaces. */
getifaddrs(&ifaddr);
@@ -2389,7 +2392,7 @@ int lxc_create_network_priv(struct lxc_handler *handler)
int lxc_network_move_created_netdev_priv(const char *lxcpath, char *lxcname,
struct lxc_list *network, pid_t pid)
{
int err;
int ret;
char ifname[IFNAMSIZ];
struct lxc_list *iterator;
@@ -2409,16 +2412,17 @@ int lxc_network_move_created_netdev_priv(const char *lxcpath, char *lxcname,
return -1;
}
err = lxc_netdev_move_by_name(ifname, pid, NULL);
if (err) {
ret = lxc_netdev_move_by_name(ifname, pid, NULL);
if (ret) {
ERROR("Failed to move network device \"%s\" to "
"network namespace %d: %s", ifname, pid,
strerror(-err));
strerror(-ret));
return -1;
}
DEBUG("Moved network device \"%s\"/\"%s\" to network namespace "
"of %d:", ifname, netdev->name[0] != '\0' ? netdev->name : "(null)",
"of %d:",
ifname, netdev->name[0] != '\0' ? netdev->name : "(null)",
pid);
}
@@ -2733,8 +2737,7 @@ static int lxc_setup_netdev_in_child_namespaces(struct lxc_netdev *netdev)
if (netdev->type != LXC_NET_VETH) {
net_type_name = lxc_net_type_to_str(netdev->type);
ERROR("%s networks are not supported for containers "
"not setup up by privileged users",
net_type_name);
"not setup up by privileged users", net_type_name);
return -1;
}

View File

@@ -175,7 +175,7 @@ struct saved_nic {
extern int lxc_convert_mac(char *macaddr, struct sockaddr *sockaddr);
/* Move a device between namespaces. */
extern int lxc_netdev_move_by_index(int ifindex, pid_t pid, const char* ifname);
extern int lxc_netdev_move_by_index(int ifindex, pid_t pid, const char *ifname);
extern int lxc_netdev_move_by_name(const char *ifname, pid_t pid,
const char *newname);