[lxc-devel] Please give a clearer error message when the interface name is too long

tpo2 tpo2 at sourcepole.ch
Sun Oct 28 11:29:38 UTC 2012


Currently when configuring a too long interface name with
lxc.network.veth.pair lxc will say:

    lxc_confile - invalid interface name: veth_haproxy_br0

leaving the user add odds what possibly could be wrong with that name.
Please give the user a clearer error message.

I suggest to change the error message to

   "interface name '%s' is too long (> %d)".

The patch below implements this change.

Thanks
*t
 
commit bc7fa5c391bc8e767fdb7322d6c60c3c5e098583
Author: Tomas Pospisek <tpo_hp at sourcepole.ch>
Date:   Sun Oct 28 12:15:19 2012 +0100

    clearer error message when interface name to long

    Signed-off-by: Tomas Pospisek <tpo_deb at sourcepole.ch>

diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index 94bb698..c8d736c 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
@@ -370,7 +370,7 @@ static struct lxc_netdev *network_netdev(const char
*key, const char *value,
 static int network_ifname(char **valuep, char *value)
 {
        if (strlen(value) >= IFNAMSIZ) {
-               ERROR("invalid interface name: %s", value);
+               ERROR("interface name '%s' is too long (> %d)", value,
IFNAMSIZ - 1);
                return -1;
        }





More information about the lxc-devel mailing list