diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2020-05-22 15:26:43 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2020-05-28 17:25:22 +0200 |
commit | 9a4578c8f9c8e098b6e9816c39841b60e1e62a26 (patch) | |
tree | 153b1b1d36b47fb13f7d6bdbcd61b3176fa66817 | |
parent | 3957d40f54167bcc49dd4147bfa8d6a159304677 (diff) | |
download | NetworkManager-9a4578c8f9c8e098b6e9816c39841b60e1e62a26.tar.gz |
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
-rw-r--r-- | src/platform/nm-linux-platform.c | 4 | ||||
-rw-r--r-- | src/platform/nm-platform.c | 1 | ||||
-rw-r--r-- | src/platform/nm-platform.h | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index a721fc7cfa..78e33748c1 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -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; diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index 8d826a109f..33aa8db69e 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -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) \ diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index c21190e803..4bfbfea432 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -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 */ |