Re: [RFC PATCH 3/4] net: drop_monitor: use drop_reason_lookup()

From: Johannes Berg
Date: Thu Sep 21 2023 - 14:55:18 EST


On Thu, 2023-09-21 at 10:51 +0200, Johannes Berg wrote:
>
> - if (!list ||
> - subsys_reason >= list->n_reasons ||
> - !list->reasons[subsys_reason] ||
> - strlen(list->reasons[subsys_reason]) > NET_DM_MAX_REASON_LEN) {
> - list = rcu_dereference(drop_reasons_by_subsys[SKB_DROP_REASON_SUBSYS_CORE]);
> - subsys_reason = SKB_DROP_REASON_NOT_SPECIFIED;
> - }

Oops, I lost this translation of erroneous ones to the core
SKB_DROP_REASON_NOT_SPECIFIED.

Maybe we should just not have the attribute in that case? But that could
be a different change too.

> - if (nla_put_string(msg, NET_DM_ATTR_REASON,
> - list->reasons[subsys_reason])) {
> + reason_str = drop_reason_lookup(cb->reason);
> + if (nla_put_string(msg, NET_DM_ATTR_REASON, reason_str)) {
> rcu_read_unlock();

johannes