Why 'ip' command with long 'label' field gives error "RTNETLINK answers: Numerical result out of range" ?

Solution In Progress - Updated -

Environment

  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7

Issue

  • ip command when used with label option gives error RTNETLINK answers: Numerical result out of range if the label string is more than 15 characters in length.
[root@test ~]# rpm -qa |grep -i iproute
iproute-2.6.32-31.el6.x86_64

[root@test ~]# ip addr add 10.65.X.X/23 dev eth0:1 label eth0:1:sn0:sn0:sn0
RTNETLINK answers: Numerical result out of range
[root@test ~]# ip addr add 10.65.X.X/23 dev eth0:1 label eth0:1:sn0:sn0:sn
RTNETLINK answers: Numerical result out of range
[root@test ~]# ip addr add 10.65.X.X/23 dev eth0:1 label eth0:1:sn0:sn0:s
RTNETLINK answers: Numerical result out of range
[root@test ~]# ip addr add 10.65.X.X/23 dev eth0:1 label eth0:1:sn0:sn0:
[root@test ~]#
  • Is this limit documented any where ?

Resolution

  • The limit is mentioned in the Networking guide Notes for Administrators
  • Change network interface (or alias) name to use 15 characters. i.e interface name + label < 16 characters. (e.g. eth0:1234567890). As maximum length supported for network interface name is 15 characters.
  • Check RHEL7 man pages,
The maximum interface name length is defined by the kernel headers and is a global limit, affecting all applications. 

Root Cause

  • label is defined in the source as an unsigned 32-bit integer and is as per design.

Diagnostic Steps

  • Try reproducing steps as mentioned in issue.
  • Command gets executed successfully only when label option string has characters less then or equal to 15. man pages (# man ip) doesn't speak about this limitation.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.