Re: [PATCH iproute2 1/2] lib/libnetlink: re malloc buff if size is not enough

2017-09-13 Thread Hangbin Liu
Hi Michal, Thanks a lot for all your explains. Phil has helped update the patch to support return a newly allocated buffer. I will post it soon. Thanks Hangbin On Tue, Sep 12, 2017 at 11:09:26AM +0200, Michal Kubecek wrote: > > > > I checked again and arpd indeed isn't a problem. It doesn't seem

Re: [PATCH iproute2 1/2] lib/libnetlink: re malloc buff if size is not enough

2017-09-12 Thread Michal Kubecek
On Tue, Sep 12, 2017 at 10:47:48AM +0200, Michal Kubecek wrote: > On Mon, Sep 11, 2017 at 03:19:55PM +0800, Hangbin Liu wrote: > > On Fri, Sep 08, 2017 at 04:51:13PM +0200, Phil Sutter wrote: > > > Regarding Michal's concern about reentrancy, maybe we should go into a > > > different direction and

Re: [PATCH iproute2 1/2] lib/libnetlink: re malloc buff if size is not enough

2017-09-12 Thread Michal Kubecek
On Mon, Sep 11, 2017 at 03:19:55PM +0800, Hangbin Liu wrote: > On Fri, Sep 08, 2017 at 04:51:13PM +0200, Phil Sutter wrote: > > Regarding Michal's concern about reentrancy, maybe we should go into a > > different direction and make rtnl_recvmsg() return a newly allocated > > buffer which the caller

Re: [PATCH iproute2 1/2] lib/libnetlink: re malloc buff if size is not enough

2017-09-11 Thread Hangbin Liu
Hi Phil and Michal, On Fri, Sep 08, 2017 at 04:51:13PM +0200, Phil Sutter wrote: > Hi, > > On Fri, Sep 08, 2017 at 10:01:31PM +0800, Hangbin Liu wrote: > [...] > > Since we have to use two static bufffers. So how about check like > > > > if (len > strlen(buffer)) > > I don't think that will

Re: [PATCH iproute2 1/2] lib/libnetlink: re malloc buff if size is not enough

2017-09-08 Thread Phil Sutter
Hi, On Fri, Sep 08, 2017 at 10:01:31PM +0800, Hangbin Liu wrote: [...] > > > diff --git a/lib/libnetlink.c b/lib/libnetlink.c > > > index be7ac86..37cfb5a 100644 > > > --- a/lib/libnetlink.c > > > +++ b/lib/libnetlink.c > > > @@ -402,6 +402,59 @@ static void rtnl_dump_error(const struct rtnl_handl

Re: [PATCH iproute2 1/2] lib/libnetlink: re malloc buff if size is not enough

2017-09-08 Thread Hangbin Liu
Hi Phil, Thanks for the comments, see replies bellow. On Fri, Sep 08, 2017 at 01:02:47PM +0200, Phil Sutter wrote: > Hi Hangbin, > > On Fri, Sep 08, 2017 at 06:14:56PM +0800, Hangbin Liu wrote: > [...] > > diff --git a/lib/libnetlink.c b/lib/libnetlink.c > > index be7ac86..37cfb5a 100644 > > ---

Re: [PATCH iproute2 1/2] lib/libnetlink: re malloc buff if size is not enough

2017-09-08 Thread Michal Kubecek
On Fri, Sep 08, 2017 at 01:02:47PM +0200, Phil Sutter wrote: > Hi Hangbin, > > On Fri, Sep 08, 2017 at 06:14:56PM +0800, Hangbin Liu wrote: > [...] > > diff --git a/lib/libnetlink.c b/lib/libnetlink.c > > index be7ac86..37cfb5a 100644 > > --- a/lib/libnetlink.c > > +++ b/lib/libnetlink.c > > @@ -4

Re: [PATCH iproute2 1/2] lib/libnetlink: re malloc buff if size is not enough

2017-09-08 Thread Phil Sutter
Hi Hangbin, On Fri, Sep 08, 2017 at 06:14:56PM +0800, Hangbin Liu wrote: [...] > diff --git a/lib/libnetlink.c b/lib/libnetlink.c > index be7ac86..37cfb5a 100644 > --- a/lib/libnetlink.c > +++ b/lib/libnetlink.c > @@ -402,6 +402,59 @@ static void rtnl_dump_error(const struct rtnl_handle > *rth, >

[PATCH iproute2 1/2] lib/libnetlink: re malloc buff if size is not enough

2017-09-08 Thread Hangbin Liu
With commit 72b365e8e0fd ("libnetlink: Double the dump buffer size") we doubled the buffer size to support more VFs. But the VFs number is increasing all the time. Some customers even use more than 200 VFs now. We could not double it everytime when the buffer is not enough. Let's just not hard cod