Error handling for rtnl_cls_set_kind() & addition of rtnl_cls_get_ops()
This commit is contained in:
parent
5d92f9c03d
commit
f42f195a80
2 changed files with 13 additions and 2 deletions
|
@ -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 *);
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue