summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2010-05-09 20:17:54 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2010-05-09 20:17:54 +0200
commita5f25889216411ad7492047fafe6de03b8408440 (patch)
tree3716ffb20863ecfd4edaf4ff33298c3e88bd1e42 /src
parentcbded627a15baf792465c0cbe960b36cb9408fe2 (diff)
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.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/attr.c b/src/attr.c
index 37fa798..d220652 100644
--- a/src/attr.c
+++ b/src/attr.c
@@ -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;