Network namespaces length in API
Migrated from: https://tracker.clearos.com/view.php?id=5811
Reported by: Dave Loper
Because of the new lengths that are automatically assigned to network interfaces, checks need to be put into place for resultant interface types. There is a hard limit to the network name length in linux of 15 characters. (See: http://stackoverflow.com/questions/24932172/what-length-can-a-network-interface-name-have)
This means that in 1:1 nat, if the originating network interface is 12 characters long or longer, it will bork and truncate. For example en0s0p0.1001:200
will truncate to en0s0p0.1001:20
This would be a VLAN 1001 interface card on the first port on a multiport NIC that is is being added to 1:1 nat.
This is the first place that this problem presents itself but it is possible for this issue to rise with other modules especially if the base NIC name is long and on a large numbered VLAN.
1:1 nat adds a colon and a three digit number starting at 200. These 4 characters means that interfaces with 12 characters or longer should be prohibited. By adding a validation check to the 1:1 nat rule creation that looks at the base name of the interface and then prohibits an add if the base nic is greater than 11 characters with the message:
Base NIC name ($nic) length is too long. Use shorter NIC name or convert NIC to alias 'netwkX' name.
The nic designation of 'netwk' is being added to the interface list so that individuals can alias NIC names using the net.ifnames=0
kernel directive with a modification to the /etc/udev/rules.d/70-persistent-net.rules, with an entry such as:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="01:02:03:04:05:06", ATTR{type}=="1", KERNEL=="eth*", NAME="netwk0"
Developer comment:
Podman seems to create interfaces with 28 characters - https://www.clearos.com/clearfoundation/social/community/checking-podman-on-clearos-7-6#reply-258031