diff options
Diffstat (limited to 'src/libnfnetlink.c')
-rw-r--r-- | src/libnfnetlink.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/libnfnetlink.c b/src/libnfnetlink.c index b048d2b..6e7afc6 100644 --- a/src/libnfnetlink.c +++ b/src/libnfnetlink.c @@ -445,8 +445,7 @@ void nfnl_fill_hdr(struct nfnl_subsys_handle *ssh, assert(ssh); assert(nlh); - struct nfgenmsg *nfg = (struct nfgenmsg *) - ((void *)nlh + sizeof(*nlh)); + struct nfgenmsg *nfg = (void *)nlh + sizeof(*nlh); nlh->nlmsg_len = NLMSG_LENGTH(len+sizeof(*nfg)); nlh->nlmsg_type = (ssh->subsys_id<<8)|msg_type; @@ -478,14 +477,14 @@ nfnl_parse_hdr(const struct nfnl_handle *nfnlh, if (nlh->nlmsg_len == NLMSG_LENGTH(sizeof(struct nfgenmsg))) { if (genmsg) - *genmsg = (struct nfgenmsg *)((void *)nlh+sizeof(nlh)); + *genmsg = (void *)nlh + sizeof(nlh); return NULL; } if (genmsg) - *genmsg = (struct nfgenmsg *)((void *)nlh + sizeof(nlh)); + *genmsg = (void *)nlh + sizeof(nlh); - return ((void *)nlh + NLMSG_LENGTH(sizeof(struct nfgenmsg))); + return (void *)nlh + NLMSG_LENGTH(sizeof(struct nfgenmsg)); } /** @@ -575,10 +574,10 @@ int nfnl_listen(struct nfnl_handle *nfnlh, int quit=0; struct msghdr msg = { - (void *)&nladdr, sizeof(nladdr), - &iov, 1, - NULL, 0, - 0 + .msg_name = &nladdr, + .msg_namelen = sizeof(nladdr), + .msg_iov = &iov, + .msg_iovlen = 1, }; memset(&nladdr, 0, sizeof(nladdr)); @@ -682,13 +681,13 @@ int nfnl_talk(struct nfnl_handle *nfnlh, struct nlmsghdr *n, pid_t peer, unsigned int seq; int status; struct iovec iov = { - (void *)n, n->nlmsg_len + n, n->nlmsg_len }; struct msghdr msg = { - (void *)&nladdr, sizeof(nladdr), - &iov, 1, - NULL, 0, - 0 + .msg_name = &nladdr, + .msg_namelen = sizeof(nladdr), + .msg_iov = &iov, + .msg_iovlen = 1, }; memset(&nladdr, 0, sizeof(nladdr)); |