[PATCH] veth: grab a reference for rtnl_link_veth_get_peer()

Thomas Haller thaller at redhat.com
Wed Apr 16 00:54:14 PDT 2014


On Tue, 2014-04-15 at 13:42 -0700, Cong Wang wrote:
> On Tue, Apr 15, 2014 at 4:01 AM, Thomas Haller <thaller at redhat.com> wrote:
> > On Mon, 2014-04-14 at 18:39 -0700, Cong Wang wrote:
> >> Signed-off-by: Cong Wang <xiyou.wangcong at gmail.com>
> >> ---
> >>  lib/route/link/veth.c | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/lib/route/link/veth.c b/lib/route/link/veth.c
> >> index 19c84f8..3b6a89c 100644
> >> --- a/lib/route/link/veth.c
> >> +++ b/lib/route/link/veth.c
> >> @@ -232,6 +232,7 @@ struct rtnl_link *rtnl_link_veth_alloc(void)
> >>  struct rtnl_link *rtnl_link_veth_get_peer(struct rtnl_link *link)
> >>  {
> >>       IS_VETH_LINK_ASSERT(link);
> >> +     nl_object_get(OBJ_CAST(link->l_info));
> >
> > rtnl_link_get(link->l_info); ?
> 
> 
> I wish I could use it but:
> 
> struct rtnl_link *rtnl_link_get(struct nl_cache *cache, int ifindex)
> 
> See? :-)

oh, right. I just quickly grepped for the name :)



> > This is a behavioral change since libnl3.2.24, but I think it is the
> > right thing to do also because it's quite new and probably not used much
> > yet(?).
> >
> > But could you add a "capability" to indicate that rtnl_link_veth_alloc()
> > now gets an additional reference? Something like the attached patch (but
> > maybe with a better name :) ). So in principle callers could handle it
> > properly and workaround it.
> >
> 
> Right, I think I should integrate your workaround into my patch, if you
> don't mind...


Of course, please do if you agree with it. You can also rename the
capability if you have a better idea. I didn't think too hard about the
name.



Thank you,
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20140416/c62efb5d/attachment.sig>


More information about the libnl mailing list