[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1395830388-13874-1-git-send-email-snagarka@redhat.com>
Date: Wed, 26 Mar 2014 16:09:48 +0530
From: Swapnil Nagarkar <snagarka@...hat.com>
To: netdev@...r.kernel.org
Cc: psabata@...hat.com
Subject: [PATCH 1/1] iproute2: wrong error when label is more than 15 chars
The string for "label" option in "ip" command does not take more than 15 chanracters.
Gives error "RTNETLINK answers: Numerical result out of range".
$ ip addr add 10.65.X.X/23 dev em1:1 label em1:123456789012
RTNETLINK answers: Numerical result out of range
$ ip addr add 10.65.X.X/23 dev em1:1 label em1:12345678901
Adding check for maximum length of interface name and proper error
message.
After patch output:-
$ ./ip addr replace 192.168.50.4 dev em1:123 label em1:123456789012
Error: argument "em1:123456789012" is wrong: invalid label value.
Signed-off-by: Swapnil Nagarkar <snagarka@...hat.com>
---
ip/ipaddress.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 14d1720..b74517d 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1358,6 +1358,8 @@ static int ipaddr_modify(int cmd, int flags, int argc, char **argv)
} else if (strcmp(*argv, "label") == 0) {
NEXT_ARG();
l = *argv;
+ if (strlen(l) >= IFNAMSIZ)
+ invarg("invalid label value.", *argv);
addattr_l(&req.n, sizeof(req), IFA_LABEL, l, strlen(l)+1);
} else if (matches(*argv, "valid_lft") == 0) {
if (valid_lftp)
--
1.8.5.3
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists