summaryrefslogtreecommitdiffstats
path: root/src/network/tc/gred.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/tc/gred.c')
-rw-r--r--src/network/tc/gred.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/network/tc/gred.c b/src/network/tc/gred.c
index ce26e62450..96281e6bd4 100644
--- a/src/network/tc/gred.c
+++ b/src/network/tc/gred.c
@@ -24,32 +24,31 @@ static int generic_random_early_detection_init(QDisc *qdisc) {
static int generic_random_early_detection_fill_message(Link *link, QDisc *qdisc, sd_netlink_message *req) {
GenericRandomEarlyDetection *gred;
- struct tc_gred_sopt opt = {};
int r;
assert(link);
assert(qdisc);
assert(req);
- gred = GRED(qdisc);
-
- opt.DPs = gred->virtual_queues;
- opt.def_DP = gred->default_virtual_queue;
+ assert_se(gred = GRED(qdisc));
- if (gred->grio >= 0)
- opt.grio = gred->grio;
+ const struct tc_gred_sopt opt = {
+ .DPs = gred->virtual_queues,
+ .def_DP = gred->default_virtual_queue,
+ .grio = gred->grio,
+ };
r = sd_netlink_message_open_container_union(req, TCA_OPTIONS, "gred");
if (r < 0)
- return log_link_error_errno(link, r, "Could not open container TCA_OPTIONS: %m");
+ return r;
- r = sd_netlink_message_append_data(req, TCA_GRED_DPS, &opt, sizeof(struct tc_gred_sopt));
+ r = sd_netlink_message_append_data(req, TCA_GRED_DPS, &opt, sizeof(opt));
if (r < 0)
- return log_link_error_errno(link, r, "Could not append TCA_GRED_DPS attribute: %m");
+ return r;
r = sd_netlink_message_close_container(req);
if (r < 0)
- return log_link_error_errno(link, r, "Could not close container TCA_OPTIONS: %m");
+ return r;
return 0;
}