extern int rtnl_u32_set_cls_terminal(struct rtnl_cls *);
extern int rtnl_u32_set_flags(struct rtnl_cls *, int);
-extern int rtnl_u32_add_mark(struct rtnl_cls *, uint32_t, uint32_t);
-extern int rtnl_u32_del_mark(struct rtnl_cls *);
+extern int rtnl_u32_add_mark(struct rtnl_cls *, uint32_t, uint32_t);
+extern int rtnl_u32_del_mark(struct rtnl_cls *);
extern int rtnl_u32_add_key(struct rtnl_cls *, uint32_t, uint32_t,
int, int);
extern int rtnl_u32_get_key(struct rtnl_cls *, uint8_t, uint32_t *, uint32_t *,
return u32_selector(u);
}
-static inline struct tc_u32_mark *u32_mark(struct rtnl_u32 *u)
-{
- return (struct tc_u32_mark *) u->cu_mark->d_data;
-}
-
static inline struct tc_u32_mark *u32_mark_alloc(struct rtnl_u32 *u)
{
if (!u->cu_mark)
u->cu_mark = nl_data_alloc(NULL, sizeof(struct tc_u32_mark));
- return u32_mark(u);
+ return (struct tc_u32_mark *) u->cu_mark->d_data;
}
static struct nla_policy u32_policy[TCA_U32_MAX+1] = {
err = -NLE_MISSING_ATTR;
goto errout;
}
-
+
sel = u->cu_selector->d_data;
pcnt_size = sizeof(struct tc_u32_pcnt) +
(sel->nkeys * sizeof(uint64_t));
!(dst->cu_selector = nl_data_clone(src->cu_selector)))
return -NLE_NOMEM;
- if (src->cu_mark &&
+ if (src->cu_mark &&
!(dst->cu_mark = nl_data_clone(src->cu_mark)))
return -NLE_NOMEM;
{
struct rtnl_u32 *u = data;
char buf[32];
-
+
if (!u)
return;
nl_dump(p, ">");
}
-
-
+
+
for (i = 0; i < sel->nkeys; i++) {
key = (struct tc_u32_key *) ((char *) sel + sizeof(*sel)) + i;
if (!u)
return;
+ if (!(u->cu_mask & (U32_ATTR_SELECTOR & U32_ATTR_MARK))) {
+ nl_dump(p, "no-selector no-mark\n");
+ return;
+ }
+
if (!(u->cu_mask & U32_ATTR_SELECTOR)) {
- nl_dump(p, "no-selector\n");
+ nl_dump(p, "no-selector");
} else {
- s = u->cu_selector->d_data;
- nl_dump(p, "nkeys %u ", s->nkeys);
+ s = u->cu_selector->d_data;
+ nl_dump(p, "nkeys %u", s->nkeys);
}
-
+
if (!(u->cu_mask & U32_ATTR_MARK)) {
- nl_dump(p, "no-mark\n");
+ nl_dump(p, " no-mark");
} else {
m = u->cu_mark->d_data;
- nl_dump(p, "mark 0x%u 0x%u\n", m->val, m->mask);
+ nl_dump(p, " mark 0x%u 0x%u", m->val, m->mask);
}
- if (!(u->cu_mask & U32_ATTR_SELECTOR) && !(u->cu_mask & U32_ATTR_MARK))
- return;
-
if (u->cu_mask & U32_ATTR_HASH)
- nl_dump(p, "ht key 0x%x hash 0x%u",
+ nl_dump(p, " ht key 0x%x hash 0x%u",
TC_U32_USERHTID(u->cu_hash), TC_U32_HASH(u->cu_hash));
if (u->cu_mask & U32_ATTR_LINK)
- nl_dump(p, "link %u ", u->cu_link);
+ nl_dump(p, " link %u", u->cu_link);
if (u->cu_mask & U32_ATTR_INDEV)
- nl_dump(p, "indev %s ", u->cu_indev);
+ nl_dump(p, " indev %s", u->cu_indev);
if (u->cu_mask & U32_ATTR_SELECTOR)
print_selector(p, s, u);
if (!u)
return 0;
-
+
if (u->cu_mask & U32_ATTR_DIVISOR)
NLA_PUT_U32(msg, TCA_U32_DIVISOR, u->cu_divisor);
if (u->cu_mask & U32_ATTR_SELECTOR)
NLA_PUT_DATA(msg, TCA_U32_SEL, u->cu_selector);
-
+
if (u->cu_mask & U32_ATTR_MARK)
NLA_PUT_DATA(msg, TCA_U32_MARK, u->cu_mark);
rtnl_tc_set_handle((struct rtnl_tc *) cls, handle );
}
-
+
int rtnl_u32_set_classid(struct rtnl_cls *cls, uint32_t classid)
{
struct rtnl_u32 *u;
if (!(u = rtnl_tc_data(TC_CAST(cls))))
return -NLE_NOMEM;
-
+
u->cu_classid = classid;
u->cu_mask |= U32_ATTR_CLASSID;
nl_data_free(u->cu_mark);
u->cu_mark = NULL;
+ u->cu_mask &= ~U32_ATTR_MARK;
return 0;
}