From f7de4a14fd188f2ef5f22b7391b62e973249a031 Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Mon, 17 Mar 2014 20:26:37 -0400 Subject: [PATCH] Use NLMSG_DATA() instead of nlmsg_get_data(). --- ndhc/ifset.c | 4 ++-- ndhc/netlink.c | 4 ++-- ndhc/nl.h | 7 +------ 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/ndhc/ifset.c b/ndhc/ifset.c index 9546865..f5af3af 100644 --- a/ndhc/ifset.c +++ b/ndhc/ifset.c @@ -288,7 +288,7 @@ struct link_flag_data { static void link_flags_get_do(const struct nlmsghdr *nlh, void *data) { - struct ifinfomsg *ifm = nlmsg_get_data(nlh); + struct ifinfomsg *ifm = NLMSG_DATA(nlh); struct link_flag_data *ifd = data; switch(nlh->nlmsg_type) { @@ -366,7 +366,7 @@ static int link_unset_flags(int fd, uint32_t flags) static void ipbcpfx_clear_others_do(const struct nlmsghdr *nlh, void *data) { struct rtattr *tb[IFA_MAX] = {0}; - struct ifaddrmsg *ifm = nlmsg_get_data(nlh); + struct ifaddrmsg *ifm = NLMSG_DATA(nlh); struct ipbcpfx *ipx = data; int r; diff --git a/ndhc/netlink.c b/ndhc/netlink.c index 87b07f9..ca98b4f 100644 --- a/ndhc/netlink.c +++ b/ndhc/netlink.c @@ -45,7 +45,7 @@ static void nl_process_msgs(const struct nlmsghdr *nlh, void *data) { - struct ifinfomsg *ifm = nlmsg_get_data(nlh); + struct ifinfomsg *ifm = NLMSG_DATA(nlh); struct client_state_t *cs = data; switch(nlh->nlmsg_type) { @@ -130,7 +130,7 @@ static int get_if_index_and_mac(const struct nlmsghdr *nlh, static void do_handle_getifdata(const struct nlmsghdr *nlh, void *data) { int *got_ifdata = (int *)data; - struct ifinfomsg *ifm = nlmsg_get_data(nlh); + struct ifinfomsg *ifm = NLMSG_DATA(nlh); switch(nlh->nlmsg_type) { case RTM_NEWLINK: diff --git a/ndhc/nl.h b/ndhc/nl.h index 0cb1a24..fe1aa74 100644 --- a/ndhc/nl.h +++ b/ndhc/nl.h @@ -38,14 +38,9 @@ static inline void *rtattr_get_data(const struct rtattr *attr) return (char *)RTA_DATA(attr); } -static inline void *nlmsg_get_data(const struct nlmsghdr *nlh) -{ - return (char *)nlh + NLMSG_HDRLEN; -} - static inline int nlmsg_get_error(const struct nlmsghdr *nlh) { - const struct nlmsgerr *err = nlmsg_get_data(nlh); + const struct nlmsgerr *err = NLMSG_DATA(nlh); if (nlh->nlmsg_len < sizeof(struct nlmsgerr) + NLMSG_HDRLEN) return EBADMSG; return err->error & 0x7fffffff;