platform: use ECHO flag for qdisc and filter requests

By default the kernel sends back events notification to all other
process except the one that requested the change, unless the ECHO flag
is used. See [1], [2].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/sched/sch_api.c?h=v5.6#n979
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/core/rtnetlink.c?h=v5.6#n706
This commit is contained in:
Beniamino Galvani 2020-05-22 15:26:43 +02:00
parent 3957d40f54
commit 9a4578c8f9
3 changed files with 5 additions and 2 deletions

View file

@ -4644,7 +4644,7 @@ _nl_msg_new_qdisc (int nlmsg_type,
.tcm_info = qdisc->info,
};
msg = nlmsg_alloc_simple (nlmsg_type, nlmsg_flags);
msg = nlmsg_alloc_simple (nlmsg_type, nlmsg_flags | NMP_NLM_FLAG_F_ECHO);
if (nlmsg_append_struct (msg, &tcm) < 0)
goto nla_put_failure;
@ -4697,7 +4697,7 @@ _nl_msg_new_tfilter (int nlmsg_type,
.tcm_info = tfilter->info,
};
msg = nlmsg_alloc_simple (nlmsg_type, nlmsg_flags);
msg = nlmsg_alloc_simple (nlmsg_type, nlmsg_flags | NMP_NLM_FLAG_F_ECHO);
if (nlmsg_append_struct (msg, &tcm) < 0)
goto nla_put_failure;

View file

@ -310,6 +310,7 @@ NM_UTILS_LOOKUP_STR_DEFINE (_nmp_nlm_flag_to_string_lookup, NMPNlmFlags,
NM_UTILS_LOOKUP_ITEM_IGNORE (NMP_NLM_FLAG_F_APPEND),
NM_UTILS_LOOKUP_ITEM_IGNORE (NMP_NLM_FLAG_FMASK),
NM_UTILS_LOOKUP_ITEM_IGNORE (NMP_NLM_FLAG_SUPPRESS_NETLINK_FAILURE),
NM_UTILS_LOOKUP_ITEM_IGNORE (NMP_NLM_FLAG_F_ECHO),
);
#define _nmp_nlm_flag_to_string(flags) \

View file

@ -69,6 +69,8 @@ typedef gboolean (*NMPObjectPredicateFunc) (const NMPObject *obj,
#define NM_GRE_KEY 0x2000
typedef enum {
NMP_NLM_FLAG_F_ECHO = 0x08, /* NLM_F_ECHO, Echo this request */
/* use our own platform enum for the nlmsg-flags. Otherwise, we'd have
* to include <linux/netlink.h> */
NMP_NLM_FLAG_F_REPLACE = 0x100, /* NLM_F_REPLACE, Override existing */