[PATCH 0/3] netlink: refactor decode_nlmsg_flags

JingPiao Chen chenjingpiao at gmail.com
Thu Sep 28 05:13:07 UTC 2017


[RFC 2/3]: The reason why this patch mark as RFC is that now only netfilter
use delete flags. If this should not be merged, please tell me. I will decode
delete flags in [3/3]("netlink: decode NETLINK_NETFILTER netlink message flags")

About RTM_DELACTION, it use NLM_F_ROOT flags:

Linux kernel: net/sched/act_api.c: tca_action_gd():
static int
tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n,
	      u32 portid, int event)
{
	...
	if (event == RTM_DELACTION && n->nlmsg_flags & NLM_F_ROOT) {
		if (tb[1] != NULL)
			return tca_action_flush(net, tb[1], n, portid);
		else
			return -EINVAL;
	}
	...
}

iproute2: tc/m_action.c: print_action()
int print_action(const struct sockaddr_nl *who,
			   struct nlmsghdr *n,
			   void *arg)
{
	...
	if (n->nlmsg_type == RTM_DELACTION) {
		if (n->nlmsg_flags & NLM_F_ROOT) {
			fprintf(fp, "Flushed table ");
			tab_flush = 1;
		} else {
			fprintf(fp, "Deleted action ");
		}
	}
	...
}

[RFC 3/3]: This patch I want the reviewer know what I do after refactor
decode_nlmsg_flags. No need to merge.

JingPiao Chen (3):
  netlink: refactor decode_nlmsg_flags
  netlink: decode netlink message delete flags
  netlink: decode NETLINK_NETFILTER netlink message flags

 NEWS                         |   2 +-
 netlink.c                    | 229 ++++++++++++++++++++++++++++++++++---------
 netlink.h                    |   3 +
 tests/netlink_crypto.c       |  10 +-
 tests/netlink_route.c        |   7 +-
 tests/netlink_xfrm.c         |  10 +-
 xlat/netlink_delete_flags.in |   1 +
 7 files changed, 207 insertions(+), 55 deletions(-)
 create mode 100644 xlat/netlink_delete_flags.in

-- 
2.7.4





More information about the Strace-devel mailing list