On Wed, 9 Jul 2025 08:17:08 +0000 Chia-Yu Chang (Nokia) wrote:
Thanks for clarification, then I will add one extra "int opt_flag = 0" and set the flag (e.g., opt_flag += 1 << TCA_DUALPI2_LIMIT).
At the end will return an error message if no flag is set, like below example:
if (!opt_flag) { sch_tree_unlock(sch); NL_SET_ERR_MSG_MOD(extack, "Dualpi2 options are empty"); return -EINVAL; }
Or is there any other suggested ways to do it, please let me know, thanks.
You don't have to track each option. I think it's enough to check if the option nest is empty:
- if (!opt) { + if (!opt || !nla_len(opt)) {