From: Christian Brauner Date: Sun, 27 Aug 2017 12:48:52 +0000 (+0200) Subject: conf: increase lxc-user-nic buffer X-Git-Tag: lxc-2.0.9~49^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d4408c37ba74c00fde96fa427a1e58e92b903e0;p=thirdparty%2Flxc.git conf: increase lxc-user-nic buffer This will allow us log more detailed failures. Signed-off-by: Christian Brauner --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index defa69060..9baf46b2b 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -3179,9 +3179,6 @@ bool lxc_delete_network(struct lxc_handler *handler) } #define LXC_USERNIC_PATH LIBEXECDIR "/lxc/lxc-user-nic" - -/* lxc-user-nic returns "interface_name:interface_name\n" */ -#define MAX_BUFFER_SIZE IFNAMSIZ * 2 + 2 static int unpriv_assign_nic(const char *lxcpath, char *lxcname, struct lxc_netdev *netdev, pid_t pid) { @@ -3190,7 +3187,7 @@ static int unpriv_assign_nic(const char *lxcpath, char *lxcname, int bytes, pipefd[2]; char *token, *saveptr = NULL; char netdev_link[IFNAMSIZ + 1]; - char buffer[MAX_BUFFER_SIZE] = {0}; + char buffer[MAXPATHLEN] = {0}; if (netdev->type != LXC_NET_VETH) { ERROR("nic type %d not support for unprivileged use", @@ -3256,7 +3253,7 @@ static int unpriv_assign_nic(const char *lxcpath, char *lxcname, /* close the write-end of the pipe */ close(pipefd[1]); - bytes = read(pipefd[0], &buffer, MAX_BUFFER_SIZE); + bytes = read(pipefd[0], &buffer, MAXPATHLEN); if (bytes < 0) { SYSERROR("Failed to read from pipe file descriptor."); close(pipefd[0]); @@ -5122,7 +5119,7 @@ int lxc_unpriv_delete_nic(const char *lxcpath, char *lxcname, { pid_t child; int bytes, pipefd[2]; - char buffer[MAX_BUFFER_SIZE] = {0}; + char buffer[MAXPATHLEN] = {0}; if (netdev->type != LXC_NET_VETH) { ERROR("nic type %d not support for unprivileged use", @@ -5181,7 +5178,7 @@ int lxc_unpriv_delete_nic(const char *lxcpath, char *lxcname, /* close the write-end of the pipe */ close(pipefd[1]); - bytes = read(pipefd[0], &buffer, MAX_BUFFER_SIZE); + bytes = read(pipefd[0], &buffer, MAXPATHLEN); if (bytes < 0) { SYSERROR("Failed to read from pipe file descriptor."); close(pipefd[0]);