Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102170734
D44089.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D44089.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 9, 11:41 AM (20 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14536931
Default Alt Text
D44089.diff (1 KB)
Attached To
Mode
D44089: netlink: add bool type support
Attached
Detach File
Event Timeline
Log In to Comment