Use NLMSG_DATA() instead of nlmsg_get_data().

This commit is contained in:
Nicholas J. Kain 2014-03-17 20:26:37 -04:00
parent a052d069b7
commit f7de4a14fd
3 changed files with 5 additions and 10 deletions

View File

@ -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;

View File

@ -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:

View File

@ -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;