Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[RTNL]: Improve error codes for unsupported operations

The most common trigger of these errors is that the
config option hasn't been enable wich would make the
functionality available. Therefore returning EOPNOTSUPP
gives a better idea on what is going wrong.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Thomas Graf and committed by
David S. Miller
038890fe 716ea3a7

+3 -3
+3 -3
net/core/rtnetlink.c
··· 862 862 863 863 type = nlh->nlmsg_type; 864 864 if (type > RTM_MAX) 865 - return -EINVAL; 865 + return -EOPNOTSUPP; 866 866 867 867 type -= RTM_BASE; 868 868 ··· 885 885 886 886 dumpit = rtnl_get_dumpit(family, type); 887 887 if (dumpit == NULL) 888 - return -EINVAL; 888 + return -EOPNOTSUPP; 889 889 890 890 return netlink_dump_start(rtnl, skb, nlh, dumpit, NULL); 891 891 } ··· 913 913 914 914 doit = rtnl_get_doit(family, type); 915 915 if (doit == NULL) 916 - return -EINVAL; 916 + return -EOPNOTSUPP; 917 917 918 918 return doit(skb, nlh, (void *)&rta_buf[0]); 919 919 }