Commit 52a4474d authored by Stephen Hemminger's avatar Stephen Hemminger

netconf: replace macro with a function

The number of casts in macro was excessive.
parent b7e0091a
...@@ -24,8 +24,7 @@ ...@@ -24,8 +24,7 @@
#include "utils.h" #include "utils.h"
#include "ip_common.h" #include "ip_common.h"
static struct static struct {
{
int family; int family;
int ifindex; int ifindex;
} filter; } filter;
...@@ -38,7 +37,11 @@ static void usage(void) ...@@ -38,7 +37,11 @@ static void usage(void)
exit(-1); exit(-1);
} }
#define NETCONF_RTA(r) ((struct rtattr *)(((char *)(r)) + NLMSG_ALIGN(sizeof(struct netconfmsg)))) static struct rtattr *netconf_rta(struct netconfmsg *ncm)
{
return (struct rtattr *)((char *)ncm
+ NLMSG_ALIGN(sizeof(struct netconfmsg)));
}
int print_netconf(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl, int print_netconf(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg) struct nlmsghdr *n, void *arg)
...@@ -65,7 +68,7 @@ int print_netconf(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl, ...@@ -65,7 +68,7 @@ int print_netconf(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl,
if (filter.family && filter.family != ncm->ncm_family) if (filter.family && filter.family != ncm->ncm_family)
return 0; return 0;
parse_rtattr(tb, NETCONFA_MAX, NETCONF_RTA(ncm), parse_rtattr(tb, NETCONFA_MAX, netconf_rta(ncm),
NLMSG_PAYLOAD(n, sizeof(*ncm))); NLMSG_PAYLOAD(n, sizeof(*ncm)));
switch (ncm->ncm_family) { switch (ncm->ncm_family) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment