mirror of
https://github.com/vishvananda/netlink
synced 2024-12-18 21:04:56 +00:00
Merge pull request #58 from chantra/rtattr_data_children
[nl] Fix RtAttr.Serialize to serialize both Data and Children
This commit is contained in:
commit
09c697082a
@ -149,10 +149,12 @@ func (a *RtAttr) Serialize() []byte {
|
||||
length := a.Len()
|
||||
buf := make([]byte, rtaAlignOf(length))
|
||||
|
||||
next := 4
|
||||
if a.Data != nil {
|
||||
copy(buf[4:], a.Data)
|
||||
} else {
|
||||
next := 4
|
||||
copy(buf[next:], a.Data)
|
||||
next += rtaAlignOf(len(a.Data))
|
||||
}
|
||||
if len(a.children) > 0 {
|
||||
for _, child := range a.children {
|
||||
childBuf := child.Serialize()
|
||||
copy(buf[next:], childBuf)
|
||||
|
Loading…
Reference in New Issue
Block a user