From ef2b660bb8cb2c30faf55c51a411e8a757707076 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 1 May 2019 08:20:42 +0200 Subject: [PATCH] platform: use u32 netlink type for TCA_FQ_CODEL_ECN In practice, there is no difference when representing 0 or 1 as signed/unsigned 32 bit integer. But still use the correct type that also kernel uses. Also, the implicit conversation from uint32 to bool was correct already. Still, explicitly convert the uint32 value to boolean in _new_from_nl_qdisc(). It's no change in behavior. (cherry picked from commit a1099a1fab661a430fa8e8015369b536c806433e) --- src/platform/nm-linux-platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 6064d89eb6..1428778e03 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -3547,7 +3547,7 @@ _new_from_nl_qdisc (struct nlmsghdr *nlh, gboolean id_only) obj->qdisc.fq_codel.memory = nla_get_u32 (options_attr); break; case TCA_FQ_CODEL_ECN: - obj->qdisc.fq_codel.ecn = nla_get_u32 (options_attr); + obj->qdisc.fq_codel.ecn = !!nla_get_u32 (options_attr); break; } } @@ -4244,7 +4244,7 @@ _nl_msg_new_qdisc (int nlmsg_type, if (qdisc->fq_codel.memory != -1) NLA_PUT_U32 (msg, TCA_FQ_CODEL_MEMORY_LIMIT, qdisc->fq_codel.memory); if (qdisc->fq_codel.ecn) - NLA_PUT_S32 (msg, TCA_FQ_CODEL_ECN, qdisc->fq_codel.ecn); + NLA_PUT_U32 (msg, TCA_FQ_CODEL_ECN, qdisc->fq_codel.ecn); } nla_nest_end (msg, tc_options);