From 18675e439323902b9bf029f54a5a284120790880 Mon Sep 17 00:00:00 2001 From: Sylvain Baubeau Date: Tue, 22 Nov 2016 21:39:47 +0100 Subject: [PATCH] Expose LinkDeserialize function (#173) --- link_linux.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/link_linux.go b/link_linux.go index ff45cde..9a428b7 100644 --- a/link_linux.go +++ b/link_linux.go @@ -949,7 +949,7 @@ func execGetLink(req *nl.NetlinkRequest) (Link, error) { return nil, fmt.Errorf("Link not found") case len(msgs) == 1: - return linkDeserialize(msgs[0]) + return LinkDeserialize(msgs[0]) default: return nil, fmt.Errorf("More than one link found") @@ -958,7 +958,7 @@ func execGetLink(req *nl.NetlinkRequest) (Link, error) { // linkDeserialize deserializes a raw message received from netlink into // a link object. -func linkDeserialize(m []byte) (Link, error) { +func LinkDeserialize(m []byte) (Link, error) { msg := nl.DeserializeIfInfomsg(m) attrs, err := nl.ParseRouteAttr(m[msg.Len():]) @@ -1096,7 +1096,7 @@ func (h *Handle) LinkList() ([]Link, error) { var res []Link for _, m := range msgs { - link, err := linkDeserialize(m) + link, err := LinkDeserialize(m) if err != nil { return nil, err } @@ -1145,7 +1145,7 @@ func linkSubscribe(newNs, curNs netns.NsHandle, ch chan<- LinkUpdate, done <-cha } for _, m := range msgs { ifmsg := nl.DeserializeIfInfomsg(m.Data) - link, err := linkDeserialize(m.Data) + link, err := LinkDeserialize(m.Data) if err != nil { return }