mirror of
https://gitee.com/openharmony/third_party_libnl
synced 2024-11-27 20:20:30 +00:00
route/cls: support setting of selector fields
Enables to set the shift, offset, mask and flags of the position to next header http://lists.infradead.org/pipermail/libnl/2016-September/002227.html http://lists.infradead.org/pipermail/libnl/2016-October/002232.html Signed-off-by: Sushma Sitaram <sushma.sitaram@intel.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
306695fb07
commit
90680e024b
@ -28,6 +28,7 @@ extern int rtnl_u32_set_divisor(struct rtnl_cls *, uint32_t);
|
||||
extern int rtnl_u32_set_link(struct rtnl_cls *, uint32_t);
|
||||
extern int rtnl_u32_set_hashtable(struct rtnl_cls *, uint32_t);
|
||||
extern int rtnl_u32_set_hashmask(struct rtnl_cls *, uint32_t, uint32_t);
|
||||
extern int rtnl_u32_set_selector(struct rtnl_cls *, int, uint32_t, char, uint16_t, char);
|
||||
extern int rtnl_u32_set_cls_terminal(struct rtnl_cls *);
|
||||
|
||||
extern int rtnl_u32_set_flags(struct rtnl_cls *, int);
|
||||
|
@ -491,6 +491,36 @@ int rtnl_u32_set_hashmask(struct rtnl_cls *cls, uint32_t hashmask, uint32_t offs
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rtnl_u32_set_selector(struct rtnl_cls *cls, int offoff, uint32_t offmask, char offshift, uint16_t off, char flags)
|
||||
{
|
||||
struct rtnl_u32 *u;
|
||||
struct tc_u32_sel *sel;
|
||||
int err;
|
||||
|
||||
offmask = ntohs(offmask);
|
||||
|
||||
if (!(u = (struct rtnl_u32 *) rtnl_tc_data(TC_CAST(cls))))
|
||||
return -NLE_NOMEM;
|
||||
|
||||
sel = u32_selector_alloc(u);
|
||||
if (!sel)
|
||||
return -NLE_NOMEM;
|
||||
|
||||
err = nl_data_append(u->cu_selector, NULL, sizeof(struct tc_u32_key));
|
||||
if(err < 0)
|
||||
return err;
|
||||
|
||||
sel = u32_selector(u);
|
||||
|
||||
sel->offoff = offoff;
|
||||
sel->offmask = offmask;
|
||||
sel->offshift = offshift;
|
||||
sel->flags |= TC_U32_VAROFFSET;
|
||||
sel->off = off;
|
||||
sel->flags |= flags;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rtnl_u32_set_cls_terminal(struct rtnl_cls *cls)
|
||||
{
|
||||
struct rtnl_u32 *u;
|
||||
|
@ -1022,5 +1022,6 @@ global:
|
||||
rtnl_link_vf_vlanproto2str;
|
||||
rtnl_link_vf_str2vlanproto;
|
||||
rtnl_link_vf_str2guid;
|
||||
rtnl_u32_set_selector;
|
||||
} libnl_3_2_28;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user