On 03/28/14 16:51, Weiny, Ira wrote:
>> On 03/28/14 06:50, [email protected] wrote:
>>> +   while ((len = recv(sock, buffer, NL_MSG_BUF_SIZE, 0)) > 0) {
>>> +           nlh = (struct nlmsghdr *)buffer;
>>> +           while ((NLMSG_OK(nlh, len)) && (nlh->nlmsg_type !=
>> NLMSG_DONE)) {
>>> +                   struct ifaddrmsg *ifa = (struct ifaddrmsg *)
>> NLMSG_DATA(nlh);
>>> +                   struct ifinfomsg *ifi = (struct ifinfomsg *)
>> NLMSG_DATA(nlh);
>>> +                   struct rtattr *rth = IFA_RTA(ifa);
>>> +                   int rtl = IFA_PAYLOAD(nlh);
>>> +
>>> +                   switch (nlh->nlmsg_type) {
>>> +                   [ ... ]
>>> +                   nlh = NLMSG_NEXT(nlh, len);
>>> +           }
>>> +   }
>>
>> Is there any reason why this code doesn't handle netlink buffer overflows
>> (ENOBUFS) ? From the netlink(7) man page:
> 
> No reason other than my inexperience with netlink.

In that case it's probably helpful to have a look at the libnl
documentation. I'm not saying that library should be used here but it's
accompanied by excellent documentation about the netlink protocol. See
also http://www.carisma.slowglass.com/~tgr/libnl/ and
http://www.carisma.slowglass.com/~tgr/libnl/doc/core.html.

Bart.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to