static int u32_get_opts(struct rtnl_cls *cls, struct nl_msg *msg) { struct rtnl_u32 *u = rtnl_cls_data(cls); if (u->cu_mask & U32_ATTR_DIVISOR) NLA_PUT_U32(msg, TCA_U32_DIVISOR, u->cu_divisor); if (u->cu_mask & U32_ATTR_HASH) NLA_PUT_U32(msg, TCA_U32_HASH, u->cu_hash); if (u->cu_mask & U32_ATTR_CLASSID) NLA_PUT_U32(msg, TCA_U32_CLASSID, u->cu_classid); if (u->cu_mask & U32_ATTR_LINK) NLA_PUT_U32(msg, TCA_U32_LINK, u->cu_link); if (u->cu_mask & U32_ATTR_SELECTOR) NLA_PUT_DATA(msg, TCA_U32_SEL, u->cu_selector); if (u->cu_mask & U32_ATTR_ACTION) NLA_PUT_DATA(msg, TCA_U32_ACT, u->cu_act); if (u->cu_mask & U32_ATTR_POLICE) NLA_PUT_DATA(msg, TCA_U32_POLICE, u->cu_police); if (u->cu_mask & U32_ATTR_INDEV) NLA_PUT_STRING(msg, TCA_U32_INDEV, u->cu_indev); return 0; nla_put_failure: return -NLE_NOMEM; }
static int u32_msg_fill(struct rtnl_tc *tc, void *data, struct nl_msg *msg) { struct rtnl_u32 *u = data; 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_HASH) NLA_PUT_U32(msg, TCA_U32_HASH, u->cu_hash); if (u->cu_mask & U32_ATTR_CLASSID) NLA_PUT_U32(msg, TCA_U32_CLASSID, u->cu_classid); if (u->cu_mask & U32_ATTR_LINK) NLA_PUT_U32(msg, TCA_U32_LINK, u->cu_link); 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); if (u->cu_mask & U32_ATTR_ACTION) { int err; err = rtnl_act_fill(msg, TCA_U32_ACT, u->cu_act); if (err) return err; } if (u->cu_mask & U32_ATTR_POLICE) NLA_PUT_DATA(msg, TCA_U32_POLICE, u->cu_police); if (u->cu_mask & U32_ATTR_INDEV) NLA_PUT_STRING(msg, TCA_U32_INDEV, u->cu_indev); return 0; nla_put_failure: return -NLE_NOMEM; }
static int fw_get_opts(struct rtnl_cls *cls, struct nl_msg *msg) { struct rtnl_fw *f = rtnl_cls_data(cls); if (f->cf_mask & FW_ATTR_CLASSID) NLA_PUT_U32(msg, TCA_FW_CLASSID, f->cf_classid); if (f->cf_mask & FW_ATTR_ACTION) NLA_PUT_DATA(msg, TCA_FW_ACT, f->cf_act); if (f->cf_mask & FW_ATTR_POLICE) NLA_PUT_DATA(msg, TCA_FW_POLICE, f->cf_police); if (f->cf_mask & FW_ATTR_INDEV) NLA_PUT_STRING(msg, TCA_FW_INDEV, f->cf_indev); return 0; nla_put_failure: return -NLE_NOMEM; }