1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

Make ifupdown2 print meaningful error when interface name length exceeds 15 characters

Ticket: CM-5882
Reviewed By: gospo
Testing Done: unit tested

When a user enters an interface name longer than 15 characters,
the error message is not clear about what the problem is.

   warning: netlink: Numerical result out of range <<<<<<<<<<<<<<<<

This patch catches the error before netlink gets the call and
prints

    error: the following interface names are too long: bond-xconnect.1006
This commit is contained in:
Sam Tannous
2015-07-02 17:10:04 -04:00
parent 8d60ab4163
commit d3ad131ee8
2 changed files with 21 additions and 0 deletions

View File

@@ -49,4 +49,12 @@ class utils():
ifacenames.append('%s-%d' %(iface_range[0], i))
return ifacenames
@classmethod
def check_ifname_size_invalid(cls, name=''):
""" IFNAMSIZ in include/linux/if.h is 16 so we check this """
IFNAMSIZ = 16
if len(name) > IFNAMSIZ - 1:
return True
else:
return False