On 8/11/17 11:11 AM, Jiri Benc wrote: > On Fri, 11 Aug 2017 10:56:57 -0600, David Ahern wrote: >> I would argue none of those messages are sufficient. The message should >> tell the user what is missing. > > Good point. > > I guess "The IFLA_INFO_DATA attribute is missing" would be a better > message. It can happen only when you're implementing your own > management tool, it's not that you'll get this message out of the ip > tool, thus referring to netlink attributes should be okay. > >> What is the point of the !data check anyway? Based on the rest of the >> validate function neither IFLA_VXLAN_ID or IFLA_VXLAN_PORT_RANGE are >> required attributes. > > The newlink callback assumes data is not NULL, i.e. IFLA_INFO_DATA is > present. It would crash otherwise.
What if a user adds IFLA_INFO_DATA but adds no vxlan attributes under it? Still not a valid config, but it passes the !data check. Whatever attributes are required but missing should be the message returned.