On Tue, 26 Sep 2017 18:35:45 +0200
Phil Sutter <[email protected]> wrote:
> This series adds explicit checks for user-supplied interface names to
> make sure their length fits Linux's requirements.
>
> The first two patches simplify interface name parsing in some places -
> these are side-effects of working on the actual implementation provided
> in patch three.
>
> Changes since v1:
> - Patches 1 and 2 introduced.
> - Changes to patch 3 are listed in there.
>
> Phil Sutter (3):
> ip{6,}tunnel: Avoid copying user-supplied interface name around
> tc: flower: No need to cache indev arg
> Check user supplied interface name lengths
>
> include/utils.h | 1 +
> ip/ip6tunnel.c | 9 +++++----
> ip/ipl2tp.c | 3 ++-
> ip/iplink.c | 27 ++++++++-------------------
> ip/ipmaddr.c | 1 +
> ip/iprule.c | 4 ++++
> ip/iptunnel.c | 27 +++++++++++++--------------
> ip/iptuntap.c | 4 +++-
> lib/utils.c | 10 ++++++++++
> misc/arpd.c | 1 +
> tc/f_flower.c | 6 ++----
> 11 files changed, 50 insertions(+), 43 deletions(-)
>
I like the idea, and checking arguments is good.
Why not merge the check and copy and put in lib/utils.c
int get_ifname(char *name, const char *arg)
{
...