diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2010-05-09 20:17:54 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2010-05-09 20:17:54 +0200 |
commit | a5f25889216411ad7492047fafe6de03b8408440 (patch) | |
tree | 3716ffb20863ecfd4edaf4ff33298c3e88bd1e42 /src | |
parent | cbded627a15baf792465c0cbe960b36cb9408fe2 (diff) | |
download | libmnl-a5f25889216411ad7492047fafe6de03b8408440.tar.gz libmnl-a5f25889216411ad7492047fafe6de03b8408440.zip |
relax mnl_attr_type_valid() checkings and change errno value
This patch relaxes strict attribute checkings in the example files.
I have also changed the errno value, now it's EOPNOTSUPP instead of
EINVAL.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/attr.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -115,11 +115,16 @@ struct nlattr *mnl_attr_next(const struct nlattr *attr, int *len) * This function allows to check if the attribute type is higher than the * maximum supported type. If the attribute type is invalid, this function * returns -1 and errno is explicitly set. On success, this function returns 1. + * + * Strict attribute checking in user-space is not a good idea since you may + * run an old application with a newer kernel that supports new attributes. + * This leads to backward compatibility breakages in user-space. Better check + * if you support an attribute, if not, skip it. */ int mnl_attr_type_valid(const struct nlattr *attr, uint16_t max) { if (mnl_attr_get_type(attr) > max) { - errno = EINVAL; + errno = EOPNOTSUPP; return -1; } return 1; |