diff options
author | Thomas Haller <thaller@redhat.com> | 2022-11-14 17:39:50 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2023-11-22 16:28:45 +0100 |
commit | 330343cf0bf001594f62f593d9141970ee1772e5 (patch) | |
tree | 5bb5d3b1698569cd797c1166f8185d313836ca43 | |
parent | 3e8ec66df647afa232fb1c57425982bf96483e68 (diff) |
platform: add _nlmsg_is_del() helper to _rtnl_handle_msg()
I minor refactoring. It slightly seems preferable to me.
-rw-r--r-- | src/libnm-platform/nm-linux-platform.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/libnm-platform/nm-linux-platform.c b/src/libnm-platform/nm-linux-platform.c index a04dc3a939..cb8760b49c 100644 --- a/src/libnm-platform/nm-linux-platform.c +++ b/src/libnm-platform/nm-linux-platform.c @@ -4690,6 +4690,23 @@ nmp_object_new_from_nl(NMPlatform *platform, } } +static gboolean +_nlmsg_is_del(guint16 nlmsg_type) +{ + if (NM_IN_SET(nlmsg_type, + RTM_DELLINK, + RTM_DELADDR, + RTM_DELROUTE, + RTM_DELRULE, + RTM_DELQDISC, + RTM_DELTFILTER)) { + /* The event notifies about a deleted object. We don't need to initialize all + * fields of the object. */ + return TRUE; + } + return FALSE; +} + /*****************************************************************************/ static gboolean @@ -7921,17 +7938,7 @@ _rtnl_handle_msg(NMPlatform *platform, const struct nl_msg_lite *msg) msghdr = msg->nm_nlh; - if (NM_IN_SET(msghdr->nlmsg_type, - RTM_DELLINK, - RTM_DELADDR, - RTM_DELROUTE, - RTM_DELRULE, - RTM_DELQDISC, - RTM_DELTFILTER)) { - /* The event notifies about a deleted object. We don't need to initialize all - * fields of the object. */ - is_del = TRUE; - } + is_del = _nlmsg_is_del(msghdr->nlmsg_type); parse_nlmsg_iter = (ParseNlmsgIter){ .iter_more = FALSE, |