/* Convert a netlink message received from a netlink socket to a nl_msg  */
struct nl_msg* nlmsg_convert(struct nlmsghdr *hdr)
/* Convert a netlink message received from a netlink socket to a nl_msg  */
struct nl_msg* nlmsg_convert(struct nlmsghdr *hdr)
{
	struct nl_msg *nm;
	nm = __nlmsg_alloc(NLMSG_ALIGN(hdr->nlmsg_len));
	if (!nm)
		goto errout;
	memcpy(nm->nm_nlh, hdr, hdr->nlmsg_len);
	return nm;
errout:
	nlmsg_free(nm);
	return NULL;
}