Page MenuHomeFreeBSD

D44089.diff
No OneTemporary

D44089.diff

diff --git a/sys/netlink/netlink_message_parser.h b/sys/netlink/netlink_message_parser.h
--- a/sys/netlink/netlink_message_parser.h
+++ b/sys/netlink/netlink_message_parser.h
@@ -173,6 +173,8 @@
const void *arg, void *target);
int nlattr_get_ip(struct nlattr *nla, struct nl_pstate *npt,
const void *arg, void *target);
+int nlattr_get_bool(struct nlattr *nla, struct nl_pstate *npt,
+ const void *arg, void *target);
int nlattr_get_uint8(struct nlattr *nla, struct nl_pstate *npt,
const void *arg, void *target);
int nlattr_get_uint16(struct nlattr *nla, struct nl_pstate *npt,
diff --git a/sys/netlink/netlink_message_parser.c b/sys/netlink/netlink_message_parser.c
--- a/sys/netlink/netlink_message_parser.c
+++ b/sys/netlink/netlink_message_parser.c
@@ -312,6 +312,17 @@
return (error);
}
+int
+nlattr_get_bool(struct nlattr *nla, struct nl_pstate *npt, const void *arg, void *target)
+{
+ if (__predict_false(NLA_DATA_LEN(nla) != sizeof(bool))) {
+ NLMSG_REPORT_ERR_MSG(npt, "nla type %d size(%u) is not bool",
+ nla->nla_type, NLA_DATA_LEN(nla));
+ return (EINVAL);
+ }
+ *((bool *)target) = *((const bool *)NL_RTA_DATA_CONST(nla));
+ return (0);
+}
int
nlattr_get_uint8(struct nlattr *nla, struct nl_pstate *npt, const void *arg, void *target)
diff --git a/sys/netlink/netlink_snl.h b/sys/netlink/netlink_snl.h
--- a/sys/netlink/netlink_snl.h
+++ b/sys/netlink/netlink_snl.h
@@ -1147,6 +1147,12 @@
return (snl_add_msg_attr(nw, nla_src->nla_type, attr_len, (const void *)(nla_src + 1)));
}
+static inline bool
+snl_add_msg_attr_bool(struct snl_writer *nw, int attrtype, bool value)
+{
+ return (snl_add_msg_attr(nw, attrtype, sizeof(bool), &value));
+}
+
static inline bool
snl_add_msg_attr_u8(struct snl_writer *nw, int attrtype, uint8_t value)
{

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 8, 2:46 PM (2 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14536931
Default Alt Text
D44089.diff (1 KB)

Event Timeline