summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-02-06 19:15:24 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-02-06 19:15:24 -0800
commitb38617999ddd478bb466f102ba4dd046a5782866 (patch)
tree4eab9a2c3e16e7dd20e10ec00ceb52b628138d8b
parent40ef28241dd7c0ca6eebdfb0949d477c417c47c1 (diff)
packet: bmp localaddress in peerup message
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--packet/bmp.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/packet/bmp.go b/packet/bmp.go
index 6b1f1ca5..4813aff9 100644
--- a/packet/bmp.go
+++ b/packet/bmp.go
@@ -297,7 +297,7 @@ func (body *BMPPeerUpNotification) ParseBody(msg *BMPMessage, data []byte) error
if msg.PeerHeader.Flags&(1<<7) != 0 {
body.LocalAddress = net.IP(data[:16]).To16()
} else {
- body.LocalAddress = net.IP(data[:4]).To4()
+ body.LocalAddress = net.IP(data[12:16]).To4()
}
body.LocalPort = binary.BigEndian.Uint16(data[16:18])
@@ -320,7 +320,7 @@ func (body *BMPPeerUpNotification) ParseBody(msg *BMPMessage, data []byte) error
func (body *BMPPeerUpNotification) Serialize() ([]byte, error) {
buf := make([]byte, 20)
if body.LocalAddress.To4() != nil {
- copy(buf[:4], body.LocalAddress.To4())
+ copy(buf[12:16], body.LocalAddress.To4())
} else {
copy(buf[:16], body.LocalAddress.To16())
}