git: eccccd657f01 - main - netlink: make nlattr_add_in[6]_addr inline
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 27 Mar 2023 11:54:18 UTC
The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=eccccd657f018c35397e49b29cce527103bfd381 commit eccccd657f018c35397e49b29cce527103bfd381 Author: Alexander V. Chernikov <melifaro@FreeBSD.org> AuthorDate: 2023-03-27 11:53:34 +0000 Commit: Alexander V. Chernikov <melifaro@FreeBSD.org> CommitDate: 2023-03-27 11:53:34 +0000 netlink: make nlattr_add_in[6]_addr inline MFC after: 2 weeks --- sys/netlink/netlink_message_writer.c | 14 -------------- sys/netlink/netlink_message_writer.h | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/sys/netlink/netlink_message_writer.c b/sys/netlink/netlink_message_writer.c index 85cf5695643c..8a9315eedd1b 100644 --- a/sys/netlink/netlink_message_writer.c +++ b/sys/netlink/netlink_message_writer.c @@ -37,8 +37,6 @@ __FBSDID("$FreeBSD$"); #include <sys/socketvar.h> #include <sys/syslog.h> -#include <netinet/in.h> - #include <netlink/netlink.h> #include <netlink/netlink_ctl.h> #include <netlink/netlink_linux.h> @@ -688,15 +686,3 @@ nlmsg_end_dump(struct nl_writer *nw, int error, struct nlmsghdr *hdr) return (true); } - -bool -nlattr_add_in_addr(struct nl_writer *nw, int attrtype, const struct in_addr *in) -{ - return (nlattr_add(nw, attrtype, sizeof(*in), in)); -} - -bool -nlattr_add_in6_addr(struct nl_writer *nw, int attrtype, const struct in6_addr *in6) -{ - return (nlattr_add(nw, attrtype, sizeof(*in6), in6)); -} diff --git a/sys/netlink/netlink_message_writer.h b/sys/netlink/netlink_message_writer.h index 2f007e9a2b14..b86a755339c8 100644 --- a/sys/netlink/netlink_message_writer.h +++ b/sys/netlink/netlink_message_writer.h @@ -31,6 +31,8 @@ #ifdef _KERNEL +#include <netinet/in.h> + /* * It is not meant to be included directly */ @@ -249,12 +251,6 @@ nlattr_add_s64(struct nl_writer *nw, int attrtype, int64_t value) return (nlattr_add(nw, attrtype, sizeof(int64_t), &value)); } -struct in_addr; -bool nlattr_add_in_addr(struct nl_writer *nw, int attrtype, const struct in_addr *in); - -struct in6_addr; -bool nlattr_add_in6_addr(struct nl_writer *nw, int attrtype, const struct in6_addr *in6); - static inline bool nlattr_add_flag(struct nl_writer *nw, int attrtype) { @@ -267,6 +263,16 @@ nlattr_add_string(struct nl_writer *nw, int attrtype, const char *str) return (nlattr_add(nw, attrtype, strlen(str) + 1, str)); } +static inline bool +nlattr_add_in_addr(struct nl_writer *nw, int attrtype, const struct in_addr *in) +{ + return (nlattr_add(nw, attrtype, sizeof(*in), in)); +} +static inline bool +nlattr_add_in6_addr(struct nl_writer *nw, int attrtype, const struct in6_addr *in6) +{ + return (nlattr_add(nw, attrtype, sizeof(*in6), in6)); +} #endif #endif