[{"id":1776099,"web_url":"http://patchwork.ozlabs.org/comment/1776099/","msgid":"<20170927084249.0591ee3a@shemminger-XPS-13-9360>","list_archive_url":null,"date":"2017-09-27T07:42:49","subject":"Re: [iproute PATCH v2 0/3] Check user supplied interface name\n\tlengths","submitter":{"id":21389,"url":"http://patchwork.ozlabs.org/api/people/21389/","name":"Stephen Hemminger","email":"stephen@networkplumber.org"},"content":"On Tue, 26 Sep 2017 18:35:45 +0200\nPhil Sutter <phil@nwl.cc> wrote:\n\n> This series adds explicit checks for user-supplied interface names to\n> make sure their length fits Linux's requirements.\n> \n> The first two patches simplify interface name parsing in some places -\n> these are side-effects of working on the actual implementation provided\n> in patch three.\n> \n> Changes since v1:\n> - Patches 1 and 2 introduced.\n> - Changes to patch 3 are listed in there.\n> \n> Phil Sutter (3):\n>   ip{6,}tunnel: Avoid copying user-supplied interface name around\n>   tc: flower: No need to cache indev arg\n>   Check user supplied interface name lengths\n> \n>  include/utils.h |  1 +\n>  ip/ip6tunnel.c  |  9 +++++----\n>  ip/ipl2tp.c     |  3 ++-\n>  ip/iplink.c     | 27 ++++++++-------------------\n>  ip/ipmaddr.c    |  1 +\n>  ip/iprule.c     |  4 ++++\n>  ip/iptunnel.c   | 27 +++++++++++++--------------\n>  ip/iptuntap.c   |  4 +++-\n>  lib/utils.c     | 10 ++++++++++\n>  misc/arpd.c     |  1 +\n>  tc/f_flower.c   |  6 ++----\n>  11 files changed, 50 insertions(+), 43 deletions(-)\n> \n\nI like the idea, and checking arguments is good.\nWhy not merge the check and copy and put in lib/utils.c\n\nint get_ifname(char *name, const char *arg)\n{\n...","headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=networkplumber-org.20150623.gappssmtp.com\n\theader.i=@networkplumber-org.20150623.gappssmtp.com\n\theader.b=\"zPAjKzXl\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y28tp5Cgjz9t4b\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 27 Sep 2017 17:42:58 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751909AbdI0Hmz (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 27 Sep 2017 03:42:55 -0400","from mail-wm0-f44.google.com ([74.125.82.44]:50051 \"EHLO\n\tmail-wm0-f44.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751287AbdI0Hmy (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Wed, 27 Sep 2017 03:42:54 -0400","by mail-wm0-f44.google.com with SMTP id r74so14860363wme.4\n\tfor <netdev@vger.kernel.org>; Wed, 27 Sep 2017 00:42:54 -0700 (PDT)","from shemminger-XPS-13-9360 ([31.216.236.195])\n\tby smtp.gmail.com with ESMTPSA id\n\tc5sm6012281edd.43.2017.09.27.00.42.52\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tWed, 27 Sep 2017 00:42:53 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=networkplumber-org.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=Jx78f2Wxiby1fAuMUdSvHBDacFJVRbNwscS/Lwe8AjQ=;\n\tb=zPAjKzXlR+84US3r14ljVvfjjekJ99/zurCjAAEUTTZgYSyQyctYZTVNLn84DM4thX\n\tIn2ZGTETZIc0Gmm2NKp+F4lOsVUkYe/fmtcHsw8z7gZTdHS1jCvP4e+jqr9fGEk2seey\n\t1TOq6ELGvOAzCrUB2pdEInu8NOFhCnGEy/pygggrKmQb7Nuha88FR2pp4mh29/vijSkh\n\tuOyKIpXLDyjetuVlYt7LGTsu3ziiCrhFPOWh7Lp8KASumusf3bp0zN9J+8wokdfuITHf\n\tkIgELJhNmRykDMFsm5I6HzW70Sly3yYSH3tcY+JYjTxqYZ63I2Qy/FTxJ6cKBSUkZ6pk\n\tvylA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=Jx78f2Wxiby1fAuMUdSvHBDacFJVRbNwscS/Lwe8AjQ=;\n\tb=qifAMqv9qDPy3yCPnKHlqr7Zvn9hY54XCUnIO+5cBaTXCfBSDMVgRADs76MPiOyHJQ\n\tXpE3eFeuH9FScH4qTyxXsa+ReEtxAP0zFGfPp6D2lfXHsopza/M2YZw3W8IyGBY/mxCg\n\tBXsr1mL2k4hP0IL1rbvGkXOzvb7CrQDAbNUHgCo58xu7Hlo5dYE7SHjq3su/0v+h/S7a\n\tk3XeSsw+OMuPeV6hmD49tTziCwRCdIzBYH5fbyJmv/8KpY87gkI5kdr2jcRayIKTJrCp\n\tBcY803fBAq4HAlDhxGCDo5sGpgGYo4xCFgpkq6e5jOAX5YoWikjNl5ZkywWrg59gbpww\n\tPckw==","X-Gm-Message-State":"AHPjjUirt7zHHxEVoYvANyLZXovHRGx7vajRp9S8o8OtguljG9gTBJs/\n\tAdXSKzPClvk1CM2qrBUifginuh/x2eg=","X-Google-Smtp-Source":"AOwi7QAhrI75SopushTYTQ61g4yfByRsKcopTbSOSQvaPtrfqbFx42lbs1c95YQkOq18ZsDpNp9X5Q==","X-Received":"by 10.80.140.36 with SMTP id p33mr865268edp.130.1506498173407;\n\tWed, 27 Sep 2017 00:42:53 -0700 (PDT)","Date":"Wed, 27 Sep 2017 08:42:49 +0100","From":"Stephen Hemminger <stephen@networkplumber.org>","To":"Phil Sutter <phil@nwl.cc>","Cc":"netdev@vger.kernel.org","Subject":"Re: [iproute PATCH v2 0/3] Check user supplied interface name\n\tlengths","Message-ID":"<20170927084249.0591ee3a@shemminger-XPS-13-9360>","In-Reply-To":"<20170926163548.24347-1-phil@nwl.cc>","References":"<20170926163548.24347-1-phil@nwl.cc>","MIME-Version":"1.0","Content-Type":"text/plain; charset=US-ASCII","Content-Transfer-Encoding":"7bit","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"}},{"id":1776452,"web_url":"http://patchwork.ozlabs.org/comment/1776452/","msgid":"<20170927160528.GN32305@orbyte.nwl.cc>","list_archive_url":null,"date":"2017-09-27T16:05:28","subject":"Re: [iproute PATCH v2 0/3] Check user supplied interface name\n\tlengths","submitter":{"id":4285,"url":"http://patchwork.ozlabs.org/api/people/4285/","name":"Phil Sutter","email":"phil@nwl.cc"},"content":"On Wed, Sep 27, 2017 at 08:42:49AM +0100, Stephen Hemminger wrote:\n> On Tue, 26 Sep 2017 18:35:45 +0200\n> Phil Sutter <phil@nwl.cc> wrote:\n> \n> > This series adds explicit checks for user-supplied interface names to\n> > make sure their length fits Linux's requirements.\n> > \n> > The first two patches simplify interface name parsing in some places -\n> > these are side-effects of working on the actual implementation provided\n> > in patch three.\n> > \n> > Changes since v1:\n> > - Patches 1 and 2 introduced.\n> > - Changes to patch 3 are listed in there.\n> > \n> > Phil Sutter (3):\n> >   ip{6,}tunnel: Avoid copying user-supplied interface name around\n> >   tc: flower: No need to cache indev arg\n> >   Check user supplied interface name lengths\n> > \n> >  include/utils.h |  1 +\n> >  ip/ip6tunnel.c  |  9 +++++----\n> >  ip/ipl2tp.c     |  3 ++-\n> >  ip/iplink.c     | 27 ++++++++-------------------\n> >  ip/ipmaddr.c    |  1 +\n> >  ip/iprule.c     |  4 ++++\n> >  ip/iptunnel.c   | 27 +++++++++++++--------------\n> >  ip/iptuntap.c   |  4 +++-\n> >  lib/utils.c     | 10 ++++++++++\n> >  misc/arpd.c     |  1 +\n> >  tc/f_flower.c   |  6 ++----\n> >  11 files changed, 50 insertions(+), 43 deletions(-)\n> > \n> \n> I like the idea, and checking arguments is good.\n\nCool!\n\n> Why not merge the check and copy and put in lib/utils.c\n> \n> int get_ifname(char *name, const char *arg)\n> {\n> ...\n\nWhat do you have in mind exactly? There are basically three situations\nto which check_ifname() is added:\n\n1) Simple pointer caching:\n\n   | check_ifname(\"name\", *argv);\n   | name = *argv;\n\n2) Value caching:\n\n   | check_ifname(\"name\", *argv);\n   | strncpy(name, *argv, IFNAMSIZ);\n\n3) Direct netlink attribute creation:\n\n   | check_ifname(\"name\", *argv);\n   | addattr_l(&req.n, sizeof(req), IFNAME, *argv, strlen(*argv) + 1);\n\nTo cover them all, I could introduce the following:\n\n| char *check_ifname(const char *name, const char *argv)\n| {\n| \t/* check *arg, call invarg() if invalid */\n| \treturn *argv;\n| }\n| \n| void copy_ifname(char *dst, const char *name, const char *argv)\n| {\n| \tstrncpy(dst, check_ifname(name, argv), IFNAMSIZ);\n| }\n| \n| void addattr_ifname(struct nlmsghdr *n, int maxlen, int type,\n| \t\t    const char *name, const char *argv)\n| {\n| \taddattr_l(n, maxlen, type, check_ifname(name, argv),\n| \t\t  strlen(*argv) + 1);\n| }\n\nWhat do you think?\n\nCheers, Phil","headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y2N2j5wH7z9tXw\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 28 Sep 2017 02:05:33 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753068AbdI0QFb (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 27 Sep 2017 12:05:31 -0400","from orbyte.nwl.cc ([151.80.46.58]:60904 \"EHLO orbyte.nwl.cc\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1752494AbdI0QFa (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tWed, 27 Sep 2017 12:05:30 -0400","from n0-1 by orbyte.nwl.cc with local (Exim 4.89)\n\t(envelope-from <n0-1@orbyte.nwl.cc>)\n\tid 1dxEq0-0004uO-Je; Wed, 27 Sep 2017 18:05:28 +0200"],"Date":"Wed, 27 Sep 2017 18:05:28 +0200","From":"Phil Sutter <phil@nwl.cc>","To":"Stephen Hemminger <stephen@networkplumber.org>","Cc":"netdev@vger.kernel.org","Subject":"Re: [iproute PATCH v2 0/3] Check user supplied interface name\n\tlengths","Message-ID":"<20170927160528.GN32305@orbyte.nwl.cc>","Mail-Followup-To":"Phil Sutter <phil@nwl.cc>,\n\tStephen Hemminger <stephen@networkplumber.org>,\n\tnetdev@vger.kernel.org","References":"<20170926163548.24347-1-phil@nwl.cc>\n\t<20170927084249.0591ee3a@shemminger-XPS-13-9360>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20170927084249.0591ee3a@shemminger-XPS-13-9360>","User-Agent":"Mutt/1.7.2 (2016-11-26)","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"}},{"id":1777675,"web_url":"http://patchwork.ozlabs.org/comment/1777675/","msgid":"<20170929103107.456efb11@xeon-e3>","list_archive_url":null,"date":"2017-09-29T17:31:07","subject":"Re: [iproute PATCH v2 0/3] Check user supplied interface name\n\tlengths","submitter":{"id":21389,"url":"http://patchwork.ozlabs.org/api/people/21389/","name":"Stephen Hemminger","email":"stephen@networkplumber.org"},"content":"On Wed, 27 Sep 2017 18:05:28 +0200\nPhil Sutter <phil@nwl.cc> wrote:\n\n> On Wed, Sep 27, 2017 at 08:42:49AM +0100, Stephen Hemminger wrote:\n> > On Tue, 26 Sep 2017 18:35:45 +0200\n> > Phil Sutter <phil@nwl.cc> wrote:\n> >   \n> > > This series adds explicit checks for user-supplied interface names to\n> > > make sure their length fits Linux's requirements.\n> > > \n> > > The first two patches simplify interface name parsing in some places -\n> > > these are side-effects of working on the actual implementation provided\n> > > in patch three.\n> > > \n> > > Changes since v1:\n> > > - Patches 1 and 2 introduced.\n> > > - Changes to patch 3 are listed in there.\n> > > \n> > > Phil Sutter (3):\n> > >   ip{6,}tunnel: Avoid copying user-supplied interface name around\n> > >   tc: flower: No need to cache indev arg\n> > >   Check user supplied interface name lengths\n> > > \n> > >  include/utils.h |  1 +\n> > >  ip/ip6tunnel.c  |  9 +++++----\n> > >  ip/ipl2tp.c     |  3 ++-\n> > >  ip/iplink.c     | 27 ++++++++-------------------\n> > >  ip/ipmaddr.c    |  1 +\n> > >  ip/iprule.c     |  4 ++++\n> > >  ip/iptunnel.c   | 27 +++++++++++++--------------\n> > >  ip/iptuntap.c   |  4 +++-\n> > >  lib/utils.c     | 10 ++++++++++\n> > >  misc/arpd.c     |  1 +\n> > >  tc/f_flower.c   |  6 ++----\n> > >  11 files changed, 50 insertions(+), 43 deletions(-)\n> > >   \n> > \n> > I like the idea, and checking arguments is good.  \n> \n> Cool!\n\nI was thinking something like:\n\n\n\ndiff --git a/include/utils.h b/include/utils.h\nindex c9ed230b9604..e2702b56f2e0 100644\n--- a/include/utils.h\n+++ b/include/utils.h\n@@ -105,6 +105,8 @@ int get_be64(__be64 *val, const char *arg, int base);\n int get_be32(__be32 *val, const char *arg, int base);\n int get_be16(__be16 *val, const char *arg, int base);\n int get_addr64(__u64 *ap, const char *cp);\n+int check_ifname(const char *arg);\n+int get_ifname(char *buf, const char *arg);\n \n int hex2mem(const char *buf, uint8_t *mem, int count);\n char *hexstring_n2a(const __u8 *str, int len, char *buf, int blen);\ndiff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c\nindex b4a7def14422..a6f0e99bdc21 100644\n--- a/ip/ip6tunnel.c\n+++ b/ip/ip6tunnel.c\n@@ -180,7 +180,8 @@ static int parse_args(int argc, char **argv, int cmd, struct ip6_tnl_parm2 *p)\n \t\t\tmemcpy(&p->laddr, &laddr.data, sizeof(p->laddr));\n \t\t} else if (strcmp(*argv, \"dev\") == 0) {\n \t\t\tNEXT_ARG();\n-\t\t\tstrncpy(medium, *argv, IFNAMSIZ - 1);\n+\t\t\tif (get_ifname(medium, *argv))\n+\t\t\t\tinvarg(\"\\\"medium\\\" not a valid ifname\", *argv);\n \t\t} else if (strcmp(*argv, \"encaplimit\") == 0) {\n \t\t\tNEXT_ARG();\n \t\t\tif (strcmp(*argv, \"none\") == 0) {\ndiff --git a/ip/iplink.c b/ip/iplink.c\nindex ff5b56c038d2..89aa51ed3b40 100644\n--- a/ip/iplink.c\n+++ b/ip/iplink.c\n@@ -1265,6 +1265,8 @@ static int do_set(int argc, char **argv)\n \t\t\tflags &= ~IFF_UP;\n \t\t} else if (strcmp(*argv, \"name\") == 0) {\n \t\t\tNEXT_ARG();\n+\t\t\tif (check_ifname(*argv))\n+\t\t\t\tinvarg(\"Invalid \\\"name\\\"\\n\", *argv);\n \t\t\tnewname = *argv;\n \t\t} else if (matches(*argv, \"address\") == 0) {\n \t\t\tNEXT_ARG();\n@@ -1383,9 +1385,6 @@ static int do_set(int argc, char **argv)\n \t}\n \n \tif (newname && strcmp(dev, newname)) {\n-\t\tif (strlen(newname) == 0)\n-\t\t\tinvarg(\"\\\"\\\" is not a valid device identifier\\n\",\n-\t\t\t       \"name\");\n \t\tif (do_changename(dev, newname) < 0)\n \t\t\treturn -1;\n \t\tdev = newname;\ndiff --git a/lib/utils.c b/lib/utils.c\nindex bbd3cbc46a0e..a93b45b51a3b 100644\n--- a/lib/utils.c\n+++ b/lib/utils.c\n@@ -20,6 +20,7 @@\n #include <sys/socket.h>\n #include <netinet/in.h>\n #include <string.h>\n+#include <ctype.h>\n #include <netdb.h>\n #include <arpa/inet.h>\n #include <asm/types.h>\n@@ -465,6 +466,34 @@ int get_addr64(__u64 *ap, const char *cp)\n \treturn 1;\n }\n \n+int check_ifname(const char *name)\n+{\n+\t/* These check mimic kernel checks in dev_valid_name */\n+\tif (*name == '\\0')\n+\t\treturn -1;\n+\tif (strlen(name) >= IFNAMSIZ)\n+\t\treturn -1;\n+\n+\twhile (*name) {\n+\t\tif (*name == '/' || isspace(*name))\n+\t\t\treturn -1;\n+\t\t++name;\n+\t}\n+\treturn 0;\n+}\n+\t\t\n+/* buf is assumed to be IFNAMSIZ */\n+int get_ifname(char *buf, const char *name)\n+{\n+\tint ret;\n+\n+\tret = check_ifname(name);\n+\tif (ret == 0)\n+\t\tstrncpy(buf, name, IFNAMSIZ - 1);\n+\n+\treturn ret;\n+}\n+\n int get_addr_1(inet_prefix *addr, const char *name, int family)\n {\n \tmemset(addr, 0, sizeof(*addr));","headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=networkplumber-org.20150623.gappssmtp.com\n\theader.i=@networkplumber-org.20150623.gappssmtp.com\n\theader.b=\"BsbYmmMf\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y3drl3s4Pz9t3f\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 30 Sep 2017 03:31:19 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752190AbdI2RbR (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 29 Sep 2017 13:31:17 -0400","from mail-pg0-f53.google.com ([74.125.83.53]:43422 \"EHLO\n\tmail-pg0-f53.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751830AbdI2RbP (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Fri, 29 Sep 2017 13:31:15 -0400","by mail-pg0-f53.google.com with SMTP id y17so31447pgc.0\n\tfor <netdev@vger.kernel.org>; Fri, 29 Sep 2017 10:31:15 -0700 (PDT)","from xeon-e3 (76-14-207-240.or.wavecable.com. [76.14.207.240])\n\tby smtp.gmail.com with ESMTPSA id\n\th88sm8076970pfa.24.2017.09.29.10.31.14\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tFri, 29 Sep 2017 10:31:15 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=networkplumber-org.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=Z5D38cAKewN+1MvfxaoI6T9XBcx9Aidskb6l9HLQoew=;\n\tb=BsbYmmMf4A4Vk8Yjim8cjGOh/7ts7tF7w5jBGxOCtSgX0qYPKz9gE2rStWlRPAUIIr\n\tIIPIGjczJs6jTEP++OnNDCphSaT+6sq7BzUpG337ANpn/7jAd26GyGus5NnMwr8gWRjG\n\t5nTkIxzWtj4g2uy1bPNun4KbPj9qzDIBZtIQ6VJwUmL9YJOt8mmMxJ41GfNAbDE63FGs\n\t9HfZq93/rwi4eltjpbrUKwD2gonntWOtHYOrGEOyfydZwxTEyOuRqP90a8SqTeehZTi/\n\tdNIccnG94H3LRiy4rKCL5tHa0OtsASXIaURAe7jOB7hpml71gbV/J+OujmfMHLIDvp2C\n\tgD9Q==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=Z5D38cAKewN+1MvfxaoI6T9XBcx9Aidskb6l9HLQoew=;\n\tb=tHsdCsO94XOr4qNz+6n29k5BMQKFnsL5EXA9i7PKZJ6B+uO4AnHPerVB+kDOO1S4VJ\n\t2KjC/aqWh6ozTo3d1Z1aQxNEoKeU8o+i6ji6fq8VzP+wFg71fN6PSJdvuCO4HM/ZvhMw\n\tp9MFaJt283In/oaniP6XytOa4c26vkpsLTYxBia6Sp8/a6k9qiIsejh24x5gnaGCaaGH\n\t2QR7GrcjV/aldYnT9IuhDcZUAJxnYbkeP01QkqVvvIqXZIEh98li8OBsG5UahV1PY28T\n\tSBUzGwO2yZn9aZQoC6cYJt5OWbkmoRCbLfN3nPzO1FUKNULyc+vUnZqCWcnd/XGQB2+7\n\tLjIw==","X-Gm-Message-State":"AHPjjUhTobxpcM7h66I7kKdeG5a5L4DYg8YHCS6U+0Jp80zkxdbCOT5I\n\tNFWSMDLUqbONt8XlgyIf2wGVZg==","X-Google-Smtp-Source":"AOwi7QDttgn/bMFYBhAxD2dAY+R4PLKuMy+k3UE0SegalcMHxbH5dkKJtAqodIxwF7R47MnCJneUrA==","X-Received":"by 10.84.130.78 with SMTP id 72mr7902447plc.406.1506706275106;\n\tFri, 29 Sep 2017 10:31:15 -0700 (PDT)","Date":"Fri, 29 Sep 2017 10:31:07 -0700","From":"Stephen Hemminger <stephen@networkplumber.org>","To":"Phil Sutter <phil@nwl.cc>","Cc":"netdev@vger.kernel.org","Subject":"Re: [iproute PATCH v2 0/3] Check user supplied interface name\n\tlengths","Message-ID":"<20170929103107.456efb11@xeon-e3>","In-Reply-To":"<20170927160528.GN32305@orbyte.nwl.cc>","References":"<20170926163548.24347-1-phil@nwl.cc>\n\t<20170927084249.0591ee3a@shemminger-XPS-13-9360>\n\t<20170927160528.GN32305@orbyte.nwl.cc>","MIME-Version":"1.0","Content-Type":"text/plain; charset=US-ASCII","Content-Transfer-Encoding":"7bit","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"}},{"id":1778239,"web_url":"http://patchwork.ozlabs.org/comment/1778239/","msgid":"<20171002101809.GK32305@orbyte.nwl.cc>","list_archive_url":null,"date":"2017-10-02T10:18:09","subject":"Re: [iproute PATCH v2 0/3] Check user supplied interface name\n\tlengths","submitter":{"id":4285,"url":"http://patchwork.ozlabs.org/api/people/4285/","name":"Phil Sutter","email":"phil@nwl.cc"},"content":"On Fri, Sep 29, 2017 at 10:31:07AM -0700, Stephen Hemminger wrote:\n[...]\n> I was thinking something like:\n> \n> \n> \n> diff --git a/include/utils.h b/include/utils.h\n> index c9ed230b9604..e2702b56f2e0 100644\n> --- a/include/utils.h\n> +++ b/include/utils.h\n> @@ -105,6 +105,8 @@ int get_be64(__be64 *val, const char *arg, int base);\n>  int get_be32(__be32 *val, const char *arg, int base);\n>  int get_be16(__be16 *val, const char *arg, int base);\n>  int get_addr64(__u64 *ap, const char *cp);\n> +int check_ifname(const char *arg);\n> +int get_ifname(char *buf, const char *arg);\n\nAh, understood. I'll change my patch accordingly.\n\nThanks, Phil","headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y5J5f5246z9t4Z\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon,  2 Oct 2017 21:18:14 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751031AbdJBKSL (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 2 Oct 2017 06:18:11 -0400","from orbyte.nwl.cc ([151.80.46.58]:45932 \"EHLO orbyte.nwl.cc\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1750949AbdJBKSK (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tMon, 2 Oct 2017 06:18:10 -0400","from n0-1 by orbyte.nwl.cc with local (Exim 4.89)\n\t(envelope-from <n0-1@orbyte.nwl.cc>)\n\tid 1dyxnd-00074g-3C; Mon, 02 Oct 2017 12:18:09 +0200"],"Date":"Mon, 2 Oct 2017 12:18:09 +0200","From":"Phil Sutter <phil@nwl.cc>","To":"Stephen Hemminger <stephen@networkplumber.org>","Cc":"netdev@vger.kernel.org","Subject":"Re: [iproute PATCH v2 0/3] Check user supplied interface name\n\tlengths","Message-ID":"<20171002101809.GK32305@orbyte.nwl.cc>","Mail-Followup-To":"Phil Sutter <phil@nwl.cc>,\n\tStephen Hemminger <stephen@networkplumber.org>,\n\tnetdev@vger.kernel.org","References":"<20170926163548.24347-1-phil@nwl.cc>\n\t<20170927084249.0591ee3a@shemminger-XPS-13-9360>\n\t<20170927160528.GN32305@orbyte.nwl.cc>\n\t<20170929103107.456efb11@xeon-e3>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20170929103107.456efb11@xeon-e3>","User-Agent":"Mutt/1.7.2 (2016-11-26)","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"}}]