]> git.ipfire.org Git - thirdparty/libnl.git/commitdiff
Error handling for rtnl_cls_set_kind() & addition of rtnl_cls_get_ops()
authorThomas Graf <tgr@plip.localdomain>
Wed, 15 Oct 2008 11:01:46 +0000 (13:01 +0200)
committerThomas Graf <tgr@plip.localdomain>
Wed, 15 Oct 2008 11:01:46 +0000 (13:01 +0200)
include/netlink/route/classifier.h
lib/route/cls_obj.c

index 01a26a932de172737d7ba08f3fd579a08a6597d5..b43400012b002ee177362edc42e6168f0a71013f 100644 (file)
@@ -42,7 +42,8 @@ extern int    rtnl_cls_delete(struct nl_sock *, struct rtnl_cls *, int);
 extern void rtnl_cls_set_ifindex(struct rtnl_cls *, int);
 extern void rtnl_cls_set_handle(struct rtnl_cls *, uint32_t);
 extern void rtnl_cls_set_parent(struct rtnl_cls *, uint32_t);
-extern void rtnl_cls_set_kind(struct rtnl_cls *, const char *);
+extern int rtnl_cls_set_kind(struct rtnl_cls *, const char *);
+extern struct rtnl_cls_ops *rtnl_cls_get_ops(struct rtnl_cls *);
 
 extern void rtnl_cls_set_prio(struct rtnl_cls *, uint16_t);
 extern uint16_t rtnl_cls_get_prio(struct rtnl_cls *);
index 6c92572ac2519203b5039c6709468f7d2fe39c3f..217b6d0810665e10976ef1760da11dfe9b9db58e 100644 (file)
@@ -143,10 +143,20 @@ void rtnl_cls_set_parent(struct rtnl_cls *f, uint32_t parent)
        tca_set_parent((struct rtnl_tca *) f, parent);
 }
 
-void rtnl_cls_set_kind(struct rtnl_cls *f, const char *kind)
+int rtnl_cls_set_kind(struct rtnl_cls *f, const char *kind)
 {
        tca_set_kind((struct rtnl_tca *) f, kind);
+
        f->c_ops = __rtnl_cls_lookup_ops(kind);
+       if (f->c_ops == NULL)
+               return -NLE_OBJ_NOTFOUND;
+       
+       return 0;
+}
+
+struct rtnl_cls_ops *rtnl_cls_get_ops(struct rtnl_cls *cls)
+{
+       return cls->c_ops;
 }
 
 void rtnl_cls_set_prio(struct rtnl_cls *cls, uint16_t prio)