Re: [PATCH v6 4/4] Netlink: handle multi netlink messages

2016-06-22 Thread Dmitry V. Levin
On Wed, Jun 22, 2016 at 12:18:38PM +, Fabien Siron wrote: > Quoting Dmitry V. Levin (2016-06-22 11:13:42) > > On Wed, Jun 22, 2016 at 10:19:03AM +, Fabien Siron wrote: > > > Quoting Dmitry V. Levin (2016-06-21 17:43:49) > > > > On Tue, Jun 21, 2016 at 02:42:46PM +, Fabien Siron wrote: >

Re: [PATCH v6 4/4] Netlink: handle multi netlink messages

2016-06-22 Thread Fabien Siron
Quoting Dmitry V. Levin (2016-06-22 11:13:42) > On Wed, Jun 22, 2016 at 10:19:03AM +, Fabien Siron wrote: > > Quoting Dmitry V. Levin (2016-06-21 17:43:49) > > > On Tue, Jun 21, 2016 at 02:42:46PM +, Fabien Siron wrote: [...] > > > > + if (nlmsghdr.nlmsg_len != (unsigned) -1 && > > > >

Re: [PATCH v6 4/4] Netlink: handle multi netlink messages

2016-06-22 Thread Dmitry V. Levin
On Wed, Jun 22, 2016 at 10:19:03AM +, Fabien Siron wrote: > Quoting Dmitry V. Levin (2016-06-21 17:43:49) > > On Tue, Jun 21, 2016 at 02:42:46PM +, Fabien Siron wrote: > > [...] > > > +static unsigned long > > > +nlmsg_next(struct nlmsghdr *nlmsghdr, unsigned long addr, unsigned long > > >

Re: [PATCH v6 4/4] Netlink: handle multi netlink messages

2016-06-22 Thread Fabien Siron
Quoting Dmitry V. Levin (2016-06-21 17:43:49) > On Tue, Jun 21, 2016 at 02:42:46PM +, Fabien Siron wrote: > [...] > > +static unsigned long > > +nlmsg_next(struct nlmsghdr *nlmsghdr, unsigned long addr, unsigned long > > *len) { > > + *len -= NLMSG_ALIGN(nlmsghdr->nlmsg_len); > > + > > +

Re: [PATCH v6 4/4] Netlink: handle multi netlink messages

2016-06-21 Thread Dmitry V. Levin
On Tue, Jun 21, 2016 at 02:42:46PM +, Fabien Siron wrote: [...] > +static unsigned long > +nlmsg_next(struct nlmsghdr *nlmsghdr, unsigned long addr, unsigned long > *len) { > + *len -= NLMSG_ALIGN(nlmsghdr->nlmsg_len); > + > + if (NLMSG_ALIGN(nlmsghdr->nlmsg_len) == 0 || > + NL

[PATCH v6 4/4] Netlink: handle multi netlink messages

2016-06-21 Thread Fabien Siron
This commit handles the case where there are several messages in the buffer. This is very useful to some protocols like SOCK_DIAG. * netlink.c (nlmsg_fetch, nlmsg_next): New functions. (decode_netlink_msg): New function. (decode_netlink): Call decode_netlink_msg(). * tests/netlink_parsing.c (send_